1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201
|
// Generated by gtkmmproc -- DO NOT MODIFY!
#include <gtkmm/iconinfo.h>
#include <gtkmm/private/iconinfo_p.h>
/* Copyright 2003 The gtkmm Development Team
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <gtk/gtk.h>
#include <gtkmm/icontheme.h>
namespace Gtk
{
IconInfo::IconInfo(const Glib::RefPtr<IconTheme>& icon_theme, const Glib::RefPtr<Gdk::Pixbuf>& pixbuf)
: gobject_( gtk_icon_info_new_for_pixbuf(Glib::unwrap(icon_theme), pixbuf->gobj()) )
{
}
bool IconInfo::get_attach_points(Glib::ArrayHandle<Gdk::Point>& /* points */) const
{
GdkPoint* c_attach_points = 0;
gint n_points = 0;
bool result = gtk_icon_info_get_attach_points (const_cast<GtkIconInfo*>(gobj()), &c_attach_points, &n_points);
if(c_attach_points)
{
//TODO: We can't use = with an ArrayHandle.
//Investigate whether the bool return value has a special meaning - maybe we can just return an empty ArrayHandle.
//points = Glib::ArrayHandle<Gdk::Point>(reinterpret_cast<Gdk::Point*>(c_attach_points), (size_t)n_points, Glib::OWNERSHIP_SHALLOW); //We use OWNERSHIP_SHALLOW because we just need to g_free() the array and nothing more.
}
return result;
}
#ifndef GTKMM_DISABLE_DEPRECATED
IconInfo::operator bool()
{
return gobj() != 0;
}
#endif // GTKMM_DISABLE_DEPRECATED
IconInfo::operator bool() const
{
return gobj() != 0;
}
} // namespace Gtk
namespace
{
} // anonymous namespace
namespace Glib
{
Gtk::IconInfo wrap(GtkIconInfo* object, bool take_copy)
{
return Gtk::IconInfo(object, take_copy);
}
} // namespace Glib
namespace Gtk
{
// static
GType IconInfo::get_type()
{
return gtk_icon_info_get_type();
}
IconInfo::IconInfo()
:
gobject_ (0) // Allows creation of invalid wrapper, e.g. for output arguments to methods.
{}
IconInfo::IconInfo(const IconInfo& other)
:
gobject_ ((other.gobject_) ? gtk_icon_info_copy(other.gobject_) : 0)
{}
IconInfo::IconInfo(GtkIconInfo* gobject, bool make_a_copy)
:
// For BoxedType wrappers, make_a_copy is true by default. The static
// BoxedType wrappers must always take a copy, thus make_a_copy = true
// ensures identical behaviour if the default argument is used.
gobject_ ((make_a_copy && gobject) ? gtk_icon_info_copy(gobject) : gobject)
{}
IconInfo& IconInfo::operator=(const IconInfo& other)
{
IconInfo temp (other);
swap(temp);
return *this;
}
IconInfo::~IconInfo()
{
if(gobject_)
gtk_icon_info_free(gobject_);
}
void IconInfo::swap(IconInfo& other)
{
GtkIconInfo *const temp = gobject_;
gobject_ = other.gobject_;
other.gobject_ = temp;
}
GtkIconInfo* IconInfo::gobj_copy() const
{
return gtk_icon_info_copy(gobject_);
}
int IconInfo::get_base_size() const
{
return gtk_icon_info_get_base_size(const_cast<GtkIconInfo*>(gobj()));
}
Glib::ustring IconInfo::get_filename() const
{
return Glib::convert_const_gchar_ptr_to_ustring(gtk_icon_info_get_filename(const_cast<GtkIconInfo*>(gobj())));
}
Glib::RefPtr<Gdk::Pixbuf> IconInfo::get_builtin_pixbuf()
{
Glib::RefPtr<Gdk::Pixbuf> retvalue = Glib::wrap(gtk_icon_info_get_builtin_pixbuf(gobj()));
if(retvalue)
retvalue->reference(); //The function does not do a ref for us.
return retvalue;
}
Glib::RefPtr<const Gdk::Pixbuf> IconInfo::get_builtin_pixbuf() const
{
return const_cast<IconInfo*>(this)->get_builtin_pixbuf();
}
#ifdef GLIBMM_EXCEPTIONS_ENABLED
Glib::RefPtr<Gdk::Pixbuf> IconInfo::load_icon() const
#else
Glib::RefPtr<Gdk::Pixbuf> IconInfo::load_icon(std::auto_ptr<Glib::Error>& error) const
#endif //GLIBMM_EXCEPTIONS_ENABLED
{
GError* gerror = 0;
Glib::RefPtr<Gdk::Pixbuf> retvalue = Glib::wrap(gtk_icon_info_load_icon(const_cast<GtkIconInfo*>(gobj()), &(gerror)));
#ifdef GLIBMM_EXCEPTIONS_ENABLED
if(gerror)
::Glib::Error::throw_exception(gerror);
#else
if(gerror)
error = ::Glib::Error::throw_exception(gerror);
#endif //GLIBMM_EXCEPTIONS_ENABLED
return retvalue;
}
void IconInfo::set_raw_coordinates(bool raw_coordinates)
{
gtk_icon_info_set_raw_coordinates(gobj(), static_cast<int>(raw_coordinates));
}
bool IconInfo::get_embedded_rect(Gdk::Rectangle& rectangle) const
{
return gtk_icon_info_get_embedded_rect(const_cast<GtkIconInfo*>(gobj()), (rectangle).gobj());
}
Glib::ustring IconInfo::get_display_name() const
{
return Glib::convert_const_gchar_ptr_to_ustring(gtk_icon_info_get_display_name(const_cast<GtkIconInfo*>(gobj())));
}
} // namespace Gtk
|