예제 #1
0
Ganash::ApplicationWindow::ApplicationWindow() :
  Gtk::ApplicationWindow()
{
  set_title("New Document - Ganash");
  set_default_size(200, 200);

  Glib::RefPtr<Ganash::Ui::IconFactory> iconFactory = Ganash::Ui::IconFactory::create();
  iconFactory->add_default();


  add(*setupUi());
}
예제 #2
0
/** \brief Registrate stock icons for this program. */
void
IconLoader::register_stock_items()
{
	Glib::RefPtr<Gtk::IconFactory> factory = Gtk::IconFactory::create();

	int i = 0;
	while (icons[i].file) {
		Gtk::IconSource source;

		try {
			// This throws an exception if the file is not found:
			source.set_pixbuf(Gdk::Pixbuf::create_from_file(icons[i].file));
		}
		catch (const Glib::Exception& ex) {
			std::cout << ex.what() << std::endl;
		}

		source.set_size(Gtk::ICON_SIZE_SMALL_TOOLBAR);
		// Icon may be scaled.
		source.set_size_wildcarded();

		Gtk::IconSet icon_set;
		// More than one source per set is allowed.
		icon_set.add_source(source);

		const Gtk::StockID stock_id(icons[i].id);
		factory->add( stock_id, icon_set);
		Gtk::Stock::add(Gtk::StockItem( stock_id, gettext(icons[i].label)));
		++i;
	}

	// Add factory to list of factories:
	factory->add_default();

	// register 64x64 pixels icon size
	Gtk::IconSize::register_new( icon_size_64x64, 64, 64);
}