Base class for the FlatMenu
renderers. This class implements the common
methods of all the renderers.
wx.lib.agw.flatmenu.FMRendererMSOffice2007
, wx.lib.agw.flatmenu.FMRendererXP
Default class constructor. |
|
Convert the given image to a bitmap, optionally overlaying an alpha |
|
Draws a shadow using background bitmap. |
|
Draws a button. |
|
Draws the menu left margin. |
|
Draws the menu. |
|
Draws everything for |
|
Draws the menu bar background colour according to the menubar.GetBackgroundColour |
|
Draws the highlight on a |
|
Draws the highlight on a FlatMenu |
|
Draws the menu item. |
|
Draws the scroll button |
|
Draws a separator inside a |
|
Draws the toolbar background |
|
Draws a separator inside the toolbar in |
|
Returns a |
|
Set the colour to highlight focus on the menu bar. |
|
Set the colour to highlight focus on the menu. |
FMRenderer
(object)¶Base class for the FlatMenu
renderers. This class implements the common
methods of all the renderers.
__init__
(self)¶Default class constructor.
ConvertToBitmap
(self, xpm, alpha=None)¶Convert the given image to a bitmap, optionally overlaying an alpha channel to it.
xpm – a list of strings formatted as XPM;
alpha – a list of alpha values, the same size as the xpm bitmap.
DrawBitmapShadow
(self, dc, rect, where=BottomShadow|RightShadow)¶Draws a shadow using background bitmap.
dc – an instance of wx.DC
;
rect – an instance of wx.Rect
, representing the bitmap client rectangle;
where (integer) –
where to draw the shadow. This can be any combination of the following bits:
Shadow Settings |
Value |
Description |
---|---|---|
|
1 |
Right side shadow |
|
2 |
Not full bottom shadow |
|
4 |
Full bottom shadow |
DrawButton
(self, dc, rect, state, colour=None)¶Draws a button.
dc – an instance of wx.DC
;
rect – an instance of wx.Rect
, representing the button client rectangle;
state (integer) – the button state;
colour – if not None
, an instance of wx.Colour
to be used to draw
the FlatMenuItem
background.
DrawLeftMargin
(self, item, dc, menuRect)¶Draws the menu left margin.
item – an instance of FlatMenuItem
;
dc – an instance of wx.DC
;
menuRect – an instance of wx.Rect
, representing the menu client rectangle.
DrawMenu
(self, flatmenu, dc)¶Draws the menu.
DrawMenuBar
(self, menubar, dc)¶Draws everything for FlatMenuBar
.
menubar – an instance of FlatMenuBar
.
dc – an instance of wx.DC
.
DrawMenuBarBackground
(self, dc, rect)¶Draws the menu bar background colour according to the menubar.GetBackgroundColour
DrawMenuBarButton
(self, dc, rect, state)¶Draws the highlight on a FlatMenuBar
.
DrawMenuButton
(self, dc, rect, state)¶Draws the highlight on a FlatMenu
DrawMenuItem
(self, item, dc, xCoord, yCoord, imageMarginX, markerMarginX, textX, rightMarginX, selected=False, backgroundImage=None)¶Draws the menu item.
item – a FlatMenuItem
instance;
dc – an instance of wx.DC
;
xCoord (integer) – the current x position where to draw the menu;
yCoord (integer) – the current y position where to draw the menu;
imageMarginX (integer) – the spacing between the image and the menu border;
markerMarginX (integer) – the spacing between the checkbox/radio marker and the menu border;
textX (integer) – the menu item label x position;
rightMarginX (integer) – the right margin between the text and the menu border;
selected (bool) – True
if this menu item is currently hovered by the mouse,
False
otherwise.
backgroundImage – if not None
, an instance of wx.Bitmap
which will
become the background image for this FlatMenu
.
DrawScrollButton
(self, dc, rect, state)¶Draws the scroll button
DrawSeparator
(self, dc, xCoord, yCoord, textX, sepWidth)¶Draws a separator inside a FlatMenu
.
dc – an instance of wx.DC
;
xCoord (integer) – the current x position where to draw the separator;
yCoord (integer) – the current y position where to draw the separator;
textX (integer) – the menu item label x position;
sepWidth (integer) – the width of the separator, in pixels.
DrawToolBarBg
(self, dc, rect)¶Draws the toolbar background
DrawToolbarSeparator
(self, dc, rect)¶Draws a separator inside the toolbar in FlatMenuBar
.
GetColoursAccordingToState
(self, state)¶Returns a wx.Colour
according to the menu item state.
state (integer) – one of the following bits:
Item State |
Value |
Description |
---|---|---|
|
0 |
The item is pressed |
|
1 |
The item is focused |
|
2 |
The item is disabled |
|
3 |
Normal state |
SetMenuBarHighlightColour
(self, colour)¶Set the colour to highlight focus on the menu bar.
colour – a valid instance of wx.Colour
.