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