application/main.c

changeset 29
c96169444d88
parent 28
794a5c91c479
child 30
34513f76d5a8
equal deleted inserted replaced
28:794a5c91c479 29:c96169444d88
49 49
50 void action_new(UiEvent *event, void *data) { 50 void action_new(UiEvent *event, void *data) {
51 UiObject *window = ui_window("Mod1", NULL); 51 UiObject *window = ui_window("Mod1", NULL);
52 //ui_window_addint(window, "check1"); 52 //ui_window_addint(window, "check1");
53 ui_show(window); 53 ui_show(window);
54 if(event->eventdata) {
55 printf("%s\n", event->eventdata);
56 }
54 } 57 }
55 58
56 void action_open(UiEvent *event, void *data) { 59 void action_open(UiEvent *event, void *data) {
57 //printf("check1: %s\n", event->intval ? "true" : "false"); 60 //printf("check1: %s\n", event->intval ? "true" : "false");
58 //printf("check1: %s\n", ui_getint(event->obj, "check1") ? "true" : "false"); 61 //printf("check1: %s\n", ui_getint(event->obj, "check1") ? "true" : "false");
75 } 78 }
76 79
77 void action_save(UiEvent *event, void *data) { 80 void action_save(UiEvent *event, void *data) {
78 TestWindowData *wd = event->window; 81 TestWindowData *wd = event->window;
79 printf("Text: {%s}\n", ui_getval(wd->text)); 82 printf("Text: {%s}\n", ui_getval(wd->text));
80 ui_setval(wd->text, "--------"); 83 ui_setval(wd->text, uistr("hello"));
81 84
82 ui_list_append(list, "abc"); 85 ui_list_append(list, "abc");
83 ui_notify(list->observers, NULL); 86 ui_notify(list->observers, NULL);
84 } 87 }
85 88
148 void action_delete(UiEvent *event, void *data) { 151 void action_delete(UiEvent *event, void *data) {
149 printf("delete\n"); 152 printf("delete\n");
150 } 153 }
151 154
152 155
153 int main(int argc, char** argv) { 156 int main(int argc, char** argv) {
154 ui_init("app1", argc, argv); 157 ui_init("app1", argc, argv);
158 ui_load_locale(NULL);
159 ui_openfilefunc(action_new, NULL);
160
155 161
156 list = ui_list_new(); 162 list = ui_list_new();
157 ui_list_append(list, "file1.txt"); 163 ui_list_append(list, "file1.txt");
158 ui_list_append(list, "hello.txt"); 164 ui_list_append(list, "hello.txt");
159 ui_list_append(list, "main.c"); 165 ui_list_append(list, "main.c");

mercurial