application/main.c

changeset 72
a00b46d92c54
parent 71
3e021c5f18a0
child 73
473acef47ddd
equal deleted inserted replaced
71:3e021c5f18a0 72:a00b46d92c54
109 ui_toolbar_add_default("button"); 109 ui_toolbar_add_default("button");
110 110
111 printf("create window\n"); 111 printf("create window\n");
112 UiObject *window = ui_window("Mod0", NULL); 112 UiObject *window = ui_window("Mod0", NULL);
113 113
114 UiModelInfo *model = ui_model_info(window->ctx, UI_STRING, "Name", UI_STRING, "Email", -1);
115 model->getvalue = (ui_model_getvalue_f)person_getvalue;
116 model->activate = action_activate;
117 model->selection = action_select;
118 UiList *list = ui_list_new();
119 Person *p1 = ui_malloc(window->ctx, sizeof(Person));
120 Person *p2 = ui_malloc(window->ctx, sizeof(Person));
121 Person *p3 = ui_malloc(window->ctx, sizeof(Person));
122 Person *p4 = ui_malloc(window->ctx, sizeof(Person));
123 p1->name = "Some Näme";
124 p1->mail = "mail@host.com";
125 p2->name = "押井守";
126 p2->mail = "other.person@provider.com";
127 p3->name = "My Self";
128 p3->mail = "my@self.org";
129 p4->name = "Gregory House";
130 p4->mail = "greg@pp";
131 ui_list_append(list, p1);
132 ui_list_append(list, p2);
133 ui_list_append(list, p3);
134 ui_list_append(list, p4);
114 135
136 ui_listview(window, list, (ui_model_getvalue_f)person_getvalue, action_activate, NULL);
115 137
116 ui_show(window); 138 ui_show(window);
117 ui_main(); 139 ui_main();
118 140
119 return (EXIT_SUCCESS); 141 return (EXIT_SUCCESS);

mercurial