class_menubutton.rst 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. :github_url: hide
  2. .. Generated automatically by doc/tools/makerst.py in Godot's source tree.
  3. .. DO NOT EDIT THIS FILE, but the MenuButton.xml source instead.
  4. .. The source is found in doc/classes or modules/<name>/doc_classes.
  5. .. _class_MenuButton:
  6. MenuButton
  7. ==========
  8. **Inherits:** :ref:`Button<class_Button>` **<** :ref:`BaseButton<class_BaseButton>` **<** :ref:`Control<class_Control>` **<** :ref:`CanvasItem<class_CanvasItem>` **<** :ref:`Node<class_Node>` **<** :ref:`Object<class_Object>`
  9. **Category:** Core
  10. Brief Description
  11. -----------------
  12. Special button that brings up a :ref:`PopupMenu<class_PopupMenu>` when clicked.
  13. Properties
  14. ----------
  15. +-----------------------------------------------+-------------------------------------------------------------------+-------------+
  16. | :ref:`ActionMode<enum_BaseButton_ActionMode>` | action_mode | **O:** 0 |
  17. +-----------------------------------------------+-------------------------------------------------------------------+-------------+
  18. | :ref:`FocusMode<enum_Control_FocusMode>` | enabled_focus_mode | **O:** 0 |
  19. +-----------------------------------------------+-------------------------------------------------------------------+-------------+
  20. | :ref:`bool<class_bool>` | flat | **O:** true |
  21. +-----------------------------------------------+-------------------------------------------------------------------+-------------+
  22. | :ref:`FocusMode<enum_Control_FocusMode>` | focus_mode | **O:** 0 |
  23. +-----------------------------------------------+-------------------------------------------------------------------+-------------+
  24. | :ref:`bool<class_bool>` | :ref:`switch_on_hover<class_MenuButton_property_switch_on_hover>` | false |
  25. +-----------------------------------------------+-------------------------------------------------------------------+-------------+
  26. | :ref:`bool<class_bool>` | toggle_mode | **O:** true |
  27. +-----------------------------------------------+-------------------------------------------------------------------+-------------+
  28. Methods
  29. -------
  30. +-----------------------------------+--------------------------------------------------------------------------------------------------------------------------+
  31. | :ref:`PopupMenu<class_PopupMenu>` | :ref:`get_popup<class_MenuButton_method_get_popup>` **(** **)** const |
  32. +-----------------------------------+--------------------------------------------------------------------------------------------------------------------------+
  33. | void | :ref:`set_disable_shortcuts<class_MenuButton_method_set_disable_shortcuts>` **(** :ref:`bool<class_bool>` disabled **)** |
  34. +-----------------------------------+--------------------------------------------------------------------------------------------------------------------------+
  35. Theme Properties
  36. ----------------
  37. +---------------------------------+---------------------+------------------------------+
  38. | :ref:`StyleBox<class_StyleBox>` | disabled | |
  39. +---------------------------------+---------------------+------------------------------+
  40. | :ref:`StyleBox<class_StyleBox>` | focus | |
  41. +---------------------------------+---------------------+------------------------------+
  42. | :ref:`Font<class_Font>` | font | |
  43. +---------------------------------+---------------------+------------------------------+
  44. | :ref:`Color<class_Color>` | font_color | Color( 0.88, 0.88, 0.88, 1 ) |
  45. +---------------------------------+---------------------+------------------------------+
  46. | :ref:`Color<class_Color>` | font_color_disabled | Color( 1, 1, 1, 0.3 ) |
  47. +---------------------------------+---------------------+------------------------------+
  48. | :ref:`Color<class_Color>` | font_color_hover | Color( 0.94, 0.94, 0.94, 1 ) |
  49. +---------------------------------+---------------------+------------------------------+
  50. | :ref:`Color<class_Color>` | font_color_pressed | Color( 1, 1, 1, 1 ) |
  51. +---------------------------------+---------------------+------------------------------+
  52. | :ref:`StyleBox<class_StyleBox>` | hover | |
  53. +---------------------------------+---------------------+------------------------------+
  54. | :ref:`int<class_int>` | hseparation | 3 |
  55. +---------------------------------+---------------------+------------------------------+
  56. | :ref:`StyleBox<class_StyleBox>` | normal | |
  57. +---------------------------------+---------------------+------------------------------+
  58. | :ref:`StyleBox<class_StyleBox>` | pressed | |
  59. +---------------------------------+---------------------+------------------------------+
  60. Signals
  61. -------
  62. .. _class_MenuButton_signal_about_to_show:
  63. - **about_to_show** **(** **)**
  64. Emitted when :ref:`PopupMenu<class_PopupMenu>` of this MenuButton is about to show.
  65. Description
  66. -----------
  67. Special button that brings up a :ref:`PopupMenu<class_PopupMenu>` when clicked. That's pretty much all it does, as it's just a helper class when building GUIs.
  68. Property Descriptions
  69. ---------------------
  70. .. _class_MenuButton_property_switch_on_hover:
  71. - :ref:`bool<class_bool>` **switch_on_hover**
  72. +-----------+----------------------------+
  73. | *Default* | false |
  74. +-----------+----------------------------+
  75. | *Setter* | set_switch_on_hover(value) |
  76. +-----------+----------------------------+
  77. | *Getter* | is_switch_on_hover() |
  78. +-----------+----------------------------+
  79. If ``true``, when the cursor hovers above another MenuButton within the same parent which also has ``switch_on_hover`` enabled, it will close the current MenuButton and open the other one.
  80. Method Descriptions
  81. -------------------
  82. .. _class_MenuButton_method_get_popup:
  83. - :ref:`PopupMenu<class_PopupMenu>` **get_popup** **(** **)** const
  84. Returns the :ref:`PopupMenu<class_PopupMenu>` contained in this button.
  85. .. _class_MenuButton_method_set_disable_shortcuts:
  86. - void **set_disable_shortcuts** **(** :ref:`bool<class_bool>` disabled **)**