]>
Commit | Line | Data |
---|---|---|
3972fb49 JS |
1 | \section{\class{wxNotebook}}\label{wxnotebook} |
2 | ||
3 | This class represents a notebook control, which manages multiple windows with associated tabs. | |
4 | ||
5 | To use the class, create a wxNotebook object and call \helpref{AddPage}{wxnotebookaddpage} or \helpref{InsertPage}{wxnotebookinsertpage}, | |
6 | passing a window to be used as the page. Do not explicitly delete the window for a page that is currently | |
7 | managed by wxNotebook. | |
8 | ||
9 | {\bf wxNotebookPage} is a typedef for wxWindow. | |
10 | ||
11 | \wxheading{Derived from} | |
12 | ||
13 | \helpref{wxControl}{wxcontrol}\\ | |
14 | \helpref{wxWindow}{wxwindow}\\ | |
15 | \helpref{wxEvtHandler}{wxevthandler}\\ | |
16 | \helpref{wxObject}{wxobject} | |
17 | ||
954b8ae6 JS |
18 | \wxheading{Include files} |
19 | ||
20 | <wx/notebook.h> | |
21 | ||
da27bd0b VZ |
22 | \wxheading{Window styles} |
23 | ||
24 | \twocolwidtha{5cm} | |
25 | \begin{twocollist}\itemsep=0pt | |
f6bcfd97 BP |
26 | |
27 | \twocolitem{\windowstyle{wxNB\_FIXEDWIDTH}}{(Windows only)All tabs will have same width.} | |
28 | \twocolitem{\windowstyle{wxNB\_LEFT}}{Place tabs on the left side.} | |
29 | \twocolitem{\windowstyle{wxNB\_RIGHT}}{Place tabs on the right side.} | |
30 | \twocolitem{\windowstyle{wxNB\_BOTTOM}}{Place tabs under instead of above the notebook pages.} | |
31 | ||
da27bd0b VZ |
32 | \end{twocollist} |
33 | ||
f6bcfd97 BP |
34 | See also \helpref{window styles overview}{windowstyles}. |
35 | ||
36 | ||
3972fb49 JS |
37 | \wxheading{Event handling} |
38 | ||
39 | To process input from a notebook control, use the following event handler macros to direct input to member | |
40 | functions that take a \helpref{wxNotebookEvent}{wxnotebookevent} argument. | |
41 | ||
42 | \twocolwidtha{7cm} | |
43 | \begin{twocollist}\itemsep=0pt | |
fd128b0c | 44 | \twocolitem{{\bf EVT\_NOTEBOOK\_PAGE\_CHANGED(id, func)}}{The page selection was changed.} |
e79848ac | 45 | \twocolitem{{\bf EVT\_NOTEBOOK\_PAGE\_CHANGING(id, func)}}{The page selection is about to be changed. |
fd128b0c | 46 | This can be prevented by calling \helpref{Veto()}{wxnotifyeventveto}.} |
3972fb49 JS |
47 | \end{twocollist}% |
48 | ||
49 | \wxheading{See also} | |
50 | ||
51 | \helpref{wxNotebookEvent}{wxnotebookevent}, \helpref{wxImageList}{wximagelist},\rtfsp | |
52 | \helpref{wxTabCtrl}{wxtabctrl} | |
53 | ||
54 | \latexignore{\rtfignore{\wxheading{Members}}} | |
55 | ||
56 | \membersection{wxNotebook::wxNotebook}\label{wxnotebookconstr} | |
57 | ||
58 | \func{}{wxNotebook}{\void} | |
59 | ||
60 | Default constructor. | |
61 | ||
62 | \func{}{wxNotebook}{\param{wxWindow*}{ parent}, \param{wxWindowID }{id}, \param{const wxPoint\&}{ pos = wxDefaultPosition}, | |
63 | \param{const wxSize\&}{ size}, \param{long}{ style = 0}, \param{const wxString\& }{name = "notebook"}} | |
64 | ||
65 | Constructs a notebook control. | |
66 | ||
5fa399c9 JS |
67 | Note that sometimes you can reduce flicker by passing the wxCLIP\_CHILDREN window style. |
68 | ||
3972fb49 JS |
69 | \wxheading{Parameters} |
70 | ||
71 | \docparam{parent}{The parent window. Must be non-NULL.} | |
72 | ||
73 | \docparam{id}{The window identifier.} | |
74 | ||
75 | \docparam{pos}{The window position.} | |
76 | ||
77 | \docparam{size}{The window size.} | |
78 | ||
f6bcfd97 | 79 | \docparam{style}{The window style. See \helpref{wxNotebook}{wxnotebook}.} |
3972fb49 | 80 | |
8c517ddd VZ |
81 | \docparam{name}{The name of the control (used only under Motif).} |
82 | ||
3972fb49 JS |
83 | \membersection{wxNotebook::\destruct{wxNotebook}} |
84 | ||
85 | \func{}{\destruct{wxNotebook}}{\void} | |
86 | ||
87 | Destroys the wxNotebook object. | |
88 | ||
89 | \membersection{wxNotebook::AddPage}\label{wxnotebookaddpage} | |
90 | ||
91 | \func{bool}{AddPage}{\param{wxNotebookPage*}{ page}, | |
92 | \param{const wxString\&}{ text}, | |
93 | \param{bool}{ select = FALSE}, | |
94 | \param{int}{ imageId = -1}} | |
95 | ||
96 | Adds a new page. | |
97 | ||
98 | \wxheading{Parameters} | |
99 | ||
100 | \docparam{page}{Specifies the new page.} | |
101 | ||
102 | \docparam{text}{Specifies the text for the new page.} | |
103 | ||
104 | \docparam{select}{Specifies whether the page should be selected.} | |
105 | ||
106 | \docparam{imageId}{Specifies the optional image index for the new page.} | |
107 | ||
108 | \wxheading{Return value} | |
109 | ||
110 | TRUE if successful, FALSE otherwise. | |
111 | ||
112 | \wxheading{Remarks} | |
113 | ||
114 | Do not delete the page, it will be deleted by the notebook. | |
115 | ||
116 | \wxheading{See also} | |
117 | ||
118 | \helpref{wxNotebook::InsertPage}{wxnotebookinsertpage} | |
119 | ||
120 | \membersection{wxNotebook::AdvanceSelection}\label{wxnotebookadvanceselection} | |
121 | ||
122 | \func{void}{AdvanceSelection}{\param{bool}{ forward = TRUE}} | |
123 | ||
124 | Cycles through the tabs. | |
125 | ||
b656febd VS |
126 | \membersection{wxNotebook::AssignImageList}\label{wxnotebookassignimagelist} |
127 | ||
128 | \func{void}{AssignImageList}{\param{wxImageList*}{ imageList}} | |
129 | ||
130 | Sets the image list for the page control and takes ownership of | |
131 | the list. | |
132 | ||
133 | \wxheading{See also} | |
134 | ||
135 | \helpref{wxImageList}{wximagelist}, | |
136 | \helpref{SetImageList}{wxnotebooksetimagelist} | |
137 | ||
3972fb49 JS |
138 | \membersection{wxNotebook::Create}\label{wxnotebookcreate} |
139 | ||
140 | \func{bool}{Create}{\param{wxWindow*}{ parent}, \param{wxWindowID }{id}, \param{const wxPoint\&}{ pos = wxDefaultPosition}, | |
141 | \param{const wxSize\&}{ size}, \param{long}{ style = 0}, \param{const wxString\& }{name = "notebook"}} | |
142 | ||
143 | Creates a notebook control. See \helpref{wxNotebook::wxNotebook}{wxnotebookconstr} for a description | |
144 | of the parameters. | |
145 | ||
146 | \membersection{wxNotebook::DeleteAllPages}\label{wxnotebookdeleteallpages} | |
147 | ||
148 | \func{bool}{DeleteAllPages}{\void} | |
149 | ||
150 | Deletes all pages. | |
151 | ||
152 | \membersection{wxNotebook::DeletePage}\label{wxnotebookdeletepage} | |
153 | ||
154 | \func{bool}{DeletePage}{\param{int}{ page}} | |
155 | ||
621793f4 | 156 | Deletes the specified page, and the associated window. |
3972fb49 JS |
157 | |
158 | \membersection{wxNotebook::GetImageList}\label{wxnotebookgetimagelist} | |
159 | ||
160 | \constfunc{wxImageList*}{GetImageList}{\void} | |
161 | ||
162 | Returns the associated image list. | |
163 | ||
164 | \wxheading{See also} | |
165 | ||
166 | \helpref{wxImageList}{wximagelist}, \helpref{wxNotebook::SetImageList}{wxnotebooksetimagelist} | |
167 | ||
168 | \membersection{wxNotebook::GetPage}\label{wxnotebookgetpage} | |
169 | ||
170 | \func{wxNotebookPage*}{GetPage}{\param{int}{ page}} | |
171 | ||
172 | Returns the window at the given page position. | |
173 | ||
174 | \membersection{wxNotebook::GetPageCount}\label{wxnotebookgetpagecount} | |
175 | ||
176 | \constfunc{int}{GetPageCount}{\void} | |
177 | ||
178 | Returns the number of pages in the notebook control. | |
179 | ||
180 | \membersection{wxNotebook::GetPageImage}\label{wxnotebookgetpageimage} | |
181 | ||
f6bcfd97 | 182 | \constfunc{int}{GetPageImage}{\param{int }{nPage}} |
3972fb49 JS |
183 | |
184 | Returns the image index for the given page. | |
185 | ||
186 | \membersection{wxNotebook::GetPageText}\label{wxnotebookgetpagetext} | |
187 | ||
f6bcfd97 | 188 | \constfunc{wxString}{GetPageText}{\param{int }{nPage}} |
3972fb49 JS |
189 | |
190 | Returns the string for the given page. | |
191 | ||
192 | \membersection{wxNotebook::GetRowCount}\label{wxnotebookgetrowcount} | |
193 | ||
194 | \constfunc{int}{GetRowCount}{\void} | |
195 | ||
196 | Returns the number of rows in the notebook control. | |
197 | ||
198 | \membersection{wxNotebook::GetSelection}\label{wxnotebookgetselection} | |
199 | ||
200 | \constfunc{int}{GetSelection}{\void} | |
201 | ||
202 | Returns the currently selected page, or -1 if none was selected. | |
203 | ||
204 | \membersection{wxNotebook::InsertPage}\label{wxnotebookinsertpage} | |
205 | ||
206 | \func{bool}{InsertPage}{\param{int}{ index}, \param{wxNotebookPage*}{ page}, | |
207 | \param{const wxString\&}{ text}, | |
208 | \param{bool}{ select = FALSE}, | |
209 | \param{int}{ imageId = -1}} | |
210 | ||
211 | Inserts a new page at the specified position. | |
212 | ||
213 | \wxheading{Parameters} | |
214 | ||
215 | \docparam{index}{Specifies the position for the new page.} | |
216 | ||
217 | \docparam{page}{Specifies the new page.} | |
218 | ||
219 | \docparam{text}{Specifies the text for the new page.} | |
220 | ||
221 | \docparam{select}{Specifies whether the page should be selected.} | |
222 | ||
223 | \docparam{imageId}{Specifies the optional image index for the new page.} | |
224 | ||
225 | \wxheading{Return value} | |
226 | ||
227 | TRUE if successful, FALSE otherwise. | |
228 | ||
229 | \wxheading{Remarks} | |
230 | ||
231 | Do not delete the page, it will be deleted by the notebook. | |
232 | ||
233 | \wxheading{See also} | |
234 | ||
235 | \helpref{wxNotebook::AddPage}{wxnotebookaddpage} | |
236 | ||
237 | \membersection{wxNotebook::OnSelChange}\label{wxnotebookonselchange} | |
238 | ||
239 | \func{void}{OnSelChange}{\param{wxNotebookEvent\&}{ event}} | |
240 | ||
241 | An event handler function, called when the page selection is changed. | |
242 | ||
243 | \wxheading{See also} | |
244 | ||
245 | \helpref{wxNotebookEvent}{wxnotebookevent} | |
246 | ||
621793f4 JS |
247 | \membersection{wxNotebook::RemovePage}\label{wxnotebookremovepage} |
248 | ||
249 | \func{bool}{RemovePage}{\param{int}{ page}} | |
250 | ||
251 | Deletes the specified page, without deleting the associated window. | |
252 | ||
3972fb49 JS |
253 | \membersection{wxNotebook::SetImageList}\label{wxnotebooksetimagelist} |
254 | ||
255 | \func{void}{SetImageList}{\param{wxImageList*}{ imageList}} | |
256 | ||
b656febd VS |
257 | Sets the image list for the page control. It does not take |
258 | ownership of the image list, you must delete it yourself. | |
3972fb49 JS |
259 | |
260 | \wxheading{See also} | |
261 | ||
b656febd VS |
262 | \helpref{wxImageList}{wximagelist}, |
263 | \helpref{AssignImageList}{wxnotebookassignimagelist} | |
3972fb49 JS |
264 | |
265 | \membersection{wxNotebook::SetPadding}\label{wxnotebooksetpadding} | |
266 | ||
267 | \func{void}{SetPadding}{\param{const wxSize\&}{ padding}} | |
268 | ||
269 | Sets the amount of space around each page's icon and label, in pixels. | |
270 | ||
271 | \membersection{wxNotebook::SetPageSize}\label{wxnotebooksetpagesize} | |
272 | ||
273 | \func{void}{SetPageSize}{\param{const wxSize\&}{ size}} | |
274 | ||
275 | Sets the width and height of the pages. | |
276 | ||
277 | \membersection{wxNotebook::SetPageImage}\label{wxnotebooksetpageimage} | |
278 | ||
279 | \func{bool}{SetPageImage}{\param{int}{ page}, \param{int }{image}} | |
280 | ||
281 | Sets the image index for the given page. {\it image} is an index into | |
282 | the image list which was set with \helpref{wxNotebook::SetImageList}{wxnotebooksetimagelist}. | |
283 | ||
284 | \membersection{wxNotebook::SetPageText}\label{wxnotebooksetpagetext} | |
285 | ||
286 | \func{bool}{SetPageText}{\param{int}{ page}, \param{const wxString\& }{text}} | |
287 | ||
288 | Sets the text for the given page. | |
289 | ||
290 | \membersection{wxNotebook::SetSelection}\label{wxnotebooksetselection} | |
291 | ||
292 | \func{int}{SetSelection}{\param{int}{ page}} | |
293 | ||
294 | Sets the selection for the given page, returning the previous selection. | |
295 | ||
296 | \wxheading{See also} | |
297 | ||
298 | \helpref{wxNotebook::GetSelection}{wxnotebookgetselection} | |
299 | ||
300 |