aboutsummaryrefslogtreecommitdiff
path: root/gui/ThemeEval.h
diff options
context:
space:
mode:
authorVicent Marti2008-08-04 17:44:18 +0000
committerVicent Marti2008-08-04 17:44:18 +0000
commitdd46f8305e5c430b3af5511e81f621262149380d (patch)
tree3ed0438343fb294297cfd9567273f8c428b69048 /gui/ThemeEval.h
parent85c36885f5bbf2d47276c7702f1b8ccbf22ecc34 (diff)
downloadscummvm-rg350-dd46f8305e5c430b3af5511e81f621262149380d.tar.gz
scummvm-rg350-dd46f8305e5c430b3af5511e81f621262149380d.tar.bz2
scummvm-rg350-dd46f8305e5c430b3af5511e81f621262149380d.zip
Layout parsing. Work in progress. Looks like a GUI!
svn-id: r33616
Diffstat (limited to 'gui/ThemeEval.h')
-rw-r--r--gui/ThemeEval.h35
1 files changed, 18 insertions, 17 deletions
diff --git a/gui/ThemeEval.h b/gui/ThemeEval.h
index f53dfe2cd1..2c57e2732c 100644
--- a/gui/ThemeEval.h
+++ b/gui/ThemeEval.h
@@ -79,8 +79,8 @@ public:
virtual const char *getName() { return "Global Layout"; }
- int16 getParentW() { return parent ? parent->w : g_system->getOverlayWidth(); }
- int16 getParentH() { return parent ? parent->w : g_system->getOverlayHeight(); }
+ int16 getParentW() { return parent ? parent->w - parent->paddingLeft - parent->paddingRight : g_system->getOverlayWidth(); }
+ int16 getParentH() { return parent ? parent->h - parent->paddingTop - parent->paddingBottom : g_system->getOverlayHeight(); }
int16 getParentX() { return parent ? parent->x : 0; }
int16 getParentY() { return parent ? parent->y : 0; }
@@ -209,18 +209,10 @@ public:
const char *getName() { return "Horizontal Layout"; }
void reflowLayout() {
- int curX, curY, mul;
-
- if (parsingMode == kLayoutParseLeft2Right) {
- curX = paddingLeft;
- curY = paddingTop;
- mul = 1;
- } else {
- curX = getParentW() - paddingRight;
- curY = paddingTop;
- mul = -1;
- }
-
+ int curX, curY;
+
+ curX = paddingLeft;
+ curY = paddingTop;
w = paddingLeft + paddingRight;
for (uint i = 0; i < children.size(); ++i) {
@@ -235,15 +227,24 @@ public:
assert(children[i]->h != -1);
- children[i]->setX((parsingMode == kLayoutParseRight2Left) ? (curX - children[i]->w) : (curX));
+ children[i]->setX(curX);
children[i]->setY(curY);
if (children[i]->h == -1)
children[i]->h = h - paddingTop - paddingBottom;
+
+ if (children[i]->w == -1)
+ children[i]->w = getParentW() - w - spacing;
h = MAX(h, (int16)(children[i]->h + paddingTop + paddingBottom));
-
- curX += (children[i]->w + spacing) * mul;
+
+ if (parsingMode == kLayoutParseRight2Left) {
+ for (int j = i - 1; j >= 0; --j)
+ children[j]->setX(children[i]->w + spacing);
+ } else {
+ curX += (children[i]->w + spacing);
+ }
+
w += children[i]->w + spacing;
}
}