Re: Button with image




Beast said:

1. Is it possible to create new button with image without adding in
Gtk2::Stock?

Of course.  The stock stuff is a convenience wrapper to do a bunch of
gruntwork for you.

  $button = Gtk2::Button->new ();  # note, no label
  $image = Gtk2::Image->new_from_pixbuf ($pixbuf);
  $button->add ($image);
  $image->show ();

If you want an image and a label, pack them into a box and add the box to the
button.


2. I can not found gtk_stock_add documentation in gtk+ site, however it
was there in gtk-perl site, is Gtk2::Stock only available in gtk-perl?

Nope, it comes from gtk+.  The page is called "Stock Items":
http://developer.gnome.org/doc/API/2.0/gtk/gtk-Stock-Items.html#gtk-stock-add

In addition to the adding_stock_icons.pl example that comes with Gtk2, there's
an example of registering stock icons in the "migrating from GnomeUIInfo"
section of the gtk+ manual:
http://developer.gnome.org/doc/API/2.0/gtk/migrating-gnomeuiinfo.html#gnomeuiinfo-icons

The two examples take slightly different approaches.


-- 
muppet <scott at asofyet dot org>




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