summaryrefslogtreecommitdiff
path: root/src/misc_gui.cpp
diff options
context:
space:
mode:
authorfrosch <frosch@openttd.org>2013-05-26 19:23:42 +0000
committerfrosch <frosch@openttd.org>2013-05-26 19:23:42 +0000
commit56e4a8c4d63b19cb037ac1ba64c5a4d7fde4350b (patch)
treef3e5c225182fce7a451af4e09e943920e0f1cc3c /src/misc_gui.cpp
parentb10a4f151aa534860dcc61ecf8cba7b3589e6281 (diff)
downloadopenttd-56e4a8c4d63b19cb037ac1ba64c5a4d7fde4350b.tar.xz
(svn r25287) -Codechange: Keep a reference to the WindowDesc in the Window after construction.
Diffstat (limited to 'src/misc_gui.cpp')
-rw-r--r--src/misc_gui.cpp34
1 files changed, 17 insertions, 17 deletions
diff --git a/src/misc_gui.cpp b/src/misc_gui.cpp
index 0fa450c51..d07254975 100644
--- a/src/misc_gui.cpp
+++ b/src/misc_gui.cpp
@@ -48,7 +48,7 @@ static const NWidgetPart _nested_land_info_widgets[] = {
NWidget(WWT_PANEL, COLOUR_GREY, WID_LI_BACKGROUND), EndContainer(),
};
-static const WindowDesc _land_info_desc(
+static WindowDesc _land_info_desc(
WDP_AUTO, 0, 0,
WC_LAND_INFO, WC_NONE,
0,
@@ -110,9 +110,9 @@ public:
}
}
- LandInfoWindow(TileIndex tile) : Window(), tile(tile)
+ LandInfoWindow(TileIndex tile) : Window(&_land_info_desc), tile(tile)
{
- this->InitNested(&_land_info_desc);
+ this->InitNested();
#if defined(_DEBUG)
# define LANDINFOD_LEVEL 0
@@ -365,7 +365,7 @@ static const NWidgetPart _nested_about_widgets[] = {
EndContainer(),
};
-static const WindowDesc _about_desc(
+static WindowDesc _about_desc(
WDP_CENTER, 0, 0,
WC_GAME_OPTIONS, WC_NONE,
0,
@@ -439,9 +439,9 @@ struct AboutWindow : public Window {
int line_height; ///< The height of a single line
static const int num_visible_lines = 19; ///< The number of lines visible simultaneously
- AboutWindow() : Window()
+ AboutWindow() : Window(&_about_desc)
{
- this->InitNested(&_about_desc, WN_GAME_OPTIONS_ABOUT);
+ this->InitNested(WN_GAME_OPTIONS_ABOUT);
this->counter = 5;
this->text_position = this->GetWidget<NWidgetBase>(WID_A_SCROLLING_TEXT)->pos_y + this->GetWidget<NWidgetBase>(WID_A_SCROLLING_TEXT)->current_y;
@@ -615,7 +615,7 @@ static const NWidgetPart _nested_tooltips_widgets[] = {
NWidget(WWT_PANEL, COLOUR_GREY, WID_TT_BACKGROUND), SetMinimalSize(200, 32), EndContainer(),
};
-static const WindowDesc _tool_tips_desc(
+static WindowDesc _tool_tips_desc(
WDP_MANUAL, 0, 0, // Coordinates and sizes are not used,
WC_TOOLTIPS, WC_NONE,
0,
@@ -630,7 +630,7 @@ struct TooltipsWindow : public Window
uint64 params[5]; ///< The string parameters.
TooltipCloseCondition close_cond; ///< Condition for closing the window.
- TooltipsWindow(Window *parent, 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(&_tool_tips_desc)
{
this->parent = parent;
this->string_id = str;
@@ -640,12 +640,12 @@ struct TooltipsWindow : public Window
this->paramcount = paramcount;
this->close_cond = close_tooltip;
- this->InitNested(&_tool_tips_desc);
+ this->InitNested();
CLRBITS(this->flags, WF_WHITE_BORDER);
}
- virtual Point OnInitialPosition(const WindowDesc *desc, int16 sm_width, int16 sm_height, int window_number)
+ virtual Point OnInitialPosition(int16 sm_width, int16 sm_height, int window_number)
{
/* Find the free screen space between the main toolbar at the top, and the statusbar at the bottom.
* Add a fixed distance 2 so the tooltip floats free from both bars.
@@ -818,8 +818,8 @@ struct QueryStringWindow : public Window
QueryString editbox; ///< Editbox.
QueryStringFlags flags; ///< Flags controlling behaviour of the window.
- QueryStringWindow(StringID str, StringID caption, uint max_bytes, uint max_chars, const WindowDesc *desc, Window *parent, CharSetFilter afilter, QueryStringFlags flags) :
- editbox(max_bytes, max_chars)
+ QueryStringWindow(StringID str, StringID caption, uint max_bytes, uint max_chars, WindowDesc *desc, Window *parent, CharSetFilter afilter, QueryStringFlags flags) :
+ Window(desc), editbox(max_bytes, max_chars)
{
char *last_of = &this->editbox.text.buf[this->editbox.text.max_bytes - 1];
GetString(this->editbox.text.buf, str, last_of);
@@ -842,7 +842,7 @@ struct QueryStringWindow : public Window
this->editbox.text.afilter = afilter;
this->flags = flags;
- this->InitNested(desc, WN_QUERY_STRING);
+ this->InitNested(WN_QUERY_STRING);
this->parent = parent;
@@ -918,7 +918,7 @@ static const NWidgetPart _nested_query_string_widgets[] = {
EndContainer(),
};
-static const WindowDesc _query_string_desc(
+static WindowDesc _query_string_desc(
WDP_CENTER, 0, 0,
WC_QUERY_STRING, WC_NONE,
0,
@@ -950,7 +950,7 @@ struct QueryWindow : public Window {
StringID message; ///< message shown for query window
StringID caption; ///< title of window
- QueryWindow(const WindowDesc *desc, StringID caption, StringID message, Window *parent, QueryCallbackProc *callback) : Window()
+ QueryWindow(WindowDesc *desc, StringID caption, StringID message, Window *parent, QueryCallbackProc *callback) : Window(desc)
{
/* Create a backup of the variadic arguments to strings because it will be
* overridden pretty often. We will copy these back for drawing */
@@ -959,7 +959,7 @@ struct QueryWindow : public Window {
this->message = message;
this->proc = callback;
- this->InitNested(desc, WN_CONFIRM_POPUP_QUERY);
+ this->InitNested(WN_CONFIRM_POPUP_QUERY);
this->parent = parent;
this->left = parent->left + (parent->width / 2) - (this->width / 2);
@@ -1059,7 +1059,7 @@ static const NWidgetPart _nested_query_widgets[] = {
EndContainer(),
};
-static const WindowDesc _query_desc(
+static WindowDesc _query_desc(
WDP_CENTER, 0, 0,
WC_CONFIRM_POPUP_QUERY, WC_NONE,
WDF_MODAL,