ui/win32/list.c

changeset 997
287b20e2a564
parent 980
39cb60b6a81b
child 998
55508508ba4d
equal deleted inserted replaced
996:61b811c4705f 997:287b20e2a564
168 list->update = ui_listview_update; 168 list->update = ui_listview_update;
169 list->getselection = ui_listview_getselection; 169 list->getselection = ui_listview_getselection;
170 list->setselection = ui_listview_setselection; 170 list->setselection = ui_listview_setselection;
171 171
172 ui_listview_update(list, -1); 172 ui_listview_update(list, -1);
173 } else if (!table && args->static_elements && args->static_nelm > 0) {
174 char **static_elements = args->static_elements;
175 size_t static_nelm = args->static_nelm;
176 LVITEM item;
177 item.mask = LVIF_TEXT;
178 item.iSubItem = 0;
179 for (int i=0;i<static_nelm;i++) {
180 item.iItem = i;
181 item.pszText = static_elements[i];
182 ListView_InsertItem(hwnd, &item);
183 }
184 listview->getvalue = strmodel_getvalue;
185 listview->getvaluedata = NULL;
173 } 186 }
174 187
175 return (W32Widget*)listview; 188 return (W32Widget*)listview;
176 } 189 }
177 190
385 list->update = ui_dropdown_update; 398 list->update = ui_dropdown_update;
386 list->getselection = ui_dropdown_getselection; 399 list->getselection = ui_dropdown_getselection;
387 list->setselection = ui_dropdown_setselection; 400 list->setselection = ui_dropdown_setselection;
388 401
389 ui_dropdown_update(list, -1); 402 ui_dropdown_update(list, -1);
390 } 403 } else if (args->static_elements && args->static_nelm > 0) {
391 404 char **static_elements = args->static_elements;
405 size_t static_nelm = args->static_nelm;
406 for (int i=0;i<static_nelm;i++) {
407 SendMessage(hwnd, CB_ADDSTRING, 0, (LPARAM)static_elements[i]);
408 }
409 dropdown->getvalue = strmodel_getvalue;
410 dropdown->getvaluedata = NULL;
411 }
392 412
393 return (W32Widget*)dropdown; 413 return (W32Widget*)dropdown;
394 } 414 }
395 415
396 int ui_dropdown_eventproc(W32Widget *widget, HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { 416 int ui_dropdown_eventproc(W32Widget *widget, HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) {

mercurial