X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Farrangement.h;h=7028aed4ecfd868b0ccfedb56e58194094179e02;hb=d85d9bd7dae120e3e7ebaf64e7b78a975fab94a6;hp=284d3f7edd7079279848ce4f9e1371e29d484b77;hpb=646af3dd91a6ca981572a5b69a0f0bd205d9af49;p=libs%2Fgltk.git diff --git a/source/arrangement.h b/source/arrangement.h index 284d3f7..7028aed 100644 --- a/source/arrangement.h +++ b/source/arrangement.h @@ -2,6 +2,7 @@ #define MSP_GLTK_ARRANGEMENT_H_ #include +#include #include "layout.h" namespace Msp { @@ -9,6 +10,13 @@ namespace GLtk { class Widget; +class arrangement_error: public std::logic_error +{ +public: + arrangement_error(const std::string &w): std::logic_error(w) { } + virtual ~arrangement_error() throw() { } +}; + class Arrangement { protected: @@ -30,6 +38,7 @@ protected: bool empty() { return widgets.empty(); } void clear(); void add(Widget &, bool); + void align(); }; Layout &layout; @@ -48,8 +57,11 @@ protected: 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 &); + void add_constraint(Widget &, Layout::ConstraintType, Side, int = -1); + void add_constraint(Widget &, Layout::ConstraintType, const Edge &, int = -1); + + static Layout::ConstraintType get_order_constraint(Side, bool); + static Layout::ConstraintType get_align_constraint(Side); }; } // namespace GLtk