13
0
livetrax/libs/tk/ytkmm/iconinfo.cc
Robin Gareus ad51c7c2ba
Localize stripped down gtk2
This is intended mainly for GNU/Linux distros who will remove
GTK2 support in the near future.
2024-01-06 21:52:48 +01:00

191 lines
4.7 KiB
C++

// Generated by gmmproc 2.45.3 -- DO NOT MODIFY!
#include <glibmm.h>
#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 <gtkmm/icontheme.h>
#include <gtk/gtk.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();
}
Glib::RefPtr<Gdk::Pixbuf> IconInfo::load_icon() const
{
GError* gerror = 0;
Glib::RefPtr<Gdk::Pixbuf> retvalue = Glib::wrap(gtk_icon_info_load_icon(const_cast<GtkIconInfo*>(gobj()), &(gerror)));
if(gerror)
::Glib::Error::throw_exception(gerror);
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