| 473 |
473 |
| 474 UiMenuBuilder *menubuilder; |
474 UiMenuBuilder *menubuilder; |
| 475 UiMenuBuilder *sourcelist_menu; |
475 UiMenuBuilder *sourcelist_menu; |
| 476 |
476 |
| 477 void* table_getvalue(void *row, int col) { |
477 void* table_getvalue(void *row, int col) { |
| 478 return "test"; |
|
| 479 switch(col) { |
478 switch(col) { |
| 480 case 0: return ui_foldericon(16); |
479 case 0: return ui_foldericon(16); |
| 481 case 1: return row; |
480 case 1: return row; |
| 482 case 2: return (void*)(intptr_t)1234; |
481 case 2: return (void*)(intptr_t)1234; |
| 483 case 3: return ui_foldericon(16); |
482 case 3: return ui_foldericon(16); |
| 486 case 6: return (void*)(intptr_t)123; |
485 case 6: return (void*)(intptr_t)123; |
| 487 case 7: return "edit me"; |
486 case 7: return "edit me"; |
| 488 case 8: return "edit me too"; |
487 case 8: return "edit me too"; |
| 489 case 9: return (void*)(intptr_t)1; |
488 case 9: return (void*)(intptr_t)1; |
| 490 } |
489 } |
| 491 return NULL; |
490 return "test"; |
| 492 } |
491 } |
| 493 |
492 |
| 494 UiBool table_getstyle(UiList *list, void *elm, int row, int col, void *userdata, UiTextStyle *style) { |
493 UiBool table_getstyle(UiList *list, void *elm, int row, int col, void *userdata, UiTextStyle *style) { |
| 495 if(col > 6) { |
494 if(col > 6) { |
| 496 return FALSE; |
495 return FALSE; |
| 575 |
574 |
| 576 static void action_add_col(UiEvent *event, void *userdata) { |
575 static void action_add_col(UiEvent *event, void *userdata) { |
| 577 MyDocument *doc = event->document; |
576 MyDocument *doc = event->document; |
| 578 |
577 |
| 579 char *colname = ui_get(doc->list_new_col); |
578 char *colname = ui_get(doc->list_new_col); |
| 580 ui_model_add_column(doc->model, UI_STRING, colname, 200); |
579 ui_model_add_column(doc->model, UI_STRING_EDITABLE, colname, 200); |
| 581 } |
580 } |
| 582 |
581 |
| 583 static void action_list_selection(UiEvent *event, void *userdata) { |
582 static void action_list_selection(UiEvent *event, void *userdata) { |
| 584 UiListSelection *sel = event->eventdata; |
583 UiListSelection *sel = event->eventdata; |
| 585 printf("list selection[%d]\n", sel->count); |
584 printf("list selection[%d]\n", sel->count); |
| 705 } |
704 } |
| 706 ui_newline(obj); |
705 ui_newline(obj); |
| 707 } |
706 } |
| 708 } |
707 } |
| 709 ui_tab(obj, "Tab 1") { |
708 ui_tab(obj, "Tab 1") { |
| 710 //UiModel *model = ui_model(obj->ctx, UI_ICON_TEXT, "col1", UI_INTEGER, "col2", UI_ICON, "col3", UI_ICON_TEXT, "col4", UI_INTEGER, "col5", UI_STRING_EDITABLE, "edit6", UI_STRING_EDITABLE, "edit7", UI_BOOL_EDITABLE, "Check", -1); |
709 UiModel *model = ui_model(obj->ctx, UI_ICON_TEXT, "col1", UI_INTEGER, "col2", UI_ICON, "col3", UI_ICON_TEXT, "col4", UI_INTEGER, "col5", UI_STRING_EDITABLE, "edit6", UI_STRING_EDITABLE, "edit7", UI_BOOL_EDITABLE, "Check", -1); |
| 711 UiModel *model = ui_model(obj->ctx, UI_STRING, "Col", -1); |
|
| 712 model->columnsize[0] = -1; |
710 model->columnsize[0] = -1; |
| 713 doc->model = model; |
711 doc->model = model; |
| 714 ui_table(obj, .model = model, .list = doc->list2, .colspan = 2, .fill = TRUE, .contextmenu = menubuilder, .multiselection = TRUE, .fill = TRUE, |
712 ui_table(obj, .model = model, .list = doc->list2, .colspan = 2, .fill = TRUE, .contextmenu = menubuilder, .multiselection = TRUE, .fill = TRUE, |
| 715 .getvalue = table_getvalue, .getstyle = table_getstyle, .onsave = list_save, |
713 .getvalue = table_getvalue, .getstyle = table_getstyle, .onsave = list_save, |
| 716 .onactivate = action_table_activate, .onactivatedata = "activate", |
714 .onactivate = action_table_activate, .onactivatedata = "activate", |