src/window_gui.h
changeset 9143 029e126e3439
parent 9142 858a058aa730
child 9144 4c8d0193ebe0
--- a/src/window_gui.h	Thu May 08 11:31:41 2008 +0000
+++ b/src/window_gui.h	Thu May 08 11:50:34 2008 +0000
@@ -561,7 +561,19 @@
 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);