]>
git.saurik.com Git - wxWidgets.git/blob - interface/wx/statbox.h
1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: interface of wxStaticBox
4 // Author: wxWidgets team
5 // Licence: wxWindows licence
6 /////////////////////////////////////////////////////////////////////////////
11 A static box is a rectangle drawn around other windows to denote
12 a logical grouping of items.
14 Note that while the previous versions required that windows appearing
15 inside a static box be created as its siblings (i.e. use the same parent as
16 the static box itself), since wxWidgets 2.9.1 it is also possible to create
17 them as children of wxStaticBox itself and you are actually encouraged to
18 do it like this if compatibility with the previous versions is not
21 So the new recommended way to create static box is:
23 void MyFrame::CreateControls()
25 wxPanel *panel = new wxPanel(this);
26 wxStaticBox *box = new wxStaticBox(panel, wxID_ANY, "StaticBox");
28 new wxStaticText(box, wxID_ANY "This window is a child of the staticbox");
33 While the compatible -- and now deprecated -- way is
35 wxStaticBox *box = new wxStaticBox(panel, wxID_ANY, "StaticBox");
37 new wxStaticText(panel, wxID_ANY "This window is a child of the panel");
41 Also note that there is a specialized wxSizer class (wxStaticBoxSizer) which can
42 be used as an easier way to pack items into a static box.
46 @appearance{staticbox}
48 @see wxStaticText, wxStaticBoxSizer
50 class wxStaticBox
: public wxControl
59 Constructor, creating and showing a static box.
62 Parent window. Must not be @NULL.
64 Window identifier. The value wxID_ANY indicates a default value.
66 Text to be displayed in the static box, the empty string for no label.
69 If ::wxDefaultPosition is specified then a default position is chosen.
72 If ::wxDefaultSize is specified then a default size is chosen.
74 Window style. See wxStaticBox.
80 wxStaticBox(wxWindow
* parent
, wxWindowID id
,
81 const wxString
& label
,
82 const wxPoint
& pos
= wxDefaultPosition
,
83 const wxSize
& size
= wxDefaultSize
,
85 const wxString
& name
= wxStaticBoxNameStr
);
88 Destructor, destroying the group box.
90 virtual ~wxStaticBox();
93 Creates the static box for two-step construction.
94 See wxStaticBox() for further details.
96 bool Create(wxWindow
* parent
, wxWindowID id
, const wxString
& label
,
97 const wxPoint
& pos
= wxDefaultPosition
,
98 const wxSize
& size
= wxDefaultSize
, long style
= 0,
99 const wxString
& name
= wxStaticBoxNameStr
);