80 } |
80 } |
81 |
81 |
82 void action_undo(UiEvent *event, void *data) { |
82 void action_undo(UiEvent *event, void *data) { |
83 printf("undo\n"); |
83 printf("undo\n"); |
84 TestWindowData *wd = event->window; |
84 TestWindowData *wd = event->window; |
85 //ui_text_undo(&wd->text); |
85 ui_text_undo(&wd->text); |
86 } |
86 } |
87 |
87 |
88 void action_redo(UiEvent *event, void *data) { |
88 void action_redo(UiEvent *event, void *data) { |
89 printf("redo\n"); |
89 printf("redo\n"); |
|
90 TestWindowData *wd = event->window; |
|
91 ui_text_redo(&wd->text); |
90 } |
92 } |
91 |
93 |
92 |
94 |
93 int main(int argc, char** argv) { |
95 int main(int argc, char** argv) { |
94 ui_init("app1", argc, argv); |
96 ui_init("app1", argc, argv); |
99 ui_menuitem("Open", action_open, NULL); |
101 ui_menuitem("Open", action_open, NULL); |
100 ui_menuseparator(); |
102 ui_menuseparator(); |
101 ui_menuitem("Dokument 1", action_doc1, NULL); |
103 ui_menuitem("Dokument 1", action_doc1, NULL); |
102 ui_menuitem("Dokument 2", action_doc2, NULL); |
104 ui_menuitem("Dokument 2", action_doc2, NULL); |
103 ui_menuseparator(); |
105 ui_menuseparator(); |
104 //ui_checkitem_nv("Check", "check1"); |
106 ui_checkitem_nv("Check", "check1"); |
105 ui_menuitem("Close", action_close, NULL); |
107 ui_menuitem("Close", action_close, NULL); |
106 |
108 |
107 |
109 |
108 |
110 |
109 ui_toolitem_st("new", UI_STOCK_NEW, action_new, NULL); |
111 ui_toolitem_st("new", UI_STOCK_NEW, action_new, NULL); |
121 ui_toolbar_add_default("redo"); |
123 ui_toolbar_add_default("redo"); |
122 |
124 |
123 |
125 |
124 printf("create window\n"); |
126 printf("create window\n"); |
125 UiObject *window = ui_window("Mod0", NULL); |
127 UiObject *window = ui_window("Mod0", NULL); |
126 TestWindowData *wdata = malloc(sizeof(TestWindowData)); |
128 TestWindowData *wdata = calloc(1, sizeof(TestWindowData)); |
127 window->window = wdata; |
129 window->window = wdata; |
128 |
130 |
129 TestDocument *doc1 = ui_document_new(sizeof(TestDocument)); |
131 TestDocument *doc1 = ui_document_new(sizeof(TestDocument)); |
130 TestDocument *doc2 = ui_document_new(sizeof(TestDocument)); |
132 TestDocument *doc2 = ui_document_new(sizeof(TestDocument)); |
131 ui_document_regint(doc1, "check1", &doc1->check1); |
133 ui_document_regint(doc1, "check1", &doc1->check1); |