/* 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/>.
 */

_CONFIGINCLUDE(gtkmmconfig.h)

#include <glibmm/interface.h>

_DEFS(gtkmm,gtk)
_PINCLUDE(glibmm/private/interface_p.h)
_PINCLUDE(gtk/gtk.h)

#ifndef DOXYGEN_SHOULD_SKIP_THIS
extern "C"
{
typedef struct _GtkAccessibleHypertextInterface GtkAccessibleHypertextInterface;
}
#endif /* DOXYGEN_SHOULD_SKIP_THIS */

namespace Gtk
{
class GTKMM_API AccessibleHyperlink;

/** An interface for accessible objects containing links.
 *
 * The %Gtk::AccessibleHypertext interface is meant to be implemented by accessible
 * objects that contain links. Those links don't necessarily have to be part
 * of text, they can be associated with images and other things.
 *
 * @newin{4,22}
 */
class GTKMM_API AccessibleHypertext : public Glib::Interface
{
  _CLASS_INTERFACE(AccessibleHypertext, GtkAccessibleHypertext, GTK_ACCESSIBLE_HYPERTEXT, GtkAccessibleHypertextInterface, , , GTKMM_API)

public:

protected:
  /** Retrieve the number of links in the accessible object.
   *
   * @returns The number of links.
   * @newin{4,22}
   */
  _WRAP_VFUNC(unsigned int get_n_links() const, get_n_links)

#m4 _CONVERSION(`Glib::RefPtr<AccessibleHyperlink>',`GtkAccessibleHyperlink*',`Glib::unwrap($3)')
  /** Retrieve the n-th link in the accessible object.
   *
   * @param index Must be less than the number of links.
   * @returns The link.
   *
   * @newin{4,22}
   */
  _WRAP_VFUNC(Glib::RefPtr<AccessibleHyperlink> get_link(unsigned int index),
    get_link, refreturn, keep_return)

  /** Retrieves the index of the link at the given character offset.
   *
   * Note that this method will return `G_MAXUINT` if the object
   * does not contain text.
   *
   * @param offset The character offset.
   * @returns Index of the link at the given character offset, or
   *   `G_MAXUINT` if there is no link.
   *
   * @newin{4,22}
   */
  _WRAP_VFUNC(unsigned int get_link_at(unsigned int offset) const, get_link_at)
};

} // namespace Gtk
