application/main.c

branch
newapi
changeset 406
0ebf9d7b23e8
parent 404
384f6d1f5784
child 407
8ea123dd89db
equal deleted inserted replaced
405:a7f18dda6baf 406:0ebf9d7b23e8
32 32
33 #include <ui/ui.h> 33 #include <ui/ui.h>
34 #include <cx/buffer.h> 34 #include <cx/buffer.h>
35 #include <cx/utils.h> 35 #include <cx/utils.h>
36 36
37 #ifndef UI_COCOA 37 #if !defined(UI_COCOA) && !defined(UI_MOTIF)
38 38
39 typedef struct { 39 typedef struct {
40 UiString *str1; 40 UiString *str1;
41 UiString *str2; 41 UiString *str2;
42 UiString *path; 42 UiString *path;
453 return (EXIT_SUCCESS); 453 return (EXIT_SUCCESS);
454 } 454 }
455 455
456 #endif 456 #endif
457 457
458 #ifdef UI_COCOA 458 #if defined(UI_COCOA) || defined(UI_MOTIF)
459
460 void action_button(UiEvent *event, void *data) {
461 printf("action_button\n");
462 }
459 463
460 void application_startup(UiEvent *event, void *data) { 464 void application_startup(UiEvent *event, void *data) {
461 465 UiObject *obj = ui_window("Test", NULL);
466 ui_button(obj, .label = "Test Button", .onclick = action_button);
467 ui_togglebutton(obj, .label = "Togglebutton");
468 ui_checkbox(obj, .label = "Checkbox", .enable_group = 123);
469 ui_checkbox(obj, .label = "Checkbox Disabled", .groups = UI_GROUPS(123));
470 ui_radiobutton(obj, .label = "Radio 1", .varname = "radio");
471 ui_radiobutton(obj, .label = "Radio 2", .varname = "radio");
472
473 ui_show(obj);
462 } 474 }
463 475
464 int main(int argc, char** argv) { 476 int main(int argc, char** argv) {
465 ui_init("app1", argc, argv); 477 ui_init("app1", argc, argv);
466 ui_onstartup(application_startup, NULL); 478 ui_onstartup(application_startup, NULL);

mercurial