1 // Generated by gtkmmproc -- DO NOT MODIFY!
3 #include <gtkmm/iconset.h>
4 #include <gtkmm/private/iconset_p.h>
11 * Copyright 1998-2002 The gtkmm Development Team
13 * This library is free software; you can redistribute it and/or
14 * modify it under the terms of the GNU Library General Public
15 * License as published by the Free Software Foundation; either
16 * version 2 of the License, or (at your option) any later version.
18 * This library is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
21 * Library General Public License for more details.
23 * You should have received a copy of the GNU Library General Public
24 * License along with this library; if not, write to the Free
25 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
28 #include <gtkmm/widget.h>
29 #include <gtkmm/style.h>
30 #include <gtk/gtkiconfactory.h>
35 IconSet::IconSet(const Glib::RefPtr<Gdk::Pixbuf>& pixbuf)
37 gobject_ = gtk_icon_set_new_from_pixbuf(pixbuf->gobj());
40 Glib::ArrayHandle<IconSize> IconSet::get_sizes() const
42 GtkIconSize* pSizes = 0;
44 gtk_icon_set_get_sizes(const_cast<GtkIconSet*>(gobj()), &pSizes, &n_sizes);
46 return Glib::ArrayHandle<IconSize>((IconSize*) pSizes, n_sizes, Glib::OWNERSHIP_SHALLOW);
49 IconSet IconSet::lookup_default(const Gtk::StockID& stock_id) //static
51 GtkIconSet* pIconSet = gtk_icon_factory_lookup_default(stock_id.get_string().c_str());
52 return IconSet(pIconSet, true); //true = take_copy.
60 } // anonymous namespace
66 Gtk::IconSet wrap(GtkIconSet* object, bool take_copy)
68 return Gtk::IconSet(object, take_copy);
79 GType IconSet::get_type()
81 return gtk_icon_set_get_type();
86 gobject_ (gtk_icon_set_new())
89 IconSet::IconSet(const IconSet& other)
91 gobject_ ((other.gobject_) ? gtk_icon_set_ref(other.gobject_) : 0)
94 IconSet::IconSet(GtkIconSet* gobject, bool make_a_copy)
96 // For BoxedType wrappers, make_a_copy is true by default. The static
97 // BoxedType wrappers must always take a copy, thus make_a_copy = true
98 // ensures identical behaviour if the default argument is used.
99 gobject_ ((make_a_copy && gobject) ? gtk_icon_set_ref(gobject) : gobject)
102 IconSet& IconSet::operator=(const IconSet& other)
104 IconSet temp (other);
112 gtk_icon_set_unref(gobject_);
115 void IconSet::swap(IconSet& other)
117 GtkIconSet *const temp = gobject_;
118 gobject_ = other.gobject_;
119 other.gobject_ = temp;
122 GtkIconSet* IconSet::gobj_copy() const
124 return gtk_icon_set_ref(gobject_);
128 IconSet IconSet::copy() const
130 return Glib::wrap(gtk_icon_set_copy(const_cast<GtkIconSet*>(gobj())));
133 Glib::RefPtr<Gdk::Pixbuf> IconSet::render_icon(const Glib::RefPtr<Style>& style, TextDirection direction, Gtk::StateType state, IconSize size, Widget& widget, const Glib::ustring& detail)
135 return Glib::wrap(gtk_icon_set_render_icon(gobj(), Glib::unwrap(style), ((GtkTextDirection)(direction)), ((GtkStateType)(state)), static_cast<GtkIconSize>(int(size)), (widget).gobj(), detail.c_str()));
138 void IconSet::add_source(const IconSource& source)
140 gtk_icon_set_add_source(gobj(), (source).gobj());