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