From 62fdf733487493dfb330720cdc37d032d8b50962 Mon Sep 17 00:00:00 2001 From: Michael Alexsander Date: Sun, 21 Aug 2022 18:06:07 -0300 Subject: [PATCH] Expose `set/get_tab_button_icon()` to scripting --- doc/classes/Tabs.xml | 17 ++++++++++++++++- scene/gui/tabs.cpp | 4 +++- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/doc/classes/Tabs.xml b/doc/classes/Tabs.xml index 971c3f855..777d7a880 100644 --- a/doc/classes/Tabs.xml +++ b/doc/classes/Tabs.xml @@ -42,6 +42,13 @@ Returns [code]true[/code] if select with right mouse button is enabled. + + + + + Returns the button icon from the tab at index [code]tab_idx[/code]. + + @@ -110,6 +117,14 @@ If [code]true[/code], enables selecting a tab with the right mouse button. + + + + + + Sets the button icon from the tab at index [code]tab_idx[/code]. + + @@ -169,7 +184,7 @@ - Emitted when a tab is right-clicked. + Emitted when a tab's right button is pressed. See [method set_tab_button_icon]. diff --git a/scene/gui/tabs.cpp b/scene/gui/tabs.cpp index 2f1e9fe8d..1483cdd92 100644 --- a/scene/gui/tabs.cpp +++ b/scene/gui/tabs.cpp @@ -139,7 +139,7 @@ void Tabs::_gui_input(const Ref &p_event) { if (rb_pressing && !mb->is_pressed() && mb->get_button_index() == BUTTON_LEFT) { if (rb_hover != -1) { - // Right mouse button pressed. + // Right tab button pressed. emit_signal("right_button_pressed", rb_hover); } @@ -955,6 +955,8 @@ void Tabs::_bind_methods() { ClassDB::bind_method(D_METHOD("get_tab_title", "tab_idx"), &Tabs::get_tab_title); ClassDB::bind_method(D_METHOD("set_tab_icon", "tab_idx", "icon"), &Tabs::set_tab_icon); ClassDB::bind_method(D_METHOD("get_tab_icon", "tab_idx"), &Tabs::get_tab_icon); + ClassDB::bind_method(D_METHOD("set_tab_button_icon", "tab_idx", "icon"), &Tabs::set_tab_right_button); + ClassDB::bind_method(D_METHOD("get_tab_button_icon", "tab_idx"), &Tabs::get_tab_right_button); ClassDB::bind_method(D_METHOD("set_tab_disabled", "tab_idx", "disabled"), &Tabs::set_tab_disabled); ClassDB::bind_method(D_METHOD("get_tab_disabled", "tab_idx"), &Tabs::get_tab_disabled); ClassDB::bind_method(D_METHOD("remove_tab", "tab_idx"), &Tabs::remove_tab);