summaryrefslogtreecommitdiff
path: root/src/toolbar_gui.cpp
diff options
context:
space:
mode:
authorfrosch <frosch@openttd.org>2015-02-13 21:13:45 +0000
committerfrosch <frosch@openttd.org>2015-02-13 21:13:45 +0000
commite113f5e4a14c763ed433487f4d21e2f35e205e1b (patch)
treeafcb033374f504ebde874649f3d5675bca2fca68 /src/toolbar_gui.cpp
parent1ebd85c1cc52efba447497c5e015b05f579a0dbb (diff)
downloadopenttd-e113f5e4a14c763ed433487f4d21e2f35e205e1b.tar.xz
(svn r27146) -Fix: Make statusbar and chat-entry window use the same width as the toolbar. Otherwise they lack a size definition.
Diffstat (limited to 'src/toolbar_gui.cpp')
-rw-r--r--src/toolbar_gui.cpp17
1 files changed, 13 insertions, 4 deletions
diff --git a/src/toolbar_gui.cpp b/src/toolbar_gui.cpp
index de7325217..da47b2afa 100644
--- a/src/toolbar_gui.cpp
+++ b/src/toolbar_gui.cpp
@@ -46,6 +46,7 @@
#include "game/game.hpp"
#include "goal_base.h"
#include "story_base.h"
+#include "toolbar_gui.h"
#include "widgets/toolbar_widget.h"
@@ -56,6 +57,9 @@
#include "safeguards.h"
+/** Width of the toolbar, shared by statusbar. */
+uint _toolbar_width = 0;
+
RailType _last_built_railtype;
RoadType _last_built_roadtype;
@@ -1350,7 +1354,7 @@ public:
child_wid->current_x = child_wid->smallest_x;
}
}
- w->window_desc->default_width = nbuttons * this->smallest_x;
+ _toolbar_width = nbuttons * this->smallest_x;
}
void AssignSizePosition(SizingType sizing, uint x, uint y, uint given_width, uint given_height, bool rtl)
@@ -1526,7 +1530,7 @@ class NWidgetScenarioToolbarContainer : public NWidgetToolbarContainer {
assert(i < lengthof(this->panel_widths));
this->panel_widths[i++] = child_wid->current_x;
- w->window_desc->default_width += child_wid->current_x;
+ _toolbar_width += child_wid->current_x;
}
}
@@ -1666,6 +1670,11 @@ struct MainToolbarWindow : Window {
DoZoomInOutWindow(ZOOM_NONE, this);
}
+ virtual void FindWindowPlacementAndResize(int def_width, int def_height)
+ {
+ Window::FindWindowPlacementAndResize(_toolbar_width, def_height);
+ }
+
virtual void OnPaint()
{
/* If spectator, disable all construction buttons
@@ -1900,7 +1909,7 @@ static const NWidgetPart _nested_toolbar_normal_widgets[] = {
};
static WindowDesc _toolb_normal_desc(
- WDP_MANUAL, NULL, 640, 22,
+ WDP_MANUAL, NULL, 0, 0,
WC_MAIN_TOOLBAR, WC_NONE,
WDF_NO_FOCUS,
_nested_toolbar_normal_widgets, lengthof(_nested_toolbar_normal_widgets),
@@ -2211,7 +2220,7 @@ static const NWidgetPart _nested_toolb_scen_widgets[] = {
};
static WindowDesc _toolb_scen_desc(
- WDP_MANUAL, NULL, 640, 22,
+ WDP_MANUAL, NULL, 0, 0,
WC_MAIN_TOOLBAR, WC_NONE,
WDF_NO_FOCUS,
_nested_toolb_scen_widgets, lengthof(_nested_toolb_scen_widgets),