| 215 static UiCondVar *cond; |
216 static UiCondVar *cond; |
| 216 static int thr_end = 0; |
217 static int thr_end = 0; |
| 217 static int thr_started = 0; |
218 static int thr_started = 0; |
| 218 |
219 |
| 219 static UiThreadpool *threadpool; |
220 static UiThreadpool *threadpool; |
| |
221 |
| |
222 typedef struct TreeNode { |
| |
223 char *name; |
| |
224 int depth; |
| |
225 } TreeNode; |
| 220 |
226 |
| 221 int threadfunc(void *data) { |
227 int threadfunc(void *data) { |
| 222 printf("thr wait for data...\n"); |
228 printf("thr wait for data...\n"); |
| 223 ui_condvar_wait(cond); |
229 ui_condvar_wait(cond); |
| 224 printf("thr data received: {%s} [%d]\n", cond->data, cond->intdata); |
230 printf("thr data received: {%s} [%d]\n", cond->data, cond->intdata); |
| 387 doc->link_label = ui_string_new(docctx, "link_label"); |
393 doc->link_label = ui_string_new(docctx, "link_label"); |
| 388 doc->link_uri = ui_string_new(docctx, "link_uri"); |
394 doc->link_uri = ui_string_new(docctx, "link_uri"); |
| 389 |
395 |
| 390 ui_int_new(docctx, "menu_radio"); |
396 ui_int_new(docctx, "menu_radio"); |
| 391 |
397 |
| |
398 doc->tree = ui_list_new(docctx, "tree"); |
| |
399 TreeNode *root = malloc(sizeof(TreeNode)); |
| |
400 root->name = "Root"; |
| |
401 root->depth = 0; |
| |
402 ui_list_append(doc->tree, root); |
| |
403 |
| |
404 TreeNode *node_a = malloc(sizeof(TreeNode)); |
| |
405 node_a->name = "Folder"; |
| |
406 node_a->depth = 1; |
| |
407 ui_list_append(doc->tree, node_a); |
| |
408 |
| |
409 TreeNode *node_a0 = malloc(sizeof(TreeNode)); |
| |
410 node_a0->name = "Leaf 1"; |
| |
411 node_a0->depth = 2; |
| |
412 ui_list_append(doc->tree, node_a0); |
| |
413 |
| |
414 TreeNode *node_a1 = malloc(sizeof(TreeNode)); |
| |
415 node_a1->name = "Leaf 2"; |
| |
416 node_a1->depth = 2; |
| |
417 ui_list_append(doc->tree, node_a1); |
| |
418 |
| |
419 TreeNode *node_1 = malloc(sizeof(TreeNode)); |
| |
420 node_1->name = "Leaf 3"; |
| |
421 node_1->depth = 1; |
| |
422 ui_list_append(doc->tree, node_1); |
| |
423 |
| |
424 |
| 392 //doc->text = ui_text_new(docctx, "text"); |
425 //doc->text = ui_text_new(docctx, "text"); |
| 393 return doc; |
426 return doc; |
| 394 } |
427 } |
| 395 |
428 |
| 396 UiIcon *icon = NULL; |
429 UiIcon *icon = NULL; |
| 533 style->fg.red = col == 5 ? 255 : 0; |
566 style->fg.red = col == 5 ? 255 : 0; |
| 534 style->fg_set = TRUE; |
567 style->fg_set = TRUE; |
| 535 return TRUE; |
568 return TRUE; |
| 536 } |
569 } |
| 537 return FALSE; |
570 return FALSE; |
| |
571 } |
| |
572 |
| |
573 void* tree_getvalue(UiList *list, void *elm, int row, int col, void *userdata, UiBool *freeResult) { |
| |
574 TreeNode *node = elm; |
| |
575 return node->name; |
| |
576 } |
| |
577 |
| |
578 int tree_getdepth(UiList *list, void *elm, int row, void *userdata) { |
| |
579 TreeNode *node = elm; |
| |
580 return node->depth; |
| 538 } |
581 } |
| 539 |
582 |
| 540 void sourcelist_getvalue(UiList *list, void *sublistdata, void *rowdata, int index, UiSubListItem *item, void *userdata) { |
583 void sourcelist_getvalue(UiList *list, void *sublistdata, void *rowdata, int index, UiSubListItem *item, void *userdata) { |
| 541 ui_menubuilder_ref(sourcelist_menu); |
584 ui_menubuilder_ref(sourcelist_menu); |
| 542 item->label = strdup(rowdata); |
585 item->label = strdup(rowdata); |
| 904 } |
947 } |
| 905 } |
948 } |
| 906 ui_tab(obj, "Tab 12") { |
949 ui_tab(obj, "Tab 12") { |
| 907 ui_drawingarea(obj, .fill = TRUE, .draw = draw); |
950 ui_drawingarea(obj, .fill = TRUE, .draw = draw); |
| 908 } |
951 } |
| |
952 ui_tab(obj, "Tab 13") { |
| |
953 UiModel *model = ui_model(obj->ctx, UI_STRING, "test", -1); |
| |
954 ui_treeview(obj, .fill = TRUE, .model = model, .show_header = TRUE, .getvalue = tree_getvalue, .getdepth = tree_getdepth, .varname = "tree"); |
| |
955 } |
| 909 } |
956 } |
| 910 |
957 |
| 911 /* |
958 /* |
| 912 |
959 |
| 913 */ |
960 */ |