| 458 case 4: return "file"; |
458 case 4: return "file"; |
| 459 } |
459 } |
| 460 return NULL; |
460 return NULL; |
| 461 } |
461 } |
| 462 |
462 |
| |
463 UiBool table_getstyle(UiList *list, void *elm, int row, int col, void *userdata, UiTextStyle *style) { |
| |
464 if(row < 2 && col != -1) { |
| |
465 style->text_style = UI_TEXT_STYLE_BOLD; |
| |
466 style->fg.blue = col == 0 ? 255 : 0; |
| |
467 style->fg.green = col == 1 ? 255 : 0; |
| |
468 style->fg.red = col == 4 ? 255 : 0; |
| |
469 return TRUE; |
| |
470 } |
| |
471 return FALSE; |
| |
472 } |
| |
473 |
| 463 void sourcelist_getvalue(UiList *list, void *sublistdata, void *rowdata, int index, UiSubListItem *item, void *userdata) { |
474 void sourcelist_getvalue(UiList *list, void *sublistdata, void *rowdata, int index, UiSubListItem *item, void *userdata) { |
| 464 item->label = strdup(rowdata); |
475 item->label = strdup(rowdata); |
| 465 item->eventdata = sublistdata; |
476 item->eventdata = sublistdata; |
| 466 } |
477 } |
| 467 |
478 |
| 626 } |
637 } |
| 627 ui_tab(obj, "Tab 1") { |
638 ui_tab(obj, "Tab 1") { |
| 628 UiModel *model = ui_model(obj->ctx, UI_STRING, "col1", UI_INTEGER, "col2", UI_ICON, "col3", UI_ICON_TEXT, "col4", UI_INTEGER, "col5", -1); |
639 UiModel *model = ui_model(obj->ctx, UI_STRING, "col1", UI_INTEGER, "col2", UI_ICON, "col3", UI_ICON_TEXT, "col4", UI_INTEGER, "col5", -1); |
| 629 model->columnsize[0] = -1; |
640 model->columnsize[0] = -1; |
| 630 ui_table(obj, .model = model, .list = doc->list2, .colspan = 2, .fill = TRUE, .contextmenu = menubuilder, .multiselection = TRUE, .fill = TRUE, |
641 ui_table(obj, .model = model, .list = doc->list2, .colspan = 2, .fill = TRUE, .contextmenu = menubuilder, .multiselection = TRUE, .fill = TRUE, |
| 631 .getvalue = table_getvalue, |
642 .getvalue = table_getvalue, .getstyle = table_getstyle, |
| 632 .onactivate = action_table_activate, .onactivatedata = "activate", |
643 .onactivate = action_table_activate, .onactivatedata = "activate", |
| 633 .onselection = action_table_activate, .onselectiondata = "selection"); |
644 .onselection = action_table_activate, .onselectiondata = "selection"); |
| 634 ui_hbox(obj, .fill = FALSE) { |
645 ui_hbox(obj, .fill = FALSE) { |
| 635 ui_textfield(obj, .value = doc->list_input); |
646 ui_textfield(obj, .value = doc->list_input); |
| 636 ui_button(obj, .label = "Update List Item 1", .onclick = action_update_list); |
647 ui_button(obj, .label = "Update List Item 1", .onclick = action_update_list); |