ui/win32/window.c

changeset 813
6d9066951cdb
parent 666
86c3f109ed3b
child 814
bcb3c7d486f3
--- a/ui/win32/window.c	Wed Oct 08 07:53:57 2025 +0200
+++ b/ui/win32/window.c	Wed Oct 08 09:46:23 2025 +0200
@@ -36,6 +36,14 @@
 #include <stdio.h>
 #include <stdlib.h>
 
+#include "win32.h"
+
+static W32WidgetClass w32_toplevel_widget_class = {
+	.show = ui_window_widget_show,
+	.enable = NULL,
+	.get_preferred_size =  NULL,
+	.destroy =  w32_widget_default_destroy
+};
 
 static HINSTANCE hInstance;
 
@@ -76,7 +84,7 @@
 			0,
 			"UiMainWindow",
 			title,
-			WS_OVERLAPPEDWINDOW | WS_VISIBLE,
+			WS_OVERLAPPEDWINDOW,
             CW_USEDEFAULT,
 			CW_USEDEFAULT,
 			800,
@@ -85,9 +93,12 @@
 			NULL,
 			hInstance,
 			NULL);
-	
-	ShowWindow(hwnd, SW_SHOWNORMAL);
+
     UpdateWindow(hwnd);
+
+	W32Widget *widget = w32_widget_new(&w32_toplevel_widget_class, hwnd);
+	obj->widget = widget;
+	obj->ref = 1;
 	
 	return obj;
 }
@@ -96,3 +107,6 @@
 	return create_window(title, window_data, FALSE);
 }
 
+void ui_window_widget_show(W32Widget *w, BOOLEAN show) {
+	ShowWindow(w->hwnd, show ? SW_SHOWNORMAL : SW_HIDE);
+}

mercurial