3 This file is part of libmspgltk
4 Copyright © 2007-2008, 2010-2011 Mikko Rasa, Mikkosoft Productions
5 Distributed under the LGPL
13 bool Geometry::is_inside(int x_, int y_) const
15 return (x_>=x && x_<x+static_cast<int>(w) && y_>=y && y_<y+static_cast<int>(h));
18 bool Geometry::is_inside_relative(int x_, int y_) const
20 return (x_>=0 && x_<static_cast<int>(w) && y_>=0 && y_<static_cast<int>(h));
31 Sides::Sides(unsigned s):
38 Sides::Sides(unsigned v, unsigned h):
45 Sides::Sides(unsigned t, unsigned h, unsigned b):
52 Sides::Sides(unsigned t, unsigned r, unsigned b, unsigned l):
60 Sides::Loader::Loader(Sides &s):
61 DataFile::ObjectLoader<Sides>(s)
63 add("top", &Sides::top);
64 add("right", &Sides::right);
65 add("bottom", &Sides::bottom);
66 add("left", &Sides::left);
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;