summaryrefslogtreecommitdiff
path: root/src/Fl_Pack.cxx
diff options
context:
space:
mode:
authorMichael R Sweet <michael.r.sweet@gmail.com>2001-12-19 15:49:39 +0000
committerMichael R Sweet <michael.r.sweet@gmail.com>2001-12-19 15:49:39 +0000
commitb9663d5e144d7e0fb6fd892825f4c81eb03f383b (patch)
tree5bb52a322c463d1161a4cfa0be8ec57f0c42ae63 /src/Fl_Pack.cxx
parent1fceb8ac2cff3e04e91a3f37fc2641dca72d5ec5 (diff)
Allow any child widget to be resizable in Fl_Pack.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@1875 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'src/Fl_Pack.cxx')
-rw-r--r--src/Fl_Pack.cxx28
1 files changed, 24 insertions, 4 deletions
diff --git a/src/Fl_Pack.cxx b/src/Fl_Pack.cxx
index af5f94194..f67c05f1b 100644
--- a/src/Fl_Pack.cxx
+++ b/src/Fl_Pack.cxx
@@ -1,5 +1,5 @@
//
-// "$Id: Fl_Pack.cxx,v 1.6.2.4 2001/01/22 15:13:40 easysw Exp $"
+// "$Id: Fl_Pack.cxx,v 1.6.2.4.2.1 2001/12/19 15:49:39 easysw Exp $"
//
// Packing widget for the Fast Light Tool Kit (FLTK).
//
@@ -44,10 +44,30 @@ void Fl_Pack::draw() {
int ty = y()+Fl::box_dy(box());
int tw = w()-Fl::box_dw(box());
int th = h()-Fl::box_dh(box());
+ int rw, rh;
int current_position = horizontal() ? tx : ty;
int maximum_position = current_position;
uchar d = damage();
Fl_Widget*const* a = array();
+ if (horizontal()) {
+ rw = -spacing_;
+ rh = th;
+
+ for (int i = children(); i--;)
+ if (child(i)->visible()) {
+ if (child(i) != this->resizable()) rw += child(i)->w();
+ rw += spacing_;
+ }
+ } else {
+ rw = tw;
+ rh = -spacing_;
+
+ for (int i = children(); i--;)
+ if (child(i)->visible()) {
+ if (child(i) != this->resizable()) rh += child(i)->h();
+ rh += spacing_;
+ }
+ }
for (int i = children(); i--;) {
Fl_Widget* o = *a++;
if (o->visible()) {
@@ -66,9 +86,9 @@ void Fl_Pack::draw() {
// Last child, if resizable, takes all remaining room
if(i == 0 && o == this->resizable()) {
if(horizontal())
- W = this->w() - Fl::box_dw(box()) - maximum_position;
+ W = tw - rw;
else
- H = this->h() - Fl::box_dh(box()) - maximum_position;
+ H = th - rh;
}
if (spacing_ && current_position>maximum_position &&
(X != o->x() || Y != o->y() || d&FL_DAMAGE_ALL)) {
@@ -112,5 +132,5 @@ void Fl_Pack::draw() {
}
//
-// End of "$Id: Fl_Pack.cxx,v 1.6.2.4 2001/01/22 15:13:40 easysw Exp $".
+// End of "$Id: Fl_Pack.cxx,v 1.6.2.4.2.1 2001/12/19 15:49:39 easysw Exp $".
//