application/main.c

changeset 777
622efebfab37
parent 776
867ff911492d
child 778
85b6cef7fcba
equal deleted inserted replaced
776:867ff911492d 777:622efebfab37
457 case 1: return row; 457 case 1: return row;
458 case 2: return (void*)(intptr_t)1234; 458 case 2: return (void*)(intptr_t)1234;
459 case 3: return ui_foldericon(16); 459 case 3: return ui_foldericon(16);
460 case 4: return ui_fileicon(16); 460 case 4: return ui_fileicon(16);
461 case 5: return "file"; 461 case 5: return "file";
462 case 6: return (void*)(intptr_t)123;
463 case 7: return "edit me";
464 case 8: return "edit me too";
462 } 465 }
463 return NULL; 466 return NULL;
464 } 467 }
465 468
466 UiBool table_getstyle(UiList *list, void *elm, int row, int col, void *userdata, UiTextStyle *style) { 469 UiBool table_getstyle(UiList *list, void *elm, int row, int col, void *userdata, UiTextStyle *style) {
470 if(col > 6) {
471 return FALSE;
472 }
467 if(row < 2 && col != -1) { 473 if(row < 2 && col != -1) {
468 style->text_style = UI_TEXT_STYLE_BOLD; 474 style->text_style = UI_TEXT_STYLE_BOLD;
469 if(col == 2) { 475 if(col == 2) {
470 style->text_style = UI_TEXT_STYLE_ITALIC; 476 style->text_style = UI_TEXT_STYLE_ITALIC;
471 } 477 }
647 } 653 }
648 ui_newline(obj); 654 ui_newline(obj);
649 } 655 }
650 } 656 }
651 ui_tab(obj, "Tab 1") { 657 ui_tab(obj, "Tab 1") {
652 UiModel *model = ui_model(obj->ctx, UI_ICON_TEXT, "col1", UI_INTEGER, "col2", UI_ICON, "col3", UI_ICON_TEXT, "col4", UI_INTEGER, "col5", -1); 658 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", -1);
653 model->columnsize[0] = -1; 659 model->columnsize[0] = -1;
654 ui_table(obj, .model = model, .list = doc->list2, .colspan = 2, .fill = TRUE, .contextmenu = menubuilder, .multiselection = TRUE, .fill = TRUE, 660 ui_table(obj, .model = model, .list = doc->list2, .colspan = 2, .fill = TRUE, .contextmenu = menubuilder, .multiselection = TRUE, .fill = TRUE,
655 .getvalue = table_getvalue, .getstyle = table_getstyle, 661 .getvalue = table_getvalue, .getstyle = table_getstyle,
656 .onactivate = action_table_activate, .onactivatedata = "activate", 662 .onactivate = action_table_activate, .onactivatedata = "activate",
657 .onselection = action_table_activate, .onselectiondata = "selection"); 663 .onselection = action_table_activate, .onselectiondata = "selection");

mercurial