Browse Source

Fl_Flowpack: Improve layout.

tags/non-daw-v1.2.0
Jonathan Moore Liles 12 years ago
parent
commit
85e225810f
1 changed files with 26 additions and 6 deletions
  1. +26
    -6
      FL/Fl_Flowpack.H

+ 26
- 6
FL/Fl_Flowpack.H View File

@@ -99,6 +99,9 @@ public:

_max_width = 0;

int LW = 0;
int LH = 0;

for ( int i = 0; i < children(); ++i )
{
Fl_Widget *o = child( i );
@@ -108,12 +111,28 @@ public:

H = o->h() > H ? o->h() : H;

if ( _flow && X + o->w() >= W )
if ( _flow )
{

Y += H + _vspacing;
H = o->h();
X = 0;
if ( Y + o->h() < H )
{
/* if it'll fit in this column, put it below the previous widget */
X -= LW + _hspacing;
}
else if ( X + o->w() >= W )
{
/* maybe wrap to the next row */
H += o->h();

X = 0;
}
else
{
/* otherwise, put it in the next column */
Y = 0;
}

LW = o->w();
LH = o->h();
}

/* avoid bothering the control with lots of resize() calls */
@@ -121,7 +140,8 @@ public:
o->y() == y() + Y ) )
o->position( x() + X, y() + Y );

X += o->w() + _hspacing;
Y += LH + _vspacing;
X += LW + _hspacing;

if ( X > _max_width )
_max_width = X;


Loading…
Cancel
Save