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


#include <glibmm.h>

#include <gtkmm/accessiblehypertext.h>
#include <gtkmm/private/accessiblehypertext_p.h>


/* Copyright (C) 2025 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/>.
 */

#include <gtkmm/accessiblehyperlink.h>
#include <gtk/gtk.h>

namespace
{
using AccessibleHypertext_get_n_links_vfunc_functype = unsigned int (*)(GtkAccessibleHypertext* self);
AccessibleHypertext_get_n_links_vfunc_functype AccessibleHypertext_get_n_links_vfunc_funcptr;
extern "C" {
static unsigned int AccessibleHypertext_get_n_links_vfunc_c_callback(GtkAccessibleHypertext* self)
{
  return AccessibleHypertext_get_n_links_vfunc_funcptr( self);
}
} // extern "C"
using AccessibleHypertext_get_link_vfunc_functype = GtkAccessibleHyperlink* (*)(GtkAccessibleHypertext* self, unsigned int index);
AccessibleHypertext_get_link_vfunc_functype AccessibleHypertext_get_link_vfunc_funcptr;
extern "C" {
static GtkAccessibleHyperlink* AccessibleHypertext_get_link_vfunc_c_callback(GtkAccessibleHypertext* self, unsigned int index)
{
  return AccessibleHypertext_get_link_vfunc_funcptr( self, index);
}
} // extern "C"
using AccessibleHypertext_get_link_at_vfunc_functype = unsigned int (*)(GtkAccessibleHypertext* self, unsigned int offset);
AccessibleHypertext_get_link_at_vfunc_functype AccessibleHypertext_get_link_at_vfunc_funcptr;
extern "C" {
static unsigned int AccessibleHypertext_get_link_at_vfunc_c_callback(GtkAccessibleHypertext* self, unsigned int offset)
{
  return AccessibleHypertext_get_link_at_vfunc_funcptr( self, offset);
}
} // extern "C"
} // anonymous namespace


namespace Glib
{

Glib::RefPtr<Gtk::AccessibleHypertext> wrap(GtkAccessibleHypertext* object, bool take_copy)
{
  return Glib::make_refptr_for_instance<Gtk::AccessibleHypertext>( dynamic_cast<Gtk::AccessibleHypertext*> (Glib::wrap_auto_interface<Gtk::AccessibleHypertext> ((GObject*)(object), take_copy)) );
  //We use dynamic_cast<> in case of multiple inheritance.
}

} // namespace Glib


namespace Gtk
{


/* The *_Class implementation: */

const Glib::Interface_Class& AccessibleHypertext_Class::init()
{
  if(!gtype_) // create the GType if necessary
  {
    // Glib::Interface_Class has to know the interface init function
    // in order to add interfaces to implementing types.
    class_init_func_ = &AccessibleHypertext_Class::iface_init_function;

    // We can not derive from another interface, and it is not necessary anyway.
    gtype_ = gtk_accessible_hypertext_get_type();
  }

  return *this;
}

void AccessibleHypertext_Class::iface_init_function(void* g_iface, void*)
{
  const auto klass = static_cast<BaseClassType*>(g_iface);

  //This is just to avoid an "unused variable" warning when there are no vfuncs or signal handlers to connect.
  //This is a temporary fix until I find out why I can not seem to derive a GtkFileChooser interface. murrayc
  g_assert(klass != nullptr);

  klass->get_n_links = &AccessibleHypertext_get_n_links_vfunc_c_callback;
  AccessibleHypertext_get_n_links_vfunc_funcptr = &get_n_links_vfunc_callback;
  klass->get_link = &AccessibleHypertext_get_link_vfunc_c_callback;
  AccessibleHypertext_get_link_vfunc_funcptr = &get_link_vfunc_callback;
  klass->get_link_at = &AccessibleHypertext_get_link_at_vfunc_c_callback;
  AccessibleHypertext_get_link_at_vfunc_funcptr = &get_link_at_vfunc_callback;

}

unsigned int AccessibleHypertext_Class::get_n_links_vfunc_callback(GtkAccessibleHypertext* self)
{
  const auto obj_base = static_cast<Glib::ObjectBase*>(
      Glib::ObjectBase::_get_current_wrapper((GObject*)self));

  // Non-gtkmmproc-generated custom classes implicitly call the default
  // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
  // generated classes can use this optimisation, which avoids the unnecessary
  // parameter conversions if there is no possibility of the virtual function
  // being overridden:
  if(obj_base && obj_base->is_derived_())
  {
    const auto obj = dynamic_cast<CppObjectType* const>(obj_base);
    if(obj) // This can be NULL during destruction.
    {
      try // Trap C++ exceptions which would normally be lost because this is a C callback.
      {
        // Call the virtual member method, which derived classes might override.
        return obj->get_n_links_vfunc();
      }
      catch(...)
      {
        Glib::exception_handlers_invoke();
      }
    }
  }

  BaseClassType *const base = static_cast<BaseClassType*>(
      g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface).
g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface.
)  );

  // Call the original underlying C function:
  if(base && base->get_n_links)
    return (*base->get_n_links)(self);

  using RType = unsigned int;
  return RType();
}
GtkAccessibleHyperlink* AccessibleHypertext_Class::get_link_vfunc_callback(GtkAccessibleHypertext* self, unsigned int index)
{
  const auto obj_base = static_cast<Glib::ObjectBase*>(
      Glib::ObjectBase::_get_current_wrapper((GObject*)self));

  // Non-gtkmmproc-generated custom classes implicitly call the default
  // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
  // generated classes can use this optimisation, which avoids the unnecessary
  // parameter conversions if there is no possibility of the virtual function
  // being overridden:
  if(obj_base && obj_base->is_derived_())
  {
    const auto obj = dynamic_cast<CppObjectType* const>(obj_base);
    if(obj) // This can be NULL during destruction.
    {
      try // Trap C++ exceptions which would normally be lost because this is a C callback.
      {
        // Call the virtual member method, which derived classes might override.
        static auto quark_return_value = g_quark_from_static_string("Gtk::AccessibleHypertext::get_link_vfunc");

        auto return_value = static_cast<Glib::RefPtr<AccessibleHyperlink>*>(g_object_get_qdata(obj_base->gobj(), quark_return_value));
        if (!return_value)
        {
          return_value = new Glib::RefPtr<AccessibleHyperlink>();
          g_object_set_qdata_full(obj_base->gobj(), quark_return_value, return_value,
          &Glib::destroy_notify_delete<Glib::RefPtr<AccessibleHyperlink>>);
        }
        // Keep a copy of the return value. The caller is not expected
        // to free the object that the returned pointer points to.
        *return_value = obj->get_link_vfunc(index);
        return Glib::unwrap((*return_value));
      }
      catch(...)
      {
        Glib::exception_handlers_invoke();
      }
    }
  }

  BaseClassType *const base = static_cast<BaseClassType*>(
      g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface).
g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface.
)  );

  // Call the original underlying C function:
  if(base && base->get_link)
    return (*base->get_link)(self, index);

  using RType = GtkAccessibleHyperlink*;
  return RType();
}
unsigned int AccessibleHypertext_Class::get_link_at_vfunc_callback(GtkAccessibleHypertext* self, unsigned int offset)
{
  const auto obj_base = static_cast<Glib::ObjectBase*>(
      Glib::ObjectBase::_get_current_wrapper((GObject*)self));

  // Non-gtkmmproc-generated custom classes implicitly call the default
  // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
  // generated classes can use this optimisation, which avoids the unnecessary
  // parameter conversions if there is no possibility of the virtual function
  // being overridden:
  if(obj_base && obj_base->is_derived_())
  {
    const auto obj = dynamic_cast<CppObjectType* const>(obj_base);
    if(obj) // This can be NULL during destruction.
    {
      try // Trap C++ exceptions which would normally be lost because this is a C callback.
      {
        // Call the virtual member method, which derived classes might override.
        return obj->get_link_at_vfunc(offset);
      }
      catch(...)
      {
        Glib::exception_handlers_invoke();
      }
    }
  }

  BaseClassType *const base = static_cast<BaseClassType*>(
      g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface).
g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface.
)  );

  // Call the original underlying C function:
  if(base && base->get_link_at)
    return (*base->get_link_at)(self, offset);

  using RType = unsigned int;
  return RType();
}


Glib::ObjectBase* AccessibleHypertext_Class::wrap_new(GObject* object)
{
  return new AccessibleHypertext((GtkAccessibleHypertext*)(object));
}


/* The implementation: */

AccessibleHypertext::AccessibleHypertext()
:
  Glib::Interface(accessiblehypertext_class_.init())
{}

AccessibleHypertext::AccessibleHypertext(GtkAccessibleHypertext* castitem)
:
  Glib::Interface((GObject*)(castitem))
{}

AccessibleHypertext::AccessibleHypertext(const Glib::Interface_Class& interface_class)
: Glib::Interface(interface_class)
{
}

AccessibleHypertext::AccessibleHypertext(AccessibleHypertext&& src) noexcept
: Glib::Interface(std::move(src))
{}

AccessibleHypertext& AccessibleHypertext::operator=(AccessibleHypertext&& src) noexcept
{
  Glib::Interface::operator=(std::move(src));
  return *this;
}

AccessibleHypertext::~AccessibleHypertext() noexcept
{}

// static
void AccessibleHypertext::add_interface(GType gtype_implementer)
{
  accessiblehypertext_class_.init().add_interface(gtype_implementer);
}

AccessibleHypertext::CppClassType AccessibleHypertext::accessiblehypertext_class_; // initialize static member

GType AccessibleHypertext::get_type()
{
  return accessiblehypertext_class_.init().get_type();
}


GType AccessibleHypertext::get_base_type()
{
  return gtk_accessible_hypertext_get_type();
}


unsigned int Gtk::AccessibleHypertext::get_n_links_vfunc() const
{
  const auto base = static_cast<BaseClassType*>(
      g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface).
g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface.
)  );

  if(base && base->get_n_links)
  {
    unsigned int retval((*base->get_n_links)(const_cast<GtkAccessibleHypertext*>(gobj())));
    return retval;
  }

  using RType = unsigned int;
  return RType();
}
Glib::RefPtr<AccessibleHyperlink> Gtk::AccessibleHypertext::get_link_vfunc(unsigned int index) 
{
  const auto base = static_cast<BaseClassType*>(
      g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface).
g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface.
)  );

  if(base && base->get_link)
  {
    Glib::RefPtr<AccessibleHyperlink> retval(Glib::wrap((*base->get_link)(gobj(),index), true));
    return retval;
  }

  using RType = Glib::RefPtr<AccessibleHyperlink>;
  return RType();
}
unsigned int Gtk::AccessibleHypertext::get_link_at_vfunc(unsigned int offset) const
{
  const auto base = static_cast<BaseClassType*>(
      g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface).
g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface.
)  );

  if(base && base->get_link_at)
  {
    unsigned int retval((*base->get_link_at)(const_cast<GtkAccessibleHypertext*>(gobj()),offset));
    return retval;
  }

  using RType = unsigned int;
  return RType();
}


} // namespace Gtk


