mirror of
https://github.com/libretro/scummvm.git
synced 2025-02-20 19:21:46 +00:00
GUI: Added Widget::setVisible convenience wrapper
svn-id: r35572
This commit is contained in:
parent
69f4b7a383
commit
f26f85ee96
@ -319,11 +319,11 @@ void SaveLoadChooser::handleCommand(GUI::CommandSender *sender, uint32 cmd, uint
|
||||
}
|
||||
|
||||
void SaveLoadChooser::reflowLayout() {
|
||||
_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();
|
||||
}
|
||||
|
@ -342,22 +342,22 @@ void SaveLoadChooser::reflowLayout() {
|
||||
|
||||
_playtime->resize(thumbX, height, kThumbnailWidth, kLineHeight);
|
||||
|
||||
_container->clearFlags(GUI::WIDGET_INVISIBLE);
|
||||
_gfxWidget->clearFlags(GUI::WIDGET_INVISIBLE);
|
||||
_date->clearFlags(GUI::WIDGET_INVISIBLE);
|
||||
_time->clearFlags(GUI::WIDGET_INVISIBLE);
|
||||
_playtime->clearFlags(GUI::WIDGET_INVISIBLE);
|
||||
_container->setVisible(true);
|
||||
_gfxWidget->setVisible(true);
|
||||
_date->setVisible(true);
|
||||
_time->setVisible(true);
|
||||
_playtime->setVisible(true);
|
||||
|
||||
_fillR = 0; //g_gui.evaluator()->getVar("scummsaveload_thumbnail.fillR");
|
||||
_fillG = 0; //g_gui.evaluator()->getVar("scummsaveload_thumbnail.fillG");
|
||||
_fillB = 0; //g_gui.evaluator()->getVar("scummsaveload_thumbnail.fillB");
|
||||
updateInfos(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();
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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();
|
||||
|
@ -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;
|
||||
|
@ -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:
|
||||
|
Loading…
x
Reference in New Issue
Block a user