diff options
author | Max Horn | 2008-12-27 14:36:28 +0000 |
---|---|---|
committer | Max Horn | 2008-12-27 14:36:28 +0000 |
commit | f26f85ee96625003edc08b370e6f3a08505a075d (patch) | |
tree | 0421e28baf30b298c96e58ba55a4e7f5b23f77b7 /gui | |
parent | 69f4b7a38388c444d2911d07a3636a65dd1a4d20 (diff) | |
download | scummvm-rg350-f26f85ee96625003edc08b370e6f3a08505a075d.tar.gz scummvm-rg350-f26f85ee96625003edc08b370e6f3a08505a075d.tar.bz2 scummvm-rg350-f26f85ee96625003edc08b370e6f3a08505a075d.zip |
GUI: Added Widget::setVisible convenience wrapper
svn-id: r35572
Diffstat (limited to 'gui')
-rw-r--r-- | gui/ScrollBarWidget.cpp | 4 | ||||
-rw-r--r-- | gui/saveload.cpp | 28 | ||||
-rw-r--r-- | gui/widget.cpp | 14 | ||||
-rw-r--r-- | gui/widget.h | 4 |
4 files changed, 29 insertions, 21 deletions
diff --git a/gui/ScrollBarWidget.cpp b/gui/ScrollBarWidget.cpp index 2838ce19ee..797bf1fdab 100644 --- a/gui/ScrollBarWidget.cpp +++ b/gui/ScrollBarWidget.cpp @@ -175,11 +175,11 @@ void ScrollBarWidget::recalc() { UP_DOWN_BOX_HEIGHT + (_h - 2 * UP_DOWN_BOX_HEIGHT - _sliderHeight) * _currentPos / (_numEntries - _entriesPerPage); if (_sliderPos < 0) _sliderPos = 0; - clearFlags(WIDGET_INVISIBLE); + setVisible(true); } else { _sliderHeight = _h - 2 * UP_DOWN_BOX_HEIGHT; _sliderPos = UP_DOWN_BOX_HEIGHT; - setFlags(WIDGET_INVISIBLE); + setVisible(false); } } diff --git a/gui/saveload.cpp b/gui/saveload.cpp index dd75e5f7b1..29b63a0415 100644 --- a/gui/saveload.cpp +++ b/gui/saveload.cpp @@ -197,32 +197,24 @@ void SaveLoadChooser::reflowLayout() { if (_playTimeSupport) _playtime->resize(thumbX, height, kThumbnailWidth, kLineHeight); - _container->clearFlags(GUI::WIDGET_INVISIBLE); - _gfxWidget->clearFlags(GUI::WIDGET_INVISIBLE); + _container->setVisible(true); + _gfxWidget->setVisible(true); - if (_saveDateSupport) { - _date->clearFlags(GUI::WIDGET_INVISIBLE); - _time->clearFlags(GUI::WIDGET_INVISIBLE); - } else { - _date->setFlags(GUI::WIDGET_INVISIBLE); - _time->setFlags(GUI::WIDGET_INVISIBLE); - } + _date->setVisible(_saveDateSupport); + _time->setVisible(_saveDateSupport); - if (_playTimeSupport) - _playtime->clearFlags(GUI::WIDGET_INVISIBLE); - else - _playtime->setFlags(GUI::WIDGET_INVISIBLE); + _playtime->setVisible(_playTimeSupport); _fillR = 0; _fillG = 0; _fillB = 0; updateSelection(false); } else { - _container->setFlags(GUI::WIDGET_INVISIBLE); - _gfxWidget->setFlags(GUI::WIDGET_INVISIBLE); - _date->setFlags(GUI::WIDGET_INVISIBLE); - _time->setFlags(GUI::WIDGET_INVISIBLE); - _playtime->setFlags(GUI::WIDGET_INVISIBLE); + _container->setVisible(false); + _gfxWidget->setVisible(false); + _date->setVisible(false); + _time->setVisible(false); + _playtime->setVisible(false); } Dialog::reflowLayout(); diff --git a/gui/widget.cpp b/gui/widget.cpp index de81d9fc56..41576b5933 100644 --- a/gui/widget.cpp +++ b/gui/widget.cpp @@ -145,6 +145,13 @@ Widget *Widget::findWidgetInChain(Widget *w, const char *name) { return 0; } +void Widget::setEnabled(bool e) { + if (e) + setFlags(WIDGET_ENABLED); + else + clearFlags(WIDGET_ENABLED); +} + bool Widget::isEnabled() const { if (g_gui.xmlEval()->getVar("Dialog." + _name + ".Enabled", 1) == 0) { return false; @@ -152,6 +159,13 @@ bool Widget::isEnabled() const { return ((_flags & WIDGET_ENABLED) != 0); } +void Widget::setVisible(bool e) { + if (e) + clearFlags(WIDGET_INVISIBLE); + else + setFlags(WIDGET_INVISIBLE); +} + bool Widget::isVisible() const { if (g_gui.xmlEval()->getVar("Dialog." + _name + ".Visible", 1) == 0) return false; diff --git a/gui/widget.h b/gui/widget.h index 6fc4113ca6..6140e03a26 100644 --- a/gui/widget.h +++ b/gui/widget.h @@ -122,8 +122,10 @@ public: void clearFlags(int flags); int getFlags() const { return _flags; } - void setEnabled(bool e) { if (e) setFlags(WIDGET_ENABLED); else clearFlags(WIDGET_ENABLED); } + void setEnabled(bool e); bool isEnabled() const; + + void setVisible(bool e); bool isVisible() const; protected: |