summaryrefslogtreecommitdiffstats
path: root/doc/classes/EditorContextMenuPlugin.xml
diff options
context:
space:
mode:
authorkobewi <kobewi4e@gmail.com>2024-09-21 20:16:45 +0200
committerkobewi <kobewi4e@gmail.com>2024-09-21 20:16:45 +0200
commit866c50a9260be4f92f6131384c9cfccabb8df7a7 (patch)
tree48c6c1c0fd0a33fea91abed562fd9332e7ccf20c /doc/classes/EditorContextMenuPlugin.xml
parente4e024ab88efe74677769395886bc1b09eccbac7 (diff)
downloadredot-engine-866c50a9260be4f92f6131384c9cfccabb8df7a7.tar.gz
Add submenu support to EditorContextMenuPlugin
Diffstat (limited to 'doc/classes/EditorContextMenuPlugin.xml')
-rw-r--r--doc/classes/EditorContextMenuPlugin.xml18
1 files changed, 18 insertions, 0 deletions
diff --git a/doc/classes/EditorContextMenuPlugin.xml b/doc/classes/EditorContextMenuPlugin.xml
index 71c4ca0f9b..fb90a2a5cd 100644
--- a/doc/classes/EditorContextMenuPlugin.xml
+++ b/doc/classes/EditorContextMenuPlugin.xml
@@ -47,6 +47,24 @@
[/codeblock]
</description>
</method>
+ <method name="add_context_submenu_item">
+ <return type="void" />
+ <param index="0" name="name" type="String" />
+ <param index="1" name="menu" type="PopupMenu" />
+ <param index="2" name="icon" type="Texture2D" default="null" />
+ <description>
+ Add a submenu to the context menu of the plugin's specified slot. The submenu is not automatically handled, you need to connect to its signals yourself. Also the submenu is freed on every popup, so provide a new [PopupMenu] every time.
+ [codeblock]
+ func _popup_menu(paths):
+ var popup_menu = PopupMenu.new()
+ popup_menu.add_item("Blue")
+ popup_menu.add_item("White")
+ popup_menu.id_pressed.connect(_on_color_submenu_option)
+
+ add_context_menu_item("Set Node Color", popup_menu)
+ [/codeblock]
+ </description>
+ </method>
<method name="add_menu_shortcut">
<return type="void" />
<param index="0" name="shortcut" type="Shortcut" />