Base class for FlatImageBook
image container.
wx.lib.agw.labelbook.ImageContainer
, wx.lib.agw.labelbook.LabelContainer
Default class constructor. |
|
Adds a page to the container. |
|
Assigns an image list to the |
|
Allows the parent to examine the children type. Some implementation |
|
Deletes all the pages in the container. |
|
Removes flag from the style. |
|
Does the actual page deletion. |
|
Draw a pin button, that allows collapsing of the image panel. |
|
Enables or disables a tab. |
|
Fixes the text, to fit maxWidth value. If the text length exceeds |
|
Returns whether a tab is enabled or not. |
|
Return the image list for |
|
Returns the image size inside the |
|
Returns the image index for the given page. |
|
Returns the tab caption for the given page. |
|
Tests for existence of flag in the style. |
|
Returns the index of the tab at the specified position or |
|
Inserts a page into the container at the specified position. |
|
Handles the |
|
Handles the |
|
Handles the |
|
Handles the |
|
Handles the |
|
Handles the |
|
Tests whether pt is located on the sash. |
|
Sets the image for the given page. |
|
Sets the tab caption for the given page. |
ImageContainerBase
(wx.Panel)¶Base class for FlatImageBook
image container.
__init__
(self, parent, id=wx.ID_ANY, pos=wx.DefaultPosition, size=wx.DefaultSize, style=0, agwStyle=0, name="ImageContainerBase")¶Default class constructor.
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 Panel
window style;
agwStyle –
the AGW-specific window style. This can be a combination of the following bits:
Window Styles |
Hex Value |
Description |
---|---|---|
|
0x1 |
Place labels below the page area. Available only for |
|
0x2 |
Place labels on the left side. Available only for |
|
0x4 |
Place labels on the right side. |
|
0x8 |
Place labels above the page area. |
|
0x10 |
Draws a border around |
|
0x20 |
Shows only text labels and no images. Available only for |
|
0x40 |
Shows only tab images and no label texts. Available only for |
|
0x80 |
Displays a pin button to show/hide the book control. |
|
0x100 |
Draw shadows below the book tabs. Available only for |
|
0x200 |
Displays a pin button to show/hide the book control. |
|
0x400 |
Draws a gradient shading on the tabs background. Available only for |
|
0x800 |
On mouse hovering, tabs behave like html hyperlinks. Available only for |
|
0x1000 |
Don’t allow resizing of the tab area. |
|
0x2000 |
Will fit the tab area to the longest text (or text+image if you have images) in all the tabs. |
|
0x4000 |
Show the selected tab text using a bold font. |
name – the window name.
AddPage
(self, caption, selected=False, imgIdx=-1)¶Adds a page to the container.
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
(self, imglist)¶Assigns an image list to the wx.ImageContainerBase
.
imglist – an instance of wx.ImageList
.
CanDoBottomStyle
(self)¶Allows the parent to examine the children type. Some implementation
(such as LabelBook
), does not support top/bottom images, only left/right.
ClearAll
(self)¶Deletes all the pages in the container.
ClearFlag
(self, flag)¶Removes flag from the style.
flag – a window style flag.
See also
HasAGWFlag
for a list of possible window style flags.
DoDeletePage
(self, page)¶Does the actual page deletion.
page – the index of the tab.
DrawPin
(self, dc, rect, downPin)¶Draw a pin button, that allows collapsing of the image panel.
dc – an instance of wx.DC
;
rect – the pin button client rectangle;
downPin – True
if the pin button is facing downwards, False
if it is facing leftwards.
EnableTab
(self, page, enabled=True)¶Enables or disables a tab.
page – an integer specifying the page index;
enabled – True
to enable a tab, False
to disable it.
FixTextSize
(self, dc, text, maxWidth)¶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…”).
dc – an instance of wx.DC
;
text – the text to fix/truncate;
maxWidth – the maximum allowed width for the text, in pixels.
GetEnabled
(self, page)¶Returns whether a tab is enabled or not.
page – an integer specifying the page index.
GetImageList
(self)¶Return the image list for wx.ImageContainerBase
.
GetImageSize
(self)¶Returns the image size inside the wx.ImageContainerBase
image list.
GetPageImage
(self, page)¶Returns the image index for the given page.
page – the index of the tab.
GetPageText
(self, page)¶Returns the tab caption for the given page.
page – the index of the tab.
HasAGWFlag
(self, flag)¶Tests for existence of flag in the style.
flag – a window style. This can be a combination of the following bits:
Window Styles |
Hex Value |
Description |
---|---|---|
|
0x1 |
Place labels below the page area. Available only for |
|
0x2 |
Place labels on the left side. Available only for |
|
0x4 |
Place labels on the right side. |
|
0x8 |
Place labels above the page area. |
|
0x10 |
Draws a border around |
|
0x20 |
Shows only text labels and no images. Available only for |
|
0x40 |
Shows only tab images and no label texts. Available only for |
|
0x80 |
Displays a pin button to show/hide the book control. |
|
0x100 |
Draw shadows below the book tabs. Available only for |
|
0x200 |
Displays a pin button to show/hide the book control. |
|
0x400 |
Draws a gradient shading on the tabs background. Available only for |
|
0x800 |
On mouse hovering, tabs behave like html hyperlinks. Available only for |
|
0x1000 |
Don’t allow resizing of the tab area. |
|
0x2000 |
Will fit the tab area to the longest text (or text+image if you have images) in all the tabs. |
|
0x4000 |
Show the selected tab text using a bold font. |
HitTest
(self, pt)¶Returns the index of the tab at the specified position or wx.NOT_FOUND
if None
, plus the flag style of HitTest
.
pt – an instance of wx.Point
, to test for hits.
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 |
---|---|---|
|
0 |
The mouse is over the tab icon |
|
1 |
The mouse is over the pin button |
|
2 |
The mouse is over the east-west book border |
|
3 |
Nowhere |
InsertPage
(self, page_idx, caption, selected=False, imgIdx=-1)¶Inserts a page into the container at the specified position.
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
(self, event)¶Handles the wx.EVT_ERASE_BACKGROUND
event for wx.ImageContainerBase
.
event – a EraseEvent
event to be processed.
Note
This method is intentionally empty to reduce flicker.
OnMouseLeaveWindow
(self, event)¶Handles the wx.EVT_LEAVE_WINDOW
event for wx.ImageContainerBase
.
event – a MouseEvent
event to be processed.
OnMouseLeftDown
(self, event)¶Handles the wx.EVT_LEFT_DOWN
event for wx.ImageContainerBase
.
event – a MouseEvent
event to be processed.
OnMouseLeftUp
(self, event)¶Handles the wx.EVT_LEFT_UP
event for wx.ImageContainerBase
.
event – a MouseEvent
event to be processed.
OnMouseMove
(self, event)¶Handles the wx.EVT_MOTION
event for wx.ImageContainerBase
.
event – a MouseEvent
event to be processed.
OnSize
(self, event)¶Handles the wx.EVT_SIZE
event for wx.ImageContainerBase
.
event – a wx.SizeEvent
event to be processed.
PointOnSash
(self, pt)¶Tests whether pt is located on the sash.
pt – an instance of wx.Point
, to test for hits.
SetPageImage
(self, page, imgIdx)¶Sets the image for the given page.
page – the index of the tab;
imgIdx – specifies the optional image index for the tab.
SetPageText
(self, page, text)¶Sets the tab caption for the given page.
page – the index of the tab;
text – the new tab caption.