X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Flineararrangement.cpp;h=6148be3b38ce4313bb4cb19073dbf958b3a413a6;hb=78e05360d70542d343401241ff9ddddfed18c5cd;hp=9e6441afaa8c72a3cdad8720f56ca0103186b20d;hpb=fef09a8d2fe38dcc8fd3beff3e132f945a4d4c8a;p=libs%2Fgltk.git diff --git a/source/lineararrangement.cpp b/source/lineararrangement.cpp index 9e6441a..6148be3 100644 --- a/source/lineararrangement.cpp +++ b/source/lineararrangement.cpp @@ -9,7 +9,8 @@ LinearArrangement::LinearArrangement(Layout &l, Side p): opposite(static_cast((primary+2)%4)), first(true), split_here(false), - gravity(opposite) + gravity(opposite), + internal_aligned(false) { } void LinearArrangement::split() @@ -29,7 +30,7 @@ void LinearArrangement::expand() throw arrangement_error("no widgets"); add_constraint(*edges[primary].widgets.front(), get_align_constraint(primary), primary); - layout.set_expand(*edges[primary].widgets.front(), false, true); + layout.set_expand(*edges[primary].widgets.front(), (primary==LEFT || primary==RIGHT), (primary==TOP || primary==BOTTOM)); edges[primary].align(); gravity = primary; } @@ -38,13 +39,13 @@ void LinearArrangement::process_widget(Widget &wdg, Side side, bool aligned) { if(side==opposite) { - bool snug = (edges[primary].aligned && aligned && !split_here); + bool snug = (internal_aligned && aligned && !split_here); add_constraint(wdg, get_order_constraint(primary, !snug), primary); if(first) - edges[side].add(wdg, aligned); + edges[side].add(wdg, (aligned && gravity==opposite)); } else if(side==primary) - next.add(wdg, (aligned && gravity==primary)); + next.add(wdg, aligned); else { if(edges[side].aligned && aligned) @@ -55,6 +56,9 @@ void LinearArrangement::process_widget(Widget &wdg, Side side, bool aligned) void LinearArrangement::finish_slot() { + internal_aligned = next.aligned; + if(gravity!=primary) + next.aligned = false; edges[primary] = next; next.clear(); split_here = false;