summaryrefslogtreecommitdiff
path: root/scene/gui/tabs.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'scene/gui/tabs.cpp')
-rw-r--r--scene/gui/tabs.cpp15
1 files changed, 14 insertions, 1 deletions
diff --git a/scene/gui/tabs.cpp b/scene/gui/tabs.cpp
index b114264de1..faf6e69e0f 100644
--- a/scene/gui/tabs.cpp
+++ b/scene/gui/tabs.cpp
@@ -189,7 +189,7 @@ void Tabs::_gui_input(const Ref<InputEvent> &p_event) {
update();
}
- if (mb->is_pressed() && mb->get_button_index() == BUTTON_LEFT) {
+ if (mb->is_pressed() && (mb->get_button_index() == BUTTON_LEFT || (select_with_rmb && mb->get_button_index() == BUTTON_RIGHT))) {
// clicks
Point2 pos(mb->get_position().x, mb->get_position().y);
@@ -920,6 +920,14 @@ int Tabs::get_tabs_rearrange_group() const {
return tabs_rearrange_group;
}
+void Tabs::set_select_with_rmb(bool p_enabled) {
+ select_with_rmb = p_enabled;
+}
+
+bool Tabs::get_select_with_rmb() const {
+ return select_with_rmb;
+}
+
void Tabs::_bind_methods() {
ClassDB::bind_method(D_METHOD("_gui_input"), &Tabs::_gui_input);
@@ -950,6 +958,9 @@ void Tabs::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_tabs_rearrange_group", "group_id"), &Tabs::set_tabs_rearrange_group);
ClassDB::bind_method(D_METHOD("get_tabs_rearrange_group"), &Tabs::get_tabs_rearrange_group);
+ ClassDB::bind_method(D_METHOD("set_select_with_rmb", "enabled"), &Tabs::set_select_with_rmb);
+ ClassDB::bind_method(D_METHOD("get_select_with_rmb"), &Tabs::get_select_with_rmb);
+
ADD_SIGNAL(MethodInfo("tab_changed", PropertyInfo(Variant::INT, "tab")));
ADD_SIGNAL(MethodInfo("right_button_pressed", PropertyInfo(Variant::INT, "tab")));
ADD_SIGNAL(MethodInfo("tab_close", PropertyInfo(Variant::INT, "tab")));
@@ -988,6 +999,8 @@ Tabs::Tabs() {
offset = 0;
max_drawn_tab = 0;
+ select_with_rmb = false;
+
min_width = 0;
scrolling_enabled = true;
buttons_visible = false;