Contents Up Previous Next

wxTabView

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

wxObject

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::wxTabView

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.


wxTabView::AddTab

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.


wxTabView::CalculateTabWidth

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.


wxTabView::ClearTabs

void ClearTabs(bool deleteTabs=TRUE)

Clears the tabs, deleting them if deleteTabs is TRUE.


wxTabView::Draw

void Draw(wxDC& dc)

Draws the tabs and (optionally) a box around the view area.


wxTabView::FindTabControlForId

wxTabControl * FindTabControlForId(int id)

Finds the wxTabControl corresponding to id.


wxTabView::FindTabControlForPosition

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.


wxTabView::GetBackgroundBrush

wxBrush * GetBackgroundBrush()

Returns the brush used to draw in the background colour. It is set when SetBackgroundColour is called.


wxTabView::GetBackgroundColour

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.


wxTabView::GetBackgroundPen

wxPen * GetBackgroundPen()

Returns the pen used to draw in the background colour. It is set when SetBackgroundColour is called.


wxTabView::GetHighlightColour

wxColour GetHighlightColour()

Returns the colour used for bright highlights on the left side of '3D' surfaces. By default, this is white.


wxTabView::GetHighlightPen

wxPen * GetHighlightPen()

Returns the pen used to draw 3D effect highlights. This is set when SetHighlightColour is called.


wxTabView::GetHorizontalTabOffset

int GetHorizontalTabOffset()

Returns the horizontal spacing by which each tab layer is offset from the one below.


wxTabView::GetNumberOfLayers

int GetNumberOfLayers()

Returns the number of layers (rows of tabs).


wxTabView::GetSelectedTabFont

wxFont * GetSelectedTabFont()

Returns the font to be used for the selected tab label.


wxTabView::GetShadowColour

wxColour GetShadowColour()

Returns the colour used for shadows on the right-hand side of '3D' surfaces. By default, this is dark grey.


wxTabView::GetTabHeight

int GetTabHeight()

Returns the tab default height.


wxTabView::GetTabFont

wxFont * GetTabFont()

Returns the tab label font.


wxTabView::GetTabSelectionHeight

int GetTabSelectionHeight()

Returns the height to be used for the currently selected tab; normally a few pixels higher than the other tabs.


wxTabView::GetTabStyle

long GetTabStyle()

Returns the tab style. See constructor documentation for details of valid styles.


wxTabView::GetTabWidth

int GetTabWidth()

Returns the tab default width.


wxTabView::GetTextColour

wxColour GetTextColour()

Returns the colour used to draw label text. By default, this is black.


wxTabView::GetTopMargin

int GetTopMargin()

Returns the height between the top of the view area and the bottom of the first row of tabs.


wxTabView::GetShadowPen

wxPen * GetShadowPen()

Returns the pen used to draw 3D effect shadows. This is set when SetShadowColour is called.


wxTabView::GetViewRect

wxRectangle GetViewRect()

Returns the rectangle specifying the view area (above which tabs are placed).


wxTabView::GetVerticalTabTextSpacing

int GetVerticalTabTextSpacing()

Returns the vertical spacing between the top of an unselected tab, and the tab label.


wxTabView::GetWindow

wwxWindow * GetWindow()

Returns the window for the view.


wxTabView::OnCreateTabControl

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.


wxTabView::LayoutTabs

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).


wxTabView::OnEvent

bool OnEvent(wxMouseEvent& event)

Processes mouse events sent from the panel or dialog. Returns TRUE if the event was processed, FALSE otherwise.


wxTabView::OnTabActivate

void OnTabActivate(int activateId, int deactivateId)

Called when a tab is activated, with the new active tab id, and the former active tab id.


wxTabView::OnTabPreActivate

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.


wxTabView::SetBackgroundColour

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.


wxTabView::SetHighlightColour

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.


wxTabView::SetHorizontalTabOffset

void SetHorizontalTabOffset(int offset)

Sets the horizontal spacing by which each tab layer is offset from the one below.


wxTabView::SetSelectedTabFont

void SetSelectedTabFont(wxFont *font)

Sets the font to be used for the selected tab label.


wxTabView::SetShadowColour

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.


wxTabView::SetTabFont

void SetTabFont(wxFont *font)

Sets the tab label font.


wxTabView::SetTabStyle

void SetTabStyle(long tabStyle)

Sets the tab style. See constructor documentation for details of valid styles.


wxTabView::SetTabSize

void SetTabSize(int width, int height)

Sets the tab default width and height.


wxTabView::SetTabSelectionHeight

void SetTabSelectionHeight(int height)

Sets the height to be used for the currently selected tab; normally a few pixels higher than the other tabs.


wxTabView::SetTabSelection

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.


wxTabView::SetTextColour

void SetTextColour(const wxColour& col)

Sets the colour to be used to draw label text. By default, this is black.


wxTabView::SetTopMargin

void SetTopMargin(int margin)

Sets the height between the top of the view area and the bottom of the first row of tabs.


wxTabView::SetVerticalTabTextSpacing

void SetVerticalTabTextSpacing(int spacing)

Sets the vertical spacing between the top of an unselected tab, and the tab label.


wxTabView::SetViewRect

void SetViewRect(const wxRectangle& rect)

Sets the rectangle specifying the view area (above which tabs are placed). This must be set by the application.


wxTabView::SetWindow

void SetWindow(wxWindow *window)

Set the window that the tab view will use for drawing onto.