/* Copyright (C) 2020 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/object.h>
#include <giomm/listmodel.h>
#include <gtk/gtk.h>

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

namespace Gtk
{

/** A row in a Gtk::TreeListModel.
 *
 * %Gtk::TreeListRow is the object used by Gtk::TreeListModel to
 * represent items. It allows navigating the model as a tree and
 * modify the state of rows.
 *
 * %Gtk::TreeListRow instances are created by a Gtk::TreeListModel only
 * when the Gtk::TreeListModel::property_passthrough() property is not set.
 *
 * There are various support objects that can make use of %Gtk::TreeListRow
 * objects, such as the Gtk::TreeExpander widget that allows displaying
 * an icon to expand or collapse a row or Gtk::TreeListRowSorter that makes
 * it possible to sort trees properly.
 *
 * @see Gtk::TreeListModel
 *
 * @newin{3,98}
 */
class GTKMM_API TreeListRow : public Glib::Object
{
  _CLASS_GOBJECT(TreeListRow, GtkTreeListRow, GTK_TREE_LIST_ROW, Glib::Object, GObject, , , GTKMM_API)
  _STRUCT_NOT_HIDDEN

public:
#m4 _CONVERSION(`gpointer',`Glib::RefPtr<Glib::ObjectBase>',`Glib::wrap(G_OBJECT($3))')
  _WRAP_METHOD(Glib::RefPtr<Glib::ObjectBase> get_item(), gtk_tree_list_row_get_item)
  _WRAP_METHOD(Glib::RefPtr<const Glib::ObjectBase> get_item() const, gtk_tree_list_row_get_item, constversion)
  _WRAP_METHOD(void set_expanded(bool expanded = true), gtk_tree_list_row_set_expanded)
  _WRAP_METHOD(bool get_expanded() const, gtk_tree_list_row_get_expanded)
  _WRAP_METHOD(bool is_expandable() const, gtk_tree_list_row_is_expandable)
  _WRAP_METHOD(guint get_position() const, gtk_tree_list_row_get_position)
  _WRAP_METHOD(guint get_depth() const, gtk_tree_list_row_get_depth)
  _WRAP_METHOD(Glib::RefPtr<Gio::ListModel> get_children(), gtk_tree_list_row_get_children, refreturn)
  _WRAP_METHOD(Glib::RefPtr<const Gio::ListModel> get_children() const, gtk_tree_list_row_get_children, refreturn, constversion)
  _WRAP_METHOD(Glib::RefPtr<TreeListRow> get_parent(), gtk_tree_list_row_get_parent)
  _WRAP_METHOD(Glib::RefPtr<const TreeListRow> get_parent() const, gtk_tree_list_row_get_parent, constversion)
  _WRAP_METHOD(Glib::RefPtr<TreeListRow> get_child_row(guint position), gtk_tree_list_row_get_child_row)
  _WRAP_METHOD(Glib::RefPtr<const TreeListRow> get_child_row(guint position) const, gtk_tree_list_row_get_child_row, constversion)

  _WRAP_PROPERTY("children", Glib::RefPtr<Gio::ListModel>)
  _WRAP_PROPERTY("depth", guint)
  _WRAP_PROPERTY("expandable", bool)
  _WRAP_PROPERTY("expanded", bool)
  _WRAP_PROPERTY("item", Glib::RefPtr<Glib::ObjectBase>)
};

}
