ui/win32/window.c

changeset 813
6d9066951cdb
parent 666
86c3f109ed3b
child 814
bcb3c7d486f3
equal deleted inserted replaced
812:29c19fcae088 813:6d9066951cdb
34 34
35 #include <stdbool.h> 35 #include <stdbool.h>
36 #include <stdio.h> 36 #include <stdio.h>
37 #include <stdlib.h> 37 #include <stdlib.h>
38 38
39 #include "win32.h"
40
41 static W32WidgetClass w32_toplevel_widget_class = {
42 .show = ui_window_widget_show,
43 .enable = NULL,
44 .get_preferred_size = NULL,
45 .destroy = w32_widget_default_destroy
46 };
39 47
40 static HINSTANCE hInstance; 48 static HINSTANCE hInstance;
41 49
42 static const char *mainWindowClass = "UiMainWindow"; 50 static const char *mainWindowClass = "UiMainWindow";
43 51
74 82
75 HWND hwnd = CreateWindowExA( 83 HWND hwnd = CreateWindowExA(
76 0, 84 0,
77 "UiMainWindow", 85 "UiMainWindow",
78 title, 86 title,
79 WS_OVERLAPPEDWINDOW | WS_VISIBLE, 87 WS_OVERLAPPEDWINDOW,
80 CW_USEDEFAULT, 88 CW_USEDEFAULT,
81 CW_USEDEFAULT, 89 CW_USEDEFAULT,
82 800, 90 800,
83 600, 91 600,
84 NULL, 92 NULL,
85 NULL, 93 NULL,
86 hInstance, 94 hInstance,
87 NULL); 95 NULL);
88 96
89 ShowWindow(hwnd, SW_SHOWNORMAL);
90 UpdateWindow(hwnd); 97 UpdateWindow(hwnd);
98
99 W32Widget *widget = w32_widget_new(&w32_toplevel_widget_class, hwnd);
100 obj->widget = widget;
101 obj->ref = 1;
91 102
92 return obj; 103 return obj;
93 } 104 }
94 105
95 UiObject *ui_window(const char *title, void *window_data) { 106 UiObject *ui_window(const char *title, void *window_data) {
96 return create_window(title, window_data, FALSE); 107 return create_window(title, window_data, FALSE);
97 } 108 }
98 109
110 void ui_window_widget_show(W32Widget *w, BOOLEAN show) {
111 ShowWindow(w->hwnd, show ? SW_SHOWNORMAL : SW_HIDE);
112 }

mercurial