45 |
45 |
46 UiInteger check1; |
46 UiInteger check1; |
47 |
47 |
48 UiList *list; |
48 UiList *list; |
49 |
49 |
|
50 /* |
|
51 |
50 void action_new(UiEvent *event, void *data) { |
52 void action_new(UiEvent *event, void *data) { |
51 UiObject *window = ui_window("Mod1", NULL); |
53 UiObject *window = ui_window("Mod1", NULL); |
52 //ui_window_addint(window, "check1"); |
54 //ui_window_addint(window, "check1"); |
53 ui_show(window); |
55 ui_show(window); |
54 if(event->eventdata) { |
56 if(event->eventdata) { |
150 |
152 |
151 void action_delete(UiEvent *event, void *data) { |
153 void action_delete(UiEvent *event, void *data) { |
152 printf("delete\n"); |
154 printf("delete\n"); |
153 } |
155 } |
154 |
156 |
|
157 //*/ |
155 |
158 |
156 int main(int argc, char** argv) { |
159 int main(int argc, char** argv) { |
157 ui_init("app1", argc, argv); |
160 ui_init("app1", argc, argv); |
158 ui_locales_dir("/opt/app1/locales"); |
161 ui_locales_dir("/opt/app1/locales"); |
159 ui_load_lang_def(NULL, "en_EN"); |
162 ui_load_lang_def(NULL, "en_EN"); |
160 ui_openfilefunc(action_new, NULL); |
163 //ui_openfilefunc(action_new, NULL); |
161 |
164 |
162 |
165 /* |
163 list = ui_list_new(); |
166 list = ui_list_new(); |
164 ui_list_append(list, "file1.txt"); |
167 ui_list_append(list, "file1.txt"); |
165 ui_list_append(list, "hello.txt"); |
168 ui_list_append(list, "hello.txt"); |
166 ui_list_append(list, "main.c"); |
169 ui_list_append(list, "main.c"); |
167 |
170 |
202 ui_toolbar_add_default("open"); |
205 ui_toolbar_add_default("open"); |
203 ui_toolbar_add_default("save"); |
206 ui_toolbar_add_default("save"); |
204 ui_toolbar_add_default("close"); |
207 ui_toolbar_add_default("close"); |
205 ui_toolbar_add_default("undo"); |
208 ui_toolbar_add_default("undo"); |
206 ui_toolbar_add_default("redo"); |
209 ui_toolbar_add_default("redo"); |
207 |
210 //*/ |
|
211 |
|
212 ui_menu("File"); |
|
213 ui_menuitem("New", NULL, NULL); |
|
214 ui_menuitem("Close", NULL, NULL); |
|
215 ui_menu("Edit"); |
|
216 ui_menuitem("Preferences", NULL, NULL); |
208 |
217 |
209 printf("create window\n"); |
218 printf("create window\n"); |
210 UiObject *window = ui_window("Mod0", NULL); |
219 UiObject *window = ui_window("Mod0", NULL); |
211 TestWindowData *wdata = calloc(1, sizeof(TestWindowData)); |
220 TestWindowData *wdata = calloc(1, sizeof(TestWindowData)); |
212 window->window = wdata; |
221 window->window = wdata; |
213 |
222 |
214 TestDocument *doc1 = ui_document_new(sizeof(TestDocument)); |
223 TestDocument *doc1 = ui_document_new(sizeof(TestDocument)); |
215 TestDocument *doc2 = ui_document_new(sizeof(TestDocument)); |
224 TestDocument *doc2 = ui_document_new(sizeof(TestDocument)); |
219 wdata->doc2 = doc2; |
228 wdata->doc2 = doc2; |
220 |
229 |
221 ui_set_document(window, doc1); |
230 ui_set_document(window, doc1); |
222 |
231 |
223 //ui_button(window, "OK", action_open, NULL); |
232 //ui_button(window, "OK", action_open, NULL); |
224 ui_textarea(window, &wdata->text); |
233 //ui_textarea(window, &wdata->text); |
225 |
234 |
226 //ui_window_addint(window, "check1"); |
235 //ui_window_addint(window, "check1"); |
227 ui_show(window); |
236 ui_show(window); |
228 ui_main(); |
237 ui_main(); |
229 |
238 |