X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Farrangement.h;fp=source%2Farrangement.h;h=284d3f7edd7079279848ce4f9e1371e29d484b77;hb=646af3dd91a6ca981572a5b69a0f0bd205d9af49;hp=0000000000000000000000000000000000000000;hpb=df07e8f3e239b146cbc458d3cbd69758e590d255;p=libs%2Fgltk.git diff --git a/source/arrangement.h b/source/arrangement.h new file mode 100644 index 0000000..284d3f7 --- /dev/null +++ b/source/arrangement.h @@ -0,0 +1,58 @@ +#ifndef MSP_GLTK_ARRANGEMENT_H_ +#define MSP_GLTK_ARRANGEMENT_H_ + +#include +#include "layout.h" + +namespace Msp { +namespace GLtk { + +class Widget; + +class Arrangement +{ +protected: + enum Side + { + TOP, + RIGHT, + BOTTOM, + LEFT + }; + + struct Edge + { + std::list widgets; + bool aligned; + + Edge(); + + bool empty() { return widgets.empty(); } + void clear(); + void add(Widget &, bool); + }; + + Layout &layout; + Arrangement *parent; + Edge edges[4]; + + Arrangement(Layout &); +public: + virtual ~Arrangement(); + + void arrange(Widget &); + void arrange(Arrangement &); + +protected: + virtual void process_widget(Widget &, Side, bool) = 0; + virtual void finish_widget(Widget &) = 0; + virtual void finish_slot() = 0; + const Edge &get_edge(Side s) const { return edges[s]; } + void add_constraint(Widget &, Layout::ConstraintType, Side); + void add_constraint(Widget &, Layout::ConstraintType, const Edge &); +}; + +} // namespace GLtk +} // namespace Msp + +#endif