From 52b2d67200e489f017d520b408cf9509f459e222 Mon Sep 17 00:00:00 2001 From: alberth Date: Sat, 31 Oct 2009 11:29:53 +0000 Subject: (svn r17914) -Codechange: Use some constants in the size calculation, and pass the size as a combined value to the tooltip window. --- src/misc_gui.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/misc_gui.cpp') 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); } -- cgit v1.2.3-70-g09d2