diff options
author | Juan Linietsky <reduzio@gmail.com> | 2018-07-29 12:31:20 -0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-07-29 12:31:20 -0300 |
commit | 0fcc28b6f370c478d1990af51070f9fbee531c20 (patch) | |
tree | d00c731ee1e6c762c53a04c6833b7c7f59cc8c58 /scene/gui/tabs.cpp | |
parent | d2aaf460fbb5d743adae1ea079a24cdd834d659f (diff) | |
parent | 1bb13e95a89c57996d6d6d937e49a6329c03d940 (diff) | |
download | redot-engine-0fcc28b6f370c478d1990af51070f9fbee531c20.tar.gz |
Merge pull request #15269 from ianb96/context_menu_improvements
Context Menu Improvements
Diffstat (limited to 'scene/gui/tabs.cpp')
-rw-r--r-- | scene/gui/tabs.cpp | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/scene/gui/tabs.cpp b/scene/gui/tabs.cpp index 50bd1d867c..2075f7ce70 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; |