application/main.c

changeset 72
a00b46d92c54
parent 71
3e021c5f18a0
child 73
473acef47ddd
--- a/application/main.c	Sun Jan 11 16:33:28 2015 +0100
+++ b/application/main.c	Mon Jan 12 12:03:05 2015 +0100
@@ -111,7 +111,29 @@
     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_listview(window, list, (ui_model_getvalue_f)person_getvalue, action_activate, NULL);
     
     ui_show(window);
     ui_main();

mercurial