Re: Custom Toolbar/Menubar items with the UIManager



This is also shown in examples/book/menus_and_toolbars/examplewindow.cc

I don't like it much.

On Fri, 2005-03-18 at 16:51 -0500, Andrew Krause wrote:
> Well, it looks like as soon as I ask the question, I've solved it. If 
> anyone is interested in how I made new stock items, here is the code. 
> Maybe this will make this information more available to others.
> 
> void openldev::create_icon_factory()
> {
>   Glib::RefPtr<Gtk::IconFactory> icon_factory = Gtk::IconFactory::create();
>   // Add new stock menu items
>   add_new_stock_item(icon_factory, "Compile", "COMPILE", 
> "/usr/share/pixmaps/openldev/compile_sm.png");
>   // Add items to default
>   icon_factory->add_default();
> }
> 
> // Create new stock menu item
> void add_new_stock_item(Glib::RefPtr<Gtk::IconFactory> icon_factory, 
> Glib::ustring name, Glib::ustring id, Glib::ustring filename)
> {
>   Gtk::IconSource icon_source;
>   Gtk::IconSet compile_icon;
>   const Gtk::StockID stock_id(id);
>   icon_source.set_icon_name(name);
>   icon_source.set_filename(filename);
>   compile_icon.add_source(icon_source);
>   icon_factory->add(stock_id, compile_icon);
>   Gtk::Stock::add(Gtk::StockItem(stock_id, name));
> }
> 
> - Andrew Krause
> _______________________________________________
> gtkmm-list mailing list
> gtkmm-list gnome org
> http://mail.gnome.org/mailman/listinfo/gtkmm-list
-- 
Murray Cumming
murrayc murrayc com
www.murrayc.com
www.openismus.com




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