summaryrefslogtreecommitdiff
path: root/src/window_gui.h
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2008-05-08 11:50:34 +0000
committerrubidium <rubidium@openttd.org>2008-05-08 11:50:34 +0000
commit92aac531c2fdc3e58c108a35e66f723360f46a9a (patch)
tree23ad171b2093a5c5980b9d912bf60056102af9fa /src/window_gui.h
parent51cda2252ceb088d75f25074f1e83e8eec5f18b6 (diff)
downloadopenttd-92aac531c2fdc3e58c108a35e66f723360f46a9a.tar.xz
(svn r13005) -Codechange: prepare AllocateWindowDescFront for subclassing of Window.
Diffstat (limited to 'src/window_gui.h')
-rw-r--r--src/window_gui.h14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/window_gui.h b/src/window_gui.h
index 32352d3ea..14e666a63 100644
--- a/src/window_gui.h
+++ b/src/window_gui.h
@@ -561,7 +561,19 @@ Window *FindWindowFromPt(int x, int y);
bool IsWindowOfPrototype(const Window *w, const Widget *widget);
void AssignWidgetToWindow(Window *w, const Widget *widget);
-Window *AllocateWindowDescFront(const WindowDesc *desc, int window_number, void *data = NULL);
+/**
+ * Open a new window.
+ * @param *desc The pointer to the WindowDesc to be created
+ * @param window_number the window number of the new window
+ * @param data arbitrary data that is send with the WE_CREATE message
+ * @return see Window pointer of the newly created window
+ */
+template <typename Wcls>
+Wcls *AllocateWindowDescFront(const WindowDesc *desc, int window_number, void *data = NULL)
+{
+ if (BringWindowToFrontById(desc->cls, window_number)) return NULL;
+ return new Wcls(desc, data, window_number);
+}
void DrawWindowViewport(const Window *w);