aboutsummaryrefslogtreecommitdiff
path: root/gui/ThemeLayout.cpp
diff options
context:
space:
mode:
authorMax Horn2008-12-27 14:30:30 +0000
committerMax Horn2008-12-27 14:30:30 +0000
commit69f4b7a38388c444d2911d07a3636a65dd1a4d20 (patch)
tree30226f3b0bc736fdb8dbd4f87e5fb5d6960080c0 /gui/ThemeLayout.cpp
parent109d55f8d331ec8d70442d20eccc7046c8901b27 (diff)
downloadscummvm-rg350-69f4b7a38388c444d2911d07a3636a65dd1a4d20.tar.gz
scummvm-rg350-69f4b7a38388c444d2911d07a3636a65dd1a4d20.tar.bz2
scummvm-rg350-69f4b7a38388c444d2911d07a3636a65dd1a4d20.zip
Got rid of ThemeLayout::getDialogData; added some comments, asserts; moved getParentW & getParentH to class ThemeLayoutStacked
svn-id: r35571
Diffstat (limited to 'gui/ThemeLayout.cpp')
-rw-r--r--gui/ThemeLayout.cpp19
1 files changed, 17 insertions, 2 deletions
diff --git a/gui/ThemeLayout.cpp b/gui/ThemeLayout.cpp
index be14671e69..390b6e13ef 100644
--- a/gui/ThemeLayout.cpp
+++ b/gui/ThemeLayout.cpp
@@ -55,6 +55,13 @@ void ThemeLayout::importLayout(ThemeLayout *layout) {
}
bool ThemeLayout::getWidgetData(const Common::String &name, int16 &x, int16 &y, uint16 &w, uint16 &h) {
+ if (name.empty()) {
+ assert(getLayoutType() == kLayoutMain);
+ x = _x; y = _y;
+ w = _w; h = _h;
+ return true;
+ }
+
for (uint i = 0; i < _children.size(); ++i) {
if (_children[i]->getWidgetData(name, x, y, w, h))
return true;
@@ -63,7 +70,7 @@ bool ThemeLayout::getWidgetData(const Common::String &name, int16 &x, int16 &y,
return false;
}
-int16 ThemeLayout::getParentW() {
+int16 ThemeLayoutStacked::getParentW() {
ThemeLayout *p = _parent;
int width = 0;
@@ -73,13 +80,16 @@ int16 ThemeLayout::getParentW() {
for (uint i = 0; i < p->_children.size(); ++i)
width += p->_children[i]->getWidth() + p->_spacing;
}
+ // FIXME: Do we really want to assume that any layout type different
+ // from kLayoutHorizontal corresponds to width 0 ?
p = p->_parent;
}
+ assert(p && p->getLayoutType() == kLayoutMain);
return p->getWidth() - width;
}
-int16 ThemeLayout::getParentH() {
+int16 ThemeLayoutStacked::getParentH() {
ThemeLayout *p = _parent;
int height = 0;
@@ -89,9 +99,12 @@ int16 ThemeLayout::getParentH() {
for (uint i = 0; i < p->_children.size(); ++i)
height += p->_children[i]->getHeight() + p->_spacing;
}
+ // FIXME: Do we really want to assume that any layout type different
+ // from kLayoutVertical corresponds to height 0 ?
p = p->_parent;
}
+ assert(p && p->getLayoutType() == kLayoutMain);
return p->getHeight() - height;
}
@@ -168,6 +181,7 @@ void ThemeLayoutStacked::reflowLayoutV() {
_children[i]->setY(curY);
+ // Center child if it this has been requested *and* the space permits it.
if (_centered && _children[i]->getWidth() < _w && _w != -1) {
_children[i]->setX((_w >> 1) - (_children[i]->getWidth() >> 1));
} else
@@ -217,6 +231,7 @@ void ThemeLayoutStacked::reflowLayoutH() {
_children[i]->setX(curX);
+ // Center child if it this has been requested *and* the space permits it.
if (_centered && _children[i]->getHeight() < _h && _h != -1)
_children[i]->setY((_h >> 1) - (_children[i]->getHeight() >> 1));
else