]> git.tdb.fi Git - libs/gltk.git/blobdiff - source/row.cpp
Combine common parts of Column and Row into LinearArrangement
[libs/gltk.git] / source / row.cpp
index 92f3fe62b19e77c8bdf9792f033420be58f88347..0188f4a663c4dec2a75e71abadd285fab640759e 100644 (file)
@@ -4,63 +4,12 @@ namespace Msp {
 namespace GLtk {
 
 Row::Row(Layout &l):
-       Arrangement(l),
-       first(true),
-       split_here(false),
-       gravity(-1)
+       LinearArrangement(l, RIGHT)
 { }
 
-void Row::split()
-{
-       if(gravity>0)
-               throw arrangement_error("already split");
-
-       split_here = true;
-       gravity = 1;
-}
-
-void Row::process_widget(Widget &wdg, Side side, bool aligned)
-{
-       if(side==LEFT)
-       {
-               bool snug = (edges[RIGHT].aligned && aligned && !split_here);
-               add_constraint(wdg, (snug ? Layout::RIGHT_OF : Layout::FAR_RIGHT_OF), RIGHT);
-               if(first)
-                       edges[LEFT].add(wdg, aligned);
-       }
-       else if(side==RIGHT)
-               next_right.add(wdg, (aligned && gravity>0));
-       else
-       {
-               if(edges[side].aligned && aligned)
-                       add_constraint(wdg, (side==TOP ? Layout::ALIGN_TOP : Layout::ALIGN_BOTTOM), side);
-               edges[side].add(wdg, aligned);
-       }
-}
-
 void Row::finish_widget(Widget &wdg)
 {
-       layout.set_gravity(wdg, gravity, 1);
-}
-
-void Row::finish_slot()
-{
-       edges[RIGHT] = next_right;
-       next_right.clear();
-       split_here = false;
-       first = false;
-}
-
-
-Row::Loader::Loader(Row &c):
-       DataFile::ObjectLoader<Row>(c)
-{
-       add("split", &Loader::split);
-}
-
-void Row::Loader::split()
-{
-       obj.split();
+       layout.set_gravity(wdg, (gravity==LEFT ? -1 : 1), 1);
 }
 
 } // namespace GLtk