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