Re: Custom Toolbar/Menubar items with the UIManager
- From: Andrew Krause <ajk265 psu edu>
- To: gtkmm-list gnome org
- Subject: Re: Custom Toolbar/Menubar items with the UIManager
- Date: Fri, 18 Mar 2005 16:51:46 -0500
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
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]