Re: Ideal way to create toolbar (with pic)
- From: John Cupitt <john cupitt ng-london org uk>
- To: Raymond Wan <rwan cs mu oz au>
- Cc: gtk-list gnome org
- Subject: Re: Ideal way to create toolbar (with pic)
- Date: Fri, 20 Feb 2004 18:50:34 +0000
Raymond Wan wrote:
I'm trying to create a toolbar button as follows:
iconw = gtk_image_new_from_file ("next.xpm");
toolbar_button = gtk_toolbar_append_item (GTK_TOOLBAR (toolbar), NULL,
"Go to next", NULL, iconw, GTK_SIGNAL_FUNC (showNext), GINT_TO_POINTER
An obvious problem with this is that the .xpm file is assumed to
be in the current directory. I could put an absolute path, but ideally,
I'd like to add the picture into the code. The GTK docs present many
choices to choose from when creating toolbar buttons. Could someone
recommend to me what is the ideal method for creating toolbars?
I think the ideal way is to make a new themeable stock item (with your pic set as the default), and then use gtk_toolbar_insert_stock(). Check the docs on gtk_icon_*() and gtk_stock_*(). I have some sample code if you're interested.
This way a theme author can easily change your graphic to something else.
] [Thread Prev