mirror of https://github.com/OpenTTD/OpenTTD
(svn r18069) -Codechange: Initialize window flags at the same tme as the other fields instead of afterwards.
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 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 *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 window_number Number being assigned to the new window
|
||||||
|
* @param desc_flags Window flags. @see WindowDefaultFlag
|
||||||
* @return Window pointer of the newly created window
|
* @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.
|
* @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.
|
* 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 */
|
/* Set up window properties; some of them are needed to set up smallest size below */
|
||||||
this->window_class = cls;
|
this->window_class = cls;
|
||||||
|
@ -928,6 +929,7 @@ void Window::InitializeData(WindowClass cls, const Widget *widget, int window_nu
|
||||||
this->focused_widget = NULL;
|
this->focused_widget = NULL;
|
||||||
this->nested_focus = NULL;
|
this->nested_focus = NULL;
|
||||||
this->window_number = window_number;
|
this->window_number = window_number;
|
||||||
|
this->desc_flags = desc_flags;
|
||||||
|
|
||||||
/* If available, initialize nested widget tree. */
|
/* If available, initialize nested widget tree. */
|
||||||
if (widget == NULL) {
|
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)
|
Window::Window(const WindowDesc *desc, WindowNumber window_number)
|
||||||
{
|
{
|
||||||
this->InitializeData(desc->cls, desc->GetWidgets(), window_number);
|
this->InitializeData(desc->cls, desc->GetWidgets(), window_number, desc->flags);
|
||||||
this->desc_flags = desc->flags;
|
|
||||||
Point pt = LocalGetWindowPlacement(desc, desc->minimum_width, desc->minimum_height, window_number);
|
Point pt = LocalGetWindowPlacement(desc, desc->minimum_width, desc->minimum_height, window_number);
|
||||||
this->InitializePositionSize(pt.x, pt.y, desc->minimum_width, desc->minimum_height);
|
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)
|
void Window::FinishInitNested(const WindowDesc *desc, WindowNumber window_number)
|
||||||
{
|
{
|
||||||
this->InitializeData(desc->cls, NULL, window_number);
|
this->InitializeData(desc->cls, NULL, window_number, desc->flags);
|
||||||
this->desc_flags = desc->flags;
|
|
||||||
Point pt = this->OnInitialPosition(desc, this->nested_root->smallest_x, this->nested_root->smallest_y, window_number);
|
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->InitializePositionSize(pt.x, pt.y, this->nested_root->smallest_x, this->nested_root->smallest_y);
|
||||||
this->FindWindowPlacementAndResize(desc->default_width, desc->default_height);
|
this->FindWindowPlacementAndResize(desc->default_width, desc->default_height);
|
||||||
|
|
|
@ -335,7 +335,7 @@ struct Window : ZeroedMemoryAllocator {
|
||||||
};
|
};
|
||||||
|
|
||||||
protected:
|
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 InitializePositionSize(int x, int y, int min_width, int min_height);
|
||||||
void FindWindowPlacementAndResize(int def_width, int def_height);
|
void FindWindowPlacementAndResize(int def_width, int def_height);
|
||||||
void FindWindowPlacementAndResize(const WindowDesc *desc);
|
void FindWindowPlacementAndResize(const WindowDesc *desc);
|
||||||
|
|
Loading…
Reference in New Issue