summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authoralberth <alberth@openttd.org>2009-10-31 11:29:53 +0000
committeralberth <alberth@openttd.org>2009-10-31 11:29:53 +0000
commit52b2d67200e489f017d520b408cf9509f459e222 (patch)
tree83dd1f3a26cdcbbda3671374cdb1c959c91b2212 /src
parent8e7af56d53840399c13c4862b74205a31a68fd64 (diff)
downloadopenttd-52b2d67200e489f017d520b408cf9509f459e222.tar.xz
(svn r17914) -Codechange: Use some constants in the size calculation, and pass the size as a combined value to the tooltip window.
Diffstat (limited to 'src')
-rw-r--r--src/misc_gui.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/misc_gui.cpp b/src/misc_gui.cpp
index 5ffd47f5f..18e98b95f 100644
--- a/src/misc_gui.cpp
+++ b/src/misc_gui.cpp
@@ -790,9 +790,9 @@ struct TooltipsWindow : public Window
uint64 params[5]; ///< The string parameters.
bool use_left_mouse_button; ///< Wait for left mouse button to close window (else, wait for right button).
- TooltipsWindow(int x, int y, int width, int height, const Widget *widget,
+ TooltipsWindow(int x, int y, const Dimension &window_size, const Widget *widget,
StringID str, uint paramcount, const uint64 params[], bool use_left_mouse_button) :
- Window(x, y, width, height, WC_TOOLTIPS, widget)
+ Window(x, y, window_size.width, window_size.height, WC_TOOLTIPS, widget)
{
this->string_id = str;
assert_compile(sizeof(this->params[0]) == sizeof(params[0]));
@@ -848,8 +848,8 @@ void GuiShowTooltips(StringID str, uint paramcount, const uint64 params[], bool
br.height = GetStringHeight(str, br.width);
/* increase slightly to have some space around the box */
- br.width += 6;
- br.height += 4;
+ br.width += 2 + WD_FRAMERECT_LEFT + WD_FRAMERECT_RIGHT;
+ br.height += 2 + WD_FRAMERECT_TOP + WD_FRAMERECT_BOTTOM;
/* Correctly position the tooltip position, watch out for window and cursor size
* Clamp value to below main toolbar and above statusbar. If tooltip would
@@ -860,7 +860,7 @@ void GuiShowTooltips(StringID str, uint paramcount, const uint64 params[], bool
const Widget *wid = InitializeWidgetArrayFromNestedWidgets(_nested_tooltips_widgets, lengthof(_nested_tooltips_widgets),
_tooltips_widgets, &generated_tooltips_widgets);
- new TooltipsWindow(x, y, br.width, br.height, wid, str, paramcount, params, use_left_mouse_button);
+ new TooltipsWindow(x, y, br, wid, str, paramcount, params, use_left_mouse_button);
}