Install ardour as a binary, a script and a set of shared
[ardour.git] / libs / gtkmm2 / gtk / gtkmm / iconset.cc
1 // Generated by gtkmmproc -- DO NOT MODIFY!
2
3 #include <gtkmm/iconset.h>
4 #include <gtkmm/private/iconset_p.h>
5
6 // -*- c++ -*-
7 /* $Id$ */
8
9 /*
10  *
11  * Copyright 1998-2002 The gtkmm Development Team
12  *
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.
17  *
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.
22  *
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.
26  */
27
28 #include <gtkmm/widget.h>
29 #include <gtkmm/style.h>
30 #include <gtk/gtkiconfactory.h>
31
32 namespace Gtk
33 {
34
35 IconSet::IconSet(const Glib::RefPtr<Gdk::Pixbuf>& pixbuf)
36 {
37   gobject_ = gtk_icon_set_new_from_pixbuf(pixbuf->gobj());
38 }
39
40 Glib::ArrayHandle<IconSize> IconSet::get_sizes() const
41 {
42   GtkIconSize* pSizes = 0;
43   int n_sizes = 0;
44   gtk_icon_set_get_sizes(const_cast<GtkIconSet*>(gobj()), &pSizes, &n_sizes);
45
46   return Glib::ArrayHandle<IconSize>((IconSize*) pSizes, n_sizes, Glib::OWNERSHIP_SHALLOW);
47 }
48
49 IconSet IconSet::lookup_default(const Gtk::StockID& stock_id) //static
50 {
51   GtkIconSet* pIconSet = gtk_icon_factory_lookup_default(stock_id.get_string().c_str());
52   return IconSet(pIconSet, true); //true = take_copy.
53 }
54
55 } /* namespace Gtk */
56
57
58 namespace
59 {
60 } // anonymous namespace
61
62
63 namespace Glib
64 {
65
66 Gtk::IconSet wrap(GtkIconSet* object, bool take_copy)
67 {
68   return Gtk::IconSet(object, take_copy);
69 }
70
71 } // namespace Glib
72
73
74 namespace Gtk
75 {
76
77
78 // static
79 GType IconSet::get_type()
80 {
81   return gtk_icon_set_get_type();
82 }
83
84 IconSet::IconSet()
85 :
86   gobject_ (gtk_icon_set_new())
87 {}
88
89 IconSet::IconSet(const IconSet& other)
90 :
91   gobject_ ((other.gobject_) ? gtk_icon_set_ref(other.gobject_) : 0)
92 {}
93
94 IconSet::IconSet(GtkIconSet* gobject, bool make_a_copy)
95 :
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)
100 {}
101
102 IconSet& IconSet::operator=(const IconSet& other)
103 {
104   IconSet temp (other);
105   swap(temp);
106   return *this;
107 }
108
109 IconSet::~IconSet()
110 {
111   if(gobject_)
112     gtk_icon_set_unref(gobject_);
113 }
114
115 void IconSet::swap(IconSet& other)
116 {
117   GtkIconSet *const temp = gobject_;
118   gobject_ = other.gobject_;
119   other.gobject_ = temp;
120 }
121
122 GtkIconSet* IconSet::gobj_copy() const
123 {
124   return gtk_icon_set_ref(gobject_);
125 }
126
127
128 IconSet IconSet::copy() const
129 {
130   return Glib::wrap(gtk_icon_set_copy(const_cast<GtkIconSet*>(gobj())));
131 }
132
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)
134 {
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()));
136 }
137
138 void IconSet::add_source(const IconSource& source)
139 {
140   gtk_icon_set_add_source(gobj(), (source).gobj());
141 }
142
143
144 } // namespace Gtk
145
146