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));
17 Sides::Sides(unsigned s):
24 Sides::Sides(unsigned v, unsigned h):
31 Sides::Sides(unsigned t, unsigned h, unsigned b):
38 Sides::Sides(unsigned t, unsigned r, unsigned b, unsigned l):
46 Sides::Loader::Loader(Sides &s):
47 DataFile::ObjectLoader<Sides>(s)
49 add("horizontal", &Loader::horizontal);
50 add("vertical", &Loader::vertical);
51 add("top", &Sides::top);
52 add("right", &Sides::right);
53 add("bottom", &Sides::bottom);
54 add("left", &Sides::left);
57 void Sides::Loader::horizontal(unsigned h)
63 void Sides::Loader::vertical(unsigned v)
70 void Alignment::apply(Geometry &geom, const Geometry &parent) const
74 geom.w += static_cast<unsigned>((parent.w-geom.w)*w);
75 geom.x += static_cast<int>((parent.w-geom.w)*x);
79 geom.h += static_cast<unsigned>((parent.h-geom.h)*h);
80 geom.y += static_cast<int>((parent.h-geom.h)*y);
84 void Alignment::apply(Geometry &geom, const Geometry &parent, const Sides &margin) const
86 Geometry content = parent;
87 content.w -= margin.left+margin.right;
88 content.h -= margin.bottom+margin.top;
90 geom.x += margin.left;
91 geom.y += margin.bottom;