Responsible for drawing tabs onto a window, and dealing with input.
Please note that the preferred class for programming tabbed windows is wxNotebook. This class is retained for backward compatibility.
Derived from
Include files
<wx/tab.h>
See also
wxTabView overview, wxPanelTabView
Members
wxTabView::wxTabView
wxTabView::AddTab
wxTabView::CalculateTabWidth
wxTabView::ClearTabs
wxTabView::Draw
wxTabView::FindTabControlForId
wxTabView::FindTabControlForPosition
wxTabView::GetBackgroundBrush
wxTabView::GetBackgroundColour
wxTabView::GetBackgroundPen
wxTabView::GetHighlightColour
wxTabView::GetHighlightPen
wxTabView::GetHorizontalTabOffset
wxTabView::GetNumberOfLayers
wxTabView::GetSelectedTabFont
wxTabView::GetShadowColour
wxTabView::GetTabHeight
wxTabView::GetTabFont
wxTabView::GetTabSelectionHeight
wxTabView::GetTabStyle
wxTabView::GetTabWidth
wxTabView::GetTextColour
wxTabView::GetTopMargin
wxTabView::GetShadowPen
wxTabView::GetViewRect
wxTabView::GetVerticalTabTextSpacing
wxTabView::GetWindow
wxTabView::OnCreateTabControl
wxTabView::LayoutTabs
wxTabView::OnEvent
wxTabView::OnTabActivate
wxTabView::OnTabPreActivate
wxTabView::SetBackgroundColour
wxTabView::SetHighlightColour
wxTabView::SetHorizontalTabOffset
wxTabView::SetSelectedTabFont
wxTabView::SetShadowColour
wxTabView::SetTabFont
wxTabView::SetTabStyle
wxTabView::SetTabSize
wxTabView::SetTabSelectionHeight
wxTabView::SetTabSelection
wxTabView::SetTextColour
wxTabView::SetTopMargin
wxTabView::SetVerticalTabTextSpacing
wxTabView::SetViewRect
wxTabView::SetWindow
wxTabView(long style = wxTAB_STYLE_DRAW_BOX | wxTAB_STYLE_COLOUR_INTERIOR)
Constructor.
style may be a bit list of the following:
wxTAB_STYLE_DRAW_BOX | Draw a box around the view area. Most commonly used for dialogs. |
wxTAB_STYLE_COLOUR_INTERIOR | Draw tab backgrounds in the specified colour. Omitting this style will ensure that the tab background matches the dialog background. |
wxTabControl * AddTab(int id, const wxString& label, wxTabControl *existingTab=NULL)
Adds a tab to the view.
id is the application-chosen identifier for the tab, which will be used in subsequent tab operations.
label is the label to give the tab.
existingTab maybe NULL to specify a new tab, or non-NULL to indicate that an existing tab should be used.
A new layer (row) is started when the current layer has been filled up with tabs.
int CalculateTabWidth(int noTabs, bool adjustView = FALSE)
The application can specify the tab width using this function, in terms of the number of tabs per layer (row) which will fit the view area, which should have been set previously with SetViewRect.
noTabs is the number of tabs which should take up the full width of the view area.
adjustView can be set to TRUE in order to readjust the view width to exactly fit the given number of tabs.
The new tab width is returned.
void ClearTabs(bool deleteTabs=TRUE)
Clears the tabs, deleting them if deleteTabs is TRUE.
void Draw(wxDC& dc)
Draws the tabs and (optionally) a box around the view area.
wxTabControl * FindTabControlForId(int id)
Finds the wxTabControl corresponding to id.
wxTabControl * FindTabControlForPosition(int layer, int position)
Finds the wxTabControl at layer layer, position in layer position, both starting from zero. Note that tabs change layer as they are selected or deselected.
wxBrush * GetBackgroundBrush()
Returns the brush used to draw in the background colour. It is set when SetBackgroundColour is called.
wxColour GetBackgroundColour()
Returns the colour used for each tab background. By default, this is light grey. To ensure a match with the dialog or panel background, omit the wxTAB_STYLE_COLOUR_INTERIOR flag from the wxTabView constructor.
wxPen * GetBackgroundPen()
Returns the pen used to draw in the background colour. It is set when SetBackgroundColour is called.
wxColour GetHighlightColour()
Returns the colour used for bright highlights on the left side of '3D' surfaces. By default, this is white.
wxPen * GetHighlightPen()
Returns the pen used to draw 3D effect highlights. This is set when SetHighlightColour is called.
int GetHorizontalTabOffset()
Returns the horizontal spacing by which each tab layer is offset from the one below.
int GetNumberOfLayers()
Returns the number of layers (rows of tabs).
wxFont * GetSelectedTabFont()
Returns the font to be used for the selected tab label.
wxColour GetShadowColour()
Returns the colour used for shadows on the right-hand side of '3D' surfaces. By default, this is dark grey.
int GetTabHeight()
Returns the tab default height.
wxFont * GetTabFont()
Returns the tab label font.
int GetTabSelectionHeight()
Returns the height to be used for the currently selected tab; normally a few pixels higher than the other tabs.
long GetTabStyle()
Returns the tab style. See constructor documentation for details of valid styles.
int GetTabWidth()
Returns the tab default width.
wxColour GetTextColour()
Returns the colour used to draw label text. By default, this is black.
int GetTopMargin()
Returns the height between the top of the view area and the bottom of the first row of tabs.
wxPen * GetShadowPen()
Returns the pen used to draw 3D effect shadows. This is set when SetShadowColour is called.
wxRectangle GetViewRect()
Returns the rectangle specifying the view area (above which tabs are placed).
int GetVerticalTabTextSpacing()
Returns the vertical spacing between the top of an unselected tab, and the tab label.
wwxWindow * GetWindow()
Returns the window for the view.
wxTabControl * OnCreateTabControl()
Creates a new tab control. By default, this returns a wxTabControl object, but the application may wish to define a derived class, in which case the tab view should be subclassed and this function overridden.
void LayoutTabs()
Recalculates the positions of the tabs, and adjusts the layer of the selected tab if necessary.
You may want to call this function if the view width has changed (for example, from an OnSize handler).
bool OnEvent(wxMouseEvent& event)
Processes mouse events sent from the panel or dialog. Returns TRUE if the event was processed, FALSE otherwise.
void OnTabActivate(int activateId, int deactivateId)
Called when a tab is activated, with the new active tab id, and the former active tab id.
bool OnTabPreActivate(int activateId, int deactivateId)
Called just before a tab is activated, with the new active tab id, and the former active tab id.
If the function returns FALSE, the tab is not activated.
void SetBackgroundColour(const wxColour& col)
Sets the colour to be used for each tab background. By default, this is light grey. To ensure a match with the dialog or panel background, omit the wxTAB_STYLE_COLOUR_INTERIOR flag from the wxTabView constructor.
void SetHighlightColour(const wxColour& col)
Sets the colour to be used for bright highlights on the left side of '3D' surfaces. By default, this is white.
void SetHorizontalTabOffset(int offset)
Sets the horizontal spacing by which each tab layer is offset from the one below.
void SetSelectedTabFont(wxFont *font)
Sets the font to be used for the selected tab label.
void SetShadowColour(const wxColour& col)
Sets the colour to be used for shadows on the right-hand side of '3D' surfaces. By default, this is dark grey.
void SetTabFont(wxFont *font)
Sets the tab label font.
void SetTabStyle(long tabStyle)
Sets the tab style. See constructor documentation for details of valid styles.
void SetTabSize(int width, int height)
Sets the tab default width and height.
void SetTabSelectionHeight(int height)
Sets the height to be used for the currently selected tab; normally a few pixels higher than the other tabs.
void SetTabSelection(int sel, bool activateTool=TRUE)
Sets the selected tab, calling the application's OnTabActivate function.
If activateTool is FALSE, OnTabActivate will not be called.
void SetTextColour(const wxColour& col)
Sets the colour to be used to draw label text. By default, this is black.
void SetTopMargin(int margin)
Sets the height between the top of the view area and the bottom of the first row of tabs.
void SetVerticalTabTextSpacing(int spacing)
Sets the vertical spacing between the top of an unselected tab, and the tab label.
void SetViewRect(const wxRectangle& rect)
Sets the rectangle specifying the view area (above which tabs are placed). This must be set by the application.
void SetWindow(wxWindow *window)
Set the window that the tab view will use for drawing onto.