585 UiObject *obj = ui_window("Test", NULL); |
586 UiObject *obj = ui_window("Test", NULL); |
586 |
587 |
587 WData *wdata = ui_malloc(obj->ctx, sizeof(WData)); |
588 WData *wdata = ui_malloc(obj->ctx, sizeof(WData)); |
588 wdata->path = ui_string_new(obj->ctx, NULL); |
589 wdata->path = ui_string_new(obj->ctx, NULL); |
589 wdata->list = ui_list_new(obj->ctx, NULL); |
590 wdata->list = ui_list_new(obj->ctx, NULL); |
|
591 wdata->spinner = ui_int_new(obj->ctx, NULL); |
590 obj->window = wdata; |
592 obj->window = wdata; |
591 |
593 |
592 ui_list_append(wdata->list, "List Item 1"); |
594 ui_list_append(wdata->list, "List Item 1"); |
593 ui_list_append(wdata->list, "List Item 2"); |
595 ui_list_append(wdata->list, "List Item 2"); |
594 ui_list_append(wdata->list, "List Item 3"); |
596 ui_list_append(wdata->list, "List Item 3"); |
595 ui_list_append(wdata->list, "List Item 4"); |
597 ui_list_append(wdata->list, "List Item 4"); |
596 |
598 |
597 ui_button(obj, .label = "Add Menu Item", .onclick = action_button, .name = "mybutton1"); |
599 ui_button(obj, .label = "Add Menu Item", .onclick = action_button, .name = "mybutton1"); |
598 ui_button(obj, .label = "Add List Item", .onclick = action_button2); |
600 ui_button(obj, .label = "Add List Item", .onclick = action_button2); |
599 ui_progressbar(obj, .name = "pb"); |
601 ui_hbox0(obj) { |
|
602 ui_progressbar(obj, .name = "pb", .fill = UI_ON); |
|
603 ui_progressspinner(obj, .value = wdata->spinner); |
|
604 } |
600 ui_listview(obj, .list = wdata->list, .fill = UI_ON, .multiselection = TRUE, |
605 ui_listview(obj, .list = wdata->list, .fill = UI_ON, .multiselection = TRUE, |
601 .onactivate = action_listevent, .onactivatedata = "activate", |
606 .onactivate = action_listevent, .onactivatedata = "activate", |
602 .onselection = action_listevent, .onselectiondata = "selection"); |
607 .onselection = action_listevent, .onselectiondata = "selection"); |
603 |
608 |
604 |
609 |
605 ui_show(obj); |
610 ui_show(obj); |
|
611 |
|
612 ui_set(wdata->spinner, 1); |
606 } |
613 } |
607 |
614 |
608 void action_test(UiEvent *event, void *data) { |
615 void action_test(UiEvent *event, void *data) { |
609 printf("action test\n"); |
616 printf("action test\n"); |
610 } |
617 } |