Re: [gtkmm] adding icons to buttons in gtkmm



1. Gtk::Dialog objects have an add_button convenience method, like so:
add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL);
which will call your on_response method you've overridden with
Gtk::RESPONSE_CANCEL as the response_id.

2. You can construct it with a Stock one, like so:
Gtk::Button * button = new Button(Gtk::Stock::OK);
That will get the Stock text too for the current locale.

3. If you just want to 'steal' a stock the graphic, do something like:
button.add( * manage( new Gtk::Image(Gtk::Stock::OK, Gtk::ICON_SIZE_MENU) ) );

HTH,

Barnaby

On Fri, Mar 05, 2004 at 08:57:00AM -0600, Tim Flechtner wrote:
> thank you andreas.  this definitely shows me how to add my.xpm  (or 
> your.xpm) to a button, but i'm still confused about how to add a stock 
> icon to a button.  thanks for your response!
> 
> -tim
> 
> Andreas B. Thun wrote:
> >>i am having the hardest time figuring out how to add an icon to a 
> >>button in gtkmm.  i know it can be done, because i can set it up that 
> >>way in glade, and instantiate it from libglademm.
> >
> >
> >Hi Tim,
> >
> >I have implemented some buttons with small bitmaps inside
> >like:
> >
> >Gtk::Button m_ButtonAll;
> >m_ButtonAll.add_pixlabel("your.xpm", "Label");
> >
> 
> 
> _______________________________________________
> 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]