Re: Stock buttons



On Sunday, April 11, 2004, at 05:48 PM, Toby A Inkster wrote:

I was wondering, is there an easy way to use Gtk2 stock icons on buttons but use different text (and different mnemonics)?

a) create the stock image that you want, and add that and your desired label to an hbox that you put inside a button.

b) create a new stock item, using a copy of the stock image that you want, and your own label information, and then use that new stock item for the button.


whether a) or b) is more work is for you to decide, but b) is definitely more elegant. there's an example of how to create stock items in the examples directory of the Gtk2 source code:

http://cvs.sourceforge.net/viewcvs.py/gtk2-perl/gtk2-perl-xs/Gtk2/ examples/adding_stock_icons.pl?annotate=1.2


the fun part of b) is re-using the old pixbuf, e.g.:

  # untested code
  $pixbuf = Gtk2::Widget->render_icon ('gtk-forward', 'toolbar');
  my $icon_set = Gtk2::IconSet->new_from_pixbuf ($pixbuf);


--
"Ghostbusters" is the best movie of this decade.
  -- Neal, circa 1996, referring to a movie released in 1984.




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