]> git.saurik.com Git - wxWidgets.git/blob - docs/latex/wx/collpane.tex
added null pointer check and assert
[wxWidgets.git] / docs / latex / wx / collpane.tex
1 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2 %% Name: collpane.tex
3 %% Purpose: wxCollapsiblePane documentation
4 %% Author: Francesco Montorsi
5 %% Created: 2006-10-14
6 %% RCS-ID: $Id$
7 %% Copyright: (c) 2006 Francesco Montorsi
8 %% License: wxWindows license
9 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10
11 \section{\class{wxCollapsiblePane}}\label{wxcollapsiblepane}
12
13 A collapsible pane is a container with an embedded button-like control which can be
14 used by the user to collapse or expand the pane's contents.
15
16 Once constructed you should use the \helpref{GetPane}{wxcollapsiblepanegetpane}
17 function to access the pane and add your controls inside it (i.e. use the
18 \helpref{GetPane}{wxcollapsiblepanegetpane}'s returned pointer as parent for the
19 controls which must go in the pane, NOT the wxCollapsiblePane itself!).
20
21 Note that because of its nature of control which can dynamically (and drastically)
22 change its size at run-time under user-input, when putting wxCollapsiblePane inside
23 a \helpref{wxSizer}{wxsizer} you should be careful to add it with a proportion value
24 of zero; this is because otherwise all other windows with non-null proportion values
25 would automatically get resized each time the user expands or collapse the pane window
26 resulting usually in a weird, flickering effect.
27
28 Usage sample:
29
30 \begin{verbatim}
31 wxCollapsiblePane *collpane = new wxCollapsiblePane(this, wxID_ANY, wxT("Details:"));
32
33 // add the pane with a zero proportion value to the 'sz' sizer which contains it
34 sz->Add(collpane, 0, wxGROW|wxALL, 5);
35
36 // now add a test label in the collapsible pane using a sizer to layout it:
37 wxWindow *win = collpane->GetPane();
38 wxSizer *paneSz = new wxBoxSizer(wxVERTICAL);
39 paneSz->Add(new wxStaticText(win, wxID_ANY, wxT("test!")), 1, wxGROW|wxALL, 2);
40 win->SetSizer(paneSz);
41 paneSz->SetSizeHints(win);
42
43 \end{verbatim}
44
45
46 It is only available if \texttt{wxUSE\_COLLPANE} is set to $1$ (the default).
47
48 \wxheading{Derived from}
49
50 \helpref{wxControl}{wxcontrol}\\
51 \helpref{wxWindow}{wxwindow}\\
52 \helpref{wxEvtHandler}{wxevthandler}\\
53 \helpref{wxObject}{wxobject}
54
55 \wxheading{Include files}
56
57 <wx/collpane.h>
58
59 \wxheading{Library}
60
61 \helpref{wxCore}{librarieslist}
62
63 \wxheading{Window styles}
64
65 \twocolwidtha{5cm}%
66 \begin{twocollist}\itemsep=0pt
67 \twocolitem{\windowstyle{wxCP\_DEFAULT\_STYLE}}{The default style: 0.}
68 \end{twocollist}
69
70 \wxheading{Event handling}
71
72 To process a collapsible pane event, use these event handler macros to direct input to member
73 functions that take a \helpref{wxCollapsiblePaneEvent}{wxcollapsiblepaneevent} argument.
74
75 \twocolwidtha{7cm}%
76 \begin{twocollist}\itemsep=0pt
77 \twocolitem{{\bf EVT\_COLLAPSIBLEPANE\_CHANGED(id, func)}}{The user showed or hidden the collapsible pane. }
78 \end{twocollist}
79
80
81 \wxheading{See also}
82
83 \helpref{wxPanel}{wxpanel},\\
84 \helpref{wxCollapsiblePaneEvent}{wxcollapsiblepaneevent}
85
86 \latexignore{\rtfignore{\wxheading{Members}}}
87
88
89
90 \membersection{wxCollapsiblePane::wxCollapsiblePane}\label{wxcollapsiblepanector}
91
92 \func{}{wxCollapsiblePane}{\param{wxWindow *}{parent},\rtfsp
93 \param{wxWindowID}{ id},\rtfsp
94 \param{const wxString\& }{label},\rtfsp
95 \param{const wxPoint\& }{pos = wxDefaultPosition},\rtfsp
96 \param{const wxSize\& }{size = wxDefaultSize},\rtfsp
97 \param{long}{ style = wxCP\_DEFAULT\_STYLE},\rtfsp
98 \param{const wxValidator\& }{validator = wxDefaultValidator},
99 \param{const wxString\& }{name = ``collapsiblePane"}}
100
101 Initializes the object and calls \helpref{Create}{wxcollapsiblepanecreate} with
102 all the parameters.
103
104
105 \membersection{wxCollapsiblePane::Create}\label{wxcollapsiblepanecreate}
106
107 \func{bool}{Create}{\param{wxWindow *}{parent},\rtfsp
108 \param{wxWindowID}{ id},\rtfsp
109 \param{const wxString\& }{label},\rtfsp
110 \param{const wxPoint\& }{pos = wxDefaultPosition},\rtfsp
111 \param{const wxSize\& }{size = wxDefaultSize},\rtfsp
112 \param{long}{ style = wxCP\_DEFAULT\_STYLE},\rtfsp
113 \param{const wxValidator\& }{validator = wxDefaultValidator},
114 \param{const wxString\& }{name = ``collapsiblePane"}}
115
116 \wxheading{Parameters}
117
118 \docparam{parent}{Parent window, must not be non-\texttt{NULL}.}
119
120 \docparam{id}{The identifier for the control.}
121
122 \docparam{label}{The initial label shown in the button which allows the user to expand or collapse the pane window.}
123
124 \docparam{pos}{Initial position.}
125
126 \docparam{size}{Initial size.}
127
128 \docparam{style}{The window style, see {\tt wxCP\_*} flags.}
129
130 \docparam{validator}{Validator which can be used for additional date checks.}
131
132 \docparam{name}{Control name.}
133
134 \wxheading{Return value}
135
136 \true if the control was successfully created or \false if creation failed.
137
138
139 \membersection{wxCollapsiblePane::IsCollapsed}\label{wxcollapsiblepaneiscollapsed}
140
141 \constfunc{bool}{IsCollapsed}{\void}
142
143 Returns \true if the pane window is currently hidden.
144
145
146 \membersection{wxCollapsiblePane::IsExpanded}\label{wxcollapsiblepaneisexpanded}
147
148 \constfunc{bool}{IsExpanded}{\void}
149
150 Returns \true if the pane window is currently shown.
151
152
153 \membersection{wxCollapsiblePane::Collapse}\label{wxcollapsiblepanecollapse}
154
155 \func{void}{Collapse}{\param{bool }{collapse = true}}
156
157 Collapses or expands the pane window.
158
159
160 \membersection{wxCollapsiblePane::Expand}\label{wxcollapsiblepaneexpand}
161
162 \func{void}{Expand}{\void}
163
164 Same as \texttt{\helpref{Collapse}{wxcollapsiblepanecollapse}(false)}.
165
166
167 \membersection{wxCollapsiblePane::GetPane}\label{wxcollapsiblepanegetpane}
168
169 \constfunc{wxWindow *}{GetPane}{\void}
170
171 Returns a pointer to the pane window. Add controls to the returned \helpref{wxWindow}{wxwindow}
172 to make them collapsible.
173
174
175
176
177
178 %% wxCollapsiblePaneEvent documentation
179
180 \section{\class{wxCollapsiblePaneEvent}}\label{wxcollapsiblepaneevent}
181
182 This event class is used for the events generated by
183 \helpref{wxCollapsiblePane}{wxcollapsiblepane}.
184
185 \wxheading{Derived from}
186
187 \helpref{wxCommandEvent}{wxcommandevent}\\
188 \helpref{wxEvent}{wxevent}\\
189 \helpref{wxObject}{wxobject}
190
191 \wxheading{Include files}
192
193 <wx/collpane.h>
194
195 \wxheading{Library}
196
197 \helpref{wxCore}{librarieslist}
198
199 \wxheading{Event handling}
200
201 To process input from a wxCollapsiblePane, use one of these event handler macros to
202 direct input to member function that take a
203 \helpref{wxCollapsiblePaneEvent}{wxcollapsiblepaneevent} argument:
204
205 \twocolwidtha{7cm}
206 \begin{twocollist}
207 \twocolitem{{\bf EVT\_COLLAPSIBLEPANE\_CHANGED(id, func)}}{The user showed or hidden the collapsible pane.}
208 \end{twocollist}%
209
210
211 \wxheading{See also}
212
213 \helpref{wxCollapsiblePane}{wxcollapsiblepane}
214
215 \latexignore{\rtfignore{\wxheading{Members}}}
216
217 \membersection{wxCollapsiblePaneEvent::wxCollapsiblePaneEvent}\label{wxcollapsiblepaneeventctor}
218
219 \func{}{wxCollapsiblePaneEvent}{\param{wxObject *}{ generator}, \param{int}{ id}, \param{bool}{ collapsed}}
220
221 The constructor is not normally used by the user code.
222
223
224 \membersection{wxCollapsiblePaneEvent::GetCollapsed}\label{wxcollapsiblepaneeventgetcollapsed}
225
226 \constfunc{bool}{GetCollapsed}{\void}
227
228 Returns \true if the pane has been collapsed.
229
230
231 \membersection{wxCollapsiblePaneEvent::SetCollapsed}\label{wxcollapsiblepaneeventsetcollapsed}
232
233 \func{void}{SetCollapsed}{\param{bool}{ collapsed}}
234
235 Sets this as a collapsed pane event (if \arg{collapsed} is \true) or as an expanded
236 pane event (if \arg{collapsed} is \false).
237