6 bool Geometry::is_inside(int x_, int y_) const
8 return (x_>=x && x_<x+static_cast<int>(w) && y_>=y && y_<y+static_cast<int>(h));
11 bool Geometry::is_inside_relative(int x_, int y_) const
13 return (x_>=0 && x_<static_cast<int>(w) && y_>=0 && y_<static_cast<int>(h));
24 Sides::Sides(unsigned s):
31 Sides::Sides(unsigned v, unsigned h):
38 Sides::Sides(unsigned t, unsigned h, unsigned b):
45 Sides::Sides(unsigned t, unsigned r, unsigned b, unsigned l):
53 Sides::Loader::Loader(Sides &s):
54 DataFile::ObjectLoader<Sides>(s)
56 add("horizontal", &Loader::horizontal);
57 add("vertical", &Loader::vertical);
58 add("top", &Sides::top);
59 add("right", &Sides::right);
60 add("bottom", &Sides::bottom);
61 add("left", &Sides::left);
64 void Sides::Loader::horizontal(unsigned h)
70 void Sides::Loader::vertical(unsigned v)
77 void Alignment::apply(Geometry &geom, const Geometry &parent) const
81 geom.w += static_cast<unsigned>((parent.w-geom.w)*w);
82 geom.x += static_cast<int>((parent.w-geom.w)*x);
86 geom.h += static_cast<unsigned>((parent.h-geom.h)*h);
87 geom.y += static_cast<int>((parent.h-geom.h)*y);
91 void Alignment::apply(Geometry &geom, const Geometry &parent, const Sides &margin) const
93 Geometry content = parent;
94 content.w -= margin.left+margin.right;
95 content.h -= margin.bottom+margin.top;
97 geom.x += margin.left;
98 geom.y += margin.bottom;
100 apply(geom, content);