X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fcolumn.cpp;h=e7f709531a06f2e5785ac9e070c7aef31f6f988d;hb=32539688068fad9614291159b069da10ead10f47;hp=d31544ab2627ed88c5fc529c733651257e49caf9;hpb=b30edd979e6e9c7acfaaf3a90903814a7e62a71e;p=libs%2Fgltk.git diff --git a/source/column.cpp b/source/column.cpp index d31544a..e7f7095 100644 --- a/source/column.cpp +++ b/source/column.cpp @@ -4,60 +4,12 @@ namespace Msp { namespace GLtk { Column::Column(Layout &l): - Arrangement(l), - first(true), - split_here(false), - gravity(1) + LinearArrangement(l, BOTTOM) { } -void Column::split() -{ - split_here = true; - gravity = -1; -} - -void Column::process_widget(Widget &wdg, Side side, bool aligned) -{ - if(side==TOP) - { - bool snug = (edges[BOTTOM].aligned && aligned && !split_here); - add_constraint(wdg, (snug ? Layout::BELOW : Layout::FAR_BELOW), BOTTOM); - if(first) - edges[TOP].add(wdg, aligned); - } - else if(side==BOTTOM) - next_bottom.add(wdg, (aligned && gravity<0)); - else - { - if(edges[side].aligned && aligned) - add_constraint(wdg, (side==LEFT ? Layout::ALIGN_LEFT : Layout::ALIGN_RIGHT), side); - edges[side].add(wdg, aligned); - } -} - void Column::finish_widget(Widget &wdg) { - layout.set_gravity(wdg, -1, gravity); -} - -void Column::finish_slot() -{ - edges[BOTTOM] = next_bottom; - next_bottom.clear(); - split_here = false; - first = false; -} - - -Column::Loader::Loader(Column &c): - DataFile::ObjectLoader(c) -{ - add("split", &Loader::split); -} - -void Column::Loader::split() -{ - obj.split(); + layout.set_gravity(wdg, -1, (gravity==BOTTOM ? -1 : 1)); } } // namespace GLtk