finish_slot();
}
-void Arrangement::add_constraint(Widget &wdg, Layout::ConstraintType type, Side side)
+void Arrangement::add_constraint(Widget &wdg, Layout::ConstraintType type, Side side, int spacing)
{
- add_constraint(wdg, type, edges[side]);
+ add_constraint(wdg, type, edges[side], spacing);
}
-void Arrangement::add_constraint(Widget &wdg, Layout::ConstraintType type, const Edge &edge)
+void Arrangement::add_constraint(Widget &wdg, Layout::ConstraintType type, const Edge &edge, int spacing)
{
for(list<Widget *>::const_iterator i=edge.widgets.begin(); i!=edge.widgets.end(); ++i)
if(*i!=&wdg)
- layout.add_constraint(wdg, type, **i);
+ {
+ if(spacing<0)
+ layout.add_constraint(wdg, type, **i);
+ else
+ layout.add_constraint(wdg, type, **i, spacing);
+ }
}
Layout::ConstraintType Arrangement::get_order_constraint(Side s, bool slack)
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);
first(true),
split_here(false),
gravity(opposite),
- internal_aligned(false)
+ internal_aligned(false),
+ next_spacing(-1)
{ }
void LinearArrangement::split()
gravity = primary;
}
+void LinearArrangement::spacing(unsigned s)
+{
+ next_spacing = s;
+}
+
void LinearArrangement::process_widget(Widget &wdg, Side side, bool aligned)
{
if(side==opposite)
{
bool snug = (internal_aligned && aligned && !split_here);
- add_constraint(wdg, get_order_constraint(primary, !snug), primary);
+ add_constraint(wdg, get_order_constraint(primary, !snug), primary, next_spacing);
if(first)
edges[side].add(wdg, (aligned && gravity==opposite));
}
next.clear();
split_here = false;
first = false;
+ next_spacing = -1;
}
DataFile::ObjectLoader<LinearArrangement>(c)
{
add("expand", &Loader::expand);
+ add("spacing", &Loader::spacing);
add("split", &Loader::split);
}
obj.expand();
}
+void LinearArrangement::Loader::spacing(unsigned s)
+{
+ obj.spacing(s);
+}
+
void LinearArrangement::Loader::split()
{
obj.split();
Loader(LinearArrangement &);
private:
void expand();
+ void spacing(unsigned);
void split();
};
bool split_here;
Side gravity;
bool internal_aligned;
+ int next_spacing;
LinearArrangement(Layout &, Side);
public:
void split();
void expand();
+ void spacing(unsigned);
protected:
virtual void process_widget(Widget &, Side, bool);