1 /////////////////////////////////////////////////////////////////////////////
2 // Name:        wx/gtk/statbox.h
3 // Purpose:
4 // Author:      Robert Roebling
5 // Copyright:   (c) 1998 Robert Roebling
6 // Licence:     wxWindows licence
7 /////////////////////////////////////////////////////////////////////////////
8 
9 #ifndef _WX_GTKSTATICBOX_H_
10 #define _WX_GTKSTATICBOX_H_
11 
12 //-----------------------------------------------------------------------------
13 // wxStaticBox
14 //-----------------------------------------------------------------------------
15 
16 class WXDLLIMPEXP_CORE wxStaticBox : public wxStaticBoxBase
17 {
18 public:
wxStaticBox()19     wxStaticBox()
20     {
21     }
22 
23     wxStaticBox( wxWindow *parent,
24                  wxWindowID id,
25                  const wxString &label,
26                  const wxPoint &pos = wxDefaultPosition,
27                  const wxSize &size = wxDefaultSize,
28                  long style = 0,
29                  const wxString &name = wxASCII_STR(wxStaticBoxNameStr) )
30     {
31         Create( parent, id, label, pos, size, style, name );
32     }
33 
34     wxStaticBox( wxWindow *parent,
35                  wxWindowID id,
36                  wxWindow* label,
37                  const wxPoint &pos = wxDefaultPosition,
38                  const wxSize &size = wxDefaultSize,
39                  long style = 0,
40                  const wxString &name = wxASCII_STR(wxStaticBoxNameStr) )
41     {
42         Create( parent, id, label, pos, size, style, name );
43     }
44 
45     bool Create( wxWindow *parent,
46                  wxWindowID id,
47                  const wxString &label,
48                  const wxPoint &pos = wxDefaultPosition,
49                  const wxSize &size = wxDefaultSize,
50                  long style = 0,
51                  const wxString &name = wxASCII_STR(wxStaticBoxNameStr) )
52     {
53         return DoCreate( parent, id, &label, NULL, pos, size, style, name );
54     }
55 
56     bool Create( wxWindow *parent,
57                  wxWindowID id,
58                  wxWindow* label,
59                  const wxPoint &pos = wxDefaultPosition,
60                  const wxSize &size = wxDefaultSize,
61                  long style = 0,
62                  const wxString &name = wxASCII_STR(wxStaticBoxNameStr) )
63     {
64         return DoCreate( parent, id, NULL, label, pos, size, style, name );
65     }
66 
67     virtual void SetLabel( const wxString &label ) wxOVERRIDE;
68 
69     static wxVisualAttributes
70     GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);
71 
72     // implementation
73 
GTKIsTransparentForMouse()74     virtual bool GTKIsTransparentForMouse() const wxOVERRIDE { return true; }
75 
76     virtual void GetBordersForSizer(int *borderTop, int *borderOther) const wxOVERRIDE;
77 
78     virtual void AddChild( wxWindowBase *child ) wxOVERRIDE;
79 
80 protected:
81     // Common implementation of both Create() overloads: exactly one of
82     // labelStr and labelWin parameters must be non-null.
83     bool DoCreate(wxWindow *parent,
84                   wxWindowID id,
85                   const wxString* labelStr,
86                   wxWindow* labelWin,
87                   const wxPoint& pos,
88                   const wxSize& size,
89                   long style,
90                   const wxString& name);
91 
92     virtual bool GTKWidgetNeedsMnemonic() const wxOVERRIDE;
93     virtual void GTKWidgetDoSetMnemonic(GtkWidget* w) wxOVERRIDE;
94 
95     void DoApplyWidgetStyle(GtkRcStyle *style) wxOVERRIDE;
96 
97     wxDECLARE_DYNAMIC_CLASS(wxStaticBox);
98 };
99 
100 // Indicate that we have the ctor overload taking wxWindow as label.
101 #define wxHAS_WINDOW_LABEL_IN_STATIC_BOX
102 
103 #endif // _WX_GTKSTATICBOX_H_
104