application/main.c

changeset 52
25e5390cce41
parent 51
42506e19eb6b
child 53
62205699cd0e
--- a/application/main.c	Fri Jun 13 10:39:54 2014 +0200
+++ b/application/main.c	Tue Jul 22 09:51:17 2014 +0200
@@ -39,6 +39,10 @@
     char *mail;
 } Person;
 
+typedef struct Document {
+    UiText text;
+} Document;
+
 void action_close(UiEvent *event, void *data) {
     ui_close(event->obj);
 }
@@ -67,6 +71,8 @@
 
 void action_button(UiEvent *event, void *data) {
     printf("button: %d\n", event->intval);
+    char *s = ui_gettext(event->obj, "text");
+    printf("{%s}\n", s);    
 }
 
 int main(int argc, char** argv) { 
@@ -81,7 +87,7 @@
     ui_menuitem_st(UI_STOCK_CLOSE, action_close, NULL);
     ui_checkitem("Check", action_button, NULL);
     
-    ui_toolitem_toggle_st("button", UI_STOCK_GO_BACK, action_button, NULL);
+    ui_toolitem_st("button", UI_STOCK_GO_BACK, action_button, NULL);
     ui_toolbar_add_default("button");
     
     printf("create window\n");
@@ -109,10 +115,26 @@
     ui_list_append(list, p3);
     ui_list_append(list, p4);
     
-    ui_sidebar(window);
-    ui_table(window, list, model);
-    ui_end(window);
-    ui_textarea(window, NULL);
+    //ui_sidebar(window);
+    //ui_table(window, list, model);
+    //ui_end(window);
+    
+    UiTabbedPane *view = ui_tabbed_document_view(window);
+    
+    UiObject *tab1 = ui_document_tab(view);
+    Document *doc1 = ui_document_new(1024);
+    UiContext *ctx1 = ui_document_context(doc1);
+    ui_document_regtext(doc1, "text", &doc1->text);
+    ui_textarea_nv(tab1, "text");
+    ui_set_document(tab1, doc1);
+    
+    
+    UiObject *tab2 = ui_document_tab(view);
+    Document *doc2 = ui_document_new(1024);
+    UiContext *ctx2 = ui_document_context(doc2);
+    ui_document_regtext(doc2, "text", &doc2->text);
+    ui_textarea_nv(tab2, "text");
+    ui_set_document(tab2, doc2);
     
     ui_show(window);
     ui_main();

mercurial