]> git.saurik.com Git - wxWidgets.git/blob - interface/wx/statbox.h
Applied #15226 with modifications: wxRichTextCtrl: Implement setting properties with...
[wxWidgets.git] / interface / wx / statbox.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: statbox.h
3 // Purpose: interface of wxStaticBox
4 // Author: wxWidgets team
5 // Licence: wxWindows licence
6 /////////////////////////////////////////////////////////////////////////////
7
8 /**
9 @class wxStaticBox
10
11 A static box is a rectangle drawn around other windows to denote
12 a logical grouping of items.
13
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
19 important.
20
21 So the new recommended way to create static box is:
22 @code
23 void MyFrame::CreateControls()
24 {
25 wxPanel *panel = new wxPanel(this);
26 wxStaticBox *box = new wxStaticBox(panel, wxID_ANY, "StaticBox");
27
28 new wxStaticText(box, wxID_ANY "This window is a child of the staticbox");
29 ...
30 }
31 @endcode
32
33 While the compatible -- and now deprecated -- way is
34 @code
35 wxStaticBox *box = new wxStaticBox(panel, wxID_ANY, "StaticBox");
36
37 new wxStaticText(panel, wxID_ANY "This window is a child of the panel");
38 ...
39 @endcode
40
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.
43
44 @library{wxcore}
45 @category{ctrl}
46 @appearance{staticbox}
47
48 @see wxStaticText, wxStaticBoxSizer
49 */
50 class wxStaticBox : public wxControl
51 {
52 public:
53 /**
54 Default constructor
55 */
56 wxStaticBox();
57
58 /**
59 Constructor, creating and showing a static box.
60
61 @param parent
62 Parent window. Must not be @NULL.
63 @param id
64 Window identifier. The value wxID_ANY indicates a default value.
65 @param label
66 Text to be displayed in the static box, the empty string for no label.
67 @param pos
68 Window position.
69 If ::wxDefaultPosition is specified then a default position is chosen.
70 @param size
71 Checkbox size.
72 If ::wxDefaultSize is specified then a default size is chosen.
73 @param style
74 Window style. See wxStaticBox.
75 @param name
76 Window name.
77
78 @see Create()
79 */
80 wxStaticBox(wxWindow* parent, wxWindowID id,
81 const wxString& label,
82 const wxPoint& pos = wxDefaultPosition,
83 const wxSize& size = wxDefaultSize,
84 long style = 0,
85 const wxString& name = wxStaticBoxNameStr);
86
87 /**
88 Destructor, destroying the group box.
89 */
90 virtual ~wxStaticBox();
91
92 /**
93 Creates the static box for two-step construction.
94 See wxStaticBox() for further details.
95 */
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);
100 };
101