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

#include <gtkmm/widget.h>

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

namespace Gtk
{

/** %Gtk::ListHeader is used by list widgets to represent the headers they display.
 *
 * The %Gtk::ListHeaders are managed just like Gtk::ListItems via
 * their factory, but provide a different set of properties suitable for
 * managing the header instead of individual items.
 *
 * @see Gtk::ListView, Gio::ListModel
 * @newin{4,12}
 */
class GTKMM_API ListHeader : public Glib::Object
{
  _CLASS_GOBJECT(ListHeader, GtkListHeader, GTK_LIST_HEADER, Glib::Object, GObject, , , GTKMM_API)
  _DO_NOT_DERIVE_GTYPE dnl// GtkListHeader is an internal type

public:
  // Don't use Glib::RefPtr<Glib::Object> Glib::wrap(GObject* object, bool take_copy).
  // The object may be an interface object, e.g. Gio::AppInfo. Such an object can't be
  // cast to Glib::Object. https://gitlab.gnome.org/GNOME/glibmm/-/issues/93
#m4 _CONVERSION(`gpointer',`Glib::RefPtr<Glib::ObjectBase>',`Glib::make_refptr_for_instance<Glib::ObjectBase>(Glib::wrap_auto(G_OBJECT($3)))')
  _WRAP_METHOD(Glib::RefPtr<Glib::ObjectBase> get_item(), gtk_list_header_get_item, refreturn)
  _WRAP_METHOD(Glib::RefPtr<const Glib::ObjectBase> get_item() const, gtk_list_header_get_item, refreturn, constversion)
  _WRAP_METHOD(guint get_start() const, gtk_list_header_get_start)
  _WRAP_METHOD(guint get_end() const, gtk_list_header_get_end)
  _WRAP_METHOD(guint get_n_items() const, gtk_list_header_get_n_items)
  _WRAP_METHOD(void set_child(Widget& child), gtk_list_header_set_child)
  void unset_child();
  _WRAP_METHOD(Widget* get_child(), gtk_list_header_get_child)
  _WRAP_METHOD(const Widget* get_child() const, gtk_list_header_get_child, constversion)

  _WRAP_PROPERTY("child", Widget*)
  _WRAP_PROPERTY("end", guint)
  _WRAP_PROPERTY("item", Glib::RefPtr<Glib::ObjectBase>)
  _WRAP_PROPERTY("n-items", guint)
  _WRAP_PROPERTY("start", guint)
};

} // namespace Gtk
