3 This file is part of libmspgltk
4 Copyright © 2007 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));
32 Sides::Loader::Loader(Sides &s):
35 add("top", &Sides::top);
36 add("right", &Sides::right);
37 add("bottom", &Sides::bottom);
38 add("left", &Sides::left);
42 void Alignment::apply(Geometry &geom, const Geometry &parent) const
46 geom.w+=static_cast<unsigned>((parent.w-geom.w)*w);
47 geom.x+=static_cast<int>((parent.w-geom.w)*x);
51 geom.h+=static_cast<unsigned>((parent.h-geom.h)*h);
52 geom.y+=static_cast<int>((parent.h-geom.h)*y);
56 void Alignment::apply(Geometry &geom, const Geometry &parent, const Sides &margin) const
58 unsigned pw=parent.w-margin.left-margin.right;
59 unsigned ph=parent.h-margin.bottom-margin.top;
62 geom.y+=margin.bottom;
66 geom.w+=static_cast<unsigned>((pw-geom.w)*w);
67 geom.x+=static_cast<int>((pw-geom.w)*x);
71 geom.h+=static_cast<unsigned>((ph-geom.h)*h);
72 geom.y+=static_cast<int>((ph-geom.h)*y);