202 } |
202 } |
203 |
203 |
204 UIWIDGET ui_listview_create(UiObject *obj, UiListArgs args) { |
204 UIWIDGET ui_listview_create(UiObject *obj, UiListArgs args) { |
205 UiObject* current = uic_current_obj(obj); |
205 UiObject* current = uic_current_obj(obj); |
206 |
206 |
207 // to simplify things and share code with ui_tableview_create, we also |
207 // to simplify things and share code with ui_table_create, we also |
208 // use a UiModel for the listview |
208 // use a UiModel for the listview |
209 UiModel *model = ui_model(obj->ctx, UI_STRING, "", -1); |
209 UiModel *model = ui_model(obj->ctx, UI_STRING, "", -1); |
210 model->getvalue = args.getvalue ? args.getvalue : ui_strmodel_getvalue; |
210 model->getvalue = args.getvalue ? args.getvalue : ui_strmodel_getvalue; |
211 args.model = model; |
211 args.model = model; |
212 |
212 |
718 UiListView *listview = malloc(sizeof(UiListView)); |
718 UiListView *listview = malloc(sizeof(UiListView)); |
719 listview->obj = obj; |
719 listview->obj = obj; |
720 listview->widget = view; |
720 listview->widget = view; |
721 listview->var = var; |
721 listview->var = var; |
722 listview->model = model; |
722 listview->model = model; |
|
723 listview->selection.count = 0; |
|
724 listview->selection.rows = NULL; |
723 g_signal_connect( |
725 g_signal_connect( |
724 view, |
726 view, |
725 "destroy", |
727 "destroy", |
726 G_CALLBACK(ui_listview_destroy), |
728 G_CALLBACK(ui_listview_destroy), |
727 listview); |
729 listview); |