1
// Generated by gtkmmproc -- DO NOT MODIFY!
3
#include <gtkmm/icontheme.h>
4
#include <gtkmm/private/icontheme_p.h>
6
/* Copyright 2003 The gtkmm Development Team
8
* This library is free software; you can redistribute it and/or
9
* modify it under the terms of the GNU Library General Public
10
* License as published by the Free Software Foundation; either
11
* version 2 of the License, or (at your option) any later version.
13
* This library is distributed in the hope that it will be useful,
14
* but WITHOUT ANY WARRANTY; without even the implied warranty of
15
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16
* Library General Public License for more details.
18
* You should have received a copy of the GNU Library General Public
19
* License along with this library; if not, write to the Free
20
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
23
#include <gtk/gtkicontheme.h>
24
#include <gtk/gtktypebuiltins.h> //For gtk_icon_theme_error_get_type().
30
void IconTheme::set_search_path(const Glib::ArrayHandle<Glib::ustring>& path)
32
gtk_icon_theme_set_search_path(gobj(), const_cast<const char**>(path.data()), path.size());
35
Glib::ArrayHandle<Glib::ustring> IconTheme::get_search_path() const
38
gchar*** temp_path = 0;
39
gtk_icon_theme_get_search_path(const_cast<GtkIconTheme*>(gobj()), temp_path, temp_int);
40
return Glib::ArrayHandle<Glib::ustring>((const char**)(*temp_path), *temp_int, Glib::OWNERSHIP_SHALLOW);
43
Glib::ArrayHandle<int> IconTheme::get_icon_sizes(const Glib::ustring& icon_name) const
45
int* pArrayInts = gtk_icon_theme_get_icon_sizes(const_cast<GtkIconTheme*>(gobj()), icon_name.c_str());
47
//pArrayInts is null-terminated.
48
return Glib::ArrayHandle<int>(pArrayInts, Glib::OWNERSHIP_SHALLOW); //TODO: I'm not sure about the ownership. murrayc.
58
const Glib::SignalProxyInfo IconTheme_signal_changed_info =
61
(GCallback) &Glib::SignalProxyNormal::slot0_void_callback,
62
(GCallback) &Glib::SignalProxyNormal::slot0_void_callback
65
} // anonymous namespace
68
Gtk::IconThemeError::IconThemeError(Gtk::IconThemeError::Code error_code, const Glib::ustring& error_message)
70
Glib::Error (GTK_ICON_THEME_ERROR, error_code, error_message)
73
Gtk::IconThemeError::IconThemeError(GError* gobject)
78
Gtk::IconThemeError::Code Gtk::IconThemeError::code() const
80
return static_cast<Code>(Glib::Error::code());
83
void Gtk::IconThemeError::throw_func(GError* gobject)
85
throw Gtk::IconThemeError(gobject);
89
GType Glib::Value<Gtk::IconThemeError::Code>::value_type()
91
return gtk_icon_theme_error_get_type();
98
Glib::RefPtr<Gtk::IconTheme> wrap(GtkIconTheme* object, bool take_copy)
100
return Glib::RefPtr<Gtk::IconTheme>( dynamic_cast<Gtk::IconTheme*> (Glib::wrap_auto ((GObject*)(object), take_copy)) );
101
//We use dynamic_cast<> in case of multiple inheritance.
104
} /* namespace Glib */
111
/* The *_Class implementation: */
113
const Glib::Class& IconTheme_Class::init()
115
if(!gtype_) // create the GType if necessary
117
// Glib::Class has to know the class init function to clone custom types.
118
class_init_func_ = &IconTheme_Class::class_init_function;
120
// This is actually just optimized away, apparently with no harm.
121
// Make sure that the parent type has been created.
122
//CppClassParent::CppObjectType::get_type();
124
// Create the wrapper type, with the same class/instance size as the base type.
125
register_derived_type(gtk_icon_theme_get_type());
127
// Add derived versions of interfaces, if the C type implements any interfaces:
133
void IconTheme_Class::class_init_function(void* g_class, void* class_data)
135
BaseClassType *const klass = static_cast<BaseClassType*>(g_class);
136
CppClassParent::class_init_function(klass, class_data);
138
klass->changed = &changed_callback;
142
void IconTheme_Class::changed_callback(GtkIconTheme* self)
144
CppObjectType *const obj = dynamic_cast<CppObjectType*>(
145
Glib::ObjectBase::_get_current_wrapper((GObject*)self));
147
// Non-gtkmmproc-generated custom classes implicitly call the default
148
// Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
149
// generated classes can use this optimisation, which avoids the unnecessary
150
// parameter conversions if there is no possibility of the virtual function
152
if(obj && obj->is_derived_())
154
try // Trap C++ exceptions which would normally be lost because this is a C callback.
156
// Call the virtual member method, which derived classes might override.
161
Glib::exception_handlers_invoke();
166
BaseClassType *const base = static_cast<BaseClassType*>(
167
g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class).
170
// Call the original underlying C function:
171
if(base && base->changed)
172
(*base->changed)(self);
177
Glib::ObjectBase* IconTheme_Class::wrap_new(GObject* object)
179
return new IconTheme((GtkIconTheme*)object);
183
/* The implementation: */
185
GtkIconTheme* IconTheme::gobj_copy()
191
IconTheme::IconTheme(const Glib::ConstructParams& construct_params)
193
Glib::Object(construct_params)
196
IconTheme::IconTheme(GtkIconTheme* castitem)
198
Glib::Object((GObject*)(castitem))
201
IconTheme::~IconTheme()
205
IconTheme::CppClassType IconTheme::icontheme_class_; // initialize static member
207
GType IconTheme::get_type()
209
return icontheme_class_.init().get_type();
212
GType IconTheme::get_base_type()
214
return gtk_icon_theme_get_type();
218
IconTheme::IconTheme()
220
Glib::ObjectBase(0), //Mark this class as gtkmmproc-generated, rather than a custom class, to allow vfunc optimisations.
221
Glib::Object(Glib::ConstructParams(icontheme_class_.init()))
225
Glib::RefPtr<IconTheme> IconTheme::create()
227
return Glib::RefPtr<IconTheme>( new IconTheme() );
229
Glib::RefPtr<IconTheme> IconTheme::get_default()
232
Glib::RefPtr<IconTheme> retvalue = Glib::wrap(gtk_icon_theme_get_default());
235
retvalue->reference(); //The function does not do a ref for us.
239
Glib::RefPtr<IconTheme> IconTheme::get_for_screen(const Glib::RefPtr<Gdk::Screen>& screen)
242
Glib::RefPtr<IconTheme> retvalue = Glib::wrap(gtk_icon_theme_get_for_screen(Glib::unwrap(screen)));
245
retvalue->reference(); //The function does not do a ref for us.
249
void IconTheme::set_screen(const Glib::RefPtr<Gdk::Screen>& screen)
251
gtk_icon_theme_set_screen(gobj(), Glib::unwrap(screen));
254
void IconTheme::append_search_path(const Glib::ustring& path)
256
gtk_icon_theme_append_search_path(gobj(), path.c_str());
259
void IconTheme::prepend_search_path(const Glib::ustring& path)
261
gtk_icon_theme_prepend_search_path(gobj(), path.c_str());
264
void IconTheme::set_custom_theme(const Glib::ustring& theme_name)
266
gtk_icon_theme_set_custom_theme(gobj(), theme_name.c_str());
269
bool IconTheme::has_icon(const Glib::ustring& icon_name) const
271
return gtk_icon_theme_has_icon(const_cast<GtkIconTheme*>(gobj()), icon_name.c_str());
274
IconInfo IconTheme::lookup_icon(const Glib::ustring& icon_name, int size, IconLookupFlags flags) const
276
return Glib::wrap(gtk_icon_theme_lookup_icon(const_cast<GtkIconTheme*>(gobj()), icon_name.c_str(), size, ((GtkIconLookupFlags)(flags))));
279
Glib::RefPtr<Gdk::Pixbuf> IconTheme::load_icon(const Glib::ustring& icon_name, int size, IconLookupFlags flags) const
282
Glib::RefPtr<Gdk::Pixbuf> retvalue = Glib::wrap(gtk_icon_theme_load_icon(const_cast<GtkIconTheme*>(gobj()), icon_name.c_str(), size, ((GtkIconLookupFlags)(flags)), &(error)));
283
if(error) ::Glib::Error::throw_exception(error);
287
Glib::ListHandle<Glib::ustring> IconTheme::list_icons(const Glib::ustring& context) const
289
return Glib::ListHandle<Glib::ustring>(gtk_icon_theme_list_icons(const_cast<GtkIconTheme*>(gobj()), context.c_str()), Glib::OWNERSHIP_SHALLOW);
292
Glib::ustring IconTheme::get_example_icon_name() const
294
return Glib::convert_return_gchar_ptr_to_ustring(gtk_icon_theme_get_example_icon_name(const_cast<GtkIconTheme*>(gobj())));
297
bool IconTheme::rescan_if_needed()
299
return gtk_icon_theme_rescan_if_needed(gobj());
302
void IconTheme::add_builtin_icon(const Glib::ustring& icon_name, int size, const Glib::RefPtr<Gdk::Pixbuf>& pixbuf)
304
gtk_icon_theme_add_builtin_icon(icon_name.c_str(), size, Glib::unwrap(pixbuf));
308
Glib::SignalProxy0< void > IconTheme::signal_changed()
310
return Glib::SignalProxy0< void >(this, &IconTheme_signal_changed_info);
314
void Gtk::IconTheme::on_changed()
316
BaseClassType *const base = static_cast<BaseClassType*>(
317
g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class).
320
if(base && base->changed)
321
(*base->changed)(gobj());