| 127 void ui_show(UiObject *obj) { |
127 void ui_show(UiObject *obj) { |
| 128 ui_set_visible(obj->widget, TRUE); |
128 ui_set_visible(obj->widget, TRUE); |
| 129 } |
129 } |
| 130 |
130 |
| 131 LRESULT CALLBACK ui_default_eventproc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { |
131 LRESULT CALLBACK ui_default_eventproc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { |
| 132 printf("default event proc: %d, %d\n", (int)hwnd, (int)uMsg); |
|
| 133 fflush(stdout); |
132 fflush(stdout); |
| 134 W32Widget *widget = (W32Widget*)GetWindowLongPtr(hwnd, GWLP_USERDATA); |
133 W32Widget *widget = (W32Widget*)GetWindowLongPtr(hwnd, GWLP_USERDATA); |
| 135 if (widget && widget->wclass->eventproc) { |
134 if (widget && widget->wclass->eventproc) { |
| 136 widget->wclass->eventproc(widget, hwnd, uMsg, wParam, lParam); |
135 widget->wclass->eventproc(widget, hwnd, uMsg, wParam, lParam); |
| 137 } |
136 } |
| 146 if (cmdWidget && cmdWidget->wclass->eventproc) { |
145 if (cmdWidget && cmdWidget->wclass->eventproc) { |
| 147 cmdWidget->wclass->eventproc(cmdWidget, hwnd, uMsg, wParam, lParam); |
146 cmdWidget->wclass->eventproc(cmdWidget, hwnd, uMsg, wParam, lParam); |
| 148 } |
147 } |
| 149 break; |
148 break; |
| 150 } |
149 } |
| |
150 case WM_NOTIFY: { |
| |
151 LPNMHDR hdr = (LPNMHDR)lParam; |
| |
152 HWND hwndCtrl = hdr->hwndFrom; |
| |
153 W32Widget *cmdWidget = (W32Widget*)GetWindowLongPtr(hwndCtrl, GWLP_USERDATA); |
| |
154 if (cmdWidget && cmdWidget->wclass->eventproc) { |
| |
155 cmdWidget->wclass->eventproc(cmdWidget, hwnd, uMsg, wParam, lParam); |
| |
156 } |
| |
157 break; |
| |
158 } |
| 151 case WM_SIZE: { |
159 case WM_SIZE: { |
| 152 int width = LOWORD(lParam); |
160 int width = LOWORD(lParam); |
| 153 int height = HIWORD(lParam); |
161 int height = HIWORD(lParam); |
| 154 if (widget->layout) { |
162 if (widget->layout) { |
| 155 widget->layout(widget->layoutmanager, width, height); |
163 widget->layout(widget->layoutmanager, width, height); |