AGW Logo

agw_title FMRenderer

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

hierarchy Inheritance Diagram

Inheritance diagram for: FMRenderer

Inheritance diagram of FMRenderer


method_summary Methods Summary

__init__Default class constructor.
ConvertToBitmapConvert the given image to a bitmap, optionally overlaying an alpha channel to it.
DrawBitmapShadowDraws a shadow using background bitmap.
DrawButtonDraws a button.
DrawLeftMarginDraws the menu left margin.
DrawMenuDraws the menu.
DrawMenuBarDraws everything for FlatMenuBar.
DrawMenuBarBackgroundDraws the menu bar background colour according to the menubar.GetBackgroundColour
DrawMenuBarButtonDraws the highlight on a FlatMenuBar.
DrawMenuButtonDraws the highlight on a FlatMenu
DrawMenuItemDraws the menu item.
DrawScrollButtonDraws the scroll button
DrawSeparatorDraws a separator inside a FlatMenu.
DrawToolBarBgDraws the toolbar background
DrawToolbarSeparatorDraws a separator inside the toolbar in FlatMenuBar.
GetColoursAccordingToStateReturns a wx.Colour according to the menu item state.
SetMenuBarHighlightColourSet the colour to highlight focus on the menu bar.
SetMenuHighlightColourSet the colour to highlight focus on the menu.

API Class API

class FMRenderer(object)[source]

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



__init__()[source]

Default class constructor.



ConvertToBitmap(xpm, alpha=None)[source]

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(dc, rect, where=3)[source]

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:


    integer parameter settings
    Shadow Settings Value Description
    RightShadow 1 Right side shadow
    BottomShadow 2 Not full bottom shadow
    BottomShadowFull 4 Full bottom shadow


DrawButton(dc, rect, state, colour=None)[source]

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(item, dc, menuRect)[source]

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(flatmenu, dc)[source]

Draws the menu.

Parameters:
  • flatmenu – the FlatMenu instance we need to paint;
  • dc – an instance of wx.DC.



DrawMenuBar(menubar, dc)[source]

Draws everything for FlatMenuBar.

Parameters:


DrawMenuBarBackground(dc, rect)[source]

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(dc, rect, state)[source]

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(dc, rect, state)[source]

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(item, dc, xCoord, yCoord, imageMarginX, markerMarginX, textX, rightMarginX, selected=False, backgroundImage=None)[source]

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 currentl 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(dc, rect, state)[source]

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(dc, xCoord, yCoord, textX, sepWidth)[source]

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(dc, rect)[source]

Draws the toolbar background

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

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



DrawToolbarSeparator(dc, rect)[source]

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(state)[source]

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

Parameters:state (integer) – one of the following bits:


integer parameter settings
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(colour)[source]

Set the colour to highlight focus on the menu bar.

Parameters:colour – a valid instance of wx.Colour.



SetMenuHighlightColour(colour)[source]

Set the colour to highlight focus on the menu.

Parameters:colour – a valid instance of wx.Colour.

Tree

Table Of Contents

Previous topic

flatmenu

Next topic

FMRendererMSOffice2007