Re: GtkComboBox :-)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, 2004-02-11 at 06:52 +0100, Stephane Wirtel wrote:
> Hi Jim, 
> 
> Excuse me, but do you have a small example ? i am looking for it in the
> source code and in the api reference, to understand the mechanism, but i
> don't find. 
> 
> And i don't know how to implement a GtkComboBox with GtkCellLayout. 
> In the source code of gtkcombobox.c, i can see gtk_combo_box_cell_layout_*
> but none examples.
> 
> If you can help me, of course. 

GtkCellLayout is a particular API that different widgets and objects can
implement. GtkComboBox implements the GtkCellLayout interface for you,
meaning you can call gtk_cell_layout_* functions and pass a GtkComboBox
as the cell_layout argument.

So, for a combo box with a "pixbuf"/"text" row:

lstore = gtk_list_store_new (2, GDK_TYPE_PIXBUF, G_TYPE_STRING);

combo = gtk_combo_box_new_with_model (lstore);

pcell = gtk_cell_renderer_pixbuf_new ();

gtk_cell_layout_pack_start (combo, pcell, FALSE);
gtk_cell_layout_add_attribute (combo, pcell, "pixbuf", 0);

tcell = gtk_cell_renderer_text_new ();

gtk_cell_layout_pack_start (combo, tcell, TRUE);
gtk_cell_layout_add_attribute (combo, tcell, "text", 1);

-- 
Peace,

    Jim Cape
    http://ignore-your.tv

    Everyone has their own Truth, but there is only one Honesty.
_______________________________________________

gtk-list@xxxxxxxxx
http://mail.gnome.org/mailman/listinfo/gtk-list

[Index of Archives]     [Touch Screen Library]     [GIMP Users]     [Gnome]     [KDE]     [Yosemite News]     [Steve's Art]

  Powered by Linux