summaryrefslogtreecommitdiff
path: root/src/misc_gui.cpp
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2010-12-12 14:14:26 +0000
committerrubidium <rubidium@openttd.org>2010-12-12 14:14:26 +0000
commita029b2b83aa344fdd8ba1f7bc0915205c52daca0 (patch)
tree95fc2013ee1d0e8c8ecd5b02ec8b807047922267 /src/misc_gui.cpp
parent5910bde58367764387e00c76e14d7465be942e7f (diff)
downloadopenttd-a029b2b83aa344fdd8ba1f7bc0915205c52daca0.tar.xz
(svn r21477) -Fix [FS#4300]: tooltips were removed when their related window got closed
Diffstat (limited to 'src/misc_gui.cpp')
-rw-r--r--src/misc_gui.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/misc_gui.cpp b/src/misc_gui.cpp
index ef485c7be..a1327ba1b 100644
--- a/src/misc_gui.cpp
+++ b/src/misc_gui.cpp
@@ -822,8 +822,9 @@ struct TooltipsWindow : public Window
uint64 params[5]; ///< The string parameters.
TooltipCloseCondition close_cond; ///< Condition for closing the window.
- TooltipsWindow(StringID str, uint paramcount, const uint64 params[], TooltipCloseCondition close_tooltip) : Window()
+ TooltipsWindow(Window *parent, StringID str, uint paramcount, const uint64 params[], TooltipCloseCondition close_tooltip) : Window()
{
+ this->parent = parent;
this->string_id = str;
assert_compile(sizeof(this->params[0]) == sizeof(params[0]));
assert(paramcount <= lengthof(this->params));
@@ -901,18 +902,19 @@ struct TooltipsWindow : public Window
/**
* Shows a tooltip
+ * @param parent The window this tooltip is related to.
* @param str String to be displayed
* @param paramcount number of params to deal with
* @param params (optional) up to 5 pieces of additional information that may be added to a tooltip
* @param use_left_mouse_button close the tooltip when the left (true) or right (false) mousebutton is released
*/
-void GuiShowTooltips(StringID str, uint paramcount, const uint64 params[], TooltipCloseCondition close_tooltip)
+void GuiShowTooltips(Window *parent, StringID str, uint paramcount, const uint64 params[], TooltipCloseCondition close_tooltip)
{
DeleteWindowById(WC_TOOLTIPS, 0);
if (str == STR_NULL) return;
- new TooltipsWindow(str, paramcount, params, close_tooltip);
+ new TooltipsWindow(parent, str, paramcount, params, close_tooltip);
}
/* Delete a character at the caret position in a text buf.