X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/adaaa68635b4c8a4d8c5284add40366ea3eefb07..9e9574fe45b176ee74bba8fad7574cf9906145d1:/interface/wx/statbox.h diff --git a/interface/wx/statbox.h b/interface/wx/statbox.h index c612133138..46004f20f4 100644 --- a/interface/wx/statbox.h +++ b/interface/wx/statbox.h @@ -2,31 +2,50 @@ // Name: statbox.h // Purpose: interface of wxStaticBox // Author: wxWidgets team -// RCS-ID: $Id$ -// Licence: wxWindows license +// Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// /** @class wxStaticBox - A static box is a rectangle drawn around other panel items to denote + A static box is a rectangle drawn around other windows to denote a logical grouping of items. - Please note that a static box should @b not be used as the parent for the - controls it contains, instead they should be siblings of each other. Although - using a static box as a parent might work in some versions of wxWidgets, it - results in a crash under, for example, wxGTK. + Note that while the previous versions required that windows appearing + inside a static box be created as its siblings (i.e. use the same parent as + the static box itself), since wxWidgets 2.9.1 it is also possible to create + them as children of wxStaticBox itself and you are actually encouraged to + do it like this if compatibility with the previous versions is not + important. - Also, please note that because of this, the order in which you create new - controls is important. Create your wxStaticBox control @b before any - siblings that are to appear inside the wxStaticBox in order to preserve the - correct Z-Order of controls. + So the new recommended way to create static box is: + @code + void MyFrame::CreateControls() + { + wxPanel *panel = new wxPanel(this); + wxStaticBox *box = new wxStaticBox(panel, wxID_ANY, "StaticBox"); + + new wxStaticText(box, wxID_ANY "This window is a child of the staticbox"); + ... + } + @endcode + + While the compatible -- and now deprecated -- way is + @code + wxStaticBox *box = new wxStaticBox(panel, wxID_ANY, "StaticBox"); + + new wxStaticText(panel, wxID_ANY "This window is a child of the panel"); + ... + @endcode + + Also note that there is a specialized wxSizer class (wxStaticBoxSizer) which can + be used as an easier way to pack items into a static box. @library{wxcore} @category{ctrl} - + @appearance{staticbox} - @see wxStaticText + @see wxStaticText, wxStaticBoxSizer */ class wxStaticBox : public wxControl { @@ -35,7 +54,7 @@ public: Default constructor */ wxStaticBox(); - + /** Constructor, creating and showing a static box. @@ -46,11 +65,11 @@ public: @param label Text to be displayed in the static box, the empty string for no label. @param pos - Window position. If wxDefaultPosition is specified then a default - position is chosen. + Window position. + If ::wxDefaultPosition is specified then a default position is chosen. @param size - Checkbox size. If the size (-1, -1) is specified then a default size is - chosen. + Checkbox size. + If ::wxDefaultSize is specified then a default size is chosen. @param style Window style. See wxStaticBox. @param name @@ -63,7 +82,7 @@ public: const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = 0, - const wxString& name = "staticBox"); + const wxString& name = wxStaticBoxNameStr); /** Destructor, destroying the group box. @@ -71,14 +90,12 @@ public: virtual ~wxStaticBox(); /** - Creates the static box for two-step construction. See wxStaticBox() - for further details. + Creates the static box for two-step construction. + See wxStaticBox() for further details. */ - bool Create(wxWindow* parent, wxWindowID id, - const wxString& label, + bool Create(wxWindow* parent, wxWindowID id, const wxString& label, const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = 0, - const wxString& name = "staticBox"); + const wxSize& size = wxDefaultSize, long style = 0, + const wxString& name = wxStaticBoxNameStr); };