Implements the generic owner-drawn menu bar for FlatMenu
.
__init__ |
Default class constructor. |
ActivateMenu |
Activates a menu. |
ActivateNextMenu |
Activates next menu and make sure all others are non-active. |
ActivatePreviousMenu |
Activates previous menu and make sure all others are non-active. |
AddCheckTool |
Adds a new check (or toggle) tool to the toolbar. |
AddControl |
Adds any control to the toolbar, typically e.g. a combobox. |
AddRadioTool |
Adds a new radio tool to the toolbar. |
AddSeparator |
Adds a separator for spacing groups of tools in toolbar. |
AddTool |
Adds a tool to the toolbar. |
Append |
Adds the item to the end of the menu bar. |
AppendToolbarItem |
Appends a tool to the FlatMenuBar . |
ClearBitmaps |
Restores a NullBitmap for all the items in the menu. |
CreateMoreMenu |
Creates the drop down menu and populate it. |
DoGiveHelp |
Gives tooltips and help in StatusBar . |
DoMouseMove |
Handles mouse move event. |
DoToolbarAction |
Performs a toolbar button pressed action. |
DrawMoreButton |
Draws ‘more’ button to the right side of the menu bar. |
DrawToolbar |
Draws the toolbar (if present). |
DrawToolbarItem |
Draws a toolbar item button. |
FindMenu |
Returns the index of the menu with the given title or wx.NOT_FOUND if |
FindMenuItem |
Finds the menu item object associated with the given menu item identifier. |
GetActiveToolbarItem |
Returns the active toolbar item. |
GetBackgroundColour |
Returns the menu bar background colour. |
GetInvisibleMenuItemCount |
Returns the number of invisible menu items. |
GetInvisibleToolbarItemCount |
Returns the number of invisible toolbar items. |
GetLastVisibleMenu |
Returns the index of the last visible menu on the menu bar. |
GetMenu |
Returns the menu at the specified index menuIdx (zero-based). |
GetMenuCount |
Returns the number of menus in the menubar. |
GetMoreMenuButtonRect |
Returns a rectangle region, as an instance of wx.Rect , surrounding the menu button. |
GetOptions |
Returns the FlatMenuBar options, whether to show a toolbar, to use LCD screen settings etc... |
GetRenderer |
Returns the renderer associated with this instance. |
GetRendererManager |
Returns the FlatMenuBar renderer manager. |
HitTest |
HitTest method for FlatMenuBar . |
Insert |
Inserts the menu at the given position into the menu bar. |
OnAccelCmd |
Single function to handle any accelerator key used inside the menubar. |
OnCustomizeDlg |
Handles the customize dialog here. |
OnEraseBackground |
Handles the wx.EVT_ERASE_BACKGROUND event for FlatMenuBar . |
OnIdle |
Handles the wx.EVT_IDLE event for FlatMenuBar . |
OnLeaveMenuBar |
Handles the wx.EVT_LEAVE_WINDOW event for FlatMenuBar . |
OnLeaveWindow |
Handles the wx.EVT_LEAVE_WINDOW event for FlatMenuBar . |
OnLeftDown |
Handles the wx.EVT_LEFT_DOWN event for FlatMenuBar . |
OnLeftUp |
Handles the wx.EVT_LEFT_UP event for FlatMenuBar . |
OnMenuDismissed |
Handles the EVT_FLAT_MENU_DISMISSED event for FlatMenuBar . |
OnMouseMove |
Handles the wx.EVT_MOTION event for FlatMenuBar . |
OnPaint |
Handles the wx.EVT_PAINT event for FlatMenuBar . |
OnSize |
Handles the wx.EVT_SIZE event for FlatMenuBar . |
OnStatusBarTimer |
Handles the timer expiring to delete the longHelp string in the StatusBar . |
PopupMoreMenu |
Pops up the ‘more’ menu. |
PositionAUI |
Positions the control inside a wxAUI / PyAUI frame manager. |
ProcessMouseMoveFromMenu |
This function is called from child menus, this allow a child menu to |
Remove |
Removes the menu from the menu bar and returns the menu object - the |
RemoveHelp |
Removes the tooltips and statusbar help (if any) for a button. |
ResetToolbarItems |
Used internally. |
SetBackgroundColour |
Sets the menu bar background colour. |
SetBarHeight |
Recalculates the FlatMenuBar height when its settings change. |
SetLCDMonitor |
Sets whether the PC monitor is an LCD or not. |
SetMargin |
Sets the margin above and below the menu bar text. |
SetOptions |
Sets the FlatMenuBar options, whether to show a toolbar, to use LCD screen settings etc... |
SetSpacing |
Sets the spacing between the menubar items. |
SetToolbarMargin |
Sets the margin around the toolbar. |
SetToolbarSpacing |
Sets the spacing between the toolbar tools. |
SetUpdateInterval |
Sets the UpdateUI interval for toolbar items. All UpdateUI events are |
ShowCustomize |
Shows/hides the drop-down arrow which allows customization of FlatMenu . |
UpdateAcceleratorTable |
Updates the parent accelerator table. |
UpdateItem |
An item was modified. This function is called by FlatMenu in case |
FlatMenuBar
(wx.Panel)¶Implements the generic owner-drawn menu bar for FlatMenu
.
__init__
(self, parent, id=wx.ID_ANY, iconSize=SmallIcons, spacer=SPACER, options=FM_OPT_SHOW_CUSTOMIZE|FM_OPT_IS_LCD)¶Default class constructor.
Parameters: |
|
---|
ActivateMenu
(self, menuInfo)¶Activates a menu.
Parameters: | menuInfo – an instance of wx.MenuEntryInfo . |
---|
ActivateNextMenu
(self)¶Activates next menu and make sure all others are non-active.
ActivatePreviousMenu
(self)¶Activates previous menu and make sure all others are non-active.
AddCheckTool
(self, toolId, label="", bitmap1=wx.NullBitmap, bitmap2=wx.NullBitmap, shortHelp="", longHelp="")¶Adds a new check (or toggle) tool to the toolbar.
See also
AddTool
for parameter descriptions.
AddControl
(self, control)¶Adds any control to the toolbar, typically e.g. a combobox.
Parameters: | control – the control to be added, a subclass of wx.Window (but no TopLevelWindow ). |
---|
AddRadioTool
(self, toolId, label= "", bitmap1=wx.NullBitmap, bitmap2=wx.NullBitmap, shortHelp="", longHelp="")¶Adds a new radio tool to the toolbar.
Consecutive radio tools form a radio group such that exactly one button in the group is pressed at any moment, in other words whenever a button in the group is pressed the previously pressed button is automatically released.
You should avoid having the radio groups of only one element as it would be impossible for the user to use such button.
By default, the first button in the radio group is initially pressed, the others are not.
See also
AddTool
for parameter descriptions.
AddSeparator
(self)¶Adds a separator for spacing groups of tools in toolbar.
AddTool
(self, toolId, label="", bitmap1=wx.NullBitmap, bitmap2=wx.NullBitmap, kind=wx.ITEM_NORMAL, shortHelp="", longHelp="")¶Adds a tool to the toolbar.
Parameters: |
|
---|
Append
(self, menu, title)¶Adds the item to the end of the menu bar.
Parameters: |
|
---|
See also
AppendToolbarItem
(self, item)¶Appends a tool to the FlatMenuBar
.
Deprecated since version 0.9.5: This method is now deprecated.
See also
ClearBitmaps
(self, start=0)¶Restores a NullBitmap
for all the items in the menu.
Parameters: | start (integer) – the index at which to start resetting the bitmaps. |
---|
CreateMoreMenu
(self)¶Creates the drop down menu and populate it.
DoGiveHelp
(self, hit)¶Gives tooltips and help in StatusBar
.
Parameters: | hit – the toolbar tool currently hovered by the mouse. |
---|
DoMouseMove
(self, pt, leftIsDown)¶Handles mouse move event.
Parameters: |
|
---|
DoToolbarAction
(self, idx)¶Performs a toolbar button pressed action.
Parameters: | idx (integer) – the tool index in the toolbar. |
---|
DrawMoreButton
(self, dc, state)¶Draws ‘more’ button to the right side of the menu bar.
Parameters: |
|
---|
See also
wx.MenuEntryInfo.SetState()
for a list of valid menu states.
DrawToolbar
(self, dc, rect)¶Draws the toolbar (if present).
Parameters: |
---|
DrawToolbarItem
(self, dc, idx, state)¶Draws a toolbar item button.
Parameters: |
|
---|
See also
wx.MenuEntryInfo.SetState()
for a list of valid menu states.
FindMenu
(self, title)¶Returns the index of the menu with the given title or wx.NOT_FOUND
if
no such menu exists in this menubar.
Parameters: | title (string) – may specify either the menu title (with accelerator characters, i.e. “&File”) or just the menu label (“File”) indifferently. |
---|
FindMenuItem
(self, id)¶Finds the menu item object associated with the given menu item identifier.
Parameters: | id (integer) – the identifier for the sought FlatMenuItem . |
---|---|
Returns: | The found menu item object, or None if one was not found. |
GetActiveToolbarItem
(self)¶Returns the active toolbar item.
GetBackgroundColour
(self)¶Returns the menu bar background colour.
GetInvisibleMenuItemCount
(self)¶Returns the number of invisible menu items.
Note
Valid only after the PaintEvent
has been processed after a resize.
GetInvisibleToolbarItemCount
(self)¶Returns the number of invisible toolbar items.
Note
Valid only after the PaintEvent
has been processed after a resize.
GetLastVisibleMenu
(self)¶Returns the index of the last visible menu on the menu bar.
GetMenu
(self, menuIdx)¶Returns the menu at the specified index menuIdx (zero-based).
Parameters: | menuIdx (integer) – the index of the sought menu. |
---|---|
Returns: | The found menu item object, or None if one was not found. |
GetMenuCount
(self)¶Returns the number of menus in the menubar.
GetMoreMenuButtonRect
(self)¶Returns a rectangle region, as an instance of wx.Rect
, surrounding the menu button.
GetOptions
(self)¶Returns the FlatMenuBar
options, whether to show a toolbar, to use LCD screen settings etc...
See also
SetOptions
for a list of valid options.
GetRenderer
(self)¶Returns the renderer associated with this instance.
GetRendererManager
(self)¶Returns the FlatMenuBar
renderer manager.
HitTest
(self, pt)¶HitTest method for FlatMenuBar
.
Parameters: | pt – an instance of wx.Point , specifying the hit test position. |
||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Returns: | A tuple representing one of the following combinations:
|
Insert
(self, pos, menu, title)¶Inserts the menu at the given position into the menu bar.
Parameters: |
|
---|
Note
Inserting menu at position 0 will insert it in the very beginning of it,
inserting at position GetMenuCount
is the same as calling Append
.
OnAccelCmd
(self, event)¶Single function to handle any accelerator key used inside the menubar.
Parameters: | event – a FlatMenuEvent event to be processed. |
---|
OnCustomizeDlg
(self, event)¶Handles the customize dialog here.
Parameters: | event – a FlatMenuEvent event to be processed. |
---|
OnEraseBackground
(self, event)¶Handles the wx.EVT_ERASE_BACKGROUND
event for FlatMenuBar
.
Parameters: | event – a EraseEvent event to be processed. |
---|
Note
This method is intentionally empty to reduce flicker.
OnIdle
(self, event)¶Handles the wx.EVT_IDLE
event for FlatMenuBar
.
Parameters: | event – a IdleEvent event to be processed. |
---|
OnLeaveMenuBar
(self, event)¶Handles the wx.EVT_LEAVE_WINDOW
event for FlatMenuBar
.
Parameters: | event – a MouseEvent event to be processed. |
---|
Note
This method is for MSW only.
OnLeaveWindow
(self, event)¶Handles the wx.EVT_LEAVE_WINDOW
event for FlatMenuBar
.
Parameters: | event – a MouseEvent event to be processed. |
---|
Note
This method is for GTK only.
OnLeftDown
(self, event)¶Handles the wx.EVT_LEFT_DOWN
event for FlatMenuBar
.
Parameters: | event – a MouseEvent event to be processed. |
---|
OnLeftUp
(self, event)¶Handles the wx.EVT_LEFT_UP
event for FlatMenuBar
.
Parameters: | event – a MouseEvent event to be processed. |
---|
OnMenuDismissed
(self, event)¶Handles the EVT_FLAT_MENU_DISMISSED
event for FlatMenuBar
.
Parameters: | event – a FlatMenuEvent event to be processed. |
---|
OnMouseMove
(self, event)¶Handles the wx.EVT_MOTION
event for FlatMenuBar
.
Parameters: | event – a MouseEvent event to be processed. |
---|
OnPaint
(self, event)¶Handles the wx.EVT_PAINT
event for FlatMenuBar
.
Parameters: | event – a PaintEvent event to be processed. |
---|
OnSize
(self, event)¶Handles the wx.EVT_SIZE
event for FlatMenuBar
.
Parameters: | event – a wx.SizeEvent event to be processed. |
---|
OnStatusBarTimer
(self)¶Handles the timer expiring to delete the longHelp string in the StatusBar
.
PopupMoreMenu
(self)¶Pops up the ‘more’ menu.
PositionAUI
(self, mgr, fixToolbar=True)¶Positions the control inside a wxAUI / PyAUI frame manager.
Parameters: |
|
---|
ProcessMouseMoveFromMenu
(self, pt)¶This function is called from child menus, this allow a child menu to pass the mouse movement event to the menu bar.
Parameters: | pt – an instance of wx.Point . |
---|
Remove
(self, pos)¶Removes the menu from the menu bar and returns the menu object - the caller is responsible for deleting it.
Parameters: | pos (integer) – the position of the menu in the menu bar. |
---|
Note
This function may be used together with Insert
to change the menubar
dynamically.
RemoveHelp
(self)¶Removes the tooltips and statusbar help (if any) for a button.
ResetToolbarItems
(self)¶Used internally.
SetBackgroundColour
(self, colour)¶Sets the menu bar background colour.
Parameters: | colour – a valid wx.Colour . |
---|
SetBarHeight
(self)¶Recalculates the FlatMenuBar
height when its settings change.
SetLCDMonitor
(self, lcd=True)¶Sets whether the PC monitor is an LCD or not.
Parameters: | lcd (bool) – True to use the settings appropriate for a LCD monitor,
False otherwise. |
---|
SetMargin
(self, margin)¶Sets the margin above and below the menu bar text.
Parameters: | margin (integer) – height in pixels of the margin. |
---|
SetOptions
(self, options)¶Sets the FlatMenuBar
options, whether to show a toolbar, to use LCD screen settings etc...
Parameters: | options (integer) – a combination of the following bits:
|
---|
SetSpacing
(self, spacer)¶Sets the spacing between the menubar items.
Parameters: | spacer (integer) – number of pixels between each menu item. |
---|
SetToolbarMargin
(self, margin)¶Sets the margin around the toolbar.
Parameters: | margin (integer) – width in pixels of the margin around the tools in the toolbar. |
---|
SetToolbarSpacing
(self, spacer)¶Sets the spacing between the toolbar tools.
Parameters: | spacer (integer) – number of pixels between each tool in the toolbar. |
---|
SetUpdateInterval
(self, interval)¶Sets the UpdateUI interval for toolbar items. All UpdateUI events are
sent from within OnIdle
handler, the default is 20 milliseconds.
Parameters: | interval (integer) – the updateUI interval in milliseconds. |
---|
ShowCustomize
(self, show=True)¶Shows/hides the drop-down arrow which allows customization of FlatMenu
.
Parameters: | show (bool) – True to show the customize menu, False to hide it. |
---|
UpdateAcceleratorTable
(self)¶Updates the parent accelerator table.