diff options
| author | Albrecht Schlosser <albrechts.fltk@online.de> | 2008-09-07 11:22:14 +0000 |
|---|---|---|
| committer | Albrecht Schlosser <albrechts.fltk@online.de> | 2008-09-07 11:22:14 +0000 |
| commit | 84e98c0ce9e66b194c5982c841a0fd03e8022047 (patch) | |
| tree | c5876f5d1bce573e1dc4faa8ff4be18d437591f3 /src/Fl_Group.cxx | |
| parent | 2ca98888465cbb9218669710719780b4749529bd (diff) | |
modified resize behavior, as discussed in STR 2032.
Fl_Group.cxx: resizes itself before changing its children
Fl_Scroll.cxx: similar change
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@6192 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'src/Fl_Group.cxx')
| -rw-r--r-- | src/Fl_Group.cxx | 29 |
1 files changed, 16 insertions, 13 deletions
diff --git a/src/Fl_Group.cxx b/src/Fl_Group.cxx index c5656e615..43f6d8d07 100644 --- a/src/Fl_Group.cxx +++ b/src/Fl_Group.cxx @@ -420,8 +420,8 @@ void Fl_Group::remove(Fl_Widget &o) { // sizes array stores the initial positions of widgets as // left,right,top,bottom quads. The first quad is the group, the // second is the resizable (clipped to the group), and the -// rest are the children. This is a convienent order for the -// algorithim. If you change this be sure to fix Fl_Tile which +// rest are the children. This is a convenient order for the +// algorithm. If you change this be sure to fix Fl_Tile which // also uses this array! void Fl_Group::init_sizes() { @@ -463,11 +463,18 @@ int *Fl_Group::sizes() { void Fl_Group::resize(int X, int Y, int W, int H) { - if (!resizable() || W==w() && H==h() ) { + int dx = X-x(); + int dy = Y-y(); + int dw = W-w(); + int dh = H-h(); + + int *p = sizes(); // save initial sizes and positions + + Fl_Widget::resize(X,Y,W,H); // make new xywh values visible for children + + if (!resizable() || dw==0 && dh==0 ) { if (type() < FL_WINDOW) { - int dx = X-x(); - int dy = Y-y(); Fl_Widget*const* a = array(); for (int i=children_; i--;) { Fl_Widget* o = *a++; @@ -477,13 +484,11 @@ void Fl_Group::resize(int X, int Y, int W, int H) { } else if (children_) { - int *p = sizes(); - // get changes in size/position from the initial size: - int dx = X - p[0]; - int dw = W - (p[1]-p[0]); - int dy = Y - p[2]; - int dh = H - (p[3]-p[2]); + dx = X - p[0]; + dw = W - (p[1]-p[0]); + dy = Y - p[2]; + dh = H - (p[3]-p[2]); if (type() >= FL_WINDOW) dx = dy = 0; p += 4; @@ -528,8 +533,6 @@ void Fl_Group::resize(int X, int Y, int W, int H) { o->resize(XX+dx, YY+dy, R-XX, B-YY); } } - - Fl_Widget::resize(X,Y,W,H); } void Fl_Group::draw_children() { |
