1 #include "lineararrangement.h"
6 LinearArrangement::LinearArrangement(Layout &l, Side p):
9 opposite(static_cast<Side>((primary+2)%4)),
15 void LinearArrangement::split()
18 throw arrangement_error("already split");
24 void LinearArrangement::expand()
27 throw arrangement_error("already split");
28 if(edges[primary].empty())
29 throw arrangement_error("no widgets");
31 add_constraint(*edges[primary].widgets.front(), get_align_constraint(primary), primary);
32 layout.set_expand(*edges[primary].widgets.front(), false, true);
33 edges[primary].align();
37 void LinearArrangement::process_widget(Widget &wdg, Side side, bool aligned)
41 bool snug = (edges[primary].aligned && aligned && !split_here);
42 add_constraint(wdg, get_order_constraint(primary, !snug), primary);
44 edges[side].add(wdg, aligned);
46 else if(side==primary)
47 next.add(wdg, (aligned && gravity==primary));
50 if(edges[side].aligned && aligned)
51 add_constraint(wdg, get_align_constraint(side), side);
52 edges[side].add(wdg, aligned);
56 void LinearArrangement::finish_slot()
58 edges[primary] = next;
65 LinearArrangement::Loader::Loader(LinearArrangement &c):
66 DataFile::ObjectLoader<LinearArrangement>(c)
68 add("expand", &Loader::expand);
69 add("split", &Loader::split);
72 void LinearArrangement::Loader::expand()
77 void LinearArrangement::Loader::split()