diff options
author | Paul Gilbert | 2015-06-20 13:46:02 -0400 |
---|---|---|
committer | Paul Gilbert | 2015-06-20 13:46:02 -0400 |
commit | beedcaf28ee83411d75fb159703823ab1ebe7925 (patch) | |
tree | 27ef9b6907593f6b822f57cbaa622a15e47f7850 /engines/sherlock/tattoo | |
parent | e92dca058e732944024a490cb509fa2fd06c6872 (diff) | |
download | scummvm-rg350-beedcaf28ee83411d75fb159703823ab1ebe7925.tar.gz scummvm-rg350-beedcaf28ee83411d75fb159703823ab1ebe7925.tar.bz2 scummvm-rg350-beedcaf28ee83411d75fb159703823ab1ebe7925.zip |
SHERLOCK: RT: Create WidgetSceneTooltip descendant tooltip class
Diffstat (limited to 'engines/sherlock/tattoo')
-rw-r--r-- | engines/sherlock/tattoo/tattoo_user_interface.cpp | 2 | ||||
-rw-r--r-- | engines/sherlock/tattoo/tattoo_user_interface.h | 2 | ||||
-rw-r--r-- | engines/sherlock/tattoo/widget_base.h | 5 | ||||
-rw-r--r-- | engines/sherlock/tattoo/widget_tooltip.cpp | 68 | ||||
-rw-r--r-- | engines/sherlock/tattoo/widget_tooltip.h | 15 |
5 files changed, 52 insertions, 40 deletions
diff --git a/engines/sherlock/tattoo/tattoo_user_interface.cpp b/engines/sherlock/tattoo/tattoo_user_interface.cpp index 7c408c820a..d7de2de6cf 100644 --- a/engines/sherlock/tattoo/tattoo_user_interface.cpp +++ b/engines/sherlock/tattoo/tattoo_user_interface.cpp @@ -611,7 +611,7 @@ void TattooUserInterface::displayObjectNames() { } } - _tooltipWidget.execute(); + _tooltipWidget.handleEvents(); _oldArrowZone = _arrowZone; } diff --git a/engines/sherlock/tattoo/tattoo_user_interface.h b/engines/sherlock/tattoo/tattoo_user_interface.h index ae647917ab..35e1cb8ef0 100644 --- a/engines/sherlock/tattoo/tattoo_user_interface.h +++ b/engines/sherlock/tattoo/tattoo_user_interface.h @@ -57,7 +57,7 @@ private: int _cAnimFramePause; WidgetInventory _inventoryWidget; WidgetText _textWidget; - WidgetTooltip _tooltipWidget; + WidgetSceneTooltip _tooltipWidget; WidgetVerbs _verbsWidget; WidgetBase *_widget; private: diff --git a/engines/sherlock/tattoo/widget_base.h b/engines/sherlock/tattoo/widget_base.h index 5a16ab612d..4b7ae2ebde 100644 --- a/engines/sherlock/tattoo/widget_base.h +++ b/engines/sherlock/tattoo/widget_base.h @@ -67,6 +67,11 @@ public: * Close a currently active menu */ virtual void banishWindow(); + + /** + * Handle event processing + */ + virtual void handleEvents() {} }; } // End of namespace Tattoo diff --git a/engines/sherlock/tattoo/widget_tooltip.cpp b/engines/sherlock/tattoo/widget_tooltip.cpp index 69bfd14162..2e55d4bfff 100644 --- a/engines/sherlock/tattoo/widget_tooltip.cpp +++ b/engines/sherlock/tattoo/widget_tooltip.cpp @@ -117,7 +117,41 @@ void WidgetTooltip::setText(const Common::String &str) { } } -void WidgetTooltip::execute() { +void WidgetTooltip::draw() { + Screen &screen = *_vm->_screen; + + if (!_surface.empty()) + screen._backBuffer1.transBlitFrom(_surface, Common::Point(_bounds.left, _bounds.top)); +} + +void WidgetTooltip::erase() { + Screen &screen = *_vm->_screen; + TattooUserInterface &ui = *(TattooUserInterface *)_vm->_ui; + + if (_bounds.width() > 0) { + screen.slamArea(_oldBounds.left - ui._currentScroll.x, _oldBounds.top, _oldBounds.width(), _oldBounds.height()); + + // If there's no text actually being displayed, then reset bounds so we don't keep restoring the area + if (_surface.empty()) { + _bounds.left = _bounds.top = _bounds.right = _bounds.bottom = 0; + _oldBounds.left = _oldBounds.top = _oldBounds.right = _oldBounds.bottom = 0; + } + } + + if (!_surface.empty()) + screen.slamArea(_bounds.left - ui._currentScroll.x, _bounds.top, _bounds.width(), _bounds.height()); +} + +void WidgetTooltip::erasePrevious() { + Screen &screen = *_vm->_screen; + if (_oldBounds.width() > 0) + screen._backBuffer1.blitFrom(screen._backBuffer2, Common::Point(_oldBounds.left, _oldBounds.top), + _oldBounds); +} + +/*----------------------------------------------------------------*/ + +void WidgetSceneTooltip::handleEvents() { Events &events = *_vm->_events; People &people = *_vm->_people; Scene &scene = *_vm->_scene; @@ -168,38 +202,6 @@ void WidgetTooltip::execute() { ui._oldArrowZone = ui._arrowZone; } -void WidgetTooltip::draw() { - Screen &screen = *_vm->_screen; - - if (!_surface.empty()) - screen._backBuffer1.transBlitFrom(_surface, Common::Point(_bounds.left, _bounds.top)); -} - -void WidgetTooltip::erase() { - Screen &screen = *_vm->_screen; - TattooUserInterface &ui = *(TattooUserInterface *)_vm->_ui; - - if (_bounds.width() > 0) { - screen.slamArea(_oldBounds.left - ui._currentScroll.x, _oldBounds.top, _oldBounds.width(), _oldBounds.height()); - - // If there's no text actually being displayed, then reset bounds so we don't keep restoring the area - if (_surface.empty()) { - _bounds.left = _bounds.top = _bounds.right = _bounds.bottom = 0; - _oldBounds.left = _oldBounds.top = _oldBounds.right = _oldBounds.bottom = 0; - } - } - - if (!_surface.empty()) - screen.slamArea(_bounds.left - ui._currentScroll.x, _bounds.top, _bounds.width(), _bounds.height()); -} - -void WidgetTooltip::erasePrevious() { - Screen &screen = *_vm->_screen; - if (_oldBounds.width() > 0) - screen._backBuffer1.blitFrom(screen._backBuffer2, Common::Point(_oldBounds.left, _oldBounds.top), - _oldBounds); -} - } // End of namespace Tattoo } // End of namespace Sherlock diff --git a/engines/sherlock/tattoo/widget_tooltip.h b/engines/sherlock/tattoo/widget_tooltip.h index ff1795d938..ae93f15f1b 100644 --- a/engines/sherlock/tattoo/widget_tooltip.h +++ b/engines/sherlock/tattoo/widget_tooltip.h @@ -44,11 +44,6 @@ public: void setText(const Common::String &str); /** - * Handle updating the tooltip state - */ - void execute(); - - /** * Draw the tooltip if necessary */ void draw(); @@ -64,6 +59,16 @@ public: void erasePrevious(); }; +class WidgetSceneTooltip : public WidgetTooltip { +public: + WidgetSceneTooltip(SherlockEngine *vm) : WidgetTooltip(vm) {} + + /** + * Handle updating the tooltip state + */ + virtual void handleEvents(); +}; + } // End of namespace Tattoo } // End of namespace Sherlock |