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

_DEFS(gtkmm,gtk)
_PINCLUDE(gtkmm/private/widget_p.h)

#include <gtkmm/widget.h>
#include <pangomm/attrlist.h>
#include <pangomm/layout.h> // for Pango::WrapMode

namespace Gtk
{
//TODO: Derive from (and implement) AccessibleText when we can break ABI.

/** %Gtk::Inscription is a widget to show text in a predefined area.
 *
 * You likely want to use Gtk::Label instead as this widget is intended only
 * for a small subset of use cases. The main scenario envisaged is inside lists
 * such as Gtk::ColumnView.
 *
 * While a Gtk::Label sizes itself depending on the text that is displayed,
 * %Gtk::Inscription is given a size and inscribes the given text into that
 * space as well as it can.
 *
 * Users of this widget should take care to plan behaviour for the common case
 * where the text doesn't fit exactly in the allocated space.
 *
 * @ingroup Widgets
 * @ingroup ListView
 * @newin{4,8}
 */
class GTKMM_API Inscription : public Widget
{
  _CLASS_GTKOBJECT(Inscription, GtkInscription, GTK_INSCRIPTION, Gtk::Widget, GtkWidget, , , GTKMM_API)
  _DO_NOT_DERIVE_GTYPE dnl// GtkInscription is a final type
  _STRUCT_NOT_HIDDEN
public:
  _WRAP_ENUM(Overflow, GtkInscriptionOverflow, decl_prefix GTKMM_API)

  _CTOR_DEFAULT

  /** Creates a new %Gtk::Inscription with the given text.
   * @param text The text.
   */
  _WRAP_CTOR(Inscription(const Glib::ustring& text), gtk_inscription_new)

  _WRAP_METHOD(Glib::ustring get_text() const, gtk_inscription_get_text)
  _WRAP_METHOD(void set_text(const Glib::ustring& text{NULL}), gtk_inscription_set_text)
  _WRAP_METHOD(Pango::AttrList get_attributes() const, gtk_inscription_get_attributes)
  _WRAP_METHOD(void set_attributes(Pango::AttrList& attrs), gtk_inscription_set_attributes)
  _WRAP_METHOD(void set_markup(const Glib::ustring& markup{NULL}), gtk_inscription_set_markup)
  _WRAP_METHOD(Inscription::Overflow get_text_overflow() const, gtk_inscription_get_text_overflow)
  _WRAP_METHOD(void set_text_overflow(Overflow overflow), gtk_inscription_set_text_overflow)
  _WRAP_METHOD(Pango::WrapMode get_wrap_mode() const, gtk_inscription_get_wrap_mode)
  _WRAP_METHOD(void set_wrap_mode(Pango::WrapMode wrap_mode), gtk_inscription_set_wrap_mode)
  _WRAP_METHOD(unsigned int get_min_chars() const, gtk_inscription_get_min_chars)
  _WRAP_METHOD(void set_min_chars(unsigned int min_chars), gtk_inscription_set_min_chars)
  _WRAP_METHOD(unsigned int get_nat_chars() const, gtk_inscription_get_nat_chars)
  _WRAP_METHOD(void set_nat_chars(unsigned int nat_chars), gtk_inscription_set_nat_chars)
  _WRAP_METHOD(unsigned int get_min_lines() const, gtk_inscription_get_min_lines)
  _WRAP_METHOD(void set_min_lines(unsigned int min_lines), gtk_inscription_set_min_lines)
  _WRAP_METHOD(unsigned int get_nat_lines() const, gtk_inscription_get_nat_lines)
  _WRAP_METHOD(void set_nat_lines(unsigned int nat_lines), gtk_inscription_set_nat_lines)
  _WRAP_METHOD(float get_xalign() const, gtk_inscription_get_xalign)
  _WRAP_METHOD(void set_xalign(float xalign), gtk_inscription_set_xalign)
  _WRAP_METHOD(float get_yalign() const, gtk_inscription_get_yalign)
  _WRAP_METHOD(void set_yalign(float yalign), gtk_inscription_set_yalign)

  _WRAP_PROPERTY("attributes", Pango::AttrList)
  _WRAP_PROPERTY("markup", Glib::ustring)
  _WRAP_PROPERTY("min-chars", unsigned int)
  _WRAP_PROPERTY("min-lines", unsigned int)
  _WRAP_PROPERTY("nat-chars", unsigned int)
  _WRAP_PROPERTY("nat-lines", unsigned int)
  _WRAP_PROPERTY("text", Glib::ustring)
  _WRAP_PROPERTY("text-overflow", Inscription::Overflow)
  _WRAP_PROPERTY("wrap-mode", Pango::WrapMode)
  _WRAP_PROPERTY("xalign", float)
  _WRAP_PROPERTY("yalign", float)
};

} // namespace Gtk
