// Generated by gmmproc 2.51.2 -- 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., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 */

#include <glibmm/vectorutils.h>

#include <gtk/gtk.h>
#include <gtkmm/icontheme.h>
//TODO: Install and use this? #include <giomm/slot_async.h>

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<Gio::SlotAsyncReady*>(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<IconTheme>& icon_theme, const Glib::RefPtr<Gdk::Pixbuf>& pixbuf)
: gobject_( gtk_icon_info_new_for_pixbuf(Glib::unwrap(icon_theme), pixbuf->gobj()) )
{
}

IconInfo::operator bool() const
{
  return gobj();
}


Glib::RefPtr<Gdk::Pixbuf> 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)
{
  GError* gerror = nullptr;
  gboolean c_was_symbolic = false;
  auto retvalue = Glib::wrap(gtk_icon_info_load_symbolic(const_cast<GtkIconInfo*>(gobj()), const_cast<GdkRGBA*>(fg.gobj()), const_cast<GdkRGBA*>(success_color.gobj()), const_cast<GdkRGBA*>(warning_color.gobj()), const_cast<GdkRGBA*>(error_color.gobj()), &c_was_symbolic, &(gerror)));
  was_symbolic = c_was_symbolic;
  if(gerror)
    ::Glib::Error::throw_exception(gerror);

  return retvalue;
}

Glib::RefPtr<Gdk::Pixbuf> IconInfo::load_symbolic_for_context(const Glib::RefPtr<StyleContext>& context, 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(context), &c_was_symbolic, &(gerror)));
  was_symbolic = c_was_symbolic;
  if(gerror)
    ::Glib::Error::throw_exception(gerror);

  return retvalue;
}


void IconInfo::load_icon_async(const Gio::SlotAsyncReady& slot, const Glib::RefPtr<Gio::Cancellable>& cancellable)
{
  // Create a copy of the slot.
  // A pointer to it will be passed through the callback's data parameter
  // and deleted in the callback.
  auto slot_copy = new Gio::SlotAsyncReady(slot);

  gtk_icon_info_load_icon_async(gobj(),
    Glib::unwrap(cancellable),
    &SignalProxy_async_callback,
    slot_copy);
}

void IconInfo::load_icon_async(const Gio::SlotAsyncReady& slot)
{
  // Create a copy of the slot.
  // A pointer to it will be passed through the callback's data parameter
  // and deleted in the callback.
  auto slot_copy = new Gio::SlotAsyncReady(slot);

  gtk_icon_info_load_icon_async(gobj(),
    nullptr,
    &SignalProxy_async_callback,
    slot_copy);
}


void IconInfo::load_symbolic_async(const Gdk::RGBA& fg, const Gdk::RGBA& success_color, const Gdk::RGBA& warning_color, const Gdk::RGBA& error_color, const Gio::SlotAsyncReady& slot, const Glib::RefPtr<Gio::Cancellable>& cancellable)
{
  // Create a copy of the slot.
  // A pointer to it will be passed through the callback's data parameter
  // and deleted in the callback.
  auto slot_copy = new Gio::SlotAsyncReady(slot);

  gtk_icon_info_load_symbolic_async(gobj(),
    fg.gobj(),
    success_color.gobj(),
    warning_color.gobj(),
    error_color.gobj(),
    Glib::unwrap(cancellable),
    &SignalProxy_async_callback,
    slot_copy);
}

void IconInfo::load_symbolic_async(const Gdk::RGBA& fg, const Gdk::RGBA& success_color, const Gdk::RGBA& warning_color, const Gdk::RGBA& error_color, const Gio::SlotAsyncReady& slot)
{
  // Create a copy of the slot.
  // A pointer to it will be passed through the callback's data parameter
  // and deleted in the callback.
  auto slot_copy = new Gio::SlotAsyncReady(slot);

  gtk_icon_info_load_symbolic_async(gobj(),
    fg.gobj(),
    success_color.gobj(),
    warning_color.gobj(),
    error_color.gobj(),
    nullptr,
    &SignalProxy_async_callback,
    slot_copy);
}


void IconInfo::load_symbolic_for_context_async(const Glib::RefPtr<StyleContext>& context, const Gio::SlotAsyncReady& slot, const Glib::RefPtr<Gio::Cancellable>& cancellable)
{
  // Create a copy of the slot.
  // A pointer to it will be passed through the callback's data parameter
  // and deleted in the callback.
  auto slot_copy = new Gio::SlotAsyncReady(slot);

  gtk_icon_info_load_symbolic_for_context_async(gobj(),
    Glib::unwrap(context),
    Glib::unwrap(cancellable),
    &SignalProxy_async_callback,
    slot_copy);
}

void IconInfo::load_symbolic_for_context_async(const Glib::RefPtr<StyleContext>& context, const Gio::SlotAsyncReady& slot)
{
  // Create a copy of the slot.
  // A pointer to it will be passed through the callback's data parameter
  // and deleted in the callback.
  auto slot_copy = new Gio::SlotAsyncReady(slot);

  gtk_icon_info_load_symbolic_for_context_async(gobj(),
    Glib::unwrap(context),
    nullptr,
    &SignalProxy_async_callback,
    slot_copy);
}


} // 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_ (nullptr) // Allows creation of invalid wrapper, e.g. for output arguments to methods.
{}

IconInfo::IconInfo(const IconInfo& other)
:
  gobject_ ((other.gobject_) ? gtk_icon_info_ref(other.gobject_) : nullptr)
{}

IconInfo::IconInfo(IconInfo&& other) noexcept
:
  gobject_(other.gobject_)
{
  other.gobject_ = nullptr;
}

IconInfo& IconInfo::operator=(IconInfo&& other) noexcept
{
  IconInfo temp (other);
  swap(temp);
  return *this;
}

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_ref(gobject) : gobject)
{}

IconInfo& IconInfo::operator=(const IconInfo& other)
{
  IconInfo temp (other);
  swap(temp);
  return *this;
}

IconInfo::~IconInfo() noexcept
{
  if(gobject_)
    g_object_unref(gobject_);
}

void IconInfo::swap(IconInfo& other) noexcept
{
  std::swap(gobject_, other.gobject_);
}

GtkIconInfo* IconInfo::gobj_copy() const
{
  return gtk_icon_info_ref(gobject_);
}


int IconInfo::get_base_size() const
{
  return gtk_icon_info_get_base_size(const_cast<GtkIconInfo*>(gobj()));
}

int IconInfo::get_base_scale() const
{
  return gtk_icon_info_get_base_scale(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::load_icon()
{
  GError* gerror = nullptr;
  Glib::RefPtr<Gdk::Pixbuf> retvalue = Glib::wrap(gtk_icon_info_load_icon(gobj(), &(gerror)));
  if(gerror)
    ::Glib::Error::throw_exception(gerror);
  return retvalue;
}

::Cairo::RefPtr< ::Cairo::Surface> IconInfo::load_surface(const Glib::RefPtr<Gdk::Window>& for_window)
{
  GError* gerror = nullptr;
  ::Cairo::RefPtr< ::Cairo::Surface> retvalue = ::Cairo::make_refptr_for_instance< ::Cairo::Surface>(new Cairo::Surface(gtk_icon_info_load_surface(gobj(), Glib::unwrap(for_window), &(gerror)), true /* do not take reference */));
  if(gerror)
    ::Glib::Error::throw_exception(gerror);
  return retvalue;
}

Glib::RefPtr<Gdk::Pixbuf> IconInfo::load_icon_finish(const Glib::RefPtr<Gio::AsyncResult>& result)
{
  GError* gerror = nullptr;
  Glib::RefPtr<Gdk::Pixbuf> retvalue = Glib::wrap(gtk_icon_info_load_icon_finish(gobj(), Glib::unwrap(result), &(gerror)));
  if(gerror)
    ::Glib::Error::throw_exception(gerror);
  return retvalue;
}

Glib::RefPtr<Gdk::Pixbuf> IconInfo::load_symbolic_for_context_finish(const Glib::RefPtr<Gio::AsyncResult>& result, bool& was_symbolic)
{
  GError* gerror = nullptr;
  Glib::RefPtr<Gdk::Pixbuf> retvalue = Glib::wrap(gtk_icon_info_load_symbolic_for_context_finish(gobj(), Glib::unwrap(result), ((gboolean*) &(was_symbolic)), &(gerror)));
  if(gerror)
    ::Glib::Error::throw_exception(gerror);
  return retvalue;
}

Glib::RefPtr<Gdk::Pixbuf> IconInfo::load_symbolic_finish(const Glib::RefPtr<Gio::AsyncResult>& result, bool& was_symbolic)
{
  GError* gerror = nullptr;
  Glib::RefPtr<Gdk::Pixbuf> retvalue = Glib::wrap(gtk_icon_info_load_symbolic_finish(gobj(), Glib::unwrap(result), ((gboolean*) &(was_symbolic)), &(gerror)));
  if(gerror)
    ::Glib::Error::throw_exception(gerror);
  return retvalue;
}

bool IconInfo::is_symbolic() const
{
  return gtk_icon_info_is_symbolic(const_cast<GtkIconInfo*>(gobj()));
}


} // namespace Gtk


