diff options
author | Vicent Marti | 2008-10-09 11:49:35 +0000 |
---|---|---|
committer | Vicent Marti | 2008-10-09 11:49:35 +0000 |
commit | 1f2ce8b1881078b3de82b63f8ecdc1777f4ab9d1 (patch) | |
tree | 3b454a1b1e0dca09eada21287ed7b7e8a7cf4226 /gui/widget.cpp | |
parent | 5dd381932f3ed501a27fe97f48ef30331b2924d5 (diff) | |
parent | 000eedb0737dbe400d016edf213928dbb1a227d3 (diff) | |
download | scummvm-rg350-1f2ce8b1881078b3de82b63f8ecdc1777f4ab9d1.tar.gz scummvm-rg350-1f2ce8b1881078b3de82b63f8ecdc1777f4ab9d1.tar.bz2 scummvm-rg350-1f2ce8b1881078b3de82b63f8ecdc1777f4ab9d1.zip |
Manual merge of the GSoC2008 GUI branch. (71 files)
svn-id: r34757
Diffstat (limited to 'gui/widget.cpp')
-rw-r--r-- | gui/widget.cpp | 37 |
1 files changed, 10 insertions, 27 deletions
diff --git a/gui/widget.cpp b/gui/widget.cpp index 31f76eac6f..818676dbf4 100644 --- a/gui/widget.cpp +++ b/gui/widget.cpp @@ -26,22 +26,21 @@ #include "graphics/fontman.h" #include "gui/widget.h" #include "gui/dialog.h" -#include "gui/eval.h" #include "gui/newgui.h" +#include "gui/ThemeEval.h" + namespace GUI { Widget::Widget(GuiObject *boss, int x, int y, int w, int h) : GuiObject(x, y, w, h), _type(0), _boss(boss), - _id(0), _flags(0), _hints(THEME_HINT_FIRST_DRAW), - _hasFocus(false), _state(Theme::kStateEnabled) { + _id(0), _flags(0), _hasFocus(false), _state(Theme::kStateEnabled) { init(); } Widget::Widget(GuiObject *boss, const Common::String &name) : GuiObject(name), _type(0), _boss(boss), - _id(0), _flags(0), _hints(THEME_HINT_FIRST_DRAW), - _hasFocus(false), _state(Theme::kStateDisabled) { + _id(0), _flags(0), _hasFocus(false), _state(Theme::kStateDisabled) { init(); } @@ -49,8 +48,6 @@ void Widget::init() { // Insert into the widget list of the boss _next = _boss->_firstWidget; _boss->_firstWidget = this; - // HACK: we enable background saving for all widgets by default for now - _hints = THEME_HINT_FIRST_DRAW | THEME_HINT_SAVE_BACKGROUND; } Widget::~Widget() { @@ -99,7 +96,7 @@ void Widget::draw() { // Draw border if (_flags & WIDGET_BORDER) { - gui->theme()->drawWidgetBackground(Common::Rect(_x, _y, _x+_w, _y+_h), _hints, Theme::kWidgetBackgroundBorder); + gui->theme()->drawWidgetBackground(Common::Rect(_x, _y, _x+_w, _y+_h), 0, Theme::kWidgetBackgroundBorder); _x += 4; _y += 4; _w -= 8; @@ -126,8 +123,6 @@ void Widget::draw() { w->draw(); w = w->_next; } - - clearHints(THEME_HINT_FIRST_DRAW); } Widget *Widget::findWidgetInChain(Widget *w, int x, int y) { @@ -153,14 +148,14 @@ Widget *Widget::findWidgetInChain(Widget *w, const char *name) { } bool Widget::isEnabled() const { - if (g_gui.evaluator()->getVar(_name + ".enabled") == 0) { + if (g_gui.xmlEval()->getVar("Dialog." + _name + ".Enabled", 1) == 0) { return false; } return ((_flags & WIDGET_ENABLED) != 0); } bool Widget::isVisible() const { - if (g_gui.evaluator()->getVar(_name + ".visible") == 0) + if (g_gui.xmlEval()->getVar("Dialog." + _name + ".Visible", 1) == 0) return false; return !(_flags & WIDGET_INVISIBLE); @@ -181,10 +176,7 @@ StaticTextWidget::StaticTextWidget(GuiObject *boss, const Common::String &name, _type = kStaticTextWidget; _label = text; - _align = (Graphics::TextAlignment)g_gui.evaluator()->getVar(name + ".align"); - - if (_align == (int)EVAL_UNDEF_VAR) - _align = kTextAlignLeft; + _align = (Graphics::TextAlignment)g_gui.xmlEval()->getVar(name + ".Align", kTextAlignLeft); } void StaticTextWidget::setValue(int value) { @@ -226,7 +218,6 @@ ButtonWidget::ButtonWidget(GuiObject *boss, const Common::String &name, const Co : StaticTextWidget(boss, name, label), CommandSender(boss), _cmd(cmd), _hotkey(hotkey) { setFlags(WIDGET_ENABLED/* | WIDGET_BORDER*/ | WIDGET_CLEARBG); - _hints = THEME_HINT_USE_SHADOW; _type = kButtonWidget; } @@ -236,7 +227,7 @@ void ButtonWidget::handleMouseUp(int x, int y, int button, int clickCount) { } void ButtonWidget::drawWidget() { - g_gui.theme()->drawButton(Common::Rect(_x, _y, _x+_w, _y+_h), _label, _state, _hints); + g_gui.theme()->drawButton(Common::Rect(_x, _y, _x+_w, _y+_h), _label, _state, 0); } #pragma mark - @@ -336,20 +327,12 @@ GraphicsWidget::GraphicsWidget(GuiObject *boss, int x, int y, int w, int h) : Widget(boss, x, y, w, h), _gfx(), _alpha(256), _transparency(false) { setFlags(WIDGET_ENABLED | WIDGET_CLEARBG); _type = kGraphicsWidget; - // HACK: Don't save the background. We want to be sure that redrawing - // the widget updates the screen, even when there isn't any image - // to draw. - _hints &= ~THEME_HINT_SAVE_BACKGROUND; } GraphicsWidget::GraphicsWidget(GuiObject *boss, const Common::String &name) : Widget(boss, name), _gfx(), _alpha(256), _transparency(false) { setFlags(WIDGET_ENABLED | WIDGET_CLEARBG); _type = kGraphicsWidget; - // HACK: Don't save the background. We want to be sure that redrawing - // the widget updates the screen, even when there isn't any image - // to draw. - _hints &= ~THEME_HINT_SAVE_BACKGROUND; } GraphicsWidget::~GraphicsWidget() { @@ -403,7 +386,7 @@ ContainerWidget::ContainerWidget(GuiObject *boss, const Common::String &name) : } void ContainerWidget::drawWidget() { - g_gui.theme()->drawWidgetBackground(Common::Rect(_x, _y, _x + _w, _y + _h), _hints, Theme::kWidgetBackgroundBorder); + g_gui.theme()->drawWidgetBackground(Common::Rect(_x, _y, _x + _w, _y + _h), 0, Theme::kWidgetBackgroundBorder); } } // End of namespace GUI |