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


#include <glibmm.h>

#include <gtkmm/accessibletext.h>
#include <gtkmm/private/accessibletext_p.h>


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

using Granularity = Gtk::AccessibleText::Granularity;

namespace
{
using AccessibleText_get_contents_vfunc_functype = GBytes* (*)(GtkAccessibleText* self, unsigned int start, unsigned int end);
AccessibleText_get_contents_vfunc_functype AccessibleText_get_contents_vfunc_funcptr;
extern "C" {
static GBytes* AccessibleText_get_contents_vfunc_c_callback(GtkAccessibleText* self, unsigned int start, unsigned int end)
{
  return AccessibleText_get_contents_vfunc_funcptr( self, start, end);
}
} // extern "C"
using AccessibleText_get_contents_at_vfunc_functype = GBytes* (*)(GtkAccessibleText* self, unsigned int offset, GtkAccessibleTextGranularity granularity, unsigned int* start, unsigned int* end);
AccessibleText_get_contents_at_vfunc_functype AccessibleText_get_contents_at_vfunc_funcptr;
extern "C" {
static GBytes* AccessibleText_get_contents_at_vfunc_c_callback(GtkAccessibleText* self, unsigned int offset, GtkAccessibleTextGranularity granularity, unsigned int* start, unsigned int* end)
{
  return AccessibleText_get_contents_at_vfunc_funcptr( self, offset, granularity, start, end);
}
} // extern "C"
using AccessibleText_get_caret_position_vfunc_functype = unsigned int (*)(GtkAccessibleText* self);
AccessibleText_get_caret_position_vfunc_functype AccessibleText_get_caret_position_vfunc_funcptr;
extern "C" {
static unsigned int AccessibleText_get_caret_position_vfunc_c_callback(GtkAccessibleText* self)
{
  return AccessibleText_get_caret_position_vfunc_funcptr( self);
}
} // extern "C"
using AccessibleText_get_selection_vfunc_functype = gboolean (*)(GtkAccessibleText* self, gsize* n_ranges, GtkAccessibleTextRange** ranges);
AccessibleText_get_selection_vfunc_functype AccessibleText_get_selection_vfunc_funcptr;
extern "C" {
static gboolean AccessibleText_get_selection_vfunc_c_callback(GtkAccessibleText* self, gsize* n_ranges, GtkAccessibleTextRange** ranges)
{
  return AccessibleText_get_selection_vfunc_funcptr( self, n_ranges, ranges);
}
} // extern "C"
using AccessibleText_get_attributes_vfunc_functype = gboolean (*)(GtkAccessibleText* self, unsigned int offset, gsize* n_ranges, GtkAccessibleTextRange** ranges, char*** attribute_names, char*** attribute_values);
AccessibleText_get_attributes_vfunc_functype AccessibleText_get_attributes_vfunc_funcptr;
extern "C" {
static gboolean AccessibleText_get_attributes_vfunc_c_callback(GtkAccessibleText* self, unsigned int offset, gsize* n_ranges, GtkAccessibleTextRange** ranges, char*** attribute_names, char*** attribute_values)
{
  return AccessibleText_get_attributes_vfunc_funcptr( self, offset, n_ranges, ranges, attribute_names, attribute_values);
}
} // extern "C"
using AccessibleText_get_default_attributes_vfunc_functype = void (*)(GtkAccessibleText* self, char*** attribute_names, char*** attribute_values);
AccessibleText_get_default_attributes_vfunc_functype AccessibleText_get_default_attributes_vfunc_funcptr;
extern "C" {
static void AccessibleText_get_default_attributes_vfunc_c_callback(GtkAccessibleText* self, char*** attribute_names, char*** attribute_values)
{
  AccessibleText_get_default_attributes_vfunc_funcptr( self, attribute_names, attribute_values);
}
} // extern "C"
} // anonymous namespace

// static
GType Glib::Value<Gtk::AccessibleText::Granularity>::value_type()
{
  return gtk_accessible_text_granularity_get_type();
}

// static
GType Glib::Value<Gtk::AccessibleText::ContentChange>::value_type()
{
  return gtk_accessible_text_content_change_get_type();
}


namespace Glib
{

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

} // namespace Glib


namespace Gtk
{


/* The *_Class implementation: */

const Glib::Interface_Class& AccessibleText_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_ = &AccessibleText_Class::iface_init_function;

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

  return *this;
}

void AccessibleText_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_contents = &AccessibleText_get_contents_vfunc_c_callback;
  AccessibleText_get_contents_vfunc_funcptr = &get_contents_vfunc_callback;
  klass->get_contents_at = &AccessibleText_get_contents_at_vfunc_c_callback;
  AccessibleText_get_contents_at_vfunc_funcptr = &get_contents_at_vfunc_callback;
  klass->get_caret_position = &AccessibleText_get_caret_position_vfunc_c_callback;
  AccessibleText_get_caret_position_vfunc_funcptr = &get_caret_position_vfunc_callback;
  klass->get_selection = &AccessibleText_get_selection_vfunc_c_callback;
  AccessibleText_get_selection_vfunc_funcptr = &get_selection_vfunc_callback;
  klass->get_attributes = &AccessibleText_get_attributes_vfunc_c_callback;
  AccessibleText_get_attributes_vfunc_funcptr = &get_attributes_vfunc_callback;
  klass->get_default_attributes = &AccessibleText_get_default_attributes_vfunc_c_callback;
  AccessibleText_get_default_attributes_vfunc_funcptr = &get_default_attributes_vfunc_callback;

}

GBytes* AccessibleText_Class::get_contents_vfunc_callback(GtkAccessibleText* self, unsigned int start, unsigned int end)
{
  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 Glib::unwrap_copy(obj->get_contents_vfunc(start, end));
      }
      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_contents)
    return (*base->get_contents)(self, start, end);

  using RType = GBytes*;
  return RType();
}
GBytes* AccessibleText_Class::get_contents_at_vfunc_callback(GtkAccessibleText* self, unsigned int offset, GtkAccessibleTextGranularity granularity, unsigned int* start, unsigned int* end)
{
  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 Glib::unwrap_copy(obj->get_contents_at_vfunc(offset, static_cast<Granularity>(granularity)
, start, end));
      }
      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_contents_at)
    return (*base->get_contents_at)(self, offset, granularity, start, end);

  using RType = GBytes*;
  return RType();
}
unsigned int AccessibleText_Class::get_caret_position_vfunc_callback(GtkAccessibleText* 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_caret_position_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_caret_position)
    return (*base->get_caret_position)(self);

  using RType = unsigned int;
  return RType();
}
gboolean AccessibleText_Class::get_selection_vfunc_callback(GtkAccessibleText* self, gsize* n_ranges, GtkAccessibleTextRange** ranges)
{
  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 static_cast<int>(obj->get_selection_vfunc(n_ranges, ranges));
      }
      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_selection)
    return (*base->get_selection)(self, n_ranges, ranges);

  using RType = gboolean;
  return RType();
}
gboolean AccessibleText_Class::get_attributes_vfunc_callback(GtkAccessibleText* self, unsigned int offset, gsize* n_ranges, GtkAccessibleTextRange** ranges, char*** attribute_names, char*** attribute_values)
{
  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 static_cast<int>(obj->get_attributes_vfunc(offset, n_ranges, ranges, attribute_names, attribute_values));
      }
      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_attributes)
    return (*base->get_attributes)(self, offset, n_ranges, ranges, attribute_names, attribute_values);

  using RType = gboolean;
  return RType();
}
void AccessibleText_Class::get_default_attributes_vfunc_callback(GtkAccessibleText* self, char*** attribute_names, char*** attribute_values)
{
  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.
        obj->get_default_attributes_vfunc(attribute_names, attribute_values);
        return;
      }
      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_default_attributes)
    (*base->get_default_attributes)(self, attribute_names, attribute_values);
}


Glib::ObjectBase* AccessibleText_Class::wrap_new(GObject* object)
{
  return new AccessibleText((GtkAccessibleText*)(object));
}


/* The implementation: */

AccessibleText::AccessibleText()
:
  Glib::Interface(accessibletext_class_.init())
{}

AccessibleText::AccessibleText(GtkAccessibleText* castitem)
:
  Glib::Interface((GObject*)(castitem))
{}

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

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

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

AccessibleText::~AccessibleText() noexcept
{}

// static
void AccessibleText::add_interface(GType gtype_implementer)
{
  accessibletext_class_.init().add_interface(gtype_implementer);
}

AccessibleText::CppClassType AccessibleText::accessibletext_class_; // initialize static member

GType AccessibleText::get_type()
{
  return accessibletext_class_.init().get_type();
}


GType AccessibleText::get_base_type()
{
  return gtk_accessible_text_get_type();
}


void AccessibleText::update_caret_position()
{
  gtk_accessible_text_update_caret_position(gobj());
}

void AccessibleText::update_selection_bound()
{
  gtk_accessible_text_update_selection_bound(gobj());
}

void AccessibleText::update_contents(ContentChange change, unsigned int start, unsigned int end)
{
  gtk_accessible_text_update_contents(gobj(), static_cast<GtkAccessibleTextContentChange>(change), start, end);
}


Glib::RefPtr<Glib::Bytes> Gtk::AccessibleText::get_contents_vfunc(unsigned int start, unsigned int end) 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_contents)
  {
    Glib::RefPtr<Glib::Bytes> retval(Glib::wrap((*base->get_contents)(const_cast<GtkAccessibleText*>(gobj()),start,end)));
    return retval;
  }

  using RType = Glib::RefPtr<Glib::Bytes>;
  return RType();
}
Glib::RefPtr<Glib::Bytes> Gtk::AccessibleText::get_contents_at_vfunc(unsigned int offset, Granularity granularity, unsigned int* start, unsigned int* end) 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_contents_at)
  {
    Glib::RefPtr<Glib::Bytes> retval(Glib::wrap((*base->get_contents_at)(const_cast<GtkAccessibleText*>(gobj()),offset,static_cast<GtkAccessibleTextGranularity>(granularity),start,end)));
    return retval;
  }

  using RType = Glib::RefPtr<Glib::Bytes>;
  return RType();
}
unsigned int Gtk::AccessibleText::get_caret_position_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_caret_position)
  {
    unsigned int retval((*base->get_caret_position)(const_cast<GtkAccessibleText*>(gobj())));
    return retval;
  }

  using RType = unsigned int;
  return RType();
}
bool Gtk::AccessibleText::get_selection_vfunc(gsize* n_ranges, GtkAccessibleTextRange** ranges) 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_selection)
  {
    bool retval((*base->get_selection)(const_cast<GtkAccessibleText*>(gobj()),n_ranges,ranges));
    return retval;
  }

  using RType = bool;
  return RType();
}
bool Gtk::AccessibleText::get_attributes_vfunc(unsigned int offset, gsize* n_ranges, GtkAccessibleTextRange** ranges, char*** attribute_names, char*** attribute_values) 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_attributes)
  {
    bool retval((*base->get_attributes)(const_cast<GtkAccessibleText*>(gobj()),offset,n_ranges,ranges,attribute_names,attribute_values));
    return retval;
  }

  using RType = bool;
  return RType();
}
void Gtk::AccessibleText::get_default_attributes_vfunc(char*** attribute_names, char*** attribute_values) 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_default_attributes)
  {
    (*base->get_default_attributes)(const_cast<GtkAccessibleText*>(gobj()),attribute_names,attribute_values);
  }
}


} // namespace Gtk


