1 // Generated by gmmproc 2.45.3 -- DO NOT MODIFY!
2 
3 
4 #include <glibmm.h>
5 
6 #include <gtkmm/iconset.h>
7 #include <gtkmm/private/iconset_p.h>
8 
9 
10 // -*- c++ -*-
11 /* $Id: iconset.ccg,v 1.1 2003/01/21 13:40:26 murrayc Exp $ */
12 
13 /*
14  *
15  * Copyright 1998-2002 The gtkmm Development Team
16  *
17  * This library is free software; you can redistribute it and/or
18  * modify it under the terms of the GNU Lesser General Public
19  * License as published by the Free Software Foundation; either
20  * version 2.1 of the License, or (at your option) any later version.
21  *
22  * This library is distributed in the hope that it will be useful,
23  * but WITHOUT ANY WARRANTY; without even the implied warranty of
24  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
25  * Lesser General Public License for more details.
26  *
27  * You should have received a copy of the GNU Lesser General Public
28  * License along with this library; if not, write to the Free
29  * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
30  */
31 
32 #include <gtkmm/widget.h>
33 #include <gtkmm/style.h>
34 #include <gtk/gtk.h>
35 
36 namespace Gtk
37 {
38 
IconSet(const Glib::RefPtr<Gdk::Pixbuf> & pixbuf)39 IconSet::IconSet(const Glib::RefPtr<Gdk::Pixbuf>& pixbuf)
40 {
41   gobject_ = gtk_icon_set_new_from_pixbuf(Glib::unwrap(pixbuf));
42 }
43 
get_sizes() const44 Glib::ArrayHandle<IconSize> IconSet::get_sizes() const
45 {
46   GtkIconSize* pSizes = 0;
47   int n_sizes = 0;
48   gtk_icon_set_get_sizes(const_cast<GtkIconSet*>(gobj()), &pSizes, &n_sizes);
49 
50   return Glib::ArrayHandle<IconSize>((IconSize*) pSizes, n_sizes, Glib::OWNERSHIP_SHALLOW);
51 }
52 
lookup_default(const Gtk::StockID & stock_id)53 IconSet IconSet::lookup_default(const Gtk::StockID& stock_id) //static
54 {
55   GtkIconSet* pIconSet = gtk_icon_factory_lookup_default(stock_id.get_string().c_str());
56   return IconSet(pIconSet, true); //true = take_copy.
57 }
58 
59 } /* namespace Gtk */
60 
61 
62 namespace
63 {
64 } // anonymous namespace
65 
66 
67 namespace Glib
68 {
69 
wrap(GtkIconSet * object,bool take_copy)70 Gtk::IconSet wrap(GtkIconSet* object, bool take_copy)
71 {
72   return Gtk::IconSet(object, take_copy);
73 }
74 
75 } // namespace Glib
76 
77 
78 namespace Gtk
79 {
80 
81 
82 // static
get_type()83 GType IconSet::get_type()
84 {
85   return gtk_icon_set_get_type();
86 }
87 
IconSet()88 IconSet::IconSet()
89 :
90   gobject_ (gtk_icon_set_new())
91 {}
92 
IconSet(const IconSet & other)93 IconSet::IconSet(const IconSet& other)
94 :
95   gobject_ ((other.gobject_) ? gtk_icon_set_ref(other.gobject_) : 0)
96 {}
97 
IconSet(GtkIconSet * gobject,bool make_a_copy)98 IconSet::IconSet(GtkIconSet* gobject, bool make_a_copy)
99 :
100   // For BoxedType wrappers, make_a_copy is true by default.  The static
101   // BoxedType wrappers must always take a copy, thus make_a_copy = true
102   // ensures identical behaviour if the default argument is used.
103   gobject_ ((make_a_copy && gobject) ? gtk_icon_set_ref(gobject) : gobject)
104 {}
105 
operator =(const IconSet & other)106 IconSet& IconSet::operator=(const IconSet& other)
107 {
108   IconSet temp (other);
109   swap(temp);
110   return *this;
111 }
112 
~IconSet()113 IconSet::~IconSet()
114 {
115   if(gobject_)
116     gtk_icon_set_unref(gobject_);
117 }
118 
swap(IconSet & other)119 void IconSet::swap(IconSet& other)
120 {
121   GtkIconSet *const temp = gobject_;
122   gobject_ = other.gobject_;
123   other.gobject_ = temp;
124 }
125 
gobj_copy() const126 GtkIconSet* IconSet::gobj_copy() const
127 {
128   return gtk_icon_set_ref(gobject_);
129 }
130 
131 
copy() const132 IconSet IconSet::copy() const
133 {
134   return Glib::wrap(gtk_icon_set_copy(const_cast<GtkIconSet*>(gobj())));
135 }
136 
render_icon(const Glib::RefPtr<Style> & style,TextDirection direction,Gtk::StateType state,IconSize size,Widget & widget,const Glib::ustring & detail)137 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)
138 {
139   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()));
140 }
141 
add_source(const IconSource & source)142 void IconSet::add_source(const IconSource& source)
143 {
144   gtk_icon_set_add_source(gobj(), (source).gobj());
145 }
146 
147 
148 } // namespace Gtk
149 
150 
151