1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698
|
.. wxPython Phoenix documentation
This file was generated by Phoenix's sphinx generator and associated
tools, do not edit by hand.
Copyright: (c) 2011-2018 by Total Control Software
License: wxWindows License
.. include:: headings.inc
.. currentmodule:: wx.lib.agw.flatmenu
.. highlight:: python
.. _wx.lib.agw.flatmenu.FlatMenuBar:
==========================================================================================================================================
|phoenix_title| **wx.lib.agw.flatmenu.FlatMenuBar**
==========================================================================================================================================
Implements the generic owner-drawn menu bar for :class:`FlatMenu`.
|
|class_hierarchy| Class Hierarchy
=================================
.. raw:: html
<div id="toggleBlock" onclick="return toggleVisibility(this)" class="closed" style="cursor:pointer;">
<img id="toggleBlock-trigger" src="_static/images/closed.png"/>
Inheritance diagram for class <strong>FlatMenuBar</strong>:
</div>
<div id="toggleBlock-summary" style="display:block;"></div>
<div id="toggleBlock-content" style="display:none;">
<p class="graphviz">
<center><img src="_static/images/inheritance/wx.lib.agw.flatmenu.FlatMenuBar_inheritance.png" alt="Inheritance diagram of FlatMenuBar" usemap="#dummy" class="inheritance"/></center>
</div>
<script type="text/javascript">toggleVisibilityOnLoad(document.getElementById('toggleBlock'))</script>
<map id="dummy" name="dummy"> <area shape="rect" id="node1" href="wx.Panel.html" title="wx.Panel" alt="" coords="82,315,157,344"/> <area shape="rect" id="node3" href="wx.lib.agw.flatmenu.FlatMenuBar.html" title="wx.lib.agw.flatmenu.FlatMenuBar" alt="" coords="5,392,235,421"/> <area shape="rect" id="node2" href="wx.Window.html" title="wx.Window" alt="" coords="75,237,164,267"/> <area shape="rect" id="node4" href="wx.Trackable.html" title="wx.Trackable" alt="" coords="12,5,113,35"/> <area shape="rect" id="node5" href="wx.EvtHandler.html" title="wx.EvtHandler" alt="" coords="64,83,175,112"/> <area shape="rect" id="node7" href="wx.WindowBase.html" title="wx.WindowBase" alt="" coords="59,160,180,189"/> <area shape="rect" id="node6" href="wx.Object.html" title="wx.Object" alt="" coords="137,5,219,35"/> </map>
</p>
|
|appearance| Control Appearance
===============================
|
.. figure:: _static/images/widgets/fullsize/wxmsw/wx.lib.agw.flatmenu.flatmenubar.png
:alt: wxMSW
:figclass: floatleft
**wxMSW**
.. figure:: _static/images/widgets/fullsize/wxmac/../no_appearance.png
:alt: wxMAC
:figclass: floatright
**wxMAC**
.. figure:: _static/images/widgets/fullsize/wxgtk/../no_appearance.png
:alt: wxGTK
:figclass: floatcenter
**wxGTK**
|
|super_classes| Known Superclasses
==================================
:class:`wx.Panel`
|
|method_summary| Methods Summary
================================
================================================================================ ================================================================================
:meth:`~wx.lib.agw.flatmenu.FlatMenuBar.__init__` Default class constructor.
:meth:`~wx.lib.agw.flatmenu.FlatMenuBar.ActivateMenu` Activates a menu.
:meth:`~wx.lib.agw.flatmenu.FlatMenuBar.ActivateNextMenu` Activates next menu and make sure all others are non-active.
:meth:`~wx.lib.agw.flatmenu.FlatMenuBar.ActivatePreviousMenu` Activates previous menu and make sure all others are non-active.
:meth:`~wx.lib.agw.flatmenu.FlatMenuBar.AddCheckTool` Adds a new check (or toggle) tool to the toolbar.
:meth:`~wx.lib.agw.flatmenu.FlatMenuBar.AddControl` Adds any control to the toolbar, typically e.g. a combobox.
:meth:`~wx.lib.agw.flatmenu.FlatMenuBar.AddRadioTool` Adds a new radio tool to the toolbar.
:meth:`~wx.lib.agw.flatmenu.FlatMenuBar.AddSeparator` Adds a separator for spacing groups of tools in toolbar.
:meth:`~wx.lib.agw.flatmenu.FlatMenuBar.AddTool` Adds a tool to the toolbar.
:meth:`~wx.lib.agw.flatmenu.FlatMenuBar.Append` Adds the item to the end of the menu bar.
:meth:`~wx.lib.agw.flatmenu.FlatMenuBar.AppendToolbarItem` Appends a tool to the :class:`FlatMenuBar`.
:meth:`~wx.lib.agw.flatmenu.FlatMenuBar.ClearBitmaps` Restores a :class:`NullBitmap` for all the items in the menu.
:meth:`~wx.lib.agw.flatmenu.FlatMenuBar.CreateMoreMenu` Creates the drop down menu and populate it.
:meth:`~wx.lib.agw.flatmenu.FlatMenuBar.DoGiveHelp` Gives tooltips and help in :class:`StatusBar`.
:meth:`~wx.lib.agw.flatmenu.FlatMenuBar.DoMouseMove` Handles mouse move event.
:meth:`~wx.lib.agw.flatmenu.FlatMenuBar.DoToolbarAction` Performs a toolbar button pressed action.
:meth:`~wx.lib.agw.flatmenu.FlatMenuBar.DrawMoreButton` Draws 'more' button to the right side of the menu bar.
:meth:`~wx.lib.agw.flatmenu.FlatMenuBar.DrawToolbar` Draws the toolbar (if present).
:meth:`~wx.lib.agw.flatmenu.FlatMenuBar.DrawToolbarItem` Draws a toolbar item button.
:meth:`~wx.lib.agw.flatmenu.FlatMenuBar.FindMenu` Returns the index of the menu with the given title or ``wx.NOT_FOUND`` if
:meth:`~wx.lib.agw.flatmenu.FlatMenuBar.FindMenuItem` Finds the menu item object associated with the given menu item identifier.
:meth:`~wx.lib.agw.flatmenu.FlatMenuBar.GetActiveToolbarItem` Returns the active toolbar item.
:meth:`~wx.lib.agw.flatmenu.FlatMenuBar.GetBackgroundColour` Returns the menu bar background colour.
:meth:`~wx.lib.agw.flatmenu.FlatMenuBar.GetInvisibleMenuItemCount` Returns the number of invisible menu items.
:meth:`~wx.lib.agw.flatmenu.FlatMenuBar.GetInvisibleToolbarItemCount` Returns the number of invisible toolbar items.
:meth:`~wx.lib.agw.flatmenu.FlatMenuBar.GetLastVisibleMenu` Returns the index of the last visible menu on the menu bar.
:meth:`~wx.lib.agw.flatmenu.FlatMenuBar.GetMenu` Returns the menu at the specified index `menuIdx` (zero-based).
:meth:`~wx.lib.agw.flatmenu.FlatMenuBar.GetMenuCount` Returns the number of menus in the menubar.
:meth:`~wx.lib.agw.flatmenu.FlatMenuBar.GetMoreMenuButtonRect` Returns a rectangle region, as an instance of :class:`wx.Rect`, surrounding the menu button.
:meth:`~wx.lib.agw.flatmenu.FlatMenuBar.GetOptions` Returns the :class:`FlatMenuBar` options, whether to show a toolbar, to use LCD screen settings etc...
:meth:`~wx.lib.agw.flatmenu.FlatMenuBar.GetRenderer` Returns the renderer associated with this instance.
:meth:`~wx.lib.agw.flatmenu.FlatMenuBar.GetRendererManager` Returns the :class:`FlatMenuBar` renderer manager.
:meth:`~wx.lib.agw.flatmenu.FlatMenuBar.HitTest` HitTest method for :class:`FlatMenuBar`.
:meth:`~wx.lib.agw.flatmenu.FlatMenuBar.Insert` Inserts the menu at the given position into the menu bar.
:meth:`~wx.lib.agw.flatmenu.FlatMenuBar.OnAccelCmd` Single function to handle any accelerator key used inside the menubar.
:meth:`~wx.lib.agw.flatmenu.FlatMenuBar.OnCustomizeDlg` Handles the customize dialog here.
:meth:`~wx.lib.agw.flatmenu.FlatMenuBar.OnEraseBackground` Handles the ``wx.EVT_ERASE_BACKGROUND`` event for :class:`FlatMenuBar`.
:meth:`~wx.lib.agw.flatmenu.FlatMenuBar.OnIdle` Handles the ``wx.EVT_IDLE`` event for :class:`FlatMenuBar`.
:meth:`~wx.lib.agw.flatmenu.FlatMenuBar.OnLeaveMenuBar` Handles the ``wx.EVT_LEAVE_WINDOW`` event for :class:`FlatMenuBar`.
:meth:`~wx.lib.agw.flatmenu.FlatMenuBar.OnLeaveWindow` Handles the ``wx.EVT_LEAVE_WINDOW`` event for :class:`FlatMenuBar`.
:meth:`~wx.lib.agw.flatmenu.FlatMenuBar.OnLeftDown` Handles the ``wx.EVT_LEFT_DOWN`` event for :class:`FlatMenuBar`.
:meth:`~wx.lib.agw.flatmenu.FlatMenuBar.OnLeftUp` Handles the ``wx.EVT_LEFT_UP`` event for :class:`FlatMenuBar`.
:meth:`~wx.lib.agw.flatmenu.FlatMenuBar.OnMenuDismissed` Handles the ``EVT_FLAT_MENU_DISMISSED`` event for :class:`FlatMenuBar`.
:meth:`~wx.lib.agw.flatmenu.FlatMenuBar.OnMouseMove` Handles the ``wx.EVT_MOTION`` event for :class:`FlatMenuBar`.
:meth:`~wx.lib.agw.flatmenu.FlatMenuBar.OnPaint` Handles the ``wx.EVT_PAINT`` event for :class:`FlatMenuBar`.
:meth:`~wx.lib.agw.flatmenu.FlatMenuBar.OnSize` Handles the ``wx.EVT_SIZE`` event for :class:`FlatMenuBar`.
:meth:`~wx.lib.agw.flatmenu.FlatMenuBar.OnStatusBarTimer` Handles the timer expiring to delete the `longHelp` string in the :class:`StatusBar`.
:meth:`~wx.lib.agw.flatmenu.FlatMenuBar.PopupMoreMenu` Pops up the 'more' menu.
:meth:`~wx.lib.agw.flatmenu.FlatMenuBar.PositionAUI` Positions the control inside a wxAUI / PyAUI frame manager.
:meth:`~wx.lib.agw.flatmenu.FlatMenuBar.ProcessMouseMoveFromMenu` This function is called from child menus, this allow a child menu to
:meth:`~wx.lib.agw.flatmenu.FlatMenuBar.Remove` Removes the menu from the menu bar and returns the menu object - the
:meth:`~wx.lib.agw.flatmenu.FlatMenuBar.RemoveHelp` Removes the tooltips and statusbar help (if any) for a button.
:meth:`~wx.lib.agw.flatmenu.FlatMenuBar.ResetToolbarItems` Used internally.
:meth:`~wx.lib.agw.flatmenu.FlatMenuBar.SetBackgroundColour` Sets the menu bar background colour.
:meth:`~wx.lib.agw.flatmenu.FlatMenuBar.SetBarHeight` Recalculates the :class:`FlatMenuBar` height when its settings change.
:meth:`~wx.lib.agw.flatmenu.FlatMenuBar.SetLCDMonitor` Sets whether the PC monitor is an LCD or not.
:meth:`~wx.lib.agw.flatmenu.FlatMenuBar.SetMargin` Sets the margin above and below the menu bar text.
:meth:`~wx.lib.agw.flatmenu.FlatMenuBar.SetOptions` Sets the :class:`FlatMenuBar` options, whether to show a toolbar, to use LCD screen settings etc...
:meth:`~wx.lib.agw.flatmenu.FlatMenuBar.SetSpacing` Sets the spacing between the menubar items.
:meth:`~wx.lib.agw.flatmenu.FlatMenuBar.SetToolbarMargin` Sets the margin around the toolbar.
:meth:`~wx.lib.agw.flatmenu.FlatMenuBar.SetToolbarSpacing` Sets the spacing between the toolbar tools.
:meth:`~wx.lib.agw.flatmenu.FlatMenuBar.SetUpdateInterval` Sets the UpdateUI interval for toolbar items. All UpdateUI events are
:meth:`~wx.lib.agw.flatmenu.FlatMenuBar.ShowCustomize` Shows/hides the drop-down arrow which allows customization of :class:`FlatMenu`.
:meth:`~wx.lib.agw.flatmenu.FlatMenuBar.UpdateAcceleratorTable` Updates the parent accelerator table.
:meth:`~wx.lib.agw.flatmenu.FlatMenuBar.UpdateItem` An item was modified. This function is called by :class:`FlatMenu` in case
================================================================================ ================================================================================
|
|api| Class API
===============
.. class:: FlatMenuBar(wx.Panel)
Implements the generic owner-drawn menu bar for :class:`FlatMenu`.
.. method:: __init__(self, parent, id=wx.ID_ANY, iconSize=SmallIcons, spacer=SPACER, options=FM_OPT_SHOW_CUSTOMIZE|FM_OPT_IS_LCD)
Default class constructor.
:param `parent`: the menu bar parent, must not be ``None``;
:param integer `id`: the window identifier. If ``wx.ID_ANY``, will automatically create an identifier;
:param integer `iconSize`: size of the icons in the toolbar. This can be one of the
following values (in pixels):
==================== ======= =============================
`iconSize` Bit Value Description
==================== ======= =============================
``LargeIcons`` 32 Use large 32x32 icons
``SmallIcons`` 16 Use standard 16x16 icons
==================== ======= =============================
:param integer `spacer`: the space between the menu bar text and the menu bar border;
:param integer `options`: a combination of the following bits:
========================= ========= =============================
`options` Bit Hex Value Description
========================= ========= =============================
``FM_OPT_IS_LCD`` 0x1 Use this style if your computer uses a LCD screen
``FM_OPT_MINIBAR`` 0x2 Use this if you plan to use toolbar only
``FM_OPT_SHOW_CUSTOMIZE`` 0x4 Show "customize link" in more menus, you will need to write your own handler. See demo.
``FM_OPT_SHOW_TOOLBAR`` 0x8 Set this option is you are planing to use the toolbar
========================= ========= =============================
.. method:: ActivateMenu(self, menuInfo)
Activates a menu.
:param `menuInfo`: an instance of :class:`wx.MenuEntryInfo`.
.. method:: ActivateNextMenu(self)
Activates next menu and make sure all others are non-active.
.. method:: ActivatePreviousMenu(self)
Activates previous menu and make sure all others are non-active.
.. method:: AddCheckTool(self, toolId, label="", bitmap1=wx.NullBitmap, bitmap2=wx.NullBitmap, shortHelp="", longHelp="")
Adds a new check (or toggle) tool to the toolbar.
:see: :meth:`~FlatMenuBar.AddTool` for parameter descriptions.
.. method:: AddControl(self, control)
Adds any control to the toolbar, typically e.g. a combobox.
:param `control`: the control to be added, a subclass of :class:`wx.Window` (but no :class:`TopLevelWindow`).
.. method:: 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: :meth:`~FlatMenuBar.AddTool` for parameter descriptions.
.. method:: AddSeparator(self)
Adds a separator for spacing groups of tools in toolbar.
.. method:: AddTool(self, toolId, label="", bitmap1=wx.NullBitmap, bitmap2=wx.NullBitmap, kind=wx.ITEM_NORMAL, shortHelp="", longHelp="")
Adds a tool to the toolbar.
:param integer `toolId`: an integer by which the tool may be identified in subsequent
operations;
:param string `label`: the tool label string;
:param integer `kind`: may be ``wx.ITEM_NORMAL`` for a normal button (default),
``wx.ITEM_CHECK`` for a checkable tool (such tool stays pressed after it had been
toggled) or ``wx.ITEM_RADIO`` for a checkable tool which makes part of a radio
group of tools each of which is automatically unchecked whenever another button
in the group is checked;
:param `bitmap1`: the primary tool bitmap, an instance of :class:`wx.Bitmap`;
:param `bitmap2`: the bitmap used when the tool is disabled. If it is equal to
:class:`NullBitmap`, the disabled bitmap is automatically generated by greing out
the normal one;
:param string `shortHelp`: a string used for the tools tooltip;
:param string `longHelp`: this string is shown in the :class:`StatusBar` (if any) of the
parent frame when the mouse pointer is inside the tool.
.. method:: Append(self, menu, title)
Adds the item to the end of the menu bar.
:param `menu`: the menu to which we are appending a new item, an instance of :class:`FlatMenu`;
:param string `title`: the menu item label, must not be empty.
:see: :meth:`~FlatMenuBar.Insert`.
.. method:: AppendToolbarItem(self, item)
Appends a tool to the :class:`FlatMenuBar`.
.. deprecated:: 0.9.5
This method is now deprecated.
:see: :meth:`~FlatMenuBar.AddTool`
.. method:: ClearBitmaps(self, start=0)
Restores a :class:`NullBitmap` for all the items in the menu.
:param integer `start`: the index at which to start resetting the bitmaps.
.. method:: CreateMoreMenu(self)
Creates the drop down menu and populate it.
.. method:: DoGiveHelp(self, hit)
Gives tooltips and help in :class:`StatusBar`.
:param `hit`: the toolbar tool currently hovered by the mouse.
.. method:: DoMouseMove(self, pt, leftIsDown)
Handles mouse move event.
:param `pt`: an instance of :class:`wx.Point`;
:param bool `leftIsDown`: ``True`` is the left mouse button is down, ``False`` otherwise.
.. method:: DoToolbarAction(self, idx)
Performs a toolbar button pressed action.
:param integer `idx`: the tool index in the toolbar.
.. method:: DrawMoreButton(self, dc, state)
Draws 'more' button to the right side of the menu bar.
:param `dc`: an instance of :class:`wx.DC`;
:param integer `state`: the 'more' button state.
:see: :meth:`wx.MenuEntryInfo.SetState() <MenuEntryInfo.SetState>` for a list of valid menu states.
.. method:: DrawToolbar(self, dc, rect)
Draws the toolbar (if present).
:param `dc`: an instance of :class:`wx.DC`;
:param `rect`: the toolbar client rectangle, an instance of :class:`wx.Rect`.
.. method:: DrawToolbarItem(self, dc, idx, state)
Draws a toolbar item button.
:param `dc`: an instance of :class:`wx.DC`;
:param integer `idx`: the tool index in the toolbar;
:param integer `state`: the button state.
:see: :meth:`wx.MenuEntryInfo.SetState() <MenuEntryInfo.SetState>` for a list of valid menu states.
.. method:: 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.
:param string `title`: may specify either the menu title (with accelerator characters,
i.e. "&File") or just the menu label ("File") indifferently.
.. method:: FindMenuItem(self, id)
Finds the menu item object associated with the given menu item identifier.
:param integer `id`: the identifier for the sought :class:`FlatMenuItem`.
:return: The found menu item object, or ``None`` if one was not found.
.. method:: GetActiveToolbarItem(self)
Returns the active toolbar item.
.. method:: GetBackgroundColour(self)
Returns the menu bar background colour.
.. method:: GetInvisibleMenuItemCount(self)
Returns the number of invisible menu items.
:note: Valid only after the :class:`PaintEvent` has been processed after a resize.
.. method:: GetInvisibleToolbarItemCount(self)
Returns the number of invisible toolbar items.
:note: Valid only after the :class:`PaintEvent` has been processed after a resize.
.. method:: GetLastVisibleMenu(self)
Returns the index of the last visible menu on the menu bar.
.. method:: GetMenu(self, menuIdx)
Returns the menu at the specified index `menuIdx` (zero-based).
:param integer `menuIdx`: the index of the sought menu.
:return: The found menu item object, or ``None`` if one was not found.
.. method:: GetMenuCount(self)
Returns the number of menus in the menubar.
.. method:: GetMoreMenuButtonRect(self)
Returns a rectangle region, as an instance of :class:`wx.Rect`, surrounding the menu button.
.. method:: GetOptions(self)
Returns the :class:`FlatMenuBar` options, whether to show a toolbar, to use LCD screen settings etc...
:see: :meth:`~FlatMenuBar.SetOptions` for a list of valid options.
.. method:: GetRenderer(self)
Returns the renderer associated with this instance.
.. method:: GetRendererManager(self)
Returns the :class:`FlatMenuBar` renderer manager.
.. method:: HitTest(self, pt)
HitTest method for :class:`FlatMenuBar`.
:param `pt`: an instance of :class:`wx.Point`, specifying the hit test position.
:return: A tuple representing one of the following combinations:
========================= ==================================================
Return Tuple Description
========================= ==================================================
(-1, 0) The :meth:`~FlatMenuBar.HitTest` method didn't find any item with the specified input point `pt` (``NoWhere`` = 0)
(`integer`, 1) A menu item has been hit, its position specified by the tuple item `integer` (``MenuItem`` = 1)
(`integer`, 2) A toolbar item has ben hit, its position specified by the tuple item `integer` (``ToolbarItem`` = 2)
(-1, 3) The drop-down area button has been hit (``DropDownArrowButton`` = 3)
========================= ==================================================
.. method:: Insert(self, pos, menu, title)
Inserts the menu at the given position into the menu bar.
:param integer `pos`: the position of the new menu in the menu bar;
:param `menu`: the menu to add, an instance of :class:`FlatMenu`. :class:`FlatMenuBar` owns the menu and will free it;
:param string `title`: the title of the menu.
:note: Inserting menu at position 0 will insert it in the very beginning of it,
inserting at position :meth:`~FlatMenuBar.GetMenuCount` is the same as calling :meth:`~FlatMenuBar.Append`.
.. method:: OnAccelCmd(self, event)
Single function to handle any accelerator key used inside the menubar.
:param `event`: a :class:`FlatMenuEvent` event to be processed.
.. method:: OnCustomizeDlg(self, event)
Handles the customize dialog here.
:param `event`: a :class:`FlatMenuEvent` event to be processed.
.. method:: OnEraseBackground(self, event)
Handles the ``wx.EVT_ERASE_BACKGROUND`` event for :class:`FlatMenuBar`.
:param `event`: a :class:`EraseEvent` event to be processed.
:note: This method is intentionally empty to reduce flicker.
.. method:: OnIdle(self, event)
Handles the ``wx.EVT_IDLE`` event for :class:`FlatMenuBar`.
:param `event`: a :class:`IdleEvent` event to be processed.
.. method:: OnLeaveMenuBar(self, event)
Handles the ``wx.EVT_LEAVE_WINDOW`` event for :class:`FlatMenuBar`.
:param `event`: a :class:`MouseEvent` event to be processed.
:note: This method is for MSW only.
.. method:: OnLeaveWindow(self, event)
Handles the ``wx.EVT_LEAVE_WINDOW`` event for :class:`FlatMenuBar`.
:param `event`: a :class:`MouseEvent` event to be processed.
:note: This method is for GTK only.
.. method:: OnLeftDown(self, event)
Handles the ``wx.EVT_LEFT_DOWN`` event for :class:`FlatMenuBar`.
:param `event`: a :class:`MouseEvent` event to be processed.
.. method:: OnLeftUp(self, event)
Handles the ``wx.EVT_LEFT_UP`` event for :class:`FlatMenuBar`.
:param `event`: a :class:`MouseEvent` event to be processed.
.. method:: OnMenuDismissed(self, event)
Handles the ``EVT_FLAT_MENU_DISMISSED`` event for :class:`FlatMenuBar`.
:param `event`: a :class:`FlatMenuEvent` event to be processed.
.. method:: OnMouseMove(self, event)
Handles the ``wx.EVT_MOTION`` event for :class:`FlatMenuBar`.
:param `event`: a :class:`MouseEvent` event to be processed.
.. method:: OnPaint(self, event)
Handles the ``wx.EVT_PAINT`` event for :class:`FlatMenuBar`.
:param `event`: a :class:`PaintEvent` event to be processed.
.. method:: OnSize(self, event)
Handles the ``wx.EVT_SIZE`` event for :class:`FlatMenuBar`.
:param `event`: a :class:`wx.SizeEvent` event to be processed.
.. method:: OnStatusBarTimer(self)
Handles the timer expiring to delete the `longHelp` string in the :class:`StatusBar`.
.. method:: PopupMoreMenu(self)
Pops up the 'more' menu.
.. method:: PositionAUI(self, mgr, fixToolbar=True)
Positions the control inside a wxAUI / PyAUI frame manager.
:param `mgr`: an instance of :class:`~wx.lib.agw.aui.framemanager.AuiManager` or :class:`framemanager`;
:param bool `fixToolbar`: ``True`` if :class:`FlatMenuBar` can not be floated.
.. method:: 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.
:param `pt`: an instance of :class:`wx.Point`.
.. method:: Remove(self, pos)
Removes the menu from the menu bar and returns the menu object - the
caller is responsible for deleting it.
:param integer `pos`: the position of the menu in the menu bar.
:note: This function may be used together with :meth:`~FlatMenuBar.Insert` to change the menubar
dynamically.
.. method:: RemoveHelp(self)
Removes the tooltips and statusbar help (if any) for a button.
.. method:: ResetToolbarItems(self)
Used internally.
.. method:: SetBackgroundColour(self, colour)
Sets the menu bar background colour.
:param `colour`: a valid :class:`wx.Colour`.
.. method:: SetBarHeight(self)
Recalculates the :class:`FlatMenuBar` height when its settings change.
.. method:: SetLCDMonitor(self, lcd=True)
Sets whether the PC monitor is an LCD or not.
:param bool `lcd`: ``True`` to use the settings appropriate for a LCD monitor,
``False`` otherwise.
.. method:: SetMargin(self, margin)
Sets the margin above and below the menu bar text.
:param integer `margin`: height in pixels of the margin.
.. method:: SetOptions(self, options)
Sets the :class:`FlatMenuBar` options, whether to show a toolbar, to use LCD screen settings etc...
:param integer `options`: a combination of the following bits:
========================= ========= =============================
`options` Bit Hex Value Description
========================= ========= =============================
``FM_OPT_IS_LCD`` 0x1 Use this style if your computer uses a LCD screen
``FM_OPT_MINIBAR`` 0x2 Use this if you plan to use toolbar only
``FM_OPT_SHOW_CUSTOMIZE`` 0x4 Show "customize link" in more menus, you will need to write your own handler. See demo.
``FM_OPT_SHOW_TOOLBAR`` 0x8 Set this option is you are planing to use the toolbar
========================= ========= =============================
.. method:: SetSpacing(self, spacer)
Sets the spacing between the menubar items.
:param integer `spacer`: number of pixels between each menu item.
.. method:: SetToolbarMargin(self, margin)
Sets the margin around the toolbar.
:param integer `margin`: width in pixels of the margin around the tools in the toolbar.
.. method:: SetToolbarSpacing(self, spacer)
Sets the spacing between the toolbar tools.
:param integer `spacer`: number of pixels between each tool in the toolbar.
.. method:: SetUpdateInterval(self, interval)
Sets the UpdateUI interval for toolbar items. All UpdateUI events are
sent from within :meth:`~FlatMenuBar.OnIdle` handler, the default is 20 milliseconds.
:param integer `interval`: the updateUI interval in milliseconds.
.. method:: ShowCustomize(self, show=True)
Shows/hides the drop-down arrow which allows customization of :class:`FlatMenu`.
:param bool `show`: ``True`` to show the customize menu, ``False`` to hide it.
.. method:: UpdateAcceleratorTable(self)
Updates the parent accelerator table.
.. method:: UpdateItem(self, item)
An item was modified. This function is called by :class:`FlatMenu` in case
an item was modified directly and not via a :class:`UpdateUIEvent` event.
:param `item`: an instance of :class:`FlatMenu`.
|