/* Copyright (C) 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, see . */ #include #include #include //TODO: Install and use this? #include namespace { //This is just to satisfy our generated code, which cannot //handle just using g_object_ref() because it needs a cast. static GtkIconInfo* gtk_icon_info_ref(GtkIconInfo* icon_info) { g_object_ref (G_OBJECT(icon_info)); return icon_info; } //TODO: Install and use giomm's slot_async.h if we use this more often: static void SignalProxy_async_callback(GObject*, GAsyncResult* res, void* data) { auto the_slot = static_cast(data); try { auto result = Glib::wrap(res, true /* take copy */); (*the_slot)(result); } catch(...) { Glib::exception_handlers_invoke(); } delete the_slot; } } namespace Gtk { IconInfo::IconInfo(const Glib::RefPtr& icon_theme, const Glib::RefPtr& pixbuf) : gobject_( gtk_icon_info_new_for_pixbuf(Glib::unwrap(icon_theme), pixbuf->gobj()) ) { } _DEPRECATE_IFDEF_START G_GNUC_BEGIN_IGNORE_DEPRECATIONS std::vector IconInfo::get_attach_points() const { GdkPoint* c_attach_points = nullptr; gint n_points = 0; gtk_icon_info_get_attach_points (const_cast(gobj()), &c_attach_points, &n_points); if (c_attach_points) { return Glib::ArrayHandler::array_to_vector(c_attach_points, n_points, Glib::OWNERSHIP_DEEP); } return std::vector (); } G_GNUC_END_IGNORE_DEPRECATIONS _DEPRECATE_IFDEF_END _DEPRECATE_IFDEF_START IconInfo::operator const void*() const { return gobj() ? GINT_TO_POINTER(1) : nullptr; } _DEPRECATE_IFDEF_END IconInfo::operator bool() const { return gobj(); } Glib::RefPtr IconInfo::load_symbolic(const Gdk::RGBA& fg, const Gdk::RGBA& success_color, const Gdk::RGBA& warning_color, const Gdk::RGBA& error_color, bool& was_symbolic) const { GError* gerror = nullptr; gboolean c_was_symbolic = false; auto retvalue = Glib::wrap(gtk_icon_info_load_symbolic(const_cast(gobj()), const_cast(fg.gobj()), const_cast(success_color.gobj()), const_cast(warning_color.gobj()), const_cast(error_color.gobj()), &c_was_symbolic, &(gerror))); was_symbolic = c_was_symbolic; if(gerror) ::Glib::Error::throw_exception(gerror); return retvalue; } Glib::RefPtr IconInfo::load_symbolic(const Glib::RefPtr& style, bool& was_symbolic) { GError* gerror = nullptr; gboolean c_was_symbolic = false; auto retvalue = Glib::wrap(gtk_icon_info_load_symbolic_for_context(gobj(), Glib::unwrap(style), &c_was_symbolic, &(gerror))); was_symbolic = c_was_symbolic; if(gerror) ::Glib::Error::throw_exception(gerror); return retvalue; } /* deprecated Glib::RefPtr IconInfo::load_symbolic(const Glib::RefPtr