GNOME Bugzilla – Bug 139347
Add GtkCellRendererCombo
Last modified: 2011-02-04 16:17:01 UTC
It would be nice to have more cell renderes which are extreme powerful and can simplify UI, for example GtkCellRendererPopup (cp. EggCellRendererPopup). regs, Chris
We want to make GtkComboBox be a renderer too.
Created attachment 26630 [details] [review] First steps to make a combo renderer This is the first step to make a GtkCellRendererCombo. The patch includes: - Modifications in gtkcombobox.c to make it implement the GtkCellEditable interface - A first implementation of GtkCellRendererCombo, which is a subclass of GtkCellRendererText and uses a hardcoded GtkComboBox instead of a GtkEntry. The main purpose of this patch is to show a (possible) bug in GtkTreeView when drawing the cells if there is a non window widget (like the combo) in those cells.
Created attachment 26631 [details] test program to show the bug with the CellRendererCombo This is a very simple program that shows the bug I previously mentioned.
Can you try the following patch to see if it fixes your problem? I haven't really tested it other than to confirm it doesn't obviously break anything, but it seems like it would fix your problem.
Created attachment 26640 [details] [review] patch to propagate exposes correctly.
I ended up committing the patch to CVS, as it seemed pretty obviously correct.
It does solve the problem. Thanks Jonathan.
Woah! That was just a side problem, and probably should have been put in a different bug. This bug is about getting the combobox to the point where it can be used as a renderer. Reopening. (-:
Created attachment 26663 [details] [review] more complete implementation of the renderer This is a more complete implementation of the renderer. So far it has a model property and in the start_editing method it uses this model as the model for the ComboBoxEntry it creates. This way the user code might look like this: treeview = gtk_tree_view_new_with_model (treeview_model); renderer = gtk_cell_renderer_combo_new (); combo_model = gtk_list_store_new (1, G_TYPE_STRING); gtk_list_store_append (combo_model, &iter); gtk_list_store_set (combo_model, &iter, 0, "red", -1); gtk_list_store_append (combo_model, &iter); gtk_list_store_set (combo_model, &iter, 0, "green", -1); gtk_list_store_append (combo_model, &iter); gtk_list_store_set (combo_model, &iter, 0, "blue", -1); /* see how we set the model property of the renderer */ g_object_set (renderer, "mode", GTK_CELL_RENDERER_MODE_EDITABLE, "editable", TRUE, "model", combo_model, NULL); column = gtk_tree_view_column_new_with_attributes ("RendererComboEntry", renderer, "text", 0, NULL); gtk_tree_view_append_column (GTK_TREE_VIEW (treeview), column);
*** Bug 116552 has been marked as a duplicate of this bug. ***
Original title was "Offer more cell renderers", so a slight addition: It would be very nice to have a public separator cell renderer, too - there is a private sep./text renderer in GTK+ but as apps like GConf-Editor need it for simplifying their bookmark UI, it should really be available to 3rd party apps as well. regs, Chris
Add a combo box cell renderer now. Christian, HEAD has separators in treeviews now (not implemented as cell renderer, though)