/* 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 <giomm/listmodel.h>
#include <gtkmm/selectionmodel.h>

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

namespace Gtk
{

/** A list model that turns a selection in a model.
 *
 * %Gtk::SelectionFilterModel is a list model that presents the
 * selected items in a Gtk::SelectionModel as its own list model.
 *
 * @see Gtk::SelectionModel
 * @ingroup ListView
 * @newin{3,98}
 */
class GTKMM_API SelectionFilterModel : public Glib::Object, public Gio::ListModel
{
  _CLASS_GOBJECT(SelectionFilterModel, GtkSelectionFilterModel, GTK_SELECTION_FILTER_MODEL, Glib::Object, GObject, , , GTKMM_API)
  _IMPLEMENTS_INTERFACE(Gio::ListModel)
  _DO_NOT_DERIVE_GTYPE dnl// GtkSelectionFilterModel is a final type
  _ABI_AS_WITH_DERIVED_GTYPE dnl// Remove when we can break ABI
  _STRUCT_NOT_HIDDEN

protected:
  _WRAP_CTOR(SelectionFilterModel(const Glib::RefPtr<SelectionModel>& model), gtk_selection_filter_model_new)

public:
  _WRAP_CREATE(const Glib::RefPtr<SelectionModel>& model)

  _WRAP_METHOD(void set_model(const Glib::RefPtr<SelectionModel>& model), gtk_selection_filter_model_set_model)
  _WRAP_METHOD(Glib::RefPtr<SelectionModel> get_model(), gtk_selection_filter_model_get_model, refreturn)
  _WRAP_METHOD(Glib::RefPtr<const SelectionModel> get_model() const, gtk_selection_filter_model_get_model, refreturn, constversion)

  _WRAP_PROPERTY("item-type", GType)
  _WRAP_PROPERTY("model", Glib::RefPtr<SelectionModel>)
  _WRAP_PROPERTY("n-items", unsigned int)
};

} // namespace Gtk
