Re: How to change toolbar icon size?



Diana Esch-Mosher wrote:

Welll, this doesn't really help you if you are using the new UIManager. You are stuck trying to use the create_icon(iconsize) method. But, I could never quite figure out how to use this method . As an example I have
       "  <toolbar  name='ToolBar'>"
       "    <toolitem action='ZoomIn'/>"
       "     <toolitem action='ZoomOut'/>"
       "  </toolbar>"

and
refActionGroup->add(Gtk::Action::create("ZoomIn", Stock::ZOOM_IN, "", "Zoom In"), sigc::bind(sigc::mem_fun (*this, &TopLevel::onToolbarZoomItem), ZOOM_IN));

What do I have to do to use the create_icon(iconsize) method? Anyone? .... hence my back door method ...

Yes, I am following the way to create toolitem from Gtk::Action too (w/o UI manager). So, I guess, only "back door" could help me.

thanks, Diana
-andrew

Chris Vine wrote:

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.





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