Implemented CardList

git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@23 0fc631ac-6414-0410-93d0-97cfa31319b6
This commit is contained in:
twanvl
2006-10-18 17:48:14 +00:00
parent 7504e0540f
commit 29d072e949
29 changed files with 762 additions and 63 deletions
+22
View File
@@ -11,6 +11,28 @@
// ----------------------------------------------------------------------------- : Alignment
double align_delta_x(Alignment align, double box_width, double obj_width) {
if (align & ALIGN_CENTER) return (box_width - obj_width) / 2;
else if (align & ALIGN_RIGHT) return box_width - obj_width;
else return 0;
}
double align_delta_y(Alignment align, double box_height, double obj_height) {
if (align & ALIGN_MIDDLE) return (box_height - obj_height) / 2;
else if (align & ALIGN_BOTTOM) return box_height - obj_height;
else return 0;
}
RealPoint align_in_rect(Alignment align, const RealSize& to_align, const RealRect& outer) {
return RealPoint(
outer.position.x + align_delta_x(align, outer.size.width, to_align.width),
outer.position.y + align_delta_y(align, outer.size.height, to_align.height)
);
}
// ----------------------------------------------------------------------------- : Reflection stuff
/// Convert a String to an Alignment
Alignment fromString(const String& str) {
int al = 0;