Re: bug/missing feature in gtk2
- From: Ronald Bultje <rbultje ronald bitfreak net>
- To: gtk-list gnome org
- Subject: Re: bug/missing feature in gtk2
- Date: 23 Feb 2002 17:04:10 +0100
On Sat, 2002-02-23 at 15:36, Owen Taylor wrote:
> I'd say it's a "known limitation" rather than either a bug or missing feature.
> I doubt we'll fix it in the context of GtkOpttionMenu, but if you
> want to file a bug report on the issue on bugzilla.gnome.org that will
> remind us to look at the issue of Icon/Text combination items for the
> new combo/option menu widget that is scheduled to be done for GTK+-2.2.
I filed it on bugzilla, hope it'll be fixed one day. But if I understand
you correctly, there's little chance that it'll be "fixed" for Gtk+-2.0?
For the archives then, here's code I use as a workaround (got this idea
while looking in the sourcecode of GtkImageMenuItem):
static GtkWidget *
gtk_menu_item_with_image (const gchar *labeltxt,
const gchar **pixmap)
{
GtkWidget *hbox, *menuitem, *label, *image;
menuitem = gtk_menu_item_new();
hbox = gtk_hbox_new(FALSE, 5);
image =
gtk_image_new_from_pixbuf(gdk_pixbuf_new_from_xpm_data(pixmap));
gtk_box_pack_start(GTK_BOX(hbox), image, FALSE, FALSE, 0);
gtk_widget_show(image);
label = gtk_label_new(labeltxt);
gtk_misc_set_alignment(GTK_MISC(label), 0.0, GTK_MISC(label)->yalign);
gtk_box_pack_start(GTK_BOX(hbox), label, TRUE, TRUE, 0);
gtk_widget_show(label);
gtk_container_add(GTK_CONTAINER(menuitem), hbox);
gtk_widget_show(hbox);
return menuitem;
}
and then for the menus:
[..]
menu = gtk_menu_new();
pixmap = (const gchar**) audio_src_volume_xpm;
for (i=0;i<g_list_length(list);i++)
{
menuitem = gtk_menu_item_with_image("some_text", pixmap);
gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem);
if (i == active)
gtk_menu_set_active(GTK_MENU(menu), i);
}
gtk_option_menu_set_menu (prefs->audio_recsrc, menu);
gtk_widget_show_all(menu);
[..]
Ronald
--
- .-.
- /V\ | Ronald Bultje <rbultje ronald bitfreak net>
- // \\ | Running: Linux 2.4.17-XFS and OpenBSD 3.0
- /( )\ | http://ronald.bitfreak.net/
- ^^-^^
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]