Re: Making owner drawn combo box



On 03/28/13 14:19, Igor Korot wrote:> Hi, ALL,
> Is it possible to make combo box/list box ownerdrawn?
> Meaning that the string in the control will have a bitmap...
> I'm using GTK+2.
>

Yes, but do you need to? I think you can just make your own model and assign it to the combobox and set the renderers you need. You can have any combination of data you like.


https://developer.gnome.org/gtk2/2.24/GtkListStore.html#gtk-list-store-new

GtkTreeModel list = gtk_list_store_new(2, G_TYPE_STRING, G_TYPE_PIXBUF);
GtkComboBox combo = gtk_combo_box_new_with_model(list);

gtk_cell_layout_clear(combo);
gtk_cell_layout_pack_start(combo, gtk_cell_renderer_text_new(), TRUE);
gtk_cell_layout_pack_start(combo, gtk_cell_renderer_pixbuf_new(), TRUE);

etc.


Regards,

Andrew Haines



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