AGW Logo

agw_title PageContainer

This class acts as a container for the pages you add to FlatNotebook.

hierarchy Inheritance Diagram

Inheritance diagram for: PageContainer

Inheritance diagram of PageContainer


method_summary Methods Summary

__init__Default class constructor.
AddPageAdds a page to the PageContainer.
AdvanceSelectionCycles through the tabs.
AssignImageListAssigns the image list for the PageContainer.
CanFitToScreenReturns wheter a tab can fit in the left space in the screen or not.
ClearAGWFlagDeletes a flag from the FlatNotebook style.
DeleteAllPagesDeletes all the pages in the PageContainer.
DeletePageDelete the specified page from PageContainer.
DoDeletePageDoes the actual page deletion.
DoSetSelectionDoes the actual selection of a page.
DrawDragHintDraws small arrow at the place that the tab will be placed.
EnableTabEnables or disables a tab.
FireEventFires the EVT_FLATNOTEBOOK_PAGE_CHANGING and EVT_FLATNOTEBOOK_PAGE_CHANGED
GetAGWWindowStyleFlagReturns the FlatNotebook window style.
GetEnabledReturns whether a tab is enabled or not.
GetImageListReturns the image list for the page control.
GetLastVisibleTabReturns the last visible tab in the tab area.
GetNumOfVisibleTabsReturns the number of visible tabs.
GetNumTabsCanScrollLeftReturns the number of tabs than can be scrolled left.
GetPageCountReturns the number of tabs in the FlatNotebook control.
GetPageImageReturns the image index associated to a page.
GetPageTextReturns the tab caption of the page.
GetPageTextColourReturns the tab text colour if it has been set previously, or None otherwise.
GetSelectionReturns the current selected page.
GetSingleLineBorderColourReturns the colour for the single line border.
HasAGWFlagReturns whether a flag is present in the FlatNotebook style.
HitTestHitTest method for PageContainer.
InsertPageInserts a new page at the specified position.
IsDefaultTabsReturns whether a tab has a default style.
IsMouseHoveringReturns whether or not the mouse is hovering over this page’s tab
IsTabVisibleReturns whether a tab is visible or not.
MoveTabPageMoves a tab inside the same FlatNotebook.
OnDropTargetHandles the drop action from a drag and drop operation.
OnEraseBackgroundHandles the wx.EVT_ERASE_BACKGROUND event for PageContainer.
OnKeyDownHandles the wx.EVT_KEY_DOWN event for PageContainer.
OnKillFocusHandles the wx.EVT_KILL_FOCUS event for PageContainer.
OnLeftDClickHandles the wx.EVT_LEFT_DCLICK event for PageContainer.
OnLeftDownHandles the wx.EVT_LEFT_DOWN event for PageContainer.
OnLeftUpHandles the wx.EVT_LEFT_UP event for PageContainer.
OnMiddleDownHandles the wx.EVT_MIDDLE_DOWN event for PageContainer.
OnMouseEnterWindowHandles the wx.EVT_ENTER_WINDOW event for PageContainer.
OnMouseLeaveHandles the wx.EVT_LEAVE_WINDOW event for PageContainer.
OnMouseMoveHandles the wx.EVT_MOTION event for PageContainer.
OnMouseWheelHandles the wx.EVT_MOUSEWHEEL event for PageContainer.
OnPaintHandles the wx.EVT_PAINT event for PageContainer.
OnRightDownHandles the wx.EVT_RIGHT_DOWN event for PageContainer.
OnSetFocusHandles the wx.EVT_SET_FOCUS event for PageContainer.
OnSizeHandles the wx.EVT_SIZE event for PageContainer.
OnTabMenuSelectionHandles the wx.EVT_MENU event for PageContainer.
PopupTabsMenuPops up the menu activated with the drop down arrow in the navigation area.
RotateLeftScrolls tabs to the left by bulk of 5 tabs.
RotateRightScrolls tabs to the right by bulk of 5 tabs.
SetAGWWindowStyleFlagSets the FlatNotebook window style.
SetFocusedPageSets/Unsets the focus on the appropriate page.
SetImageListSets the image list for the PageContainer.
SetPageImageSets the image index for the given page.
SetPageTextSets the tab caption of the page.
SetPageTextColourSets the tab text colour individually.
SetSelectionSets the selected page.
ShowTabTooltipShows a tab tooltip.
TabHasImageReturns whether a tab has an associated image index or not.
_ReShowHandles the redraw of the tabs when the FNB_HIDE_ON_SINGLE_TAB has been removed.

API Class API

class PageContainer(wx.PyPanel)[source]

This class acts as a container for the pages you add to FlatNotebook.



__init__(parent, id=wx.ID_ANY, pos=wx.DefaultPosition, size=wx.DefaultSize, style=0)[source]

Default class constructor.

Used internally, do not call it in your code!

Parameters:
  • parent – the PageContainer parent;
  • id – an identifier for the control: a value of -1 is taken to mean a default;
  • pos – the control position. A value of (-1, -1) indicates a default position, chosen by either the windowing system or wxPython, depending on platform;
  • size – the control size. A value of (-1, -1) indicates a default size, chosen by either the windowing system or wxPython, depending on platform;
  • style – the window style.


AddPage(caption, selected=False, imgindex=-1)[source]

Adds a page to the PageContainer.

Parameters:
  • page – specifies the new page;
  • text – specifies the text for the new page;
  • select – specifies whether the page should be selected;
  • imageId – specifies the optional image index for the new page.


AdvanceSelection(forward=True)[source]

Cycles through the tabs.

Parameters:forward – if True, the selection is advanced in ascending order (to the right), otherwise the selection is advanced in descending order.

Note

The call to this function generates the page changing events.



AssignImageList(imglist)[source]

Assigns the image list for the PageContainer.

Parameters:imageList – an instance of wx.ImageList.


CanFitToScreen(page)[source]

Returns wheter a tab can fit in the left space in the screen or not.

Parameters:page – an integer specifying the page index.


ClearAGWFlag(flag)[source]

Deletes a flag from the FlatNotebook style.

Parameters:flag – one of the possible FlatNotebook window styles.

See also

FlatNotebook.SetAGWWindowStyleFlag() for a list of possible window style flags.



DeleteAllPages()[source]

Deletes all the pages in the PageContainer.



DeletePage(page)[source]

Delete the specified page from PageContainer.

Parameters:page – an integer specifying the page index.


DoDeletePage(page)[source]

Does the actual page deletion.

Parameters:page – an integer specifying the page index.


DoSetSelection(page)[source]

Does the actual selection of a page.

Parameters:page – an integer specifying the page index.


DrawDragHint()[source]

Draws small arrow at the place that the tab will be placed.



EnableTab(page, enabled=True)[source]

Enables or disables a tab.

Parameters:
  • page – an integer specifying the page index;
  • enabledTrue to enable a tab, False to disable it.


FireEvent(selection)[source]

Fires the EVT_FLATNOTEBOOK_PAGE_CHANGING and EVT_FLATNOTEBOOK_PAGE_CHANGED events called from other methods (from menu selection or Smart Tabbing).

This is an utility function.

Parameters:selection – the new selection inside FlatNotebook.


GetAGWWindowStyleFlag()[source]

Returns the FlatNotebook window style.

See also

The FlatNotebook.__init__() method for the agwStyle parameter description.



GetEnabled(page)[source]

Returns whether a tab is enabled or not.

Parameters:page – an integer specifying the page index.


GetImageList()[source]

Returns the image list for the page control.



GetLastVisibleTab()[source]

Returns the last visible tab in the tab area.



GetNumOfVisibleTabs()[source]

Returns the number of visible tabs.



GetNumTabsCanScrollLeft()[source]

Returns the number of tabs than can be scrolled left.



GetPageCount()[source]

Returns the number of tabs in the FlatNotebook control.



GetPageImage(page)[source]

Returns the image index associated to a page.

Parameters:page – an integer specifying the page index.


GetPageText(page)[source]

Returns the tab caption of the page.

Parameters:page – an integer specifying the page index.


GetPageTextColour(page)[source]

Returns the tab text colour if it has been set previously, or None otherwise.

Parameters:page – an integer specifying the page index.


GetSelection()[source]

Returns the current selected page.



GetSingleLineBorderColour()[source]

Returns the colour for the single line border.



HasAGWFlag(flag)[source]

Returns whether a flag is present in the FlatNotebook style.

Parameters:flag – one of the possible FlatNotebook window styles.

See also

FlatNotebook.SetAGWWindowStyleFlag() for a list of possible window style flags.



HitTest(pt)[source]

HitTest method for PageContainer.

Parameters:pt – an instance of wx.Point, to test for hits.
Returns:The hit test flag (if any) and the hit page index (if any). The return value can be one of the following bits:
HitTest Flag Value Description
FNB_NOWHERE 0 Indicates mouse coordinates not on any tab of the notebook
FNB_TAB 1 Indicates mouse coordinates inside a tab
FNB_X 2 Indicates mouse coordinates inside the ‘X’ button region
FNB_TAB_X 3 Indicates mouse coordinates inside the ‘X’ region in a tab
FNB_LEFT_ARROW 4 Indicates mouse coordinates inside the left arrow region
FNB_RIGHT_ARROW 5 Indicates mouse coordinates inside the right arrow region
FNB_DROP_DOWN_ARROW 6 Indicates mouse coordinates inside the drop down arrow region


InsertPage(indx, text, selected=True, imgindex=-1)[source]

Inserts a new page at the specified position.

Parameters:
  • indx – specifies the position of the new page;
  • page – specifies the new page;
  • text – specifies the text for the new page;
  • select – specifies whether the page should be selected;
  • imageId – specifies the optional image index for the new page.


IsDefaultTabs()[source]

Returns whether a tab has a default style.



IsMouseHovering(page)[source]

Returns whether or not the mouse is hovering over this page’s tab

Parameters:page – an integer specifying the page index.


IsTabVisible(page)[source]

Returns whether a tab is visible or not.

Parameters:page – an integer specifying the page index.


MoveTabPage(nMove, nMoveTo)[source]

Moves a tab inside the same FlatNotebook.

Parameters:
  • nMove – the start index of the moved tab;
  • nMoveTo – the destination index of the moved tab.


OnDropTarget(x, y, nTabPage, wnd_oldContainer)[source]

Handles the drop action from a drag and drop operation.

Parameters:
  • x – the x position of the drop action;
  • y – the y position of the drop action;
  • nTabPage – the index of the tab being dropped;
  • wnd_oldContainer – the FlatNotebook to which the dropped tab previously belonged to.


OnEraseBackground(event)[source]

Handles the wx.EVT_ERASE_BACKGROUND event for PageContainer.

Parameters:event – a wx.EraseEvent event to be processed.

Note

This method is intentionally empty to reduce flicker.



OnKeyDown(event)[source]

Handles the wx.EVT_KEY_DOWN event for PageContainer.

Parameters:event – a wx.KeyEvent event to be processed.

Note

When the PageContainer has the focus tabs can be changed with the left/right arrow keys.



OnKillFocus(event)[source]

Handles the wx.EVT_KILL_FOCUS event for PageContainer.

Parameters:event – a wx.FocusEvent event to be processed.


OnLeftDClick(event)[source]

Handles the wx.EVT_LEFT_DCLICK event for PageContainer.

Parameters:event – a wx.MouseEvent event to be processed.


OnLeftDown(event)[source]

Handles the wx.EVT_LEFT_DOWN event for PageContainer.

Parameters:event – a wx.MouseEvent event to be processed.



OnLeftUp(event)[source]

Handles the wx.EVT_LEFT_UP event for PageContainer.

Parameters:event – a wx.MouseEvent event to be processed.



OnMiddleDown(event)[source]

Handles the wx.EVT_MIDDLE_DOWN event for PageContainer.

Parameters:event – a wx.MouseEvent event to be processed.



OnMouseEnterWindow(event)[source]

Handles the wx.EVT_ENTER_WINDOW event for PageContainer.

Parameters:event – a wx.MouseEvent event to be processed.



OnMouseLeave(event)[source]

Handles the wx.EVT_LEAVE_WINDOW event for PageContainer.

Parameters:event – a wx.MouseEvent event to be processed.



OnMouseMove(event)[source]

Handles the wx.EVT_MOTION event for PageContainer.

Parameters:event – a wx.MouseEvent event to be processed.



OnMouseWheel(event)[source]

Handles the wx.EVT_MOUSEWHEEL event for PageContainer.

Parameters:event – a wx.MouseEvent event to be processed.



OnPaint(event)[source]

Handles the wx.EVT_PAINT event for PageContainer.

Parameters:event – a wx.PaintEvent event to be processed.


OnRightDown(event)[source]

Handles the wx.EVT_RIGHT_DOWN event for PageContainer.

Parameters:event – a wx.MouseEvent event to be processed.



OnSetFocus(event)[source]

Handles the wx.EVT_SET_FOCUS event for PageContainer.

Parameters:event – a wx.FocusEvent event to be processed.



OnSize(event)[source]

Handles the wx.EVT_SIZE event for PageContainer.

Parameters:event – a wx.SizeEvent event to be processed.


OnTabMenuSelection(event)[source]

Handles the wx.EVT_MENU event for PageContainer.

Parameters:event – a wx.MenuEvent event to be processed.


PopupTabsMenu()[source]

Pops up the menu activated with the drop down arrow in the navigation area.



RotateLeft()[source]

Scrolls tabs to the left by bulk of 5 tabs.



RotateRight()[source]

Scrolls tabs to the right by bulk of 5 tabs.



SetAGWWindowStyleFlag(agwStyle)[source]

Sets the FlatNotebook window style.

Parameters:agwStyle – the new FlatNotebook window style.

See also

The FlatNotebook.__init__() method for the agwStyle parameter description.



SetFocusedPage(pageIndex=-1)[source]

Sets/Unsets the focus on the appropriate page.

Parameters:pageIndex – an integer specifying the page index. If pageIndex is defaulted to -1, we have lost focus and no focus indicator is drawn.


SetImageList(imglist)[source]

Sets the image list for the PageContainer.

Parameters:imageList – an instance of wx.ImageList.



SetPageImage(page, image)[source]

Sets the image index for the given page.

Parameters:
  • page – an integer specifying the page index;
  • image – an index into the image list which was set with SetImageList.


SetPageText(page, text)[source]

Sets the tab caption of the page.

Parameters:
  • page – an integer specifying the page index;
  • text – the new tab label.


SetPageTextColour(page, colour)[source]

Sets the tab text colour individually.

Parameters:
  • page – an integer specifying the page index;
  • colour – a valid wx.Colour object or any typemap supported by wxWidgets/wxPython to generate a colour (i.e., a hex string, a colour name, a 3 or 4 integer tuple). You can pass None or wx.NullColour to return to the default page text colour.


SetSelection(page)[source]

Sets the selected page.

Parameters:page – an integer specifying the page index.


ShowTabTooltip(tabIdx)[source]

Shows a tab tooltip.

Parameters:tabIdx – an integer specifying the page index.


TabHasImage(tabIdx)[source]

Returns whether a tab has an associated image index or not.

Parameters:tabIdx – an integer specifying the page index.
Tree

Table Of Contents

Previous topic

FlatNotebookEvent

Next topic

PageInfo