]> git.tdb.fi Git - libs/gltk.git/blobdiff - source/layout.cpp
Initial implementation of middle gravity
[libs/gltk.git] / source / layout.cpp
index d5437f0b0a29ed04c1ce000534174fd0d9b9fa12..bfe46c47f8b1dcd683238532bdd0fc7497185879 100644 (file)
@@ -304,6 +304,16 @@ void Layout::solve_constraints(int dir, SolveMode mode)
                        row.back() = geom.*(ptrs.dim)-margin.*(ptrs.high_margin);
                }
 
+               if(((*i)->*(ptrs.packing)).gravity==0)
+               {
+                       /* This forces the widget's distance from the left and right edge of
+                       the container to be equal.  It's a bit of a hack, but more time and
+                       thought is needed for a better solution. */
+                       LinearProgram::Row row = linprog.add_row();
+                       row[(*i)->index*5+2] = 1;
+                       row[(*i)->index*5+3] = -1;
+               }
+
                {
                        /* Only allow the widget's dimension to increase.  The geometry has
                        previously been set to the smallest allowable size. */