AGW Logo

agw_title ImageContainerBase

Base class for FlatImageBook image container.

hierarchy Inheritance Diagram

Inheritance diagram for: ImageContainerBase

Inheritance diagram of ImageContainerBase


method_summary Methods Summary

__init__Default class constructor.
AddPageAdds a page to the container.
AssignImageListAssigns an image list to the ImageContainerBase.
CanDoBottomStyleAllows the parent to examine the children type.
ClearAllDeletes all the pages in the container.
ClearFlagRemoves flag from the style.
DoDeletePageDoes the actual page deletion.
DrawPinDraw a pin button, that allows collapsing of the image panel.
EnableTabEnables or disables a tab.
FixTextSizeFixes the text, to fit maxWidth value. If the text length exceeds
GetEnabledReturns whether a tab is enabled or not.
GetImageListReturn the image list for ImageContainerBase.
GetImageSizeReturns the image size inside the ImageContainerBase image list.
GetPageImageReturns the image index for the given page.
GetPageTextReturns the tab caption for the given page.
HasAGWFlagTests for existance of flag in the style.
HitTestReturns the index of the tab at the specified position or wx.NOT_FOUND
InsertPageInserts a page into the container at the specified position.
OnEraseBackgroundHandles the wx.EVT_ERASE_BACKGROUND event for ImageContainerBase.
OnMouseLeaveWindowHandles the wx.EVT_LEAVE_WINDOW event for ImageContainerBase.
OnMouseLeftDownHandles the wx.EVT_LEFT_DOWN event for ImageContainerBase.
OnMouseLeftUpHandles the wx.EVT_LEFT_UP event for ImageContainerBase.
OnMouseMoveHandles the wx.EVT_MOTION event for ImageContainerBase.
OnSizeHandles the wx.EVT_SIZE event for ImageContainerBase.
PointOnSashTests whether pt is located on the sash.
SetPageImageSets the image for the given page.
SetPageTextSets the tab caption for the given page.

API Class API

class ImageContainerBase(wx.Panel)[source]

Base class for FlatImageBook image container.



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

Default class constructor.

Parameters:
  • parent – parent window. Must not be None;
  • id – window identifier. A value of -1 indicates a default value;
  • 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 underlying wx.Panel window style;
  • agwStyle – the AGW-specific window style. This can be a combination of the following bits:


    Window Styles Hex Value Description
    INB_BOTTOM 0x1 Place labels below the page area. Available only for FlatImageBook.
    INB_LEFT 0x2 Place labels on the left side. Available only for FlatImageBook.
    INB_RIGHT 0x4 Place labels on the right side.
    INB_TOP 0x8 Place labels above the page area.
    INB_BORDER 0x10 Draws a border around LabelBook or FlatImageBook.
    INB_SHOW_ONLY_TEXT 0x20 Shows only text labels and no images. Available only for LabelBook.
    INB_SHOW_ONLY_IMAGES 0x40 Shows only tab images and no label texts. Available only for LabelBook.
    INB_FIT_BUTTON 0x80 Displays a pin button to show/hide the book control.
    INB_DRAW_SHADOW 0x100 Draw shadows below the book tabs. Available only for LabelBook.
    INB_USE_PIN_BUTTON 0x200 Displays a pin button to show/hide the book control.
    INB_GRADIENT_BACKGROUND 0x400 Draws a gradient shading on the tabs background. Available only for LabelBook.
    INB_WEB_HILITE 0x800 On mouse hovering, tabs behave like html hyperlinks. Available only for LabelBook.
    INB_NO_RESIZE 0x1000 Don’t allow resizing of the tab area.
    INB_FIT_LABELTEXT 0x2000 Will fit the tab area to the longest text (or text+image if you have images) in all the tabs.
    INB_BOLD_TAB_SELECTION 0x4000 Show the selected tab text using a bold font.
  • name – the window name.


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

Adds a page to the container.

Parameters:
  • caption – specifies the text for the new tab;
  • selected – specifies whether the page should be selected;
  • imgIdx – specifies the optional image index for the new tab.


AssignImageList(imglist)[source]

Assigns an image list to the ImageContainerBase.

Parameters:imglist – an instance of wx.ImageList.


CanDoBottomStyle()[source]

Allows the parent to examine the children type. Some implementation (such as LabelBook), does not support top/bottom images, only left/right.



ClearAll()[source]

Deletes all the pages in the container.



ClearFlag(flag)[source]

Removes flag from the style.

Parameters:flag – a window style flag.

See also

HasAGWFlag for a list of possible window style flags.



DoDeletePage(page)[source]

Does the actual page deletion.

Parameters:page – the index of the tab.


DrawPin(dc, rect, downPin)[source]

Draw a pin button, that allows collapsing of the image panel.

Parameters:
  • dc – an instance of wx.DC;
  • rect – the pin button client rectangle;
  • downPinTrue if the pin button is facing downwards, False if it is facing leftwards.


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.


FixTextSize(dc, text, maxWidth)[source]

Fixes the text, to fit maxWidth value. If the text length exceeds maxWidth value this function truncates it and appends two dots at the end. (“Long Long Long Text” might become “Long Long...”).

Parameters:
  • dc – an instance of wx.DC;

  • text – the text to fix/truncate;
  • maxWidth – the maximum allowed width for the text, in pixels.


GetEnabled(page)[source]

Returns whether a tab is enabled or not.

Parameters:page – an integer specifying the page index.


GetImageList()[source]

Return the image list for ImageContainerBase.



GetImageSize()[source]

Returns the image size inside the ImageContainerBase image list.



GetPageImage(page)[source]

Returns the image index for the given page.

Parameters:page – the index of the tab.


GetPageText(page)[source]

Returns the tab caption for the given page.

Parameters:page – the index of the tab.


HasAGWFlag(flag)[source]

Tests for existance of flag in the style.

Parameters:flag – a window style. This can be a combination of the following bits:


Window Styles Hex Value Description
INB_BOTTOM 0x1 Place labels below the page area. Available only for FlatImageBook.
INB_LEFT 0x2 Place labels on the left side. Available only for FlatImageBook.
INB_RIGHT 0x4 Place labels on the right side.
INB_TOP 0x8 Place labels above the page area.
INB_BORDER 0x10 Draws a border around LabelBook or FlatImageBook.
INB_SHOW_ONLY_TEXT 0x20 Shows only text labels and no images. Available only for LabelBook.
INB_SHOW_ONLY_IMAGES 0x40 Shows only tab images and no label texts. Available only for LabelBook.
INB_FIT_BUTTON 0x80 Displays a pin button to show/hide the book control.
INB_DRAW_SHADOW 0x100 Draw shadows below the book tabs. Available only for LabelBook.
INB_USE_PIN_BUTTON 0x200 Displays a pin button to show/hide the book control.
INB_GRADIENT_BACKGROUND 0x400 Draws a gradient shading on the tabs background. Available only for LabelBook.
INB_WEB_HILITE 0x800 On mouse hovering, tabs behave like html hyperlinks. Available only for LabelBook.
INB_NO_RESIZE 0x1000 Don’t allow resizing of the tab area.
INB_FIT_LABELTEXT 0x2000 Will fit the tab area to the longest text (or text+image if you have images) in all the tabs.
INB_BOLD_TAB_SELECTION 0x4000 Show the selected tab text using a bold font.


HitTest(pt)[source]

Returns the index of the tab at the specified position or wx.NOT_FOUND if None, plus the flag style of HitTest.

Parameters:pt – an instance of wx.Point, to test for hits.
Returns:The index of the tab at the specified position plus the hit test flag, which can be one of the following bits:
HitTest Flags Value Description
IMG_OVER_IMG 0 The mouse is over the tab icon
IMG_OVER_PIN 1 The mouse is over the pin button
IMG_OVER_EW_BORDER 2 The mouse is over the east-west book border
IMG_NONE 3 Nowhere


InsertPage(page_idx, caption, selected=False, imgIdx=-1)[source]

Inserts a page into the container at the specified position.

Parameters:
  • page_idx – specifies the position for the new tab;
  • caption – specifies the text for the new tab;
  • selected – specifies whether the page should be selected;
  • imgIdx – specifies the optional image index for the new tab.


OnEraseBackground(event)[source]

Handles the wx.EVT_ERASE_BACKGROUND event for ImageContainerBase.

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

Note

This method is intentionally empty to reduce flicker.



OnMouseLeaveWindow(event)[source]

Handles the wx.EVT_LEAVE_WINDOW event for ImageContainerBase.

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


OnMouseLeftDown(event)[source]

Handles the wx.EVT_LEFT_DOWN event for ImageContainerBase.

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



OnMouseLeftUp(event)[source]

Handles the wx.EVT_LEFT_UP event for ImageContainerBase.

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



OnMouseMove(event)[source]

Handles the wx.EVT_MOTION event for ImageContainerBase.

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



OnSize(event)[source]

Handles the wx.EVT_SIZE event for ImageContainerBase.

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


PointOnSash(pt)[source]

Tests whether pt is located on the sash.

Parameters:pt – an instance of wx.Point, to test for hits.



SetPageImage(page, imgIdx)[source]

Sets the image for the given page.

Parameters:
  • page – the index of the tab;
  • imgIdx – specifies the optional image index for the tab.


SetPageText(page, text)[source]

Sets the tab caption for the given page.

Parameters:
  • page – the index of the tab;
  • text – the new tab caption.
Tree

Table Of Contents

Previous topic

ImageContainer

Next topic

ImageInfo