1 #include "lineararrangement.h"
6 LinearArrangement::LinearArrangement(Layout &l, Side p):
9 opposite(static_cast<Side>((primary+2)%4)),
13 internal_aligned(false)
16 void LinearArrangement::split()
19 throw arrangement_error("already split");
25 void LinearArrangement::expand()
28 throw arrangement_error("already split");
29 if(edges[primary].empty())
30 throw arrangement_error("no widgets");
32 add_constraint(*edges[primary].widgets.front(), get_align_constraint(primary), primary);
33 layout.set_expand(*edges[primary].widgets.front(), (primary==LEFT || primary==RIGHT), (primary==TOP || primary==BOTTOM));
34 edges[primary].align();
38 void LinearArrangement::process_widget(Widget &wdg, Side side, bool aligned)
42 bool snug = (internal_aligned && aligned && !split_here);
43 add_constraint(wdg, get_order_constraint(primary, !snug), primary);
45 edges[side].add(wdg, (aligned && gravity==opposite));
47 else if(side==primary)
48 next.add(wdg, aligned);
51 if(edges[side].aligned && aligned)
52 add_constraint(wdg, get_align_constraint(side), side);
53 edges[side].add(wdg, aligned);
57 void LinearArrangement::finish_slot()
59 internal_aligned = next.aligned;
62 edges[primary] = next;
69 LinearArrangement::Loader::Loader(LinearArrangement &c):
70 DataFile::ObjectLoader<LinearArrangement>(c)
72 add("expand", &Loader::expand);
73 add("split", &Loader::split);
76 void LinearArrangement::Loader::expand()
81 void LinearArrangement::Loader::split()