From dfbc2dce177462506d9c41dfaa867dd76bd136a7 Mon Sep 17 00:00:00 2001 From: Juan Linietsky Date: Fri, 22 Jan 2016 20:19:57 -0300 Subject: -Improved tab visibility, fixes #3314 --- scene/gui/tabs.cpp | 41 +++++++++++++++++++++++++++++++++++++++++ scene/gui/tabs.h | 1 + 2 files changed, 42 insertions(+) (limited to 'scene/gui') diff --git a/scene/gui/tabs.cpp b/scene/gui/tabs.cpp index a26acc9c05..ecce71bdbd 100644 --- a/scene/gui/tabs.cpp +++ b/scene/gui/tabs.cpp @@ -243,6 +243,10 @@ void Tabs::_notification(int p_what) { hover=-1; update(); } break; + case NOTIFICATION_RESIZED: { + + _ensure_no_over_offset(); + } break; case NOTIFICATION_DRAW: { RID ci = get_canvas_item(); @@ -587,6 +591,8 @@ void Tabs::remove_tab(int p_idx) { //emit_signal("tab_changed",current); + _ensure_no_over_offset(); + } @@ -645,6 +651,39 @@ int Tabs::get_tab_width(int p_idx) const { return x; } + +void Tabs::_ensure_no_over_offset() { + + if (!is_inside_tree()) + return; + + Ref incr = get_icon("increment"); + Ref decr = get_icon("decrement"); + + int limit=get_size().width-incr->get_width()-decr->get_width(); + + while(offset>0) { + + int total_w=0; + for(int i=0;i