1\section{\class{wxTabView}}\label{wxtabview} 2 3Responsible for drawing tabs onto a window, and dealing with input. 4 5Please note that the preferred class for programming tabbed windows is \helpref{wxNotebook}{wxnotebook}. 6This class is retained for backward compatibility. 7 8\wxheading{Derived from} 9 10\helpref{wxObject}{wxobject} 11 12\wxheading{Include files} 13 14<wx/tab.h> 15 16\wxheading{See also} 17 18\helpref{wxTabView overview}{wxtabviewoverview}, \helpref{wxPanelTabView}{wxpaneltabview} 19 20\latexignore{\rtfignore{\wxheading{Members}}} 21 22\membersection{wxTabView::wxTabView} 23 24\func{}{wxTabView}{\param{long }{style = wxTAB\_STYLE\_DRAW\_BOX \pipe wxTAB\_STYLE\_COLOUR\_INTERIOR}} 25 26Constructor. 27 28{\it style} may be a bit list of the following: 29 30\begin{twocollist}\itemsep=0pt 31\twocolitem{wxTAB\_STYLE\_DRAW\_BOX}{Draw a box around the view area. Most commonly used for dialogs.} 32\twocolitem{wxTAB\_STYLE\_COLOUR\_INTERIOR}{Draw tab backgrounds in the specified colour. Omitting this style 33will ensure that the tab background matches the dialog background.} 34\end{twocollist} 35 36\membersection{wxTabView::AddTab}\label{wxtabviewaddtab} 37 38\func{wxTabControl *}{AddTab}{\param{int}{ id}, \param{const wxString\& }{label}, \param{wxTabControl *}{existingTab=NULL}} 39 40Adds a tab to the view. 41 42{\it id} is the application-chosen identifier for the tab, which will be used in subsequent tab operations. 43 44{\it label} is the label to give the tab. 45 46{\it existingTab} maybe NULL to specify a new tab, or non-NULL to indicate that an existing tab should be used. 47 48A new layer (row) is started when the current layer has been filled up with tabs. 49 50\membersection{wxTabView::CalculateTabWidth}\label{wxtabviewcalculatetabwidth} 51 52\func{int}{CalculateTabWidth}{\param{int}{ noTabs}, \param{bool}{ adjustView = false}} 53 54The application can specify the tab width using this function, in terms 55of the number of tabs per layer (row) which will fit the view area, which 56should have been set previously with SetViewRect. 57 58{\it noTabs} is the number of tabs which should take up the full width 59of the view area. 60 61{\it adjustView} can be set to true in order to readjust the view width 62to exactly fit the given number of tabs. 63 64The new tab width is returned. 65 66\membersection{wxTabView::ClearTabs} 67 68\func{void}{ClearTabs}{\param{bool }{deleteTabs=true}} 69 70Clears the tabs, deleting them if {\it deleteTabs} is true. 71 72\membersection{wxTabView::Draw} 73 74\func{void}{Draw}{\param{wxDC\& }{dc}} 75 76Draws the tabs and (optionally) a box around the view area. 77 78\membersection{wxTabView::FindTabControlForId} 79 80\func{wxTabControl *}{FindTabControlForId}{\param{int}{ id}} 81 82Finds the wxTabControl corresponding to {\it id}. 83 84\membersection{wxTabView::FindTabControlForPosition} 85 86\func{wxTabControl *}{FindTabControlForPosition}{\param{int}{ layer}, \param{int}{ position}} 87 88Finds the wxTabControl at layer {\it layer}, position in layer {\it position}, both starting from 89zero. Note that tabs change layer as they are selected or deselected. 90 91\membersection{wxTabView::GetBackgroundBrush} 92 93\func{wxBrush *}{GetBackgroundBrush}{\void} 94 95Returns the brush used to draw in the background colour. It is set when 96SetBackgroundColour is called. 97 98\membersection{wxTabView::GetBackgroundColour} 99 100\func{wxColour}{GetBackgroundColour}{\void} 101 102Returns the colour used for each tab background. By default, this is 103light grey. To ensure a match with the dialog or panel background, omit 104the wxTAB\_STYLE\_COLOUR\_INTERIOR flag from the wxTabView constructor. 105 106\membersection{wxTabView::GetBackgroundPen} 107 108\func{wxPen *}{GetBackgroundPen}{\void} 109 110Returns the pen used to draw in the background colour. It is set when 111SetBackgroundColour is called. 112 113\membersection{wxTabView::GetHighlightColour} 114 115\func{wxColour}{GetHighlightColour}{\void} 116 117Returns the colour used for bright highlights on the left side of `3D' surfaces. By default, this is white. 118 119\membersection{wxTabView::GetHighlightPen} 120 121\func{wxPen *}{GetHighlightPen}{\void} 122 123Returns the pen used to draw 3D effect highlights. This is set when 124SetHighlightColour is called. 125 126\membersection{wxTabView::GetHorizontalTabOffset} 127 128\func{int}{GetHorizontalTabOffset}{\void} 129 130Returns the horizontal spacing by which each tab layer is offset from the one below. 131 132\membersection{wxTabView::GetNumberOfLayers} 133 134\func{int}{GetNumberOfLayers}{\void} 135 136Returns the number of layers (rows of tabs). 137 138\membersection{wxTabView::GetSelectedTabFont} 139 140\func{wxFont *}{GetSelectedTabFont}{\void} 141 142Returns the font to be used for the selected tab label. 143 144\membersection{wxTabView::GetShadowColour} 145 146\func{wxColour}{GetShadowColour}{\void} 147 148Returns the colour used for shadows on the right-hand side of `3D' surfaces. By default, this is dark grey. 149 150\membersection{wxTabView::GetTabHeight} 151 152\func{int}{GetTabHeight}{\void} 153 154Returns the tab default height. 155 156\membersection{wxTabView::GetTabFont} 157 158\func{wxFont *}{GetTabFont}{\void} 159 160Returns the tab label font. 161 162\membersection{wxTabView::GetTabSelectionHeight} 163 164\func{int}{GetTabSelectionHeight}{\void} 165 166Returns the height to be used for the currently selected tab; normally a few pixels 167higher than the other tabs. 168 169\membersection{wxTabView::GetTabStyle} 170 171\func{long}{GetTabStyle}{\void} 172 173Returns the tab style. See constructor documentation for details of valid styles. 174 175\membersection{wxTabView::GetTabWidth} 176 177\func{int}{GetTabWidth}{\void} 178 179Returns the tab default width. 180 181\membersection{wxTabView::GetTextColour} 182 183\func{wxColour}{GetTextColour}{\void} 184 185Returns the colour used to draw label text. By default, this is 186black. 187 188\membersection{wxTabView::GetTopMargin} 189 190\func{int}{GetTopMargin}{\void} 191 192Returns the height between the top of the view area and the bottom of the first 193row of tabs. 194 195\membersection{wxTabView::GetShadowPen} 196 197\func{wxPen *}{GetShadowPen}{\void} 198 199Returns the pen used to draw 3D effect shadows. This is set when 200SetShadowColour is called. 201 202\membersection{wxTabView::GetViewRect} 203 204\func{wxRectangle}{GetViewRect}{\void} 205 206Returns the rectangle specifying the view area (above which tabs are 207placed). 208 209\membersection{wxTabView::GetVerticalTabTextSpacing} 210 211\func{int}{GetVerticalTabTextSpacing}{\void} 212 213Returns the vertical spacing between the top of an unselected tab, and the tab label. 214 215\membersection{wxTabView::GetWindow} 216 217\func{wwxWindow *}{GetWindow}{\void} 218 219Returns the window for the view. 220 221\membersection{wxTabView::OnCreateTabControl} 222 223\func{wxTabControl *}{OnCreateTabControl}{\void} 224 225Creates a new tab control. By default, this returns a wxTabControl object, but the application may wish 226to define a derived class, in which case the tab view should be subclassed and this function overridden. 227 228\membersection{wxTabView::LayoutTabs} 229 230\func{void}{LayoutTabs}{\void} 231 232Recalculates the positions of the tabs, and adjusts the layer of the selected tab if necessary. 233 234You may want to call this function if the view width has changed (for example, from an OnSize handler). 235 236\membersection{wxTabView::OnEvent} 237 238\func{bool}{OnEvent}{\param{wxMouseEvent\& }{event}} 239 240Processes mouse events sent from the panel or dialog. Returns true if the event was processed, 241false otherwise. 242 243\membersection{wxTabView::OnTabActivate} 244 245\func{void}{OnTabActivate}{\param{int}{ activateId}, \param{int}{ deactivateId}} 246 247Called when a tab is activated, with the new active tab id, and the former active tab id. 248 249\membersection{wxTabView::OnTabPreActivate} 250 251\func{bool}{OnTabPreActivate}{\param{int}{ activateId}, \param{int}{ deactivateId}} 252 253Called just before a tab is activated, with the new active tab id, and the former active tab id. 254 255If the function returns false, the tab is not activated. 256 257\membersection{wxTabView::SetBackgroundColour} 258 259\func{void}{SetBackgroundColour}{\param{const wxColour\&}{ col}} 260 261Sets the colour to be used for each tab background. By default, this is 262light grey. To ensure a match with the dialog or panel background, omit 263the wxTAB\_STYLE\_COLOUR\_INTERIOR flag from the wxTabView constructor. 264 265\membersection{wxTabView::SetHighlightColour} 266 267\func{void}{SetHighlightColour}{\param{const wxColour\&}{ col}} 268 269Sets the colour to be used for bright highlights on the left side of `3D' surfaces. By default, this is white. 270 271\membersection{wxTabView::SetHorizontalTabOffset} 272 273\func{void}{SetHorizontalTabOffset}{\param{int}{ offset}} 274 275Sets the horizontal spacing by which each tab layer is offset from the one below. 276 277\membersection{wxTabView::SetSelectedTabFont} 278 279\func{void}{SetSelectedTabFont}{\param{wxFont *}{font}} 280 281Sets the font to be used for the selected tab label. 282 283\membersection{wxTabView::SetShadowColour} 284 285\func{void}{SetShadowColour}{\param{const wxColour\&}{ col}} 286 287Sets the colour to be used for shadows on the right-hand side of `3D' surfaces. By default, this is dark grey. 288 289\membersection{wxTabView::SetTabFont} 290 291\func{void}{SetTabFont}{\param{wxFont *}{font}} 292 293Sets the tab label font. 294 295\membersection{wxTabView::SetTabStyle} 296 297\func{void}{SetTabStyle}{\param{long}{ tabStyle}} 298 299Sets the tab style. See constructor documentation for details of valid styles. 300 301\membersection{wxTabView::SetTabSize} 302 303\func{void}{SetTabSize}{\param{int}{ width}, \param{int}{ height}} 304 305Sets the tab default width and height. 306 307\membersection{wxTabView::SetTabSelectionHeight} 308 309\func{void}{SetTabSelectionHeight}{\param{int}{ height}} 310 311Sets the height to be used for the currently selected tab; normally a few pixels 312higher than the other tabs. 313 314\membersection{wxTabView::SetTabSelection} 315 316\func{void}{SetTabSelection}{\param{int}{ sel}, \param{bool}{ activateTool=true}} 317 318Sets the selected tab, calling the application's OnTabActivate function. 319 320If {\it activateTool} is false, OnTabActivate will not be called. 321 322\membersection{wxTabView::SetTextColour} 323 324\func{void}{SetTextColour}{\param{const wxColour\&}{ col}} 325 326Sets the colour to be used to draw label text. By default, this is 327black. 328 329\membersection{wxTabView::SetTopMargin} 330 331\func{void}{SetTopMargin}{\param{int}{ margin}} 332 333Sets the height between the top of the view area and the bottom of the first 334row of tabs. 335 336\membersection{wxTabView::SetVerticalTabTextSpacing} 337 338\func{void}{SetVerticalTabTextSpacing}{\param{int}{ spacing}} 339 340Sets the vertical spacing between the top of an unselected tab, and the tab label. 341 342\membersection{wxTabView::SetViewRect}\label{wxtabviewsetviewrect} 343 344\func{void}{SetViewRect}{\param{const wxRectangle\& }{rect}} 345 346Sets the rectangle specifying the view area (above which tabs are 347placed). This must be set by the application. 348 349\membersection{wxTabView::SetWindow} 350 351\func{void}{SetWindow}{\param{wxWindow *}{window}} 352 353Set the window that the tab view will use for drawing onto. 354 355 356