From 4a021ae7d68a7b1701a6567ad14feea90b6a833f Mon Sep 17 00:00:00 2001 From: Jorge Arellano Cid Date: Fri, 5 Aug 2011 09:28:29 -0400 Subject: Fix: Don't confuse FLTK when tabs overflow. When tabs overflow width, FLTK starts resizing the last tab label. This patch handles the case more gracefully. --- src/ui.hh | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'src/ui.hh') diff --git a/src/ui.hh b/src/ui.hh index 57611f86..3b61f69b 100644 --- a/src/ui.hh +++ b/src/ui.hh @@ -48,6 +48,7 @@ class CustTabs; * The resizable child get's the remaining space. */ class CustGroupHorizontal : public Fl_Group { + Fl_Widget *rsz; public: CustGroupHorizontal(int x,int y,int w ,int h,const char *l = 0) : Fl_Group(x,y,w,h,l) { }; @@ -57,13 +58,24 @@ public: int sum = 0, _x = x(); int children_ = children(); + if (resizable()) + rsz = resizable(); + for (int i=0; i < children_; i++) if (a[i] != resizable() && a[i]->visible()) sum += a[i]->w(); for (int i=0; i < children_; i++) { - if (a[i] == resizable()) { - a[i]->resize(_x, y(), w() - sum, h()); + if (a[i] == rsz) { + if (w() > sum) { + a[i]->resize(_x, y(), w()-sum, h()); + if (!resizable()) + resizable(rsz); + } else { + /* widgets overflow width */ + a[i]->resize(_x, y(), 0, h()); + resizable(NULL); + } } else { a[i]->resize(_x, y(), a[i]->w(), h()); } -- cgit v1.2.3