wx.lib.agw.flatmenu.FMRenderer¶
Base class for the FlatMenu renderers. This class implements the common
methods of all the renderers.
Class Hierarchy¶
Known Subclasses¶
wx.lib.agw.flatmenu.FMRendererMSOffice2007, wx.lib.agw.flatmenu.FMRendererXP
Methods Summary¶
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. |
Class API¶
- class FMRenderer(object)¶
Base class for the
FlatMenurenderers. This class implements the common methods of all the renderers.
Methods¶
- __init__(self)¶
Default class constructor.
- ConvertToBitmap(self, xpm, alpha=None)¶
Convert the given image to a bitmap, optionally overlaying an alpha channel to it.
- Parameters:
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.
- Parameters:
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
RightShadow1
Right side shadow
BottomShadow2
Not full bottom shadow
BottomShadowFull4
Full bottom shadow
- DrawButton(self, dc, rect, state, colour=None)¶
Draws a button.
- Parameters:
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 ofwx.Colourto be used to draw theFlatMenuItembackground.
- DrawLeftMargin(self, item, dc, menuRect)¶
Draws the menu left margin.
- Parameters:
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.- Parameters:
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.
- Parameters:
item – a
FlatMenuIteminstance;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) –
Trueif this menu item is currently hovered by the mouse,Falseotherwise.backgroundImage – if not
None, an instance ofwx.Bitmapwhich will become the background image for thisFlatMenu.
- DrawScrollButton(self, dc, rect, state)¶
Draws the scroll button
- DrawSeparator(self, dc, xCoord, yCoord, textX, sepWidth)¶
Draws a separator inside a
FlatMenu.- Parameters:
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.Colouraccording to the menu item state.- Parameters:
state (integer) – one of the following bits:
Item State
Value
Description
ControlPressed0
The item is pressed
ControlFocus1
The item is focused
ControlDisabled2
The item is disabled
ControlNormal3
Normal state
- SetMenuBarHighlightColour(self, colour)¶
Set the colour to highlight focus on the menu bar.
- Parameters:
colour – a valid instance of
wx.Colour.