application/main.c

changeset 66
8d490d97aab8
parent 64
6ef2c7f73a30
child 67
f72c4f01bf4a
--- a/application/main.c	Mon Jan 05 18:47:07 2015 +0100
+++ b/application/main.c	Wed Jan 07 17:25:33 2015 +0100
@@ -78,13 +78,13 @@
     printf("button: %d\n", event->intval);
     char *s = ui_gettext(event->obj, "text");
     printf("{%s}\n", s);
-    printf("name: {%s}\n", ui_getval(name));
-    printf("mail: {%s}\n", ui_getval(mail));
-    ui_select_tab(tabview, 0);
+    //printf("name: {%s}\n", ui_getval(name));
+    //printf("mail: {%s}\n", ui_getval(mail));
+    //ui_select_tab(tabview, 0);
 }
 
 void action_test(UiEvent *event, void *data) {
-    ui_select_tab(tabview, 1);
+    //ui_select_tab(tabview, 1);
 }
 
 int main(int argc, char** argv) { 
@@ -97,7 +97,7 @@
     
     ui_menu("File");
     ui_menuitem_st(UI_STOCK_CLOSE, action_close, NULL);
-    ui_checkitem("Check", action_button, NULL);
+    //ui_checkitem("Check", action_button, NULL);
     
     ui_toolitem_st("button", UI_STOCK_GO_BACK, action_button, NULL);
     ui_toolbar_add_default("button");
@@ -105,92 +105,22 @@
     printf("create window\n");
     UiObject *window = ui_window("Mod0", NULL);
     
-    UiModelInfo *model = ui_model_info(window->ctx, UI_STRING, "Name", UI_STRING, "Email", -1);
-    model->getvalue = (ui_model_getvalue_f)person_getvalue;
-    model->activate = action_activate;
-    model->selection = action_select;
-    UiList *list = ui_list_new();
-    Person *p1 = ui_malloc(window->ctx, sizeof(Person));
-    Person *p2 = ui_malloc(window->ctx, sizeof(Person));
-    Person *p3 = ui_malloc(window->ctx, sizeof(Person));
-    Person *p4 = ui_malloc(window->ctx, sizeof(Person));
-    p1->name = "Some Näme";
-    p1->mail = "mail@host.com";
-    p2->name = "押井守";
-    p2->mail = "other.person@provider.com";
-    p3->name = "My Self";
-    p3->mail = "my@self.org";
-    p4->name = "Gregory House";
-    p4->mail = "greg@pp";
-    ui_list_append(list, p1);
-    ui_list_append(list, p2);
-    ui_list_append(list, p3);
-    ui_list_append(list, p4);
+    ui_button(window, "Test1", action_button, NULL);
+    ui_button(window, "Test2", action_button, NULL);
     
-    /*
-    ui_sidebar(window);
+    ui_hbox(window);
+    
     ui_layout_fill(window, FALSE);
     ui_vbox(window);
-    ui_button(window, "Test1", NULL, NULL);
-    ui_button(window, "Test2", NULL, NULL);
-    ui_button(window, "Test3", NULL, NULL);
-    ui_button(window, "Test4", NULL, NULL);
-    ui_button(window, "Test5", NULL, NULL);
-    ui_button(window, "Test6", NULL, NULL);
-    ui_button(window, "Test7", NULL, NULL);
-    ui_button(window, "Test8", NULL, NULL);
-    ui_end(window);
-    ui_end(window);
-    ui_table(window, list, model);
-    */
-    ui_layout_fill(window, FALSE);
-    ui_grid(window);
-    ui_label(window, "Name");
-    ui_textfield(window, &name);
-    ui_newline(window);
-    ui_label(window, "Email");
-    ui_textfield(window, &mail);
-    ui_newline(window);
-    ui_end(window);
-    
-    tabview = ui_tabview(window);
-    
-    ui_tab(window, "Editor");
-    ui_textarea_nv(window, "text");
-    ui_button(window, "Submit", action_test, NULL);
+    ui_button(window, "A", NULL, NULL);
+    ui_button(window, "B", NULL, NULL);
+    ui_button(window, "C", NULL, NULL);
     ui_end(window);
     
-    ui_tab(window, "Button");
-    ui_button(window, "TestButton", NULL, NULL);
+    ui_textarea_nv(window, "text");
     ui_end(window);
     
-    ui_end(window);
-    ui_button(window, "End", NULL, NULL);
-    /*
-    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);
-    
-    UiObject *tab3 = ui_document_tab(view);
-    Document *doc3 = ui_document_new(1024);
-    UiContext *ctx3 = ui_document_context(doc3);
-    ui_document_regtext(doc3, "text", &doc3->text);
-    ui_textarea_nv(tab3, "text");
-    ui_set_document(tab3, doc3);
-    */
+    ui_button(window, "Test4", action_button, NULL);
     
     ui_show(window);
     ui_main();

mercurial