summaryrefslogtreecommitdiff
path: root/doc/classes/RichTextLabel.xml
diff options
context:
space:
mode:
Diffstat (limited to 'doc/classes/RichTextLabel.xml')
-rw-r--r--doc/classes/RichTextLabel.xml105
1 files changed, 53 insertions, 52 deletions
diff --git a/doc/classes/RichTextLabel.xml b/doc/classes/RichTextLabel.xml
index 1ecc8a1d4e..5985af53fc 100644
--- a/doc/classes/RichTextLabel.xml
+++ b/doc/classes/RichTextLabel.xml
@@ -106,6 +106,45 @@
<return type="PopupMenu" />
<description>
Returns the [PopupMenu] of this [RichTextLabel]. By default, this menu is displayed when right-clicking on the [RichTextLabel].
+ You can add custom menu items or remove standard ones. Make sure your IDs don't conflict with the standard ones (see [enum MenuItems]). For example:
+ [codeblocks]
+ [gdscript]
+ func _ready():
+ var menu = get_menu()
+ # Remove "Select All" item.
+ menu.remove_item(MENU_SELECT_ALL)
+ # Add custom items.
+ menu.add_separator()
+ menu.add_item("Duplicate Text", MENU_MAX + 1)
+ # Connect callback.
+ menu.id_pressed.connect(_on_item_pressed)
+
+ func _on_item_pressed(id):
+ if id == MENU_MAX + 1:
+ add_text("\n" + get_parsed_text())
+ [/gdscript]
+ [csharp]
+ public override void _Ready()
+ {
+ var menu = GetMenu();
+ // Remove "Select All" item.
+ menu.RemoveItem(RichTextLabel.MenuItems.SelectAll);
+ // Add custom items.
+ menu.AddSeparator();
+ menu.AddItem("Duplicate Text", RichTextLabel.MenuItems.Max + 1);
+ // Add event handler.
+ menu.IdPressed += OnItemPressed;
+ }
+
+ public void OnItemPressed(int id)
+ {
+ if (id == TextEdit.MenuItems.Max + 1)
+ {
+ AddText("\n" + GetParsedText());
+ }
+ }
+ [/csharp]
+ [/codeblocks]
[b]Warning:[/b] This is a required internal node, removing and freeing it may cause a crash. If you wish to hide it or any of its children, use their [member Window.visible] property.
</description>
</method>
@@ -193,6 +232,13 @@
If [member threaded] is enabled, returns [code]true[/code] if the background thread has finished text processing, otherwise always return [code]true[/code].
</description>
</method>
+ <method name="menu_option">
+ <return type="void" />
+ <param index="0" name="option" type="int" />
+ <description>
+ Executes a given action as defined in the [enum MenuItems] enum.
+ </description>
+ </method>
<method name="newline">
<return type="void" />
<description>
@@ -327,7 +373,7 @@
<return type="void" />
<param index="0" name="data" type="Variant" />
<description>
- Adds a [code][meta][/code] tag to the tag stack. Similar to the BBCode [code][url=something]{text}[/url][/code], but supports non-[String] metadata types.
+ Adds a meta tag to the tag stack. Similar to the BBCode [code][url=something]{text}[/url][/code], but supports non-[String] metadata types.
</description>
</method>
<method name="push_mono">
@@ -579,59 +625,14 @@
<constant name="LIST_DOTS" value="3" enum="ListType">
Each list item has a filled circle marker.
</constant>
- <constant name="ITEM_FRAME" value="0" enum="ItemType">
- </constant>
- <constant name="ITEM_TEXT" value="1" enum="ItemType">
- </constant>
- <constant name="ITEM_IMAGE" value="2" enum="ItemType">
- </constant>
- <constant name="ITEM_NEWLINE" value="3" enum="ItemType">
- </constant>
- <constant name="ITEM_FONT" value="4" enum="ItemType">
- </constant>
- <constant name="ITEM_FONT_SIZE" value="5" enum="ItemType">
- </constant>
- <constant name="ITEM_FONT_FEATURES" value="6" enum="ItemType">
- </constant>
- <constant name="ITEM_COLOR" value="7" enum="ItemType">
- </constant>
- <constant name="ITEM_OUTLINE_SIZE" value="8" enum="ItemType">
- </constant>
- <constant name="ITEM_OUTLINE_COLOR" value="9" enum="ItemType">
- </constant>
- <constant name="ITEM_UNDERLINE" value="10" enum="ItemType">
- </constant>
- <constant name="ITEM_STRIKETHROUGH" value="11" enum="ItemType">
- </constant>
- <constant name="ITEM_PARAGRAPH" value="12" enum="ItemType">
- </constant>
- <constant name="ITEM_INDENT" value="13" enum="ItemType">
- </constant>
- <constant name="ITEM_LIST" value="14" enum="ItemType">
- </constant>
- <constant name="ITEM_TABLE" value="15" enum="ItemType">
- </constant>
- <constant name="ITEM_FADE" value="16" enum="ItemType">
- </constant>
- <constant name="ITEM_SHAKE" value="17" enum="ItemType">
- </constant>
- <constant name="ITEM_WAVE" value="18" enum="ItemType">
- </constant>
- <constant name="ITEM_TORNADO" value="19" enum="ItemType">
- </constant>
- <constant name="ITEM_RAINBOW" value="20" enum="ItemType">
- </constant>
- <constant name="ITEM_BGCOLOR" value="21" enum="ItemType">
- </constant>
- <constant name="ITEM_FGCOLOR" value="22" enum="ItemType">
- </constant>
- <constant name="ITEM_META" value="23" enum="ItemType">
- </constant>
- <constant name="ITEM_HINT" value="24" enum="ItemType">
+ <constant name="MENU_COPY" value="0" enum="MenuItems">
+ Copies the selected text.
</constant>
- <constant name="ITEM_DROPCAP" value="25" enum="ItemType">
+ <constant name="MENU_SELECT_ALL" value="1" enum="MenuItems">
+ Selects the whole [RichTextLabel] text.
</constant>
- <constant name="ITEM_CUSTOMFX" value="26" enum="ItemType">
+ <constant name="MENU_MAX" value="2" enum="MenuItems">
+ Represents the size of the [enum MenuItems] enum.
</constant>
</constants>
<theme_items>