application/main.c

changeset 22
bcf880b29bc3
parent 21
012418e7dc90
child 26
a137277f9173
equal deleted inserted replaced
21:012418e7dc90 22:bcf880b29bc3
102 void action_document(UiEvent *event, void *data) { 102 void action_document(UiEvent *event, void *data) {
103 UiList *documents = data; 103 UiList *documents = data;
104 printf("selected document: %d\n", event->intval); 104 printf("selected document: %d\n", event->intval);
105 } 105 }
106 106
107 void action_cut(UiEvent *event, void *data) {
108 printf("cut\n");
109 }
110
111 void action_copy(UiEvent *event, void *data) {
112 printf("copy\n");
113 }
114
115 void action_paste(UiEvent *event, void *data) {
116 printf("paste\n");
117 }
118
119 void action_delete(UiEvent *event, void *data) {
120 printf("delete\n");
121 }
122
107 123
108 int main(int argc, char** argv) { 124 int main(int argc, char** argv) {
109 ui_init("app1", argc, argv); 125 ui_init("app1", argc, argv);
110 126
111 list = ui_list_new(); 127 list = ui_list_new();
129 145
130 void ui_menuseparator(); 146 void ui_menuseparator();
131 ui_menuitem_list(list, action_document, list); 147 ui_menuitem_list(list, action_document, list);
132 ui_menuseparator(); 148 ui_menuseparator();
133 ui_menuitem_st(UI_STOCK_CLOSE, action_close, NULL); 149 ui_menuitem_st(UI_STOCK_CLOSE, action_close, NULL);
150
151 ui_menu("Edit");
152 ui_menuitem_stgr(UI_STOCK_CUT, action_cut, NULL, UI_GROUP_SELECTION, -1);
153 ui_menuitem_stgr(UI_STOCK_COPY, action_copy, NULL, UI_GROUP_SELECTION, -1);
154 ui_menuitem_st(UI_STOCK_PASTE, action_paste, NULL);
155 ui_menuitem_stgr(UI_STOCK_DELETE, action_delete, NULL, UI_GROUP_SELECTION, -1);
134 156
135 157
136 ui_toolitem_st("new", UI_STOCK_NEW, action_new, NULL); 158 ui_toolitem_st("new", UI_STOCK_NEW, action_new, NULL);
137 ui_toolitem_st("open", UI_STOCK_GO_BACK, action_open, NULL); 159 ui_toolitem_st("open", UI_STOCK_GO_BACK, action_open, NULL);
138 ui_toolitem_st("save", UI_STOCK_GO_FORWARD, action_save, NULL); 160 ui_toolitem_st("save", UI_STOCK_GO_FORWARD, action_save, NULL);

mercurial