| 840:f74250eda598 | 841:651cf2c59dd9 |
|---|---|
| 29 #include "button.h" | 29 #include "button.h" |
| 30 #include "widget.h" | 30 #include "widget.h" |
| 31 | 31 |
| 32 #include <stdio.h> | 32 #include <stdio.h> |
| 33 #include <stdlib.h> | 33 #include <stdlib.h> |
| 34 | |
| 35 #include <commctrl.h> | |
| 34 | 36 |
| 35 static W32WidgetClass button_widget_class = { | 37 static W32WidgetClass button_widget_class = { |
| 36 .eventproc = ui_button_eventproc, | 38 .eventproc = ui_button_eventproc, |
| 37 .enable = w32_widget_default_enable, | 39 .enable = w32_widget_default_enable, |
| 38 .show = w32_widget_default_show, | 40 .show = w32_widget_default_show, |
| 70 | 72 |
| 71 W32Size ui_button_get_preferred_size(W32Widget *widget) { | 73 W32Size ui_button_get_preferred_size(W32Widget *widget) { |
| 72 W32Size size; | 74 W32Size size; |
| 73 size.width = 100; | 75 size.width = 100; |
| 74 size.height = 30; | 76 size.height = 30; |
| 77 SIZE sz; | |
| 78 if (Button_GetIdealSize(widget->hwnd, &sz)) { | |
| 79 size.width = sz.cx; | |
| 80 size.height = sz.cy; | |
| 81 } | |
| 75 return size; | 82 return size; |
| 76 } | 83 } |
| 77 | 84 |
| 78 void ui_button_eventproc(W32Widget *widget, HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { | 85 void ui_button_eventproc(W32Widget *widget, HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { |
| 79 UiWidget *w = (UiWidget*)widget; | 86 UiWidget *w = (UiWidget*)widget; |