| 39 static W32WidgetClass listview_widget_class = { |
39 static W32WidgetClass listview_widget_class = { |
| 40 .eventproc = ui_listview_eventproc, |
40 .eventproc = ui_listview_eventproc, |
| 41 .enable = w32_widget_default_enable, |
41 .enable = w32_widget_default_enable, |
| 42 .show = w32_widget_default_show, |
42 .show = w32_widget_default_show, |
| 43 .get_preferred_size = ui_listview_get_preferred_size, |
43 .get_preferred_size = ui_listview_get_preferred_size, |
| 44 .destroy = w32_widget_default_destroy |
44 .destroy = ui_listview_destroy |
| 45 }; |
45 }; |
| 46 |
46 |
| 47 static void* strmodel_getvalue(UiList *list, void *elm, int row, int col, void *userdata, UiBool *freeResult) { |
47 static void* strmodel_getvalue(UiList *list, void *elm, int row, int col, void *userdata, UiBool *freeResult) { |
| 48 return col == 0 ? elm : NULL; |
48 return col == 0 ? elm : NULL; |
| 49 } |
49 } |
| 101 HINSTANCE hInstance = GetModuleHandle(NULL); |
101 HINSTANCE hInstance = GetModuleHandle(NULL); |
| 102 UiContainerPrivate *container = ui_obj_container(obj); |
102 UiContainerPrivate *container = ui_obj_container(obj); |
| 103 HWND parent = ui_container_get_parent(container); |
103 HWND parent = ui_container_get_parent(container); |
| 104 UiLayout layout = UI_ARGS2LAYOUT(args); |
104 UiLayout layout = UI_ARGS2LAYOUT(args); |
| 105 |
105 |
| |
106 unsigned int noheader = 0; |
| |
107 if (!table || args->hide_header) { |
| |
108 noheader = LVS_NOCOLUMNHEADER; |
| |
109 } |
| 106 HWND hwnd = CreateWindowEx( |
110 HWND hwnd = CreateWindowEx( |
| 107 WS_EX_CLIENTEDGE, |
111 WS_EX_CLIENTEDGE, |
| 108 WC_LISTVIEW, |
112 WC_LISTVIEW, |
| 109 "", |
113 "", |
| 110 WS_CHILD | WS_VISIBLE | LVS_REPORT, |
114 WS_CHILD | WS_VISIBLE | LVS_REPORT | noheader, |
| 111 0, 0, 100, 100, |
115 0, 0, 100, 100, |
| 112 parent, |
116 parent, |
| 113 (HMENU)1337, |
117 (HMENU)1337, |
| 114 hInstance, |
118 hInstance, |
| 115 NULL); |
119 NULL); |
| 276 size.width = listview->preferred_width; |
280 size.width = listview->preferred_width; |
| 277 size.height = listview->preferred_height; |
281 size.height = listview->preferred_height; |
| 278 return size; |
282 return size; |
| 279 } |
283 } |
| 280 |
284 |
| |
285 void ui_listview_destroy(W32Widget *widget) { |
| |
286 UiListView *listview = (UiListView*)widget; |
| |
287 if (listview->model) { |
| |
288 ui_model_unref(listview->model); |
| |
289 } |
| |
290 free(widget); |
| |
291 } |
| |
292 |
| 281 /* |
293 /* |
| 282 * Creates and inserts an LVITEM |
294 * Creates and inserts an LVITEM |
| 283 * |
295 * |
| 284 * list: An UiList bound to an UiListView |
296 * list: An UiList bound to an UiListView |
| 285 * row: row index |
297 * row: row index |