#include int main (int argc, char *argv[]) { GtkWidget* window, *combo; GtkTreeStore *store; GtkTreeIter iter, iter2; GdkPixbuf *pixbuf; GtkCellRenderer *renderer; gtk_init (&argc, &argv); window = gtk_window_new (GTK_WINDOW_TOPLEVEL); /* Create the model */ store = gtk_tree_store_new (3, GDK_TYPE_PIXBUF, G_TYPE_STRING, G_TYPE_BOOLEAN); /* Create the combo box */ combo = gtk_combo_box_new (); pixbuf = gtk_widget_render_icon (combo, GTK_STOCK_DIALOG_WARNING, GTK_ICON_SIZE_BUTTON, NULL); gtk_tree_store_append (store, &iter, NULL); gtk_tree_store_set (store, &iter, 0, pixbuf, 1, "Danger", 2, FALSE, -1); pixbuf = gtk_widget_render_icon (combo, GTK_STOCK_NEW, GTK_ICON_SIZE_BUTTON, NULL); gtk_tree_store_append (store, &iter2, &iter); gtk_tree_store_set (store, &iter2, 0, pixbuf, 1, "New", 2, FALSE, -1); gtk_tree_store_append (store, &iter, NULL); gtk_tree_store_set (store, &iter, 0, pixbuf, 1, "Separator", 2, TRUE, -1); pixbuf = gtk_widget_render_icon (combo, GTK_STOCK_STOP, GTK_ICON_SIZE_BUTTON, NULL); gtk_tree_store_append (store, &iter, NULL); gtk_tree_store_set (store, &iter, 0, pixbuf, 1, "Stop", 2, FALSE, -1); /* Set the model */ gtk_combo_box_set_model (GTK_COMBO_BOX (combo), GTK_TREE_MODEL (store)); gtk_combo_box_set_active_iter (GTK_COMBO_BOX (combo), &iter); /* Set up cell renderers */ renderer = gtk_cell_renderer_pixbuf_new (); gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (combo), renderer, FALSE); gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (combo), renderer, "pixbuf", 0, NULL); renderer = gtk_cell_renderer_text_new (); gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (combo), renderer, TRUE); gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (combo), renderer, "text", 1, NULL); gtk_container_add (GTK_CONTAINER (window), combo); gtk_widget_show_all (window); gtk_main (); return 0; }