diff options
author | Eugene Sandulenko | 2006-03-07 13:41:36 +0000 |
---|---|---|
committer | Eugene Sandulenko | 2006-03-07 13:41:36 +0000 |
commit | 1eff73cb412c6c403be82cde77ee61b9944f805e (patch) | |
tree | 532b9085f3093085034ea779732312d13170b5e0 | |
parent | 059c7a0296fdf71e80caf15092d3f629a6c43122 (diff) | |
download | scummvm-rg350-1eff73cb412c6c403be82cde77ee61b9944f805e.tar.gz scummvm-rg350-1eff73cb412c6c403be82cde77ee61b9944f805e.tar.bz2 scummvm-rg350-1eff73cb412c6c403be82cde77ee61b9944f805e.zip |
GUI widget positions:
o Add 'true' and 'false' constants
o add .visible widget property
o allow dots to be part of section and key names in configs
svn-id: r21123
-rw-r--r-- | common/config-file.cpp | 2 | ||||
-rw-r--r-- | gui/eval.cpp | 3 | ||||
-rw-r--r-- | gui/newgui.cpp | 1 | ||||
-rw-r--r-- | gui/object.h | 3 | ||||
-rw-r--r-- | gui/widget.cpp | 8 | ||||
-rw-r--r-- | gui/widget.h | 2 |
6 files changed, 16 insertions, 3 deletions
diff --git a/common/config-file.cpp b/common/config-file.cpp index a5ef6a17ba..cb770f625e 100644 --- a/common/config-file.cpp +++ b/common/config-file.cpp @@ -51,7 +51,7 @@ static char *rtrim(char *t) { */ bool ConfigFile::isValidName(const Common::String &name) { const char *p = name.c_str(); - while (*p && (isalnum(*p) || *p == '-' || *p == '_')) + while (*p && (isalnum(*p) || *p == '-' || *p == '_' || *p == '.')) p++; return *p == 0; } diff --git a/gui/eval.cpp b/gui/eval.cpp index 5b86a6d8d5..ad9b0607d3 100644 --- a/gui/eval.cpp +++ b/gui/eval.cpp @@ -236,6 +236,9 @@ static const BuiltinConsts builtinConsts[] = { {"kBigButtonHeight", GUI::kBigButtonHeight}, {"kBigSliderWidth", GUI::kBigSliderWidth}, {"kBigSliderHeight", GUI::kBigSliderHeight}, + + {"false", 0}, + {"true", 1}, {NULL, 0} }; diff --git a/gui/newgui.cpp b/gui/newgui.cpp index 3c76febfae..808dea699d 100644 --- a/gui/newgui.cpp +++ b/gui/newgui.cpp @@ -62,6 +62,7 @@ GuiObject::GuiObject(Common::String name) : _firstWidget(0) { _y = g_gui.evaluator()->getVar(name + ".y"); _w = g_gui.evaluator()->getVar(name + ".w"); _h = g_gui.evaluator()->getVar(name + ".h"); + _name = name; } diff --git a/gui/object.h b/gui/object.h index c9fe097a06..5067ab8354 100644 --- a/gui/object.h +++ b/gui/object.h @@ -59,11 +59,12 @@ class GuiObject : public CommandReceiver { protected: int16 _x, _y; uint16 _w, _h; + Common::String _name; Widget *_firstWidget; public: - GuiObject(int x, int y, int w, int h) : _x(x), _y(y), _w(w), _h(h), _firstWidget(0) { } + GuiObject(int x, int y, int w, int h) : _x(x), _y(y), _w(w), _h(h), _firstWidget(0), _name("") { } GuiObject(Common::String name); virtual int16 getAbsX() const { return _x; } diff --git a/gui/widget.cpp b/gui/widget.cpp index 0bf3c07fc7..87aeb4db56 100644 --- a/gui/widget.cpp +++ b/gui/widget.cpp @@ -113,6 +113,14 @@ Widget *Widget::findWidgetInChain(Widget *w, int x, int y) { return w; } +bool Widget::isVisible() const { + if (g_gui.evaluator()->getVar(_name + ".visible") == 0) + return false; + + return !(_flags & WIDGET_INVISIBLE); +} + + #pragma mark - StaticTextWidget::StaticTextWidget(GuiObject *boss, int x, int y, int w, int h, const String &text, TextAlignment align, WidgetSize ws) diff --git a/gui/widget.h b/gui/widget.h index dbc87e4127..4f54b5708c 100644 --- a/gui/widget.h +++ b/gui/widget.h @@ -137,7 +137,7 @@ public: void setEnabled(bool e) { if (e) setFlags(WIDGET_ENABLED); else clearFlags(WIDGET_ENABLED); } bool isEnabled() const { return _flags & WIDGET_ENABLED; } - bool isVisible() const { return !(_flags & WIDGET_INVISIBLE); } + bool isVisible() const; protected: virtual void drawWidget(bool hilite) {} |