6 Grid::Grid(Layout &l, unsigned c):
20 if(row_bottom.empty())
21 throw arrangement_error("empty row not allowed");
26 void Grid::process_widget(Widget &wdg, Side side, bool aligned)
30 Edge &top_edge = (first_row ? edges[TOP] : row_top);
31 if(top_edge.aligned && aligned)
32 add_constraint(wdg, Layout::ALIGN_TOP, top_edge);
34 bool snug = (edges[BOTTOM].aligned && aligned);
35 add_constraint(wdg, (snug ? Layout::BELOW : Layout::FAR_BELOW), BOTTOM);
37 top_edge.add(wdg, aligned);
41 if(row_bottom.aligned && aligned)
42 add_constraint(wdg, Layout::ALIGN_BOTTOM, row_bottom);
44 row_bottom.add(wdg, aligned);
48 if(columns[column].left.aligned && aligned)
49 add_constraint(wdg, Layout::ALIGN_LEFT, columns[column].left);
52 bool snug = (columns[column-1].right.aligned && aligned);
53 add_constraint(wdg, (snug ? Layout::RIGHT_OF : Layout::FAR_RIGHT_OF), columns[column-1].right);
56 edges[LEFT].add(wdg, (aligned && !column));
57 columns[column].left.add(wdg, aligned);
61 if(columns[column].right.aligned && aligned)
62 add_constraint(wdg, Layout::ALIGN_RIGHT, columns[column].right);
64 edges[RIGHT].add(wdg, (aligned && column+1==columns.size()));
65 columns[column].right.add(wdg, aligned);
69 void Grid::finish_widget(Widget &wdg)
71 layout.set_gravity(wdg, -1, 1);
74 void Grid::finish_slot()
77 if(column==columns.size())
81 void Grid::finish_row()
83 edges[BOTTOM] = row_bottom;
91 Grid::Loader::Loader(Grid &g):
92 DataFile::ObjectLoader<Grid>(g)
94 add("next_row", &Loader::next_row);
95 add("skip", &Loader::skip);
98 void Grid::Loader::next_row()
103 void Grid::Loader::skip()