diff options
author | frosch <frosch@openttd.org> | 2013-05-26 19:23:42 +0000 |
---|---|---|
committer | frosch <frosch@openttd.org> | 2013-05-26 19:23:42 +0000 |
commit | 56e4a8c4d63b19cb037ac1ba64c5a4d7fde4350b (patch) | |
tree | f3e5c225182fce7a451af4e09e943920e0f1cc3c /src/window_gui.h | |
parent | b10a4f151aa534860dcc61ecf8cba7b3589e6281 (diff) | |
download | openttd-56e4a8c4d63b19cb037ac1ba64c5a4d7fde4350b.tar.xz |
(svn r25287) -Codechange: Keep a reference to the WindowDesc in the Window after construction.
Diffstat (limited to 'src/window_gui.h')
-rw-r--r-- | src/window_gui.h | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/src/window_gui.h b/src/window_gui.h index c0beaf323..f04c7d0a3 100644 --- a/src/window_gui.h +++ b/src/window_gui.h @@ -248,14 +248,14 @@ struct QueryString; */ struct Window : ZeroedMemoryAllocator { protected: - void InitializeData(const WindowDesc *desc, WindowNumber window_number); + void InitializeData(WindowNumber window_number); void InitializePositionSize(int x, int y, int min_width, int min_height); void FindWindowPlacementAndResize(int def_width, int def_height); SmallVector<int, 4> scheduled_invalidation_data; ///< Data of scheduled OnInvalidateData() calls. public: - Window(); + Window(WindowDesc *desc); virtual ~Window(); @@ -279,6 +279,7 @@ public: { } + WindowDesc *window_desc; ///< Window description WindowFlags flags; ///< Window flags WindowClass window_class; ///< Window class WindowNumber window_number; ///< Window number within the window class @@ -322,9 +323,9 @@ public: const QueryString *GetQueryString(uint widnum) const; QueryString *GetQueryString(uint widnum); - void InitNested(const WindowDesc *desc, WindowNumber number = 0); - void CreateNestedTree(const WindowDesc *desc, bool fill_nested = true); - void FinishInitNested(const WindowDesc *desc, WindowNumber window_number = 0); + void InitNested(WindowNumber number = 0); + void CreateNestedTree(bool fill_nested = true); + void FinishInitNested(WindowNumber window_number = 0); /** * Set the timeout flag of the window and initiate the timer. @@ -506,13 +507,12 @@ public: /** * Compute the initial position of the window. - * @param *desc The pointer to the WindowDesc of the window to create. * @param sm_width Smallest width of the window. * @param sm_height Smallest height of the window. * @param window_number The window number of the new window. * @return Initial position of the top-left corner of the window. */ - 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); /** * The window must be repainted. @@ -805,7 +805,7 @@ inline const NWID *Window::GetWidget(uint widnum) const class PickerWindowBase : public Window { public: - PickerWindowBase(Window *parent) : Window() + PickerWindowBase(WindowDesc *desc, Window *parent) : Window(desc) { this->parent = parent; } @@ -823,7 +823,7 @@ Window *FindWindowFromPt(int x, int y); * @return see Window pointer of the newly created window */ template <typename Wcls> -Wcls *AllocateWindowDescFront(const WindowDesc *desc, int window_number) +Wcls *AllocateWindowDescFront(WindowDesc *desc, int window_number) { if (BringWindowToFrontById(desc->cls, window_number)) return NULL; return new Wcls(desc, window_number); |