ui/gtk/list.c

changeset 827
eae5b817aa47
parent 824
a0ea8f3aa6e8
child 853
380ec881faa2
equal deleted inserted replaced
826:e596cfc1ca46 827:eae5b817aa47
243 entry_data); 243 entry_data);
244 244
245 GtkEventController *focus_controller = gtk_event_controller_focus_new(); 245 GtkEventController *focus_controller = gtk_event_controller_focus_new();
246 g_signal_connect(focus_controller, "leave", G_CALLBACK(cell_entry_leave_focus), entry_data); 246 g_signal_connect(focus_controller, "leave", G_CALLBACK(cell_entry_leave_focus), entry_data);
247 gtk_widget_add_controller(textfield, focus_controller); 247 gtk_widget_add_controller(textfield, focus_controller);
248 } else { 248 } else if(type == UI_BOOL_EDITABLE) {
249 GtkWidget *checkbox = gtk_check_button_new();
250 gtk_list_item_set_child(item, checkbox);
251 }else {
249 GtkWidget *label = gtk_label_new(NULL); 252 GtkWidget *label = gtk_label_new(NULL);
250 gtk_label_set_xalign(GTK_LABEL(label), 0); 253 gtk_label_set_xalign(GTK_LABEL(label), 0);
251 gtk_list_item_set_child(item, label); 254 gtk_list_item_set_child(item, label);
252 } 255 }
253 } 256 }
388 entry->previous_value = strdup(data); 391 entry->previous_value = strdup(data);
389 } 392 }
390 ENTRY_SET_TEXT(child, data); 393 ENTRY_SET_TEXT(child, data);
391 break; 394 break;
392 } 395 }
396 case UI_BOOL_EDITABLE: {
397 intptr_t i = (intptr_t)data;
398 gtk_check_button_set_active(GTK_CHECK_BUTTON(child), (gboolean)i);
399 break;
400 }
393 } 401 }
394 402
395 if(attributes != listview->current_row_attributes) { 403 if(attributes != listview->current_row_attributes) {
396 pango_attr_list_unref(attributes); 404 pango_attr_list_unref(attributes);
397 } 405 }
415 if(entry) { 423 if(entry) {
416 cell_save_value(entry, FALSE); 424 cell_save_value(entry, FALSE);
417 entry->listview = NULL; 425 entry->listview = NULL;
418 free(entry->previous_value); 426 free(entry->previous_value);
419 entry->previous_value = NULL; 427 entry->previous_value = NULL;
428 } else if(GTK_IS_CHECK_BUTTON(child)) {
429
420 } 430 }
421 } 431 }
422 432
423 433
424 static GtkSelectionModel* create_selection_model(UiListView *listview, GListStore *liststore, bool multiselection) { 434 static GtkSelectionModel* create_selection_model(UiListView *listview, GListStore *liststore, bool multiselection) {
1507 /* --------------------------- ComboBox --------------------------- */ 1517 /* --------------------------- ComboBox --------------------------- */
1508 1518
1509 UIWIDGET ui_combobox_create(UiObject *obj, UiListArgs *args) { 1519 UIWIDGET ui_combobox_create(UiObject *obj, UiListArgs *args) {
1510 GtkWidget *combobox = gtk_combo_box_new(); 1520 GtkWidget *combobox = gtk_combo_box_new();
1511 if(args->width > 0) { 1521 if(args->width > 0) {
1512 gtk_widget_set_size_request(scroll_area, args->width, -1); 1522 gtk_widget_set_size_request(combobox, args->width, -1);
1513 } 1523 }
1514 1524
1515 ui_set_name_and_style(combobox, args->name, args->style_class); 1525 ui_set_name_and_style(combobox, args->name, args->style_class);
1516 ui_set_widget_groups(obj->ctx, combobox, args->groups); 1526 ui_set_widget_groups(obj->ctx, combobox, args->groups);
1517 UiContainerPrivate *ct = (UiContainerPrivate*)obj->container_end; 1527 UiContainerPrivate *ct = (UiContainerPrivate*)obj->container_end;

mercurial