diff options
author | Jorge Arellano Cid <jcid@dillo.org> | 2011-08-05 09:40:34 -0400 |
---|---|---|
committer | Jorge Arellano Cid <jcid@dillo.org> | 2011-08-05 09:40:34 -0400 |
commit | 9eff7b30b70ee13501dba6e6061cd312b3a7186e (patch) | |
tree | f3304a6bae10e1ee6e454e34b8c3101f8b54868c | |
parent | 9458f15205966cf532a79925737d9098f8b2be5b (diff) | |
parent | dd05e2dddec41cefb3869749e6729f565fb3e821 (diff) |
merge
-rw-r--r-- | src/ui.hh | 21 | ||||
-rw-r--r-- | src/uicmd.cc | 12 |
2 files changed, 30 insertions, 3 deletions
@@ -31,6 +31,11 @@ typedef enum { UI_HIDDEN = 1 } UIPanelmode; + +// Min size to fit the full UI +#define UI_MIN_W 600 +#define UI_MIN_H 200 + // Private classes class CustProgressBox; class CustTabs; @@ -43,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) { }; @@ -52,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()); } diff --git a/src/uicmd.cc b/src/uicmd.cc index ca5100af..32b5e8bb 100644 --- a/src/uicmd.cc +++ b/src/uicmd.cc @@ -194,6 +194,11 @@ int CustTabs::handle(int e) a_Timeout_add(0.0, a_UIcmd_close_all_bw, NULL); ret = 1; } + } else if (e == FL_ENTER) { + /* WORKAROUND: when tabs overflow width, the resizable is set to NULL, + * and the close button loses its position. This call fixes it. */ + if (!resizable()) + rearrange(); } return (ret) ? ret : CustGroupHorizontal::handle(e); @@ -210,12 +215,16 @@ UI *CustTabs::add_new_tab(UI *old_ui, int focus) Wizard->resize(0,ctab_h,Wizard->w(),window()->h()-ctab_h); resize(0,0,window()->w(),ctab_h); // tabbar CloseBtn->show(); + child(0)->size(tab_w,ctab_h); child(0)->show(); // first tab button window()->init_sizes(); } + /* The UI is constructed in a comfortable fitting size, and then resized + * so FLTK doesn't get confused later with even smaller dimensions! */ current(0); - UI *new_ui = new UI(0,ctab_h,Wizard->w(),Wizard->h(),0,old_ui); + UI *new_ui = new UI(0,0,UI_MIN_W,UI_MIN_H,0,old_ui); + new_ui->resize(0,ctab_h,Wizard->w(),Wizard->h()); new_ui->tabs(this); Wizard->add(new_ui); new_ui->show(); @@ -271,6 +280,7 @@ void CustTabs::remove_tab(UI *ui) // hide tabbar ctab_h = 1; CloseBtn->hide(); + child(0)->size(0,0); child(0)->hide(); // first tab button resize(0,0,window()->w(),ctab_h); // tabbar Wizard->resize(0,ctab_h,Wizard->w(),window()->h()-ctab_h); |