diff options
author | Max Horn | 2002-07-08 11:55:55 +0000 |
---|---|---|
committer | Max Horn | 2002-07-08 11:55:55 +0000 |
commit | 32ea67dfed453f60442bdf3340edcb379ff86932 (patch) | |
tree | 5f04b03e0b7a173cc4ae9dfb33e9bb83773cf99c /gui | |
parent | d262c4e6dca83b214c54c96f474cb1e766e77885 (diff) | |
download | scummvm-rg350-32ea67dfed453f60442bdf3340edcb379ff86932.tar.gz scummvm-rg350-32ea67dfed453f60442bdf3340edcb379ff86932.tar.bz2 scummvm-rg350-32ea67dfed453f60442bdf3340edcb379ff86932.zip |
got rid of RTTI again (i.e. dynamic_cast)
svn-id: r4492
Diffstat (limited to 'gui')
-rw-r--r-- | gui/dialog.cpp | 5 | ||||
-rw-r--r-- | gui/widget.cpp | 5 | ||||
-rw-r--r-- | gui/widget.h | 7 |
3 files changed, 13 insertions, 4 deletions
diff --git a/gui/dialog.cpp b/gui/dialog.cpp index 850c490702..682a36fb2c 100644 --- a/gui/dialog.cpp +++ b/gui/dialog.cpp @@ -56,9 +56,8 @@ void Dialog::handleKey(char key, int modifiers) Widget *w = _firstWidget; key = toupper(key); while (w) { - ButtonWidget *b = dynamic_cast<ButtonWidget *>(w); - if (b && key == toupper(b->_hotkey)) { - b->handleClick(1); + if (w->_type == kButtonWidget && key == toupper(((ButtonWidget *)w)->_hotkey)) { + w->handleClick(1); break; } w = w->_next; diff --git a/gui/widget.cpp b/gui/widget.cpp index 1975001733..cb3fce0ed5 100644 --- a/gui/widget.cpp +++ b/gui/widget.cpp @@ -25,7 +25,7 @@ Widget::Widget (Dialog *boss, int x, int y, int w, int h) - : _boss(boss), _x(x), _y(y), _w(w), _h(h), _id(0), _flags(0) + : _type(0), _boss(boss), _x(x), _y(y), _w(w), _h(h), _id(0), _flags(0) { // Insert into the widget list of the boss _next = _boss->_firstWidget; @@ -78,6 +78,7 @@ StaticTextWidget::StaticTextWidget(Dialog *boss, int x, int y, int w, int h, con { // FIXME - maybe we should make a real copy of the string? _text = text; + _type = kStaticTextWidget; } void StaticTextWidget::drawWidget(bool hilite) @@ -94,6 +95,7 @@ ButtonWidget::ButtonWidget(Dialog *boss, int x, int y, int w, int h, const char : StaticTextWidget(boss, x, y, w, h, label), _cmd(cmd), _hotkey(hotkey) { _flags = WIDGET_ENABLED | WIDGET_BORDER /* | WIDGET_CLEARBG */ ; + _type = kButtonWidget; } void ButtonWidget::handleClick(int button) @@ -122,6 +124,7 @@ CheckboxWidget::CheckboxWidget(Dialog *boss, int x, int y, int w, int h, const c : ButtonWidget(boss, x, y, w, h, label, cmd, hotkey), _state(false) { _flags = WIDGET_ENABLED; + _type = kCheckboxWidget; } void CheckboxWidget::handleClick(int button) diff --git a/gui/widget.h b/gui/widget.h index aed1e5590b..0e8e15cce7 100644 --- a/gui/widget.h +++ b/gui/widget.h @@ -35,10 +35,17 @@ enum { WIDGET_WANT_TICKLE = 1 << 5, }; +enum { + kStaticTextWidget = 'TEXT', + kButtonWidget = 'BTTN', + kCheckboxWidget = 'CHKB', +}; + /* Widget */ class Widget { friend class Dialog; protected: + int _type; Dialog *_boss; Widget *_next; int16 _x, _y; |