X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;ds=sidebyside;f=source%2Fgeometry.h;h=4fe6a75ae33dab5a89fa2f907a177a6ee644fcc9;hb=73afd124ab87e8bace98db55517a56c797a9b8c7;hp=6dc982727070ed2f09dbd357f94963922ee8d8e1;hpb=c2635c5a3dca6a6cea5562fd387beb0662b18cf0;p=libs%2Fgltk.git diff --git a/source/geometry.h b/source/geometry.h index 6dc9827..4fe6a75 100644 --- a/source/geometry.h +++ b/source/geometry.h @@ -8,7 +8,7 @@ Distributed under the LGPL #ifndef MSP_GLTK_GEOMETRY_H_ #define MSP_GLTK_GEOMETRY_H_ -#include +#include namespace Msp { namespace GLtk { @@ -24,20 +24,19 @@ struct Geometry Geometry(): x(0), y(0), w(1), h(1) { } Geometry(int x_, int y_, unsigned w_, unsigned h_): x(x_), y(y_), w(w_), h(h_) { } bool is_inside(int, int) const; + bool is_inside_relative(int, int) const; }; + /** Specifies margins on the sides of an element. */ struct Sides { - class Loader: public DataFile::Loader + class Loader: public DataFile::ObjectLoader { public: Loader(Sides &); - Sides &get_object() { return sides; } - private: - Sides &sides; }; unsigned top; @@ -48,6 +47,20 @@ struct Sides Sides(); }; + +/** +Performs alignment of nested geometries, such as widgets and their parts. +*/ +struct Alignment +{ + float x, y; + float w, h; + + Alignment(): x(0), y(0), w(1), h(1) { } + void apply(Geometry &, const Geometry &) const; + void apply(Geometry &, const Geometry &, const Sides &) const; +}; + } // namespace GLtk } // namespace Msp