]>
git.saurik.com Git - wxWidgets.git/blob - interface/wx/collpane.h
1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: interface of wxCollapsiblePane
4 // Author: wxWidgets team
6 // Licence: wxWindows license
7 /////////////////////////////////////////////////////////////////////////////
10 @class wxCollapsiblePaneEvent
12 This event class is used for the events generated by wxCollapsiblePane.
14 @beginEventTable{wxCollapsiblePaneEvent}
15 @event{EVT_COLLAPSIBLEPANE_CHANGED(id, func)}
16 The user expanded or collapsed the collapsible pane.
22 @see wxCollapsiblePane
24 class wxCollapsiblePaneEvent
: public wxCommandEvent
28 The constructor is not normally used by the user code.
30 wxCollapsiblePaneEvent(wxObject
* generator
, int id
, bool collapsed
);
33 Returns @true if the pane has been collapsed.
35 bool GetCollapsed() const;
38 Sets this as a collapsed pane event (if @a collapsed is @true) or as an
39 expanded pane event (if @a collapsed is @false).
41 void SetCollapsed(bool collapsed
);
47 @class wxCollapsiblePane
49 A collapsible pane is a container with an embedded button-like control
50 which can be used by the user to collapse or expand the pane's contents.
52 Once constructed you should use the GetPane() function to access the pane
53 and add your controls inside it (i.e. use the returned pointer from
54 GetPane() as parent for the controls which must go in the pane, @b not the
55 wxCollapsiblePane itself!).
57 Note that because of its nature of control which can dynamically (and
58 drastically) change its size at run-time under user-input, when putting
59 wxCollapsiblePane inside a wxSizer you should be careful to add it with a
60 proportion value of zero; this is because otherwise all other windows with
61 non-null proportion values will automatically resize each time the user
62 expands or collapse the pane window usually resulting in a weird,
68 wxCollapsiblePane *collpane = new wxCollapsiblePane(this, wxID_ANY, wxT("Details:"));
70 // add the pane with a zero proportion value to the 'sz' sizer which contains it
71 sz->Add(collpane, 0, wxGROW|wxALL, 5);
73 // now add a test label in the collapsible pane using a sizer to layout it:
74 wxWindow *win = collpane->GetPane();
75 wxSizer *paneSz = new wxBoxSizer(wxVERTICAL);
76 paneSz->Add(new wxStaticText(win, wxID_ANY, wxT("test!")), 1, wxGROW|wxALL, 2);
77 win->SetSizer(paneSz);
78 paneSz->SetSizeHints(win);
81 It is only available if @c wxUSE_COLLPANE is set to 1 (the default).
84 @style{wxCP_DEFAULT_STYLE}
85 The default style. It includes wxTAB_TRAVERSAL and wxBORDER_NONE.
86 @style{wxCP_NO_TLW_RESIZE}
87 By default wxCollapsiblePane resizes the top level window containing it
88 when its own size changes. This allows to easily implement dialogs
89 containing an optionally shown part, for example, and so is the default
90 behaviour but can be inconvenient in some specific cases -- use this
91 flag to disable this automatic parent resizing then.
94 @beginEventTable{wxCollapsiblePaneEvent}
95 @event{EVT_COLLAPSIBLEPANE_CHANGED(id, func)}
96 The user expanded or collapsed the collapsible pane.
101 @appearance{collapsiblepane.png}
103 @see wxPanel, wxCollapsiblePaneEvent
105 class wxCollapsiblePane
: public wxControl
114 Initializes the object and calls Create() with all the parameters.
116 wxCollapsiblePane(wxWindow
* parent
, wxWindowID id
,
117 const wxString
& label
,
118 const wxPoint
& pos
= wxDefaultPosition
,
119 const wxSize
& size
= wxDefaultSize
,
120 long style
= wxCP_DEFAULT_STYLE
,
121 const wxValidator
& validator
= wxDefaultValidator
,
122 const wxString
& name
= wxCollapsiblePaneNameStr
);
126 Parent window, must not be non-@NULL.
128 The identifier for the control.
130 The initial label shown in the button which allows the user to
131 expand or collapse the pane window.
137 The window style, see wxCP_* flags.
139 Validator which can be used for additional date checks.
143 @return @true if the control was successfully created or @false if
146 bool Create(wxWindow
* parent
, wxWindowID id
,
147 const wxString
& label
,
148 const wxPoint
& pos
= wxDefaultPosition
,
149 const wxSize
& size
= wxDefaultSize
,
150 long style
= wxCP_DEFAULT_STYLE
,
151 const wxValidator
& validator
= wxDefaultValidator
,
152 const wxString
& name
= wxCollapsiblePaneNameStr
);
155 Collapses or expands the pane window.
157 virtual void Collapse(bool collapse
= true);
160 Same as calling Collapse(@false).
165 Returns a pointer to the pane window. Add controls to the returned
166 wxWindow to make them collapsible.
168 virtual wxWindow
* GetPane() const;
171 Returns @true if the pane window is currently hidden.
173 virtual bool IsCollapsed() const;
176 Returns @true if the pane window is currently shown.
178 bool IsExpanded() const;