]> git.tdb.fi Git - libs/gltk.git/blobdiff - source/row.cpp
Add some classes for automatically creating basic layouts
[libs/gltk.git] / source / row.cpp
diff --git a/source/row.cpp b/source/row.cpp
new file mode 100644 (file)
index 0000000..30e1811
--- /dev/null
@@ -0,0 +1,29 @@
+#include "row.h"
+
+namespace Msp {
+namespace GLtk {
+
+Row::Row(bool u):
+       uniform(u)
+{ }
+
+Layout::Slot *Row::create_slot(Widget &w)
+{
+       Slot *slot = new Slot(*this, w);
+
+       if(!slots.empty())
+       {
+               Slot &prev = *slots.back();
+               slot->constraints.push_back(Constraint(RIGHT_OF, prev));
+               slot->constraints.push_back(Constraint(ALIGN_TOP, prev));
+               slot->constraints.push_back(Constraint(ALIGN_BOTTOM, prev));
+               if(uniform)
+                       slot->constraints.push_back(Constraint(COPY_WIDTH, prev));
+               slot->vert_pack.expand = true;
+       }
+
+       return slot;
+}
+
+} // namespace GLtk
+} // namespace Msp