]>
Commit | Line | Data |
---|---|---|
23324ae1 FM |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: statbox.h | |
e54c96f1 | 3 | // Purpose: interface of wxStaticBox |
23324ae1 | 4 | // Author: wxWidgets team |
526954c5 | 5 | // Licence: wxWindows licence |
23324ae1 FM |
6 | ///////////////////////////////////////////////////////////////////////////// |
7 | ||
8 | /** | |
9 | @class wxStaticBox | |
7c913512 | 10 | |
f3289ffb | 11 | A static box is a rectangle drawn around other windows to denote |
23324ae1 | 12 | a logical grouping of items. |
7c913512 | 13 | |
338c3ec7 VZ |
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 | |
39cdc95f | 34 | @code |
338c3ec7 | 35 | wxStaticBox *box = new wxStaticBox(panel, wxID_ANY, "StaticBox"); |
39cdc95f | 36 | |
338c3ec7 VZ |
37 | new wxStaticText(panel, wxID_ANY "This window is a child of the panel"); |
38 | ... | |
39cdc95f | 39 | @endcode |
338c3ec7 | 40 | |
39cdc95f FM |
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. | |
7c913512 | 43 | |
23324ae1 FM |
44 | @library{wxcore} |
45 | @category{ctrl} | |
ce154616 | 46 | @appearance{staticbox} |
7c913512 | 47 | |
f3289ffb | 48 | @see wxStaticText, wxStaticBoxSizer |
23324ae1 FM |
49 | */ |
50 | class wxStaticBox : public wxControl | |
51 | { | |
52 | public: | |
671600d8 RR |
53 | /** |
54 | Default constructor | |
55 | */ | |
56 | wxStaticBox(); | |
4701dc09 | 57 | |
23324ae1 FM |
58 | /** |
59 | Constructor, creating and showing a static box. | |
3c4f71cc | 60 | |
7c913512 | 61 | @param parent |
4cc4bfaf | 62 | Parent window. Must not be @NULL. |
7c913512 | 63 | @param id |
4cc4bfaf | 64 | Window identifier. The value wxID_ANY indicates a default value. |
7c913512 | 65 | @param label |
4cc4bfaf | 66 | Text to be displayed in the static box, the empty string for no label. |
7c913512 | 67 | @param pos |
4701dc09 | 68 | Window position. |
f3289ffb | 69 | If ::wxDefaultPosition is specified then a default position is chosen. |
7c913512 | 70 | @param size |
4701dc09 | 71 | Checkbox size. |
f3289ffb | 72 | If ::wxDefaultSize is specified then a default size is chosen. |
7c913512 | 73 | @param style |
4cc4bfaf | 74 | Window style. See wxStaticBox. |
7c913512 | 75 | @param name |
4cc4bfaf | 76 | Window name. |
3c4f71cc | 77 | |
4cc4bfaf | 78 | @see Create() |
23324ae1 | 79 | */ |
7c913512 FM |
80 | wxStaticBox(wxWindow* parent, wxWindowID id, |
81 | const wxString& label, | |
82 | const wxPoint& pos = wxDefaultPosition, | |
83 | const wxSize& size = wxDefaultSize, | |
84 | long style = 0, | |
11e3af6e | 85 | const wxString& name = wxStaticBoxNameStr); |
23324ae1 FM |
86 | |
87 | /** | |
88 | Destructor, destroying the group box. | |
89 | */ | |
adaaa686 | 90 | virtual ~wxStaticBox(); |
23324ae1 FM |
91 | |
92 | /** | |
4701dc09 FM |
93 | Creates the static box for two-step construction. |
94 | See wxStaticBox() for further details. | |
23324ae1 | 95 | */ |
5267aefd | 96 | bool Create(wxWindow* parent, wxWindowID id, const wxString& label, |
23324ae1 | 97 | const wxPoint& pos = wxDefaultPosition, |
5267aefd FM |
98 | const wxSize& size = wxDefaultSize, long style = 0, |
99 | const wxString& name = wxStaticBoxNameStr); | |
23324ae1 | 100 | }; |
e54c96f1 | 101 |