After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 139347 - Add GtkCellRendererCombo
Add GtkCellRendererCombo
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: Widget: GtkComboBox
2.5.x
Other All
: Normal normal
: ---
Assigned To: gtktreeview-bugs
gtktreeview-bugs
: 116552 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2004-04-07 10:53 UTC by Christian Neumair
Modified: 2011-02-04 16:17 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
First steps to make a combo renderer (10.14 KB, patch)
2004-04-13 19:32 UTC, Lorenzo Gil Sanchez
none Details | Review
test program to show the bug with the CellRendererCombo (1.61 KB, text/plain)
2004-04-13 19:35 UTC, Lorenzo Gil Sanchez
  Details
patch to propagate exposes correctly. (2.51 KB, patch)
2004-04-14 07:25 UTC, Jonathan Blandford
committed Details | Review
more complete implementation of the renderer (11.58 KB, patch)
2004-04-14 18:43 UTC, Lorenzo Gil Sanchez
none Details | Review

Description Christian Neumair 2004-04-07 10:53:37 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
Comment 1 Jonathan Blandford 2004-04-13 18:39:25 UTC
We want to make GtkComboBox be a renderer too.
Comment 2 Lorenzo Gil Sanchez 2004-04-13 19:32:14 UTC
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.
Comment 3 Lorenzo Gil Sanchez 2004-04-13 19:35:48 UTC
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.
Comment 4 Jonathan Blandford 2004-04-14 07:24:09 UTC
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.
Comment 5 Jonathan Blandford 2004-04-14 07:25:00 UTC
Created attachment 26640 [details] [review]
patch to propagate exposes correctly.
Comment 6 Jonathan Blandford 2004-04-14 07:53:21 UTC
I ended up committing the patch to CVS, as it seemed pretty obviously correct.
Comment 7 Lorenzo Gil Sanchez 2004-04-14 08:50:32 UTC
It does solve the problem. Thanks Jonathan.
Comment 8 Jonathan Blandford 2004-04-14 15:25:00 UTC
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. (-:
Comment 9 Lorenzo Gil Sanchez 2004-04-14 18:43:14 UTC
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);
Comment 10 Matthias Clasen 2004-07-09 18:36:46 UTC
*** Bug 116552 has been marked as a duplicate of this bug. ***
Comment 11 Christian Neumair 2004-07-09 19:29:24 UTC
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
Comment 12 Matthias Clasen 2004-07-16 20:28:52 UTC
Add a combo box cell renderer now.

Christian, HEAD has separators in treeviews now (not implemented as cell
renderer, though)