Re: How to change toolbar icon size?



On Thursday 23 December 2004 09:12, Andrew E. Makeev wrote:
> Hi,
>
> What is alternative for deprecated Gtk::Toolbar->set_icon_size() method
> if I would to change toolbar icons at runtime?

I normally size the image or other object that I am loading into the 
Gtk::Toolbutton object.  If you are using stock icons you would do something 
like:

Gtk::Image* image = manage(new Gtk::Image(Gtk::Stock::CLEAR,
                           Gtk::ICON_SIZE_SMALL_TOOLBAR));
manage(new Gtk::ToolButton(*image));

You can register your own icon size with:
// a 22x22 pixel size
Gtk::IconSize::register_new("MY_BUTTON_SIZE", 22, 22);
Gtk::Image* image = manage(new Gtk::Image(Gtk::Stock::CLEAR,
                           Gtk::IconSize::from_name("MY_BUTTON_SIZE")));

If you are loading Gdk::Pixbufs into the image, look at its scale(), 
scale_simple() and similar methods.

Chris



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