Version: 3.3.1
Loading...
Searching...
No Matches

#include <wx/aui/auibook.h>

Inheritance diagram for wxAuiTabArt:

Detailed Description

Tab art provider defines all the drawing functions used by wxAuiNotebook.

This allows the wxAuiNotebook to have a pluggable look-and-feel.

By default, a wxAuiNotebook uses an instance of class wxAuiDefaultTabArt, derived from this class, which provides bitmaps and a colour scheme that is adapted to the major platforms' look. You can either derive from that class to alter its behaviour or write a completely new tab art class.

Another example of creating a new wxAuiNotebook tab bar is wxAuiSimpleTabArt.

Call wxAuiNotebook::SetArtProvider() to make use of this new tab art.

Library:  wxAui
Category:  Window Docking (wxAUI)

Public Member Functions

 wxAuiTabArt ()
 Constructor.
virtual wxAuiTabArtClone ()=0
 Clones the art object.
virtual void DrawBackground (wxDC &dc, wxWindow *wnd, const wxRect &rect)=0
 Draws a background on the given area.
virtual void DrawButton (wxDC &dc, wxWindow *wnd, const wxRect &in_rect, int bitmap_id, int button_state, int orientation, wxRect *out_rect)=0
 Draws a button.
virtual void DrawTab (wxDC &dc, wxWindow *wnd, const wxAuiNotebookPage &page, const wxRect &rect, int close_button_state, wxRect *out_tab_rect, wxRect *out_button_rect, int *x_extent)
 Draws a tab.
virtual int DrawPageTab (wxDC &dc, wxWindow *wnd, wxAuiNotebookPage &page, const wxRect &rect)
 Draws a tab for the specified notebook page.
virtual int GetBestTabCtrlSize (wxWindow *, const wxAuiNotebookPageArray &, const wxSize &)=0
 Returns the tab control size.
virtual int GetIndentSize ()=0
 Returns the indent size.
virtual wxFont GetNormalFont () const
 Returns the font to use for normal, non-selected, tabs.
virtual wxFont GetSelectedFont () const
 Returns the font to use for the selected tab.
virtual wxSize GetTabSize (wxReadOnlyDC &dc, wxWindow *wnd, const wxString &caption, const wxBitmapBundle &bitmap, bool active, int close_button_state, int *x_extent)
 Returns the tab size for the given caption, bitmap and state.
virtual wxSize GetPageTabSize (wxReadOnlyDC &dc, wxWindow *wnd, const wxAuiNotebookPage &page, int *xExtent=nullptr)
 Returns the size of the tab for the specified notebook page.
virtual int GetButtonRect (wxReadOnlyDC &dc, wxWindow *wnd, const wxRect &inRect, int bitmapId, int buttonState, int orientation, wxRect *outRect=nullptr)
 Returns the rectangle for the given button.
virtual void SetFlags (unsigned int flags)=0
 Sets flags.
virtual void SetMeasuringFont (const wxFont &font)=0
 Sets the font used for calculating measurements.
virtual void SetNormalFont (const wxFont &font)=0
 Sets the normal font for drawing labels.
virtual void SetSelectedFont (const wxFont &font)=0
 Sets the font for drawing text for selected UI elements.
virtual void SetColour (const wxColour &colour)=0
 Sets the colour of the inactive tabs.
virtual void SetActiveColour (const wxColour &colour)=0
 Sets the colour of the selected tab.
virtual void SetSizingInfo (const wxSize &tab_ctrl_size, size_t tab_count, wxWindow *wnd=nullptr)=0
 Sets sizing information.

Constructor & Destructor Documentation

◆ wxAuiTabArt()

wxAuiTabArt::wxAuiTabArt ( )

Constructor.

Member Function Documentation

◆ Clone()

virtual wxAuiTabArt * wxAuiTabArt::Clone ( )
pure virtual

Clones the art object.

Implemented in wxAuiGenericTabArt, and wxAuiSimpleTabArt.

◆ DrawBackground()

virtual void wxAuiTabArt::DrawBackground ( wxDC & dc,
wxWindow * wnd,
const wxRect & rect )
pure virtual

Draws a background on the given area.

Implemented in wxAuiGenericTabArt, and wxAuiSimpleTabArt.

◆ DrawButton()

virtual void wxAuiTabArt::DrawButton ( wxDC & dc,
wxWindow * wnd,
const wxRect & in_rect,
int bitmap_id,
int button_state,
int orientation,
wxRect * out_rect )
pure virtual

Draws a button.

Implemented in wxAuiGenericTabArt, and wxAuiSimpleTabArt.

◆ DrawPageTab()

virtual int wxAuiTabArt::DrawPageTab ( wxDC & dc,
wxWindow * wnd,
wxAuiNotebookPage & page,
const wxRect & rect )
virtual

Draws a tab for the specified notebook page.

This function must be overridden if DrawTab() is not overridden and, also, if pinned tabs are used, as they are not supported by DrawTab().

The pane contains the information about the page to draw, in particular its wxAuiNotebookPage::buttons specifies the buttons to draw if it is not empty and receives the rectangles where they were drawn on output in the wxAuiTabContainerButton::rect fields.

Note that if a button state is wxAUI_BUTTON_STATE_HIDDEN, the effect is the same as not including this button at all, i.e. it is not drawn and the output field is not modified in this case.

The wxAuiNotebookPage::rect field is also updated by this function to contain the bounding rectangle of the tab.

Returns
The total horizontal span of the tab, which may be greater than the page bounding rectangle.
Since
3.3.0

◆ DrawTab()

virtual void wxAuiTabArt::DrawTab ( wxDC & dc,
wxWindow * wnd,
const wxAuiNotebookPage & page,
const wxRect & rect,
int close_button_state,
wxRect * out_tab_rect,
wxRect * out_button_rect,
int * x_extent )
virtual

Draws a tab.

This function used to be pure virtual and so had to be overridden in the derived classes in the previous versions of wxWidgets, however since version 3.3.0 it doesn't have to be overridden if DrawPageTab() is overridden and, moreover, it is recommended to override DrawPageTab() instead of this function in the new code.

Reimplemented in wxAuiGenericTabArt, and wxAuiSimpleTabArt.

◆ GetBestTabCtrlSize()

virtual int wxAuiTabArt::GetBestTabCtrlSize ( wxWindow * ,
const wxAuiNotebookPageArray & ,
const wxSize &  )
pure virtual

Returns the tab control size.

Implemented in wxAuiGenericTabArt, and wxAuiSimpleTabArt.

◆ GetButtonRect()

virtual int wxAuiTabArt::GetButtonRect ( wxReadOnlyDC & dc,
wxWindow * wnd,
const wxRect & inRect,
int bitmapId,
int buttonState,
int orientation,
wxRect * outRect = nullptr )
virtual

Returns the rectangle for the given button.

This function is not pure virtual because it is only for multi-line tabs, but it must be implemented if wxAUI_NB_MULTILINE is used.

If specified, the returned rectangle must be filled with the same value as DrawButton() puts into its outRect but here it can also be null in which case just its width is returned.

Since
3.3.0

◆ GetIndentSize()

virtual int wxAuiTabArt::GetIndentSize ( )
pure virtual

Returns the indent size.

Implemented in wxAuiGenericTabArt, and wxAuiSimpleTabArt.

◆ GetNormalFont()

virtual wxFont wxAuiTabArt::GetNormalFont ( ) const
virtual

Returns the font to use for normal, non-selected, tabs.

By default, returns an invalid font, meaning that the font set for wxAuiNotebook itself should be used.

This function should be overridden for SetNormalFont() to actually work.

Since
3.3.0

◆ GetPageTabSize()

virtual wxSize wxAuiTabArt::GetPageTabSize ( wxReadOnlyDC & dc,
wxWindow * wnd,
const wxAuiNotebookPage & page,
int * xExtent = nullptr )
virtual

Returns the size of the tab for the specified notebook page.

This function must be overridden if GetTabSize() is not overridden and, also, if pinned tabs are used, as they are not supported by GetTabSize().

Since
3.3.0

◆ GetSelectedFont()

virtual wxFont wxAuiTabArt::GetSelectedFont ( ) const
virtual

Returns the font to use for the selected tab.

By default, returns an invalid font, meaning that the font set for wxAuiNotebook itself should be used.

This function should be overridden for SetSelectedFont() to actually work.

Since
3.3.0

◆ GetTabSize()

virtual wxSize wxAuiTabArt::GetTabSize ( wxReadOnlyDC & dc,
wxWindow * wnd,
const wxString & caption,
const wxBitmapBundle & bitmap,
bool active,
int close_button_state,
int * x_extent )
virtual

Returns the tab size for the given caption, bitmap and state.

This function used to be pure virtual and so had to be overridden in the derived classes in the previous versions of wxWidgets, however since version 3.3.0 it doesn't have to be overridden if GetPageTabSize() is overridden and it is recommended to override GetPageTabSize() instead of this function in the new code.

Reimplemented in wxAuiGenericTabArt.

◆ SetActiveColour()

virtual void wxAuiTabArt::SetActiveColour ( const wxColour & colour)
pure virtual

Sets the colour of the selected tab.

Since
2.9.2

Implemented in wxAuiGenericTabArt, and wxAuiSimpleTabArt.

◆ SetColour()

virtual void wxAuiTabArt::SetColour ( const wxColour & colour)
pure virtual

Sets the colour of the inactive tabs.

Since
2.9.2

Implemented in wxAuiGenericTabArt, and wxAuiSimpleTabArt.

◆ SetFlags()

virtual void wxAuiTabArt::SetFlags ( unsigned int flags)
pure virtual

Sets flags.

Implemented in wxAuiGenericTabArt, and wxAuiSimpleTabArt.

◆ SetMeasuringFont()

virtual void wxAuiTabArt::SetMeasuringFont ( const wxFont & font)
pure virtual

Sets the font used for calculating measurements.

Implemented in wxAuiGenericTabArt, and wxAuiSimpleTabArt.

◆ SetNormalFont()

virtual void wxAuiTabArt::SetNormalFont ( const wxFont & font)
pure virtual

Sets the normal font for drawing labels.

See also
GetNormalFont()

Implemented in wxAuiGenericTabArt, and wxAuiSimpleTabArt.

◆ SetSelectedFont()

virtual void wxAuiTabArt::SetSelectedFont ( const wxFont & font)
pure virtual

Sets the font for drawing text for selected UI elements.

See also
GetSelectedFont()

Implemented in wxAuiGenericTabArt, and wxAuiSimpleTabArt.

◆ SetSizingInfo()

virtual void wxAuiTabArt::SetSizingInfo ( const wxSize & tab_ctrl_size,
size_t tab_count,
wxWindow * wnd = nullptr )
pure virtual

Sets sizing information.

The wnd argument is only present in wxWidgets 3.1.6 and newer and is required, it only has nullptr default value for compatibility reasons.

Implemented in wxAuiGenericTabArt, and wxAuiSimpleTabArt.