(svn r25287) -Codechange: Keep a reference to the WindowDesc in the Window after construction.
This commit is contained in:
@@ -38,22 +38,22 @@ struct SetDateWindow : Window {
|
||||
* @param max_year the maximum year (inclusive) to show in the year dropdown
|
||||
* @param callback the callback to call once a date has been selected
|
||||
*/
|
||||
SetDateWindow(const WindowDesc *desc, WindowNumber window_number, Window *parent, Date initial_date, Year min_year, Year max_year, SetDateCallback *callback) :
|
||||
Window(),
|
||||
SetDateWindow(WindowDesc *desc, WindowNumber window_number, Window *parent, Date initial_date, Year min_year, Year max_year, SetDateCallback *callback) :
|
||||
Window(desc),
|
||||
callback(callback),
|
||||
min_year(max(MIN_YEAR, min_year)),
|
||||
max_year(min(MAX_YEAR, max_year))
|
||||
{
|
||||
assert(this->min_year <= this->max_year);
|
||||
this->parent = parent;
|
||||
this->InitNested(desc, window_number);
|
||||
this->InitNested(window_number);
|
||||
|
||||
if (initial_date == 0) initial_date = _date;
|
||||
ConvertDateToYMD(initial_date, &this->date);
|
||||
this->date.year = Clamp(this->date.year, min_year, max_year);
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
Point pt = { this->parent->left + this->parent->width / 2 - sm_width / 2, this->parent->top + this->parent->height / 2 - sm_height / 2 };
|
||||
return pt;
|
||||
@@ -194,7 +194,7 @@ static const NWidgetPart _nested_set_date_widgets[] = {
|
||||
};
|
||||
|
||||
/** Description of the date setting window. */
|
||||
static const WindowDesc _set_date_desc(
|
||||
static WindowDesc _set_date_desc(
|
||||
WDP_CENTER, 0, 0,
|
||||
WC_SET_DATE, WC_NONE,
|
||||
0,
|
||||
|
Reference in New Issue
Block a user