| 468 case 4: return ui_fileicon(16); |
468 case 4: return ui_fileicon(16); |
| 469 case 5: return "file"; |
469 case 5: return "file"; |
| 470 case 6: return (void*)(intptr_t)123; |
470 case 6: return (void*)(intptr_t)123; |
| 471 case 7: return "edit me"; |
471 case 7: return "edit me"; |
| 472 case 8: return "edit me too"; |
472 case 8: return "edit me too"; |
| |
473 case 9: return (void*)(intptr_t)1; |
| 473 } |
474 } |
| 474 return NULL; |
475 return NULL; |
| 475 } |
476 } |
| 476 |
477 |
| 477 UiBool table_getstyle(UiList *list, void *elm, int row, int col, void *userdata, UiTextStyle *style) { |
478 UiBool table_getstyle(UiList *list, void *elm, int row, int col, void *userdata, UiTextStyle *style) { |
| 670 } |
671 } |
| 671 ui_newline(obj); |
672 ui_newline(obj); |
| 672 } |
673 } |
| 673 } |
674 } |
| 674 ui_tab(obj, "Tab 1") { |
675 ui_tab(obj, "Tab 1") { |
| 675 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); |
676 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); |
| 676 model->columnsize[0] = -1; |
677 model->columnsize[0] = -1; |
| 677 ui_table(obj, .model = model, .list = doc->list2, .colspan = 2, .fill = TRUE, .contextmenu = menubuilder, .multiselection = TRUE, .fill = TRUE, |
678 ui_table(obj, .model = model, .list = doc->list2, .colspan = 2, .fill = TRUE, .contextmenu = menubuilder, .multiselection = TRUE, .fill = TRUE, |
| 678 .getvalue = table_getvalue, .getstyle = table_getstyle, .onsave = list_save, |
679 .getvalue = table_getvalue, .getstyle = table_getstyle, .onsave = list_save, |
| 679 .onactivate = action_table_activate, .onactivatedata = "activate", |
680 .onactivate = action_table_activate, .onactivatedata = "activate", |
| 680 .onselection = action_table_activate, .onselectiondata = "selection"); |
681 .onselection = action_table_activate, .onselectiondata = "selection"); |
| 1073 ui_radiobutton(obj, .label = "Radio 1", .varname = "radio"); |
1074 ui_radiobutton(obj, .label = "Radio 1", .varname = "radio"); |
| 1074 ui_radiobutton(obj, .label = "Radio 2", .varname = "radio"); |
1075 ui_radiobutton(obj, .label = "Radio 2", .varname = "radio"); |
| 1075 ui_radiobutton(obj, .label = "Radio 3", .varname = "radio"); |
1076 ui_radiobutton(obj, .label = "Radio 3", .varname = "radio"); |
| 1076 ui_radiobutton(obj, .label = "Radio 4", .varname = "radio"); |
1077 ui_radiobutton(obj, .label = "Radio 4", .varname = "radio"); |
| 1077 } |
1078 } |
| |
1079 ui_newline(obj); |
| |
1080 |
| |
1081 ui_hbox(obj, .colspan = 3) { |
| |
1082 ui_button(obj, .label = "Margin Test 1", .margin_top = 10); |
| |
1083 ui_button(obj, .label = "Margin Test 2", .margin_top = 20); |
| |
1084 UIWIDGET w = ui_button(obj, .label = "Margin Test 3", .margin = 30); |
| |
1085 //ui_set_visible(w, FALSE); |
| |
1086 ui_button(obj, .label = "Margin Test 4", .margin_top = 40); |
| |
1087 ui_button(obj, .label = "Margin Test 5", .margin_top = 50); |
| |
1088 ui_button(obj, .label = "Margin Test 6", .margin_top = 60); |
| |
1089 } |
| 1078 } |
1090 } |
| 1079 ui_show(obj); |
1091 ui_show(obj); |
| 1080 } |
1092 } |
| 1081 |
1093 |
| 1082 int main(int argc, char **argv) { |
1094 int main(int argc, char **argv) { |
| 1121 |
1133 |
| 1122 #endif |
1134 #endif |
| 1123 |
1135 |
| 1124 #ifdef UI_WIN32 |
1136 #ifdef UI_WIN32 |
| 1125 |
1137 |
| |
1138 static void action_button(UiEvent *event, void *data) { |
| |
1139 printf("button clicked\n"); |
| |
1140 } |
| |
1141 |
| 1126 void application_startup(UiEvent *event, void *data) { |
1142 void application_startup(UiEvent *event, void *data) { |
| 1127 UiObject *obj = ui_window("Test w32", NULL); |
1143 UiObject *obj = ui_window("Test w32", NULL); |
| 1128 |
1144 ui_button(obj, .label = "Test", .hfill = TRUE, .hexpand = TRUE, .colspan = 3, .margin = 10); |
| |
1145 ui_button(obj, .label = "Test 2-1", .margin_left = 10); |
| |
1146 ui_button(obj, .label = "Test 2-2", .hfill = TRUE, .hexpand = TRUE, .margin_left = 20); |
| |
1147 ui_button(obj, .label = "Test 2-3", .margin_left = 30); |
| |
1148 ui_button(obj, .label = "Test 3XX", .colspan = 3, .fill = TRUE, .onclick = action_button); |
| |
1149 ui_show(obj); |
| 1129 } |
1150 } |
| 1130 |
1151 |
| 1131 int WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd) { |
1152 int WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd) { |
| 1132 ui_init("app1", 0, NULL); |
1153 ui_init("app1", 0, NULL); |
| 1133 ui_onstartup(application_startup, NULL); |
1154 ui_onstartup(application_startup, NULL); |