phoenix_title wx.lib.agw.flatmenu.FMRenderer

Base class for the FlatMenu renderers. This class implements the common methods of all the renderers.


class_hierarchy Class Hierarchy

Inheritance diagram for class FMRenderer:

sub_classes Known Subclasses

wx.lib.agw.flatmenu.FMRendererMSOffice2007, wx.lib.agw.flatmenu.FMRendererXP


method_summary Methods Summary

__init__

Default class constructor.

ConvertToBitmap

Convert the given image to a bitmap, optionally overlaying an alpha

DrawBitmapShadow

Draws a shadow using background bitmap.

DrawButton

Draws a button.

DrawLeftMargin

Draws the menu left margin.

DrawMenu

Draws the menu.

DrawMenuBar

Draws everything for FlatMenuBar.

DrawMenuBarBackground

Draws the menu bar background colour according to the menubar.GetBackgroundColour

DrawMenuBarButton

Draws the highlight on a FlatMenuBar.

DrawMenuButton

Draws the highlight on a FlatMenu

DrawMenuItem

Draws the menu item.

DrawScrollButton

Draws the scroll button

DrawSeparator

Draws a separator inside a FlatMenu.

DrawToolBarBg

Draws the toolbar background

DrawToolbarSeparator

Draws a separator inside the toolbar in FlatMenuBar.

GetColoursAccordingToState

Returns a wx.Colour according to the menu item state.

SetMenuBarHighlightColour

Set the colour to highlight focus on the menu bar.

SetMenuHighlightColour

Set the colour to highlight focus on the menu.


api Class API

class FMRenderer(object)

Base class for the FlatMenu renderers. 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

    RightShadow

    1

    Right side shadow

    BottomShadow

    2

    Not full bottom shadow

    BottomShadowFull

    4

    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 of wx.Colour to be used to draw the FlatMenuItem background.



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.

Parameters:
  • flatmenu – the FlatMenu instance we need to paint;

  • dc – an instance of wx.DC.



DrawMenuBar(self, menubar, dc)

Draws everything for FlatMenuBar.

Parameters:


DrawMenuBarBackground(self, dc, rect)

Draws the menu bar background colour according to the menubar.GetBackgroundColour

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

  • rect – an instance of wx.Rect, representing the menubar client rectangle.



DrawMenuBarButton(self, dc, rect, state)

Draws the highlight on a FlatMenuBar.

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

  • rect – an instance of wx.Rect, representing the button client rectangle;

  • state (integer) – the button state.



DrawMenuButton(self, dc, rect, state)

Draws the highlight on a FlatMenu

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

  • rect – an instance of wx.Rect, representing the button client rectangle;

  • state (integer) – the button state.



DrawMenuItem(self, item, dc, xCoord, yCoord, imageMarginX, markerMarginX, textX, rightMarginX, selected=False, backgroundImage=None)

Draws the menu item.

Parameters:
  • 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

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

  • rect – an instance of wx.Rect, representing the button client rectangle;

  • state (integer) – the button state.



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

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

  • rect – an instance of wx.Rect, representing the toolbar client rectangle.



DrawToolbarSeparator(self, dc, rect)

Draws a separator inside the toolbar in FlatMenuBar.

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

  • rect – an instance of wx.Rect, representing the bitmap client rectangle.



GetColoursAccordingToState(self, state)

Returns a wx.Colour according to the menu item state.

Parameters:

state (integer) – one of the following bits:

Item State

Value

Description

ControlPressed

0

The item is pressed

ControlFocus

1

The item is focused

ControlDisabled

2

The item is disabled

ControlNormal

3

Normal state



SetMenuBarHighlightColour(self, colour)

Set the colour to highlight focus on the menu bar.

Parameters:

colour – a valid instance of wx.Colour.



SetMenuHighlightColour(self, colour)

Set the colour to highlight focus on the menu.

Parameters:

colour – a valid instance of wx.Colour.