Table Of Contents

Previous topic

AuiNotebookPage

Next topic

AuiTabContainerButton

This Page

Phoenix Logo

phoenix_title AuiTabContainer

AuiTabContainer is a class which contains information about each tab. It also can render an entire tab control to a specified DC. It’s not a window class itself, because this code will be used by the AuiNotebook, where it is disadvantageous to have separate windows for each tab control in the case of “docked tabs”.

A derived class, AuiTabCtrl, is an actual Window - derived window which can be used as a tab control in the normal sense.


class_hierarchy Class Hierarchy

Inheritance diagram for class AuiTabContainer:


method_summary Methods Summary

__init__ Default class constructor.
AddButton Adds a button in the tab area.
AddPage Adds a page to the tab control.
ButtonHitTest Tests if a button was hit.
CloneButtons Clones the tab area buttons when the AuiNotebook is being split.
DoShowHide This function shows the active window, then hides all of the other windows
EnableTab Enables/disables a tab in the AuiTabContainer.
GetActivePage Returns the current selected tab or NOT_FOUND if none is selected.
GetAGWFlags Returns the tab art flags.
GetArtProvider Returns the current art provider being used.
GetEnabled Returns whether a tab is enabled or not.
GetIdxFromWindow Returns the tab index based on the window wnd associated with it.
GetPage Returns the page specified by the given index.
GetPageCount Returns the number of pages in the AuiTabContainer.
GetPages Returns a list of all the pages in this AuiTabContainer.
GetTabOffset Returns the tab offset.
GetWindowFromIdx Returns the window associated with the tab with index idx.
InsertPage Inserts a page in the tab control in the position specified by idx.
IsTabVisible Returns whether a tab is visible or not.
MakeTabVisible Make the tab visible if it wasn’t already.
MovePage Moves a page in a new position specified by new_idx.
RemoveButton Removes a button from the tab area.
RemovePage Removes a page from the tab control.
Render Renders the tab catalog to the specified DC.
SetActivePage Sets the AuiNotebook active page.
SetAGWFlags Sets the tab art flags.
SetArtProvider Instructs AuiTabContainer to use art provider specified by parameter art
SetMeasuringFont Sets the font for calculating text measurements.
SetNoneActive Sets all the tabs as inactive (non-selected).
SetNormalFont Sets the normal font for drawing tab labels.
SetSelectedFont Sets the selected tab font for drawing tab labels.
SetTabOffset Sets the tab offset.
SetTabRect Sets the tab area rectangle.
TabHitTest TabHitTest() tests if a tab was hit, passing the window pointer

api Class API



class AuiTabContainer(object)

AuiTabContainer is a class which contains information about each tab. It also can render an entire tab control to a specified DC. It’s not a window class itself, because this code will be used by the AuiNotebook, where it is disadvantageous to have separate windows for each tab control in the case of “docked tabs”.

A derived class, AuiTabCtrl, is an actual Window - derived window which can be used as a tab control in the normal sense.


Methods



__init__(self, auiNotebook)

Default class constructor. Used internally, do not call it in your code!

Parameters:auiNotebook – the parent AuiNotebook window.


AddButton(self, id, location, normal_bitmap=NullBitmap, disabled_bitmap=NullBitmap, help_string='')

Adds a button in the tab area.

Parameters:
  • id (integer) – the button identifier. This can be one of the following:

    Button Identifier Description
    AUI_BUTTON_CLOSE Shows a close button on the tab area
    AUI_BUTTON_WINDOWLIST Shows a window list button on the tab area
    AUI_BUTTON_LEFT Shows a left button on the tab area
    AUI_BUTTON_RIGHT Shows a right button on the tab area
  • location (integer) – the button location. Can be LEFT or RIGHT ;
  • normal_bitmap (Bitmap) – the bitmap for an enabled tab;
  • disabled_bitmap (Bitmap) – the bitmap for a disabled tab;
  • help_string (string) – the string to display when the mouse hover over a button.


AddPage(self, page, info)

Adds a page to the tab control.

Parameters:


ButtonHitTest(self, x, y)

Tests if a button was hit.

Parameters:
  • x (integer) – the mouse x position;
  • y (integer) – the mouse y position.
Returns:

and instance of AuiTabContainerButton if a button was hit, None otherwise.



CloneButtons(self)

Clones the tab area buttons when the AuiNotebook is being split.

See also

AddButton

Note

Standard buttons for AuiNotebook are not cloned, only custom ones.



DoShowHide(self)

This function shows the active window, then hides all of the other windows (in that order).



EnableTab(self, idx, enable=True)

Enables/disables a tab in the AuiTabContainer.

Parameters:
  • idx (integer) – the tab index;
  • enable (bool) – True to enable a tab, False to disable it.


GetActivePage(self)

Returns the current selected tab or NOT_FOUND if none is selected.



GetAGWFlags(self)

Returns the tab art flags.

See also

SetAGWFlags for a list of possible return values.



GetArtProvider(self)

Returns the current art provider being used.



GetEnabled(self, idx)

Returns whether a tab is enabled or not.

Parameters:idx (integer) – the tab index.


GetIdxFromWindow(self, wnd)

Returns the tab index based on the window wnd associated with it.

Parameters:wnd – an instance of Window.


GetPage(self, idx)

Returns the page specified by the given index.

Parameters:idx (integer) – the tab index.


GetPageCount(self)

Returns the number of pages in the AuiTabContainer.



GetPages(self)

Returns a list of all the pages in this AuiTabContainer.



GetTabOffset(self)

Returns the tab offset.



GetWindowFromIdx(self, idx)

Returns the window associated with the tab with index idx.

Parameters:idx (integer) – the tab index.


InsertPage(self, page, info, idx)

Inserts a page in the tab control in the position specified by idx.

Parameters:
  • page (Window) – the window associated with this tab;
  • info – an instance of AuiNotebookPage;
  • idx (integer) – the page insertion index.


IsTabVisible(self, tabPage, tabOffset, dc, wnd)

Returns whether a tab is visible or not.

Parameters:
  • tabPage (integer) – the tab index;
  • tabOffset (integer) – the tab offset;
  • dc – a DC device context;
  • wnd – an instance of Window derived window.


MakeTabVisible(self, tabPage, win)

Make the tab visible if it wasn’t already.

Parameters:
  • tabPage (integer) – the tab index;
  • win – an instance of Window derived window.


MovePage(self, page, new_idx)

Moves a page in a new position specified by new_idx.

Parameters:
  • page (Window) – the window associated with this tab;
  • new_idx (integer) – the new page position.


RemoveButton(self, id)

Removes a button from the tab area.

Parameters:id (integer) – the button identifier. See AddButton for a list of button identifiers.

See also

AddButton



RemovePage(self, wnd)

Removes a page from the tab control.

Parameters:wnd – an instance of Window, a window associated with this tab.


Render(self, raw_dc, wnd)

Renders the tab catalog to the specified DC.

It is a virtual function and can be overridden to provide custom drawing capabilities.

Parameters:
  • raw_dc – a DC device context;
  • wnd – an instance of Window.


SetActivePage(self, wndOrInt)

Sets the AuiNotebook active page.

Parameters:wndOrInt – an instance of Window or an integer specifying a tab index.


SetAGWFlags(self, agwFlags)

Sets the tab art flags.

Parameters:agwFlags (integer) – a combination of the following values:

Flag name Description
AUI_NB_TOP With this style, tabs are drawn along the top of the notebook
AUI_NB_LEFT With this style, tabs are drawn along the left of the notebook. Not implemented yet
AUI_NB_RIGHT With this style, tabs are drawn along the right of the notebook. Not implemented yet
AUI_NB_BOTTOM With this style, tabs are drawn along the bottom of the notebook
AUI_NB_TAB_SPLIT Allows the tab control to be split by dragging a tab
AUI_NB_TAB_MOVE Allows a tab to be moved horizontally by dragging
AUI_NB_TAB_EXTERNAL_MOVE Allows a tab to be moved to another tab control
AUI_NB_TAB_FIXED_WIDTH With this style, all tabs have the same width
AUI_NB_SCROLL_BUTTONS With this style, left and right scroll buttons are displayed
AUI_NB_WINDOWLIST_BUTTON With this style, a drop-down list of windows is available
AUI_NB_CLOSE_BUTTON With this style, a close button is available on the tab bar
AUI_NB_CLOSE_ON_ACTIVE_TAB With this style, a close button is available on the active tab
AUI_NB_CLOSE_ON_ALL_TABS With this style, a close button is available on all tabs
AUI_NB_MIDDLE_CLICK_CLOSE Allows to close AuiNotebook tabs by mouse middle button click
AUI_NB_SUB_NOTEBOOK This style is used by AuiManager to create automatic AuiNotebooks
AUI_NB_HIDE_ON_SINGLE_TAB Hides the tab window if only one tab is present
AUI_NB_SMART_TABS Use Smart Tabbing, like Alt + Tab on Windows
AUI_NB_USE_IMAGES_DROPDOWN Uses images on dropdown window list menu instead of check items
AUI_NB_CLOSE_ON_TAB_LEFT Draws the tab close button on the left instead of on the right (a la Camino browser)
AUI_NB_TAB_FLOAT Allows the floating of single tabs. Known limitation: when the notebook is more or less full screen, tabs cannot be dragged far enough outside of the notebook to become floating pages
AUI_NB_DRAW_DND_TAB Draws an image representation of a tab while dragging (on by default)
AUI_NB_ORDER_BY_ACCESS Tab navigation order by last access time for the tabs
AUI_NB_NO_TAB_FOCUS Don’t draw tab focus rectangle

Todo

Implementation of flags AUI_NB_RIGHT and AUI_NB_LEFT.



SetArtProvider(self, art)

Instructs AuiTabContainer to use art provider specified by parameter art for all drawing calls. This allows plugable look-and-feel features.

Parameters:art – an art provider.

Note

The previous art provider object, if any, will be deleted by AuiTabContainer.



SetMeasuringFont(self, font)

Sets the font for calculating text measurements.

Parameters:font (Font) – the new font to use to measure tab label text extents.


SetNoneActive(self)

Sets all the tabs as inactive (non-selected).



SetNormalFont(self, font)

Sets the normal font for drawing tab labels.

Parameters:font (Font) – the new font to use to draw tab labels in their normal, un-selected state.


SetSelectedFont(self, font)

Sets the selected tab font for drawing tab labels.

Parameters:font (Font) – the new font to use to draw tab labels in their selected state.


SetTabOffset(self, offset)

Sets the tab offset.

Parameters:offset (integer) – the tab offset.


SetTabRect(self, rect)

Sets the tab area rectangle.

Parameters:rect (Rect) – the available area for AuiTabContainer.


TabHitTest(self, x, y)

TabHitTest() tests if a tab was hit, passing the window pointer back if that condition was fulfilled.

Parameters:
  • x (integer) – the mouse x position;
  • y (integer) – the mouse y position.