diff options
author | Vicent Marti | 2008-08-05 16:23:17 +0000 |
---|---|---|
committer | Vicent Marti | 2008-08-05 16:23:17 +0000 |
commit | eb3d163439455fb941be0de73c1b3d28f3414c20 (patch) | |
tree | bfd4e9ae5943fecaf5b1fefc3abbcf5a2876d998 /gui/ThemeEval.cpp | |
parent | fdf485ea9bd84e07c8af1f2741af9078b6a9fcf6 (diff) | |
download | scummvm-rg350-eb3d163439455fb941be0de73c1b3d28f3414c20.tar.gz scummvm-rg350-eb3d163439455fb941be0de73c1b3d28f3414c20.tar.bz2 scummvm-rg350-eb3d163439455fb941be0de73c1b3d28f3414c20.zip |
Look, the launcher is rendered with the new layout parser.
svn-id: r33641
Diffstat (limited to 'gui/ThemeEval.cpp')
-rw-r--r-- | gui/ThemeEval.cpp | 28 |
1 files changed, 15 insertions, 13 deletions
diff --git a/gui/ThemeEval.cpp b/gui/ThemeEval.cpp index ec5c1e6abd..e13ccc0176 100644 --- a/gui/ThemeEval.cpp +++ b/gui/ThemeEval.cpp @@ -36,7 +36,7 @@ namespace GUI { -bool ThemeLayoutWidget::getWidgetData(const Common::String &name, int16 &x, int16 &y, int16 &w, int16 &h) { +bool ThemeLayoutWidget::getWidgetData(const Common::String &name, int16 &x, int16 &y, uint16 &w, uint16 &h) { if (name == _name) { x = _x; y = _y; w = _w; h = _h; @@ -46,7 +46,7 @@ bool ThemeLayoutWidget::getWidgetData(const Common::String &name, int16 &x, int1 return false; } -bool ThemeLayout::getWidgetData(const Common::String &name, int16 &x, int16 &y, int16 &w, int16 &h) { +bool ThemeLayout::getWidgetData(const Common::String &name, int16 &x, int16 &y, uint16 &w, uint16 &h) { for (uint i = 0; i < _children.size(); ++i) { if (_children[i]->getWidgetData(name, x, y, w, h)) return true; @@ -82,15 +82,19 @@ void ThemeLayoutVertical::reflowLayout() { if (i == 0) assert(_children[i]->getWidth() != -1); - - _children[i]->setX(curX); - _children[i]->setY(curY); if (_children[i]->getWidth() == -1) _children[i]->setWidth(_w - _paddingLeft - _paddingRight); if (_children[i]->getHeight() == -1) _children[i]->setHeight(getParentH() - _h - _spacing); + + _children[i]->setY(curY); + + if (_centered) + _children[i]->setX((_w >> 1) - (_children[i]->getWidth() >> 1)); + else + _children[i]->setX(curX); if (_reverse) { for (int j = i - 1; j >= 0; --j) @@ -121,9 +125,6 @@ void ThemeLayoutHorizontal::reflowLayout() { if (i == 0) assert(_children[i]->getHeight() != -1); - - _children[i]->setX(curX); - _children[i]->setY(curY); if (_children[i]->getHeight() == -1) _children[i]->setHeight(_h - _paddingTop - _paddingBottom); @@ -131,6 +132,9 @@ void ThemeLayoutHorizontal::reflowLayout() { if (_children[i]->getWidth() == -1) _children[i]->setWidth(getParentW() - _w - _spacing); + _children[i]->setX(curX); + _children[i]->setY(curY); + if (_reverse) { for (int j = i - 1; j >= 0; --j) _children[j]->setX(_children[i]->getWidth() + _spacing); @@ -172,13 +176,13 @@ void ThemeEval::addDialog(const Common::String &name) { _curLayout.push(layout); } -void ThemeEval::addLayout(ThemeLayout::LayoutType type, bool reverse) { +void ThemeEval::addLayout(ThemeLayout::LayoutType type, bool reverse, bool center) { ThemeLayout *layout = 0; if (type == ThemeLayout::kLayoutVertical) - layout = new ThemeLayoutVertical(_curLayout.top(), getVar("Globals.Layout.Spacing", 4), reverse); + layout = new ThemeLayoutVertical(_curLayout.top(), getVar("Globals.Layout.Spacing", 4), reverse, center); else if (type == ThemeLayout::kLayoutHorizontal) - layout = new ThemeLayoutHorizontal(_curLayout.top(), getVar("Globals.Layout.Spacing", 4), reverse); + layout = new ThemeLayoutHorizontal(_curLayout.top(), getVar("Globals.Layout.Spacing", 4), reverse, center); layout->setPadding( getVar("Globals.Padding.Left", 0), @@ -187,8 +191,6 @@ void ThemeEval::addLayout(ThemeLayout::LayoutType type, bool reverse) { getVar("Globals.Padding.Bottom", 0) ); - layout->setSpacing(4); - _curLayout.top()->addChild(layout); _curLayout.push(layout); } |