application/main.c

changeset 433
605bb5dc34f1
parent 429
0921f8a5d535
child 436
222205801430
equal deleted inserted replaced
431:bb7da585debc 433:605bb5dc34f1
545 } 545 }
546 546
547 typedef struct WData { 547 typedef struct WData {
548 UiString *path; 548 UiString *path;
549 UiList *list; 549 UiList *list;
550 UiInteger *spinner;
550 } WData; 551 } WData;
551 552
552 553
553 int lsitems = 4; 554 int lsitems = 4;
554 555
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 }

mercurial