| 368 |
368 |
| 369 doc->link = ui_string_new(docctx, "link"); |
369 doc->link = ui_string_new(docctx, "link"); |
| 370 doc->link_label = ui_string_new(docctx, "link_label"); |
370 doc->link_label = ui_string_new(docctx, "link_label"); |
| 371 doc->link_uri = ui_string_new(docctx, "link_uri"); |
371 doc->link_uri = ui_string_new(docctx, "link_uri"); |
| 372 |
372 |
| |
373 ui_int_new(docctx, "menu_radio"); |
| |
374 |
| 373 //doc->text = ui_text_new(docctx, "text"); |
375 //doc->text = ui_text_new(docctx, "text"); |
| 374 return doc; |
376 return doc; |
| 375 } |
377 } |
| 376 |
378 |
| 377 UiIcon *icon = NULL; |
379 UiIcon *icon = NULL; |
| 622 |
624 |
| 623 ui_draw_rect(g, (g->width/2)-80, (g->height/2)-40, 160, 80, FALSE); |
625 ui_draw_rect(g, (g->width/2)-80, (g->height/2)-40, 160, 80, FALSE); |
| 624 } |
626 } |
| 625 |
627 |
| 626 static void action_menu_radio(UiEvent *event, void *userdata) { |
628 static void action_menu_radio(UiEvent *event, void *userdata) { |
| 627 printf("option: %d\n", event->intval); |
629 if(event->intval) { |
| |
630 int i = ui_var_get_int(event->obj->ctx, "menu_radio"); |
| |
631 printf("menu radio option: %d\n", i); |
| |
632 } |
| 628 } |
633 } |
| 629 |
634 |
| 630 static void action_menu_toggle(UiEvent *event, void *userdata) { |
635 static void action_menu_toggle(UiEvent *event, void *userdata) { |
| 631 if(event->eventdatatype != UI_EVENT_DATA_INTEGER_VALUE) { |
636 if(event->eventdatatype != UI_EVENT_DATA_INTEGER_VALUE) { |
| 632 printf("Error: action_menu_toggle: wrong event data type\n"); |
637 printf("Error: action_menu_toggle: wrong event data type\n"); |
| 897 ui_menuitem(.label = "Test"); |
902 ui_menuitem(.label = "Test"); |
| 898 ui_menuseparator(); |
903 ui_menuseparator(); |
| 899 ui_menu_toggleitem(.label = "Toggle 1", .varname = "menu_toggle1", .onchange = action_menu_toggle); |
904 ui_menu_toggleitem(.label = "Toggle 1", .varname = "menu_toggle1", .onchange = action_menu_toggle); |
| 900 ui_menu_toggleitem(.label = "Toggle 2", .varname = "menu_toggle2", .onchange = action_menu_toggle); |
905 ui_menu_toggleitem(.label = "Toggle 2", .varname = "menu_toggle2", .onchange = action_menu_toggle); |
| 901 ui_menuseparator(); |
906 ui_menuseparator(); |
| 902 ui_menu_radioitem(.label = "Option 1", .varname = "menu_radio"); |
907 ui_menu_radioitem(.label = "Option 1", .varname = "menu_radio", .onchange = action_menu_radio); |
| 903 ui_menu_radioitem(.label = "Option 2", .varname = "menu_radio"); |
908 ui_menu_radioitem(.label = "Option 2", .varname = "menu_radio", .onchange = action_menu_radio); |
| 904 ui_menu_radioitem(.label = "Option 3", .varname = "menu_radio"); |
909 ui_menu_radioitem(.label = "Option 3", .varname = "menu_radio", .onchange = action_menu_radio); |
| 905 ui_menu_radioitem(.label = "Option 4", .varname = "menu_radio"); |
910 ui_menu_radioitem(.label = "Option 4", .varname = "menu_radio", .onchange = action_menu_radio); |
| 906 ui_menu_radioitem(.label = "Option 5", .varname = "menu_radio"); |
911 ui_menu_radioitem(.label = "Option 5", .varname = "menu_radio", .onchange = action_menu_radio); |
| 907 ui_menuseparator(); |
912 ui_menuseparator(); |
| 908 } |
913 } |
| 909 |
914 |
| 910 ui_contextmenu(&menubuilder) { |
915 ui_contextmenu(&menubuilder) { |
| 911 ui_menuitem(.label = "Context Item 1"); |
916 ui_menuitem(.label = "Context Item 1"); |