diff options
| author | Michael R Sweet <michael.r.sweet@gmail.com> | 2004-04-06 18:32:52 +0000 |
|---|---|---|
| committer | Michael R Sweet <michael.r.sweet@gmail.com> | 2004-04-06 18:32:52 +0000 |
| commit | aa00aba5c19aa87922d12cc6664a78aa7ff56b85 (patch) | |
| tree | 728bd6e105201e4ab4285f7b8478f8ee3c4c4c4f /fluid/align_widget.cxx | |
| parent | 7fdbfc61bee6b6a22c6c24fbd80a79cf08cdd51e (diff) | |
FLUID's Layout functionality did not move child widgets when
laying out group widgets (STR #319)
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@3301 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'fluid/align_widget.cxx')
| -rw-r--r-- | fluid/align_widget.cxx | 110 |
1 files changed, 95 insertions, 15 deletions
diff --git a/fluid/align_widget.cxx b/fluid/align_widget.cxx index ad5544610..dcadf1410 100644 --- a/fluid/align_widget.cxx +++ b/fluid/align_widget.cxx @@ -1,5 +1,5 @@ // -// "$Id: align_widget.cxx,v 1.1.2.5 2004/04/06 17:38:36 easysw Exp $" +// "$Id: align_widget.cxx,v 1.1.2.6 2004/04/06 18:32:52 easysw Exp $" // // alignment code for the Fast Light Tool Kit (FLTK). // @@ -57,7 +57,13 @@ void align_widget_cb(Fl_Widget*, long how) if (o->selected && o->is_widget()) { Fl_Widget *w = ((Fl_Widget_Type *)o)->o; - w->resize(left, w->y(), w->w(), w->h()); + if (o->next && o->next->level > o->level && !o->next->selected) { + // When resizing a group, make sure we also move the children... + ((igroup *)w)->full_resize(left, w->y(), w->w(), w->h()); + } else { + // Otherwise, just do the widget... + w->resize(left, w->y(), w->w(), w->h()); + } w->redraw(); if (w->window()) w->window()->redraw(); } @@ -81,7 +87,13 @@ void align_widget_cb(Fl_Widget*, long how) if (o->selected && o->is_widget()) { Fl_Widget *w = ((Fl_Widget_Type *)o)->o; - w->resize((center2-w->w())/2, w->y(), w->w(), w->h()); + if (o->next && o->next->level > o->level && !o->next->selected) { + // When resizing a group, make sure we also move the children... + ((igroup *)w)->full_resize((center2-w->w())/2, w->y(), w->w(), w->h()); + } else { + // Otherwise, just do the widget... + w->resize((center2-w->w())/2, w->y(), w->w(), w->h()); + } w->redraw(); if (w->window()) w->window()->redraw(); } @@ -102,7 +114,13 @@ void align_widget_cb(Fl_Widget*, long how) if (o->selected && o->is_widget()) { Fl_Widget *w = ((Fl_Widget_Type *)o)->o; - w->resize(right-w->w(), w->y(), w->w(), w->h()); + if (o->next && o->next->level > o->level && !o->next->selected) { + // When resizing a group, make sure we also move the children... + ((igroup *)w)->full_resize(right-w->w(), w->y(), w->w(), w->h()); + } else { + // Otherwise, just do the widget... + w->resize(right-w->w(), w->y(), w->w(), w->h()); + } w->redraw(); if (w->window()) w->window()->redraw(); } @@ -122,7 +140,13 @@ void align_widget_cb(Fl_Widget*, long how) if (o->selected && o->is_widget()) { Fl_Widget *w = ((Fl_Widget_Type *)o)->o; - w->resize(w->x(), top, w->w(), w->h()); + if (o->next && o->next->level > o->level && !o->next->selected) { + // When resizing a group, make sure we also move the children... + ((igroup *)w)->full_resize(w->x(), top, w->w(), w->h()); + } else { + // Otherwise, just do the widget... + w->resize(w->x(), top, w->w(), w->h()); + } w->redraw(); if (w->window()) w->window()->redraw(); } @@ -146,7 +170,13 @@ void align_widget_cb(Fl_Widget*, long how) if (o->selected && o->is_widget()) { Fl_Widget *w = ((Fl_Widget_Type *)o)->o; - w->resize(w->x(), (center2-w->h())/2, w->w(), w->h()); + if (o->next && o->next->level > o->level && !o->next->selected) { + // When resizing a group, make sure we also move the children... + ((igroup *)w)->full_resize(w->x(), (center2-w->h())/2, w->w(), w->h()); + } else { + // Otherwise, just do the widget... + w->resize(w->x(), (center2-w->h())/2, w->w(), w->h()); + } w->redraw(); if (w->window()) w->window()->redraw(); } @@ -167,7 +197,13 @@ void align_widget_cb(Fl_Widget*, long how) if (o->selected && o->is_widget()) { Fl_Widget *w = ((Fl_Widget_Type *)o)->o; - w->resize( w->x(), bot-w->h(), w->w(), w->h()); + if (o->next && o->next->level > o->level && !o->next->selected) { + // When resizing a group, make sure we also move the children... + ((igroup *)w)->full_resize( w->x(), bot-w->h(), w->w(), w->h()); + } else { + // Otherwise, just do the widget... + w->resize( w->x(), bot-w->h(), w->w(), w->h()); + } w->redraw(); if (w->window()) w->window()->redraw(); } @@ -195,7 +231,13 @@ void align_widget_cb(Fl_Widget*, long how) if (o->selected && o->is_widget()) { Fl_Widget *w = ((Fl_Widget_Type *)o)->o; - w->resize(left+wsum+wdt*cnt/n, w->y(), w->w(), w->h()); + if (o->next && o->next->level > o->level && !o->next->selected) { + // When resizing a group, make sure we also move the children... + ((igroup *)w)->full_resize(left+wsum+wdt*cnt/n, w->y(), w->w(), w->h()); + } else { + // Otherwise, just do the widget... + w->resize(left+wsum+wdt*cnt/n, w->y(), w->w(), w->h()); + } w->redraw(); if (w->window()) w->window()->redraw(); cnt++; @@ -225,7 +267,13 @@ void align_widget_cb(Fl_Widget*, long how) if (o->selected && o->is_widget()) { Fl_Widget *w = ((Fl_Widget_Type *)o)->o; - w->resize(w->x(), top+hsum+hgt*cnt/n, w->w(), w->h()); + if (o->next && o->next->level > o->level && !o->next->selected) { + // When resizing a group, make sure we also move the children... + ((igroup *)w)->full_resize(w->x(), top+hsum+hgt*cnt/n, w->w(), w->h()); + } else { + // Otherwise, just do the widget... + w->resize(w->x(), top+hsum+hgt*cnt/n, w->w(), w->h()); + } w->redraw(); if (w->window()) w->window()->redraw(); cnt++; @@ -249,7 +297,13 @@ void align_widget_cb(Fl_Widget*, long how) if (o->selected && o->is_widget()) { Fl_Widget *w = ((Fl_Widget_Type *)o)->o; - w->resize( w->x(), w->y(), wdt, w->h()); + if (o->next && o->next->level > o->level && !o->next->selected) { + // When resizing a group, make sure we also move the children... + ((igroup *)w)->full_resize(w->x(), w->y(), wdt, w->h()); + } else { + // Otherwise, just do the widget... + w->resize(w->x(), w->y(), wdt, w->h()); + } w->redraw(); if (w->window()) w->window()->redraw(); } @@ -269,7 +323,13 @@ void align_widget_cb(Fl_Widget*, long how) if (o->selected && o->is_widget()) { Fl_Widget *w = ((Fl_Widget_Type *)o)->o; - w->resize( w->x(), w->y(), w->w(), hgt); + if (o->next && o->next->level > o->level && !o->next->selected) { + // When resizing a group, make sure we also move the children... + ((igroup *)w)->full_resize( w->x(), w->y(), w->w(), hgt); + } else { + // Otherwise, just do the widget... + w->resize( w->x(), w->y(), w->w(), hgt); + } w->redraw(); if (w->window()) w->window()->redraw(); } @@ -291,7 +351,13 @@ void align_widget_cb(Fl_Widget*, long how) if (o->selected && o->is_widget()) { Fl_Widget *w = ((Fl_Widget_Type *)o)->o; - w->resize( w->x(), w->y(), wdt, hgt); + if (o->next && o->next->level > o->level && !o->next->selected) { + // When resizing a group, make sure we also move the children... + ((igroup *)w)->full_resize( w->x(), w->y(), wdt, hgt); + } else { + // Otherwise, just do the widget... + w->resize( w->x(), w->y(), wdt, hgt); + } w->redraw(); if (w->window()) w->window()->redraw(); } @@ -307,7 +373,14 @@ void align_widget_cb(Fl_Widget*, long how) if (w->window() == p) center2 = p->w(); else center2 = 2*p->x()+p->w(); - w->resize((center2-w->w())/2, w->y(), w->w(), w->h()); + + if (o->next && o->next->level > o->level && !o->next->selected) { + // When resizing a group, make sure we also move the children... + ((igroup *)w)->full_resize((center2-w->w())/2, w->y(), w->w(), w->h()); + } else { + // Otherwise, just do the widget... + w->resize((center2-w->w())/2, w->y(), w->w(), w->h()); + } w->redraw(); if (w->window()) w->window()->redraw(); } @@ -322,7 +395,14 @@ void align_widget_cb(Fl_Widget*, long how) if (w->window() == p) center2 = p->h(); else center2 = 2*p->y()+p->h(); - w->resize(w->x(), (center2-w->h())/2, w->w(), w->h()); + + if (o->next && o->next->level > o->level && !o->next->selected) { + // When resizing a group, make sure we also move the children... + ((igroup *)w)->full_resize(w->x(), (center2-w->h())/2, w->w(), w->h()); + } else { + // Otherwise, just do the widget... + w->resize(w->x(), (center2-w->h())/2, w->w(), w->h()); + } w->redraw(); if (w->window()) w->window()->redraw(); } @@ -332,6 +412,6 @@ void align_widget_cb(Fl_Widget*, long how) // -// End of "$Id: align_widget.cxx,v 1.1.2.5 2004/04/06 17:38:36 easysw Exp $". +// End of "$Id: align_widget.cxx,v 1.1.2.6 2004/04/06 18:32:52 easysw Exp $". // |
