X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/3c4f71cc3d63fb7bdfbd6cec3e39c8a8679f3e60..6631cbd98e7d1139a45841b519ae8aa753a15fbc:/interface/collpane.h diff --git a/interface/collpane.h b/interface/collpane.h index 89a6e74e79..161eff344d 100644 --- a/interface/collpane.h +++ b/interface/collpane.h @@ -1,6 +1,6 @@ ///////////////////////////////////////////////////////////////////////////// // Name: collpane.h -// Purpose: interface of wxCollapsiblePaneEvent +// Purpose: interface of wxCollapsiblePane // Author: wxWidgets team // RCS-ID: $Id$ // Licence: wxWindows license @@ -10,11 +10,15 @@ @class wxCollapsiblePaneEvent @wxheader{collpane.h} - This event class is used for the events generated by - wxCollapsiblePane. + This event class is used for the events generated by wxCollapsiblePane. + + @beginEventTable{wxCollapsiblePaneEvent} + @event{EVT_COLLAPSIBLEPANE_CHANGED(id, func)} + The user expanded or collapsed the collapsible pane. + @endEventTable @library{wxcore} - @category{FIXME} + @category{events} @see wxCollapsiblePane */ @@ -24,8 +28,7 @@ public: /** The constructor is not normally used by the user code. */ - wxCollapsiblePaneEvent(wxObject* generator, int id, - bool collapsed); + wxCollapsiblePaneEvent(wxObject* generator, int id, bool collapsed); /** Returns @true if the pane has been collapsed. @@ -34,8 +37,7 @@ public: /** Sets this as a collapsed pane event (if @a collapsed is @true) or as an - expanded - pane event (if @a collapsed is @false). + expanded pane event (if @a collapsed is @false). */ void SetCollapsed(bool collapsed); }; @@ -46,55 +48,53 @@ public: @class wxCollapsiblePane @wxheader{collpane.h} - A collapsible pane is a container with an embedded button-like control which - can be - used by the user to collapse or expand the pane's contents. + A collapsible pane is a container with an embedded button-like control + which can be used by the user to collapse or expand the pane's contents. - Once constructed you should use the wxCollapsiblePane::GetPane - function to access the pane and add your controls inside it (i.e. use the - wxCollapsiblePane::GetPane's returned pointer as parent for the - controls which must go in the pane, NOT the wxCollapsiblePane itself!). + Once constructed you should use the GetPane() function to access the pane + and add your controls inside it (i.e. use the returned pointer from + GetPane() as parent for the controls which must go in the pane, @b not the + wxCollapsiblePane itself!). Note that because of its nature of control which can dynamically (and - drastically) - change its size at run-time under user-input, when putting wxCollapsiblePane - inside - a wxSizer you should be careful to add it with a proportion value - of zero; this is because otherwise all other windows with non-null proportion - values - would automatically get resized each time the user expands or collapse the pane - window - resulting usually in a weird, flickering effect. + drastically) change its size at run-time under user-input, when putting + wxCollapsiblePane inside a wxSizer you should be careful to add it with a + proportion value of zero; this is because otherwise all other windows with + non-null proportion values will automatically resize each time the user + expands or collapse the pane window usually resulting in a weird, + flickering effect. Usage sample: @code - wxCollapsiblePane *collpane = new wxCollapsiblePane(this, wxID_ANY, - wxT("Details:")); - - // add the pane with a zero proportion value to the 'sz' sizer which - contains it - sz-Add(collpane, 0, wxGROW|wxALL, 5); - - // now add a test label in the collapsible pane using a sizer to layout it: - wxWindow *win = collpane-GetPane(); - wxSizer *paneSz = new wxBoxSizer(wxVERTICAL); - paneSz-Add(new wxStaticText(win, wxID_ANY, wxT("test!")), 1, wxGROW|wxALL, - 2); - win-SetSizer(paneSz); - paneSz-SetSizeHints(win); + wxCollapsiblePane *collpane = new wxCollapsiblePane(this, wxID_ANY, wxT("Details:")); + + // add the pane with a zero proportion value to the 'sz' sizer which contains it + sz->Add(collpane, 0, wxGROW|wxALL, 5); + + // now add a test label in the collapsible pane using a sizer to layout it: + wxWindow *win = collpane->GetPane(); + wxSizer *paneSz = new wxBoxSizer(wxVERTICAL); + paneSz->Add(new wxStaticText(win, wxID_ANY, wxT("test!")), 1, wxGROW|wxALL, 2); + win->SetSizer(paneSz); + paneSz->SetSizeHints(win); @endcode It is only available if @c wxUSE_COLLPANE is set to 1 (the default). @beginStyleTable - @style{wxCP_DEFAULT_STYLE}: + @style{wxCP_DEFAULT_STYLE} The default style: 0. @endStyleTable + @beginEventTable{wxCollapsiblePaneEvent} + @event{EVT_COLLAPSIBLEPANE_CHANGED(id, func)} + The user expanded or collapsed the collapsible pane. + @endEventTable + @library{wxcore} @category{ctrl} - @appearance{collapsiblepane.png} + @see wxPanel, wxCollapsiblePaneEvent */ @@ -102,8 +102,12 @@ class wxCollapsiblePane : public wxControl { public: /** - Initializes the object and calls Create() with - all the parameters. + Default constructor. + */ + wxCollapsiblePane(); + + /** + Initializes the object and calls Create() with all the parameters. */ wxCollapsiblePane(wxWindow* parent, wxWindowID id, const wxString& label, @@ -113,19 +117,14 @@ public: const wxValidator& validator = wxDefaultValidator, const wxString& name = "collapsiblePane"); - /** - Collapses or expands the pane window. - */ - void Collapse(bool collapse = true); - /** @param parent Parent window, must not be non-@NULL. @param id The identifier for the control. @param label - The initial label shown in the button which allows the user to expand or - collapse the pane window. + The initial label shown in the button which allows the user to + expand or collapse the pane window. @param pos Initial position. @param size @@ -137,8 +136,8 @@ public: @param name Control name. - @returns @true if the control was successfully created or @false if - creation failed. + @return @true if the control was successfully created or @false if + creation failed. */ bool Create(wxWindow* parent, wxWindowID id, const wxString& label, @@ -149,13 +148,18 @@ public: const wxString& name = "collapsiblePane"); /** - Same as @c wxCollapsiblePane::Collapse(@false). + Collapses or expands the pane window. + */ + void Collapse(bool collapse = true); + + /** + Same as calling Collapse(@false). */ void Expand(); /** - Returns a pointer to the pane window. Add controls to the returned wxWindow - to make them collapsible. + Returns a pointer to the pane window. Add controls to the returned + wxWindow to make them collapsible. */ wxWindow* GetPane() const;