(svn r25287) -Codechange: Keep a reference to the WindowDesc in the Window after construction.

This commit is contained in:
frosch
2013-05-26 19:23:42 +00:00
parent b10a4f151a
commit 56e4a8c4d6
61 changed files with 488 additions and 482 deletions

View File

@@ -90,7 +90,7 @@ static const NWidgetPart _nested_dropdown_menu_widgets[] = {
EndContainer(),
};
const WindowDesc _dropdown_desc(
static WindowDesc _dropdown_desc(
WDP_MANUAL, 0, 0,
WC_DROPDOWN_MENU, WC_NONE,
0,
@@ -124,11 +124,12 @@ struct DropdownWindow : Window {
* @param scroll Dropdown menu has a scrollbar.
* @param widget Widgets of the dropdown menu window.
*/
DropdownWindow(Window *parent, DropDownList *list, int selected, int button, bool instant_close, const Point &position, const Dimension &size, Colours wi_colour, bool scroll) : Window()
DropdownWindow(Window *parent, DropDownList *list, int selected, int button, bool instant_close, const Point &position, const Dimension &size, Colours wi_colour, bool scroll)
: Window(&_dropdown_desc)
{
this->position = position;
this->CreateNestedTree(&_dropdown_desc);
this->CreateNestedTree();
this->vscroll = this->GetScrollbar(WID_DM_SCROLL);
@@ -142,7 +143,7 @@ struct DropdownWindow : Window {
this->GetWidget<NWidgetStacked>(WID_DM_SHOW_SCROLL)->SetDisplayedPlane(scroll ? 0 : SZSP_NONE);
this->FinishInitNested(&_dropdown_desc, 0);
this->FinishInitNested(0);
CLRBITS(this->flags, WF_WHITE_BORDER);
/* Total length of list */
@@ -183,7 +184,7 @@ struct DropdownWindow : Window {
DeleteDropDownList(this->list);
}
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)
{
return this->position;
}