1 \section{\class{wxNotebook
}}\label{wxnotebook
}
3 This class represents a notebook control, which manages multiple windows with associated tabs.
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
9 {\bf wxNotebookPage
} is a typedef for wxWindow.
11 \wxheading{Derived from
}
13 \helpref{wxControl
}{wxcontrol
}\\
14 \helpref{wxWindow
}{wxwindow
}\\
15 \helpref{wxEvtHandler
}{wxevthandler
}\\
16 \helpref{wxObject
}{wxobject
}
18 \wxheading{Include files
}
22 \wxheading{Window styles
}
25 \begin{twocollist
}\itemsep=
0pt
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.
}
34 See also
\helpref{window styles overview
}{windowstyles
}.
37 \wxheading{Event handling
}
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.
43 \begin{twocollist
}\itemsep=
0pt
44 \twocolitem{{\bf EVT
\_NOTEBOOK\_PAGE\_CHANGED(id, func)
}}{The page selection was changed.
}
45 \twocolitem{{\bf EVT
\_NOTEBOOK\_PAGE\_CHANGING(id, func)
}}{The page selection is about to be changed.
46 This can be prevented by calling
\helpref{Veto()
}{wxnotifyeventveto
}.
}
51 \helpref{wxNotebookEvent
}{wxnotebookevent
},
\helpref{wxImageList
}{wximagelist
},
\rtfsp
52 \helpref{wxTabCtrl
}{wxtabctrl
}
54 \latexignore{\rtfignore{\wxheading{Members
}}}
56 \membersection{wxNotebook::wxNotebook
}\label{wxnotebookconstr
}
58 \func{}{wxNotebook
}{\void}
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"
}}
65 Constructs a notebook control.
67 Note that sometimes you can reduce flicker by passing the wxCLIP
\_CHILDREN window style.
69 \wxheading{Parameters
}
71 \docparam{parent
}{The parent window. Must be non-NULL.
}
73 \docparam{id
}{The window identifier.
}
75 \docparam{pos
}{The window position.
}
77 \docparam{size
}{The window size.
}
79 \docparam{style
}{The window style. See
\helpref{wxNotebook
}{wxnotebook
}.
}
81 \docparam{name
}{The name of the control (used only under Motif).
}
83 \membersection{wxNotebook::
\destruct{wxNotebook
}}
85 \func{}{\destruct{wxNotebook
}}{\void}
87 Destroys the wxNotebook object.
89 \membersection{wxNotebook::AddPage
}\label{wxnotebookaddpage
}
91 \func{bool
}{AddPage
}{\param{wxNotebookPage*
}{ page
},
92 \param{const wxString\&
}{ text
},
93 \param{bool
}{ select = FALSE
},
94 \param{int
}{ imageId = -
1}}
98 \wxheading{Parameters
}
100 \docparam{page
}{Specifies the new page.
}
102 \docparam{text
}{Specifies the text for the new page.
}
104 \docparam{select
}{Specifies whether the page should be selected.
}
106 \docparam{imageId
}{Specifies the optional image index for the new page.
}
108 \wxheading{Return value
}
110 TRUE if successful, FALSE otherwise.
114 Do not delete the page, it will be deleted by the notebook.
118 \helpref{wxNotebook::InsertPage
}{wxnotebookinsertpage
}
120 \membersection{wxNotebook::AdvanceSelection
}\label{wxnotebookadvanceselection
}
122 \func{void
}{AdvanceSelection
}{\param{bool
}{ forward = TRUE
}}
124 Cycles through the tabs.
126 \membersection{wxNotebook::AssignImageList
}\label{wxnotebookassignimagelist
}
128 \func{void
}{AssignImageList
}{\param{wxImageList*
}{ imageList
}}
130 Sets the image list for the page control and takes ownership of
135 \helpref{wxImageList
}{wximagelist
},
136 \helpref{SetImageList
}{wxnotebooksetimagelist
}
138 \membersection{wxNotebook::Create
}\label{wxnotebookcreate
}
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"
}}
143 Creates a notebook control. See
\helpref{wxNotebook::wxNotebook
}{wxnotebookconstr
} for a description
146 \membersection{wxNotebook::DeleteAllPages
}\label{wxnotebookdeleteallpages
}
148 \func{bool
}{DeleteAllPages
}{\void}
152 \membersection{wxNotebook::DeletePage
}\label{wxnotebookdeletepage
}
154 \func{bool
}{DeletePage
}{\param{int
}{ page
}}
156 Deletes the specified page, and the associated window.
158 \membersection{wxNotebook::GetImageList
}\label{wxnotebookgetimagelist
}
160 \constfunc{wxImageList*
}{GetImageList
}{\void}
162 Returns the associated image list.
166 \helpref{wxImageList
}{wximagelist
},
\helpref{wxNotebook::SetImageList
}{wxnotebooksetimagelist
}
168 \membersection{wxNotebook::GetPage
}\label{wxnotebookgetpage
}
170 \func{wxNotebookPage*
}{GetPage
}{\param{int
}{ page
}}
172 Returns the window at the given page position.
174 \membersection{wxNotebook::GetPageCount
}\label{wxnotebookgetpagecount
}
176 \constfunc{int
}{GetPageCount
}{\void}
178 Returns the number of pages in the notebook control.
180 \membersection{wxNotebook::GetPageImage
}\label{wxnotebookgetpageimage
}
182 \constfunc{int
}{GetPageImage
}{\param{int
}{nPage
}}
184 Returns the image index for the given page.
186 \membersection{wxNotebook::GetPageText
}\label{wxnotebookgetpagetext
}
188 \constfunc{wxString
}{GetPageText
}{\param{int
}{nPage
}}
190 Returns the string for the given page.
192 \membersection{wxNotebook::GetRowCount
}\label{wxnotebookgetrowcount
}
194 \constfunc{int
}{GetRowCount
}{\void}
196 Returns the number of rows in the notebook control.
198 \membersection{wxNotebook::GetSelection
}\label{wxnotebookgetselection
}
200 \constfunc{int
}{GetSelection
}{\void}
202 Returns the currently selected page, or -
1 if none was selected.
204 \membersection{wxNotebook::InsertPage
}\label{wxnotebookinsertpage
}
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}}
211 Inserts a new page at the specified position.
213 \wxheading{Parameters
}
215 \docparam{index
}{Specifies the position for the new page.
}
217 \docparam{page
}{Specifies the new page.
}
219 \docparam{text
}{Specifies the text for the new page.
}
221 \docparam{select
}{Specifies whether the page should be selected.
}
223 \docparam{imageId
}{Specifies the optional image index for the new page.
}
225 \wxheading{Return value
}
227 TRUE if successful, FALSE otherwise.
231 Do not delete the page, it will be deleted by the notebook.
235 \helpref{wxNotebook::AddPage
}{wxnotebookaddpage
}
237 \membersection{wxNotebook::OnSelChange
}\label{wxnotebookonselchange
}
239 \func{void
}{OnSelChange
}{\param{wxNotebookEvent\&
}{ event
}}
241 An event handler function, called when the page selection is changed.
245 \helpref{wxNotebookEvent
}{wxnotebookevent
}
247 \membersection{wxNotebook::RemovePage
}\label{wxnotebookremovepage
}
249 \func{bool
}{RemovePage
}{\param{int
}{ page
}}
251 Deletes the specified page, without deleting the associated window.
253 \membersection{wxNotebook::SetImageList
}\label{wxnotebooksetimagelist
}
255 \func{void
}{SetImageList
}{\param{wxImageList*
}{ imageList
}}
257 Sets the image list for the page control. It does not take
258 ownership of the image list, you must delete it yourself.
262 \helpref{wxImageList
}{wximagelist
},
263 \helpref{AssignImageList
}{wxnotebookassignimagelist
}
265 \membersection{wxNotebook::SetPadding
}\label{wxnotebooksetpadding
}
267 \func{void
}{SetPadding
}{\param{const wxSize\&
}{ padding
}}
269 Sets the amount of space around each page's icon and label, in pixels.
271 \membersection{wxNotebook::SetPageSize
}\label{wxnotebooksetpagesize
}
273 \func{void
}{SetPageSize
}{\param{const wxSize\&
}{ size
}}
275 Sets the width and height of the pages.
277 \membersection{wxNotebook::SetPageImage
}\label{wxnotebooksetpageimage
}
279 \func{bool
}{SetPageImage
}{\param{int
}{ page
},
\param{int
}{image
}}
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
}.
284 \membersection{wxNotebook::SetPageText
}\label{wxnotebooksetpagetext
}
286 \func{bool
}{SetPageText
}{\param{int
}{ page
},
\param{const wxString\&
}{text
}}
288 Sets the text for the given page.
290 \membersection{wxNotebook::SetSelection
}\label{wxnotebooksetselection
}
292 \func{int
}{SetSelection
}{\param{int
}{ page
}}
294 Sets the selection for the given page, returning the previous selection.
298 \helpref{wxNotebook::GetSelection
}{wxnotebookgetselection
}