Re: Ideal way to create toolbar (with pic)



Hi Ray,

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
(curr));

	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.

John




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