]>
git.saurik.com Git - wxWidgets.git/blob - interface/collpane.h
1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: interface of wxCollapsiblePane
4 // Author: wxWidgets team
6 // Licence: wxWindows license
7 /////////////////////////////////////////////////////////////////////////////
10 @class wxCollapsiblePaneEvent
13 This event class is used for the events generated by wxCollapsiblePane.
15 @beginEventTable{wxCollapsiblePaneEvent}
16 @event{EVT_COLLAPSIBLEPANE_CHANGED(id, func)}
17 The user expanded or collapsed the collapsible pane.
23 @see wxCollapsiblePane
25 class wxCollapsiblePaneEvent
: public wxCommandEvent
29 The constructor is not normally used by the user code.
31 wxCollapsiblePaneEvent(wxObject
* generator
, int id
, bool collapsed
);
34 Returns @true if the pane has been collapsed.
36 bool GetCollapsed() const;
39 Sets this as a collapsed pane event (if @a collapsed is @true) or as an
40 expanded pane event (if @a collapsed is @false).
42 void SetCollapsed(bool collapsed
);
48 @class wxCollapsiblePane
51 A collapsible pane is a container with an embedded button-like control
52 which can be used by the user to collapse or expand the pane's contents.
54 Once constructed you should use the GetPane() function to access the pane
55 and add your controls inside it (i.e. use the returned pointer from
56 GetPane() as parent for the controls which must go in the pane, @b not the
57 wxCollapsiblePane itself!).
59 Note that because of its nature of control which can dynamically (and
60 drastically) change its size at run-time under user-input, when putting
61 wxCollapsiblePane inside a wxSizer you should be careful to add it with a
62 proportion value of zero; this is because otherwise all other windows with
63 non-null proportion values will automatically resize each time the user
64 expands or collapse the pane window usually resulting in a weird,
70 wxCollapsiblePane *collpane = new wxCollapsiblePane(this, wxID_ANY, wxT("Details:"));
72 // add the pane with a zero proportion value to the 'sz' sizer which contains it
73 sz->Add(collpane, 0, wxGROW|wxALL, 5);
75 // now add a test label in the collapsible pane using a sizer to layout it:
76 wxWindow *win = collpane->GetPane();
77 wxSizer *paneSz = new wxBoxSizer(wxVERTICAL);
78 paneSz->Add(new wxStaticText(win, wxID_ANY, wxT("test!")), 1, wxGROW|wxALL, 2);
79 win->SetSizer(paneSz);
80 paneSz->SetSizeHints(win);
83 It is only available if @c wxUSE_COLLPANE is set to 1 (the default).
86 @style{wxCP_DEFAULT_STYLE}
90 @beginEventTable{wxCollapsiblePaneEvent}
91 @event{EVT_COLLAPSIBLEPANE_CHANGED(id, func)}
92 The user expanded or collapsed the collapsible pane.
97 <!-- @appearance{collapsiblepane.png} -->
99 @see wxPanel, wxCollapsiblePaneEvent
101 class wxCollapsiblePane
: public wxControl
105 Initializes the object and calls Create() with all the parameters.
107 wxCollapsiblePane(wxWindow
* parent
, wxWindowID id
,
108 const wxString
& label
,
109 const wxPoint
& pos
= wxDefaultPosition
,
110 const wxSize
& size
= wxDefaultSize
,
111 long style
= wxCP_DEFAULT_STYLE
,
112 const wxValidator
& validator
= wxDefaultValidator
,
113 const wxString
& name
= "collapsiblePane");
117 Parent window, must not be non-@NULL.
119 The identifier for the control.
121 The initial label shown in the button which allows the user to
122 expand or collapse the pane window.
128 The window style, see wxCP_* flags.
130 Validator which can be used for additional date checks.
134 @returns @true if the control was successfully created or @false if
137 bool Create(wxWindow
* parent
, wxWindowID id
,
138 const wxString
& label
,
139 const wxPoint
& pos
= wxDefaultPosition
,
140 const wxSize
& size
= wxDefaultSize
,
141 long style
= wxCP_DEFAULT_STYLE
,
142 const wxValidator
& validator
= wxDefaultValidator
,
143 const wxString
& name
= "collapsiblePane");
146 Collapses or expands the pane window.
148 void Collapse(bool collapse
= true);
151 Same as calling Collapse(@false).
156 Returns a pointer to the pane window. Add controls to the returned
157 wxWindow to make them collapsible.
159 wxWindow
* GetPane() const;
162 Returns @true if the pane window is currently hidden.
164 bool IsCollapsed() const;
167 Returns @true if the pane window is currently shown.
169 bool IsExpanded() const;