diff --git a/gui/Tooltip.cpp b/gui/Tooltip.cpp index 85e5856cffc..88124e782b4 100644 --- a/gui/Tooltip.cpp +++ b/gui/Tooltip.cpp @@ -37,7 +37,7 @@ Tooltip::Tooltip() : } void Tooltip::setup(Dialog *parent, Widget *widget, int x, int y) { - assert(widget->getTooltip()); + assert(widget->hasTooltip()); _maxWidth = g_gui.xmlEval()->getVar("Globals.Tooltip.MaxWidth", 100); _xdelta = g_gui.xmlEval()->getVar("Globals.Tooltip.XDelta", 0); diff --git a/gui/gui-manager.cpp b/gui/gui-manager.cpp index abd781e1a38..a0ef4216aa0 100644 --- a/gui/gui-manager.cpp +++ b/gui/gui-manager.cpp @@ -381,7 +381,7 @@ void GuiManager::runLoop() { if (tooltipCheck && _lastMousePosition.time + kTooltipDelay < _system->getMillis()) { Widget *wdg = activeDialog->findWidget(_lastMousePosition.x, _lastMousePosition.y); - if (wdg && wdg->getTooltip() && !(wdg->getFlags() & WIDGET_PRESSED)) { + if (wdg && wdg->hasTooltip() && !(wdg->getFlags() & WIDGET_PRESSED)) { Tooltip *tooltip = new Tooltip(); tooltip->setup(activeDialog, wdg, _lastMousePosition.x, _lastMousePosition.y); tooltip->runModal(); diff --git a/gui/widget.h b/gui/widget.h index 6de56862c3d..d80b2ad7e20 100644 --- a/gui/widget.h +++ b/gui/widget.h @@ -88,7 +88,7 @@ protected: uint16 _id; bool _hasFocus; ThemeEngine::WidgetStateInfo _state; - const char *_tooltip; + Common::String _tooltip; private: uint16 _flags; @@ -142,7 +142,9 @@ public: uint8 parseHotkey(const Common::String &label); Common::String cleanupHotkey(const Common::String &label); - const char *getTooltip() const { return _tooltip; } + bool hasTooltip() const { return !_tooltip.empty(); } + const Common::String &getTooltip() const { return _tooltip; } + void setTooltip(const Common::String &tooltip) { _tooltip = tooltip; } protected: void updateState(int oldFlags, int newFlags);