mirror of https://github.com/OpenTTD/OpenTTD.git
(svn r18069) -Codechange: Initialize window flags at the same tme as the other fields instead of afterwards.
This commit is contained in:
parent
4d84dbb26b
commit
94261ad01a
|
@ -915,11 +915,12 @@ static void AssignWidgetToWindow(Window *w, const Widget *widget)
|
|||
* @param cls Class of the window, used for identification and grouping. @see WindowClass
|
||||
* @param *widget Pointer to the widget array, it is \c NULL when nested widgets are used. @see Widget
|
||||
* @param window_number Number being assigned to the new window
|
||||
* @param desc_flags Window flags. @see WindowDefaultFlag
|
||||
* @return Window pointer of the newly created window
|
||||
* @pre If nested widgets are used (\a widget is \c NULL), #nested_root and #nested_array_size must be initialized.
|
||||
* In addition, #nested_array is either \c NULL, or already initialized.
|
||||
*/
|
||||
void Window::InitializeData(WindowClass cls, const Widget *widget, int window_number)
|
||||
void Window::InitializeData(WindowClass cls, const Widget *widget, int window_number, uint32 desc_flags)
|
||||
{
|
||||
/* Set up window properties; some of them are needed to set up smallest size below */
|
||||
this->window_class = cls;
|
||||
|
@ -928,6 +929,7 @@ void Window::InitializeData(WindowClass cls, const Widget *widget, int window_nu
|
|||
this->focused_widget = NULL;
|
||||
this->nested_focus = NULL;
|
||||
this->window_number = window_number;
|
||||
this->desc_flags = desc_flags;
|
||||
|
||||
/* If available, initialize nested widget tree. */
|
||||
if (widget == NULL) {
|
||||
|
@ -1312,8 +1314,7 @@ static Point LocalGetWindowPlacement(const WindowDesc *desc, int16 sm_width, int
|
|||
*/
|
||||
Window::Window(const WindowDesc *desc, WindowNumber window_number)
|
||||
{
|
||||
this->InitializeData(desc->cls, desc->GetWidgets(), window_number);
|
||||
this->desc_flags = desc->flags;
|
||||
this->InitializeData(desc->cls, desc->GetWidgets(), window_number, desc->flags);
|
||||
Point pt = LocalGetWindowPlacement(desc, desc->minimum_width, desc->minimum_height, window_number);
|
||||
this->InitializePositionSize(pt.x, pt.y, desc->minimum_width, desc->minimum_height);
|
||||
}
|
||||
|
@ -1346,8 +1347,7 @@ void Window::CreateNestedTree(const WindowDesc *desc, bool fill_nested)
|
|||
*/
|
||||
void Window::FinishInitNested(const WindowDesc *desc, WindowNumber window_number)
|
||||
{
|
||||
this->InitializeData(desc->cls, NULL, window_number);
|
||||
this->desc_flags = desc->flags;
|
||||
this->InitializeData(desc->cls, NULL, window_number, desc->flags);
|
||||
Point pt = this->OnInitialPosition(desc, this->nested_root->smallest_x, this->nested_root->smallest_y, window_number);
|
||||
this->InitializePositionSize(pt.x, pt.y, this->nested_root->smallest_x, this->nested_root->smallest_y);
|
||||
this->FindWindowPlacementAndResize(desc->default_width, desc->default_height);
|
||||
|
|
|
@ -335,7 +335,7 @@ struct Window : ZeroedMemoryAllocator {
|
|||
};
|
||||
|
||||
protected:
|
||||
void InitializeData(WindowClass cls, const Widget *widget, int window_number);
|
||||
void InitializeData(WindowClass cls, const Widget *widget, int window_number, uint32 desc_flags);
|
||||
void InitializePositionSize(int x, int y, int min_width, int min_height);
|
||||
void FindWindowPlacementAndResize(int def_width, int def_height);
|
||||
void FindWindowPlacementAndResize(const WindowDesc *desc);
|
||||
|
|
Loading…
Reference in New Issue