Re: How to change the font of GtkComboBox popup list



On Tue, 15 Feb 2005 09:53:29 -0600, Greg Breland <gbreland mozillanews org> wrote:

On Tue, 2005-02-15 at 08:52, Marco Scholten wrote:
I think you are talking about GtkCombo, i was talking about GtkComboBox.

I think i may have to create a cellrenderertext set its font and pack that
into the combobox, í'm gonna try it that way.

Please post back here if you figure it out since this is also on my
current ToDo list for my application.


I figured it out:

GtkWidget *combobox;
GtkListStore *liststore;
GtkCellRenderer *renderer;
GtkTreeIter iter;	

liststore = gtk_list_store_new (1, G_TYPE_STRING);
combobox = gtk_combo_box_new_with_model(GTK_TREE_MODEL(liststore));
renderer = gtk_cell_renderer_text_new();
gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(combobox), renderer, true);
gtk_cell_layout_add_attribute(GTK_CELL_LAYOUT(combobox), renderer, "text", 0);

gtk_list_store_append (liststore, &iter);
gtk_list_store_set (liststore, &iter, 0, "Item 1", -1);
gtk_list_store_append (liststore, &iter);
gtk_list_store_set (liststore, &iter, 0, "Item 2", -1);
gtk_list_store_append (liststore, &iter);
gtk_list_store_set (liststore, &iter, 0, "Item 3", -1);

g_object_set(renderer, "font", "Sans 20", NULL);



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