]>
Commit | Line | Data |
---|---|---|
23324ae1 FM |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: statbox.h | |
e54c96f1 | 3 | // Purpose: interface of wxStaticBox |
23324ae1 FM |
4 | // Author: wxWidgets team |
5 | // RCS-ID: $Id$ | |
526954c5 | 6 | // Licence: wxWindows licence |
23324ae1 FM |
7 | ///////////////////////////////////////////////////////////////////////////// |
8 | ||
9 | /** | |
10 | @class wxStaticBox | |
7c913512 | 11 | |
f3289ffb | 12 | A static box is a rectangle drawn around other windows to denote |
23324ae1 | 13 | a logical grouping of items. |
7c913512 | 14 | |
338c3ec7 VZ |
15 | Note that while the previous versions required that windows appearing |
16 | inside a static box be created as its siblings (i.e. use the same parent as | |
17 | the static box itself), since wxWidgets 2.9.1 it is also possible to create | |
18 | them as children of wxStaticBox itself and you are actually encouraged to | |
19 | do it like this if compatibility with the previous versions is not | |
20 | important. | |
21 | ||
22 | So the new recommended way to create static box is: | |
23 | @code | |
24 | void MyFrame::CreateControls() | |
25 | { | |
26 | wxPanel *panel = new wxPanel(this); | |
27 | wxStaticBox *box = new wxStaticBox(panel, wxID_ANY, "StaticBox"); | |
28 | ||
29 | new wxStaticText(box, wxID_ANY "This window is a child of the staticbox"); | |
30 | ... | |
31 | } | |
32 | @endcode | |
33 | ||
34 | While the compatible -- and now deprecated -- way is | |
39cdc95f | 35 | @code |
338c3ec7 | 36 | wxStaticBox *box = new wxStaticBox(panel, wxID_ANY, "StaticBox"); |
39cdc95f | 37 | |
338c3ec7 VZ |
38 | new wxStaticText(panel, wxID_ANY "This window is a child of the panel"); |
39 | ... | |
39cdc95f | 40 | @endcode |
338c3ec7 | 41 | |
39cdc95f FM |
42 | Also note that there is a specialized wxSizer class (wxStaticBoxSizer) which can |
43 | be used as an easier way to pack items into a static box. | |
7c913512 | 44 | |
23324ae1 FM |
45 | @library{wxcore} |
46 | @category{ctrl} | |
7e59b885 | 47 | @appearance{staticbox.png} |
7c913512 | 48 | |
f3289ffb | 49 | @see wxStaticText, wxStaticBoxSizer |
23324ae1 FM |
50 | */ |
51 | class wxStaticBox : public wxControl | |
52 | { | |
53 | public: | |
671600d8 RR |
54 | /** |
55 | Default constructor | |
56 | */ | |
57 | wxStaticBox(); | |
4701dc09 | 58 | |
23324ae1 FM |
59 | /** |
60 | Constructor, creating and showing a static box. | |
3c4f71cc | 61 | |
7c913512 | 62 | @param parent |
4cc4bfaf | 63 | Parent window. Must not be @NULL. |
7c913512 | 64 | @param id |
4cc4bfaf | 65 | Window identifier. The value wxID_ANY indicates a default value. |
7c913512 | 66 | @param label |
4cc4bfaf | 67 | Text to be displayed in the static box, the empty string for no label. |
7c913512 | 68 | @param pos |
4701dc09 | 69 | Window position. |
f3289ffb | 70 | If ::wxDefaultPosition is specified then a default position is chosen. |
7c913512 | 71 | @param size |
4701dc09 | 72 | Checkbox size. |
f3289ffb | 73 | If ::wxDefaultSize is specified then a default size is chosen. |
7c913512 | 74 | @param style |
4cc4bfaf | 75 | Window style. See wxStaticBox. |
7c913512 | 76 | @param name |
4cc4bfaf | 77 | Window name. |
3c4f71cc | 78 | |
4cc4bfaf | 79 | @see Create() |
23324ae1 | 80 | */ |
7c913512 FM |
81 | wxStaticBox(wxWindow* parent, wxWindowID id, |
82 | const wxString& label, | |
83 | const wxPoint& pos = wxDefaultPosition, | |
84 | const wxSize& size = wxDefaultSize, | |
85 | long style = 0, | |
11e3af6e | 86 | const wxString& name = wxStaticBoxNameStr); |
23324ae1 FM |
87 | |
88 | /** | |
89 | Destructor, destroying the group box. | |
90 | */ | |
adaaa686 | 91 | virtual ~wxStaticBox(); |
23324ae1 FM |
92 | |
93 | /** | |
4701dc09 FM |
94 | Creates the static box for two-step construction. |
95 | See wxStaticBox() for further details. | |
23324ae1 | 96 | */ |
5267aefd | 97 | bool Create(wxWindow* parent, wxWindowID id, const wxString& label, |
23324ae1 | 98 | const wxPoint& pos = wxDefaultPosition, |
5267aefd FM |
99 | const wxSize& size = wxDefaultSize, long style = 0, |
100 | const wxString& name = wxStaticBoxNameStr); | |
23324ae1 | 101 | }; |
e54c96f1 | 102 |