AW: [gtkmm] My own image in toolbar



Hi,

the code I use is

#include myImage.xpm
// assuming toolbar is called toolbar1
// button with custom icon
  Glib::RefPtr<Gdk::Bitmap> _image1_mask;
  Glib::RefPtr<Gdk::Pixmap> _image1_pixmap = Gdk::Pixmap::create_from_xpm
    (get_default_colormap(), _image1_mask, myImage_xpm);
  Gtk::Image *image1 = manage(new class Gtk::Image(_image1_pixmap,
_image1_mask));
  toolbar1->tools().push_back
    (Gtk::Toolbar_Helpers::ButtonElem("Button Text",
				      *image1, // you can use a reference to
any widget here
				      SigC::slot
				      (*this,
				       &myClass::signalHandler),
				      "tooltip text") );
Cheers,
Elke

>
> Hi!
>
> I'd like to use my own icon in a Toolbar button.
> I faced the same problem for menu and had to use ImageMenuElem.
> But there is no ImageElem in the Gtk::Toolbar_Helpers.
> The only solution I see now is to add StockItem in Gtk::Stock
> but I don't know how to do.
>
> Thank you very much for any help
>
>
>
>
> _______________________________________________
> gtkmm-list mailing list
> gtkmm-list gnome org
> http://mail.gnome.org/mailman/listinfo/gtkmm-list
>



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