13
0
livetrax/libs/gtkmm2/gtk/gtkmm/iconinfo.cc

187 lines
4.6 KiB
C++
Raw Normal View History

// 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 Library General Public
* License as published by the Free Software Foundation; either
* version 2 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library 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/gtkicontheme.h>
namespace Gtk
{
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;
}
IconInfo::operator bool()
{
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