// Generated by gmmproc 2.84.0 -- DO NOT MODIFY!


#include <glibmm.h>

#include <gdkmm/dmabufformats.h>
#include <gdkmm/private/dmabufformats_p.h>


/* Copyright (C) 2023 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 <http://www.gnu.org/licenses/>.
 */

namespace Gdk
{
std::pair<guint32, guint64> DmabufFormats::get_format(gsize idx) const
{
  guint32 fourcc = 0;
  guint64 modifier = 0;
  gdk_dmabuf_formats_get_format(const_cast<GdkDmabufFormats*>(gobj()), idx, &fourcc, &modifier);
  return {fourcc, modifier};
}
} // namespace Gdk

namespace Glib
{
GType Value<RefPtr<Gdk::DmabufFormats> >::value_type()
{
  return GDK_TYPE_DMABUF_FORMATS;
}

void Value<RefPtr<Gdk::DmabufFormats> >::set(const CppType& data)
{
  set_boxed(Glib::unwrap(data));
}

Value<RefPtr<Gdk::DmabufFormats>>::CppType Value<RefPtr<Gdk::DmabufFormats>>::get() const
{
  return Glib::wrap(static_cast<CType>(get_boxed()), true);
}

} // namespace Glib

namespace
{
} // anonymous namespace


/* Why reinterpret_cast<DmabufFormats*>(gobject) is needed:
 *
 * A DmabufFormats instance is in fact always a GdkDmabufFormats instance.
 * Unfortunately, GdkDmabufFormats cannot be a member of DmabufFormats,
 * because it is an opaque struct.  Also, the C interface does not provide
 * any hooks to install a destroy notification handler, thus we cannot
 * wrap it dynamically either.
 *
 * The cast works because DmabufFormats does not have any member data, and
 * it is impossible to derive from it.  This is ensured by using final on the
 * class and by using = delete on the default constructor.
 */

namespace Glib
{

Glib::RefPtr<Gdk::DmabufFormats> wrap(GdkDmabufFormats* object, bool take_copy)
{
  if(take_copy && object)
    gdk_dmabuf_formats_ref(object);

  // See the comment at the top of this file, if you want to know why the cast works.
  return Glib::make_refptr_for_instance<Gdk::DmabufFormats>(reinterpret_cast<Gdk::DmabufFormats*>(object));
}

} // namespace Glib


namespace Gdk
{

void DmabufFormats::reference() const
{
  // See the comment at the top of this file, if you want to know why the cast works.
  gdk_dmabuf_formats_ref(reinterpret_cast<GdkDmabufFormats*>(const_cast<DmabufFormats*>(this)));
}

void DmabufFormats::unreference() const
{
  // See the comment at the top of this file, if you want to know why the cast works.
  gdk_dmabuf_formats_unref(reinterpret_cast<GdkDmabufFormats*>(const_cast<DmabufFormats*>(this)));
}

GdkDmabufFormats* DmabufFormats::gobj()
{
  // See the comment at the top of this file, if you want to know why the cast works.
  return reinterpret_cast<GdkDmabufFormats*>(this);
}

const GdkDmabufFormats* DmabufFormats::gobj() const
{
  // See the comment at the top of this file, if you want to know why the cast works.
  return reinterpret_cast<const GdkDmabufFormats*>(this);
}

GdkDmabufFormats* DmabufFormats::gobj_copy() const
{
  // See the comment at the top of this file, if you want to know why the cast works.
  const auto gobject = reinterpret_cast<GdkDmabufFormats*>(const_cast<DmabufFormats*>(this));
  gdk_dmabuf_formats_ref(gobject);
  return gobject;
}


gsize DmabufFormats::get_n_formats() const
{
  return gdk_dmabuf_formats_get_n_formats(const_cast<GdkDmabufFormats*>(gobj()));
}

bool DmabufFormats::contains(guint32 fourcc, guint64 modifier) const
{
  return gdk_dmabuf_formats_contains(const_cast<GdkDmabufFormats*>(gobj()), fourcc, modifier);
}

bool DmabufFormats::equal(const Glib::RefPtr<const DmabufFormats>& formats2) const
{
  return gdk_dmabuf_formats_equal(const_cast<GdkDmabufFormats*>(gobj()), Glib::unwrap(formats2));
}


} // namespace Gdk


