/* Copyright (C) 2002 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 <https://www.gnu.org/licenses/>.
 */

_DEFS(gtkmm,gtk)
_CONFIGINCLUDE(gtkmmconfig.h)
_IS_DEPRECATED // The entire file is deprecated.

#include <gtkmm/treemodel.h>
#include <gtkmm/treepath.h>

#m4 _PUSH(SECTION_CC_PRE_INCLUDES)
#undef GTK_DISABLE_DEPRECATED
#define GDK_DISABLE_DEPRECATION_WARNINGS 1
#m4 _POP()

namespace Gtk
{

/** Typedefed as Gtk::TreeModel::RowReference.
 * This reference will keep pointing to
 * the node pointed to by the Path, so long as it exists.  It listens to all
 * signals emitted by the Model, and updates its Path appropriately.
 * @ingroup TreeView
 * @deprecated 4.10: Use Gio::ListModel instead.
 */
class GTKMM_API TreeRowReference
{
  _CLASS_BOXEDTYPE(TreeRowReference, GtkTreeRowReference, NONE, gtk_tree_row_reference_copy, gtk_tree_row_reference_free, GTKMM_API)
  _IGNORE(gtk_tree_row_reference_new, gtk_tree_row_reference_copy, gtk_tree_row_reference_free)
public:
  TreeRowReference(const Glib::RefPtr<TreeModel>& model, const TreeModel::Path& path);

  /** The same as is_valid().
   * For instance,
   * @code
   * if(treerowreference)
   *   do_something()
   * @endcode
   *
   * @newin{3,22}
   */
  explicit operator bool() const;

  _WRAP_METHOD(TreeModel::Path get_path() const,  gtk_tree_row_reference_get_path)

  _WRAP_METHOD(Glib::RefPtr<TreeModel> get_model(), gtk_tree_row_reference_get_model, refreturn)
  _WRAP_METHOD(Glib::RefPtr<const TreeModel> get_model() const, gtk_tree_row_reference_get_model, refreturn, constversion)

  _WRAP_METHOD(bool is_valid() const, gtk_tree_row_reference_valid)
};

} // namespace Gtk
