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

#include <gtkmm/filter.h>
#include <gtkmm/buildable.h>
#include <giomm/listmodel.h>

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

namespace Gtk
{

/** Combining multiple filters.
 *
 * %Gtk::MultiFilter is the base type that implements support for handling
 * multiple filters.
 *
 * @ingroup ListView
 * @newin{3,98}
 */
class GTKMM_API MultiFilter : public Filter, public Gio::ListModel, public Buildable
{
  _CLASS_GOBJECT(MultiFilter, GtkMultiFilter, GTK_MULTI_FILTER, Gtk::Filter, GtkFilter, , , GTKMM_API)
  _IMPLEMENTS_INTERFACE(Gio::ListModel)
  _IMPLEMENTS_INTERFACE(Buildable)
  _DO_NOT_DERIVE_GTYPE dnl// GtkMultiFilter is an internal type
  _ABI_AS_WITH_DERIVED_GTYPE dnl// Remove when we can break ABI

protected:
  _CTOR_DEFAULT

public:
#m4 _CONVERSION(`const Glib::RefPtr<Filter>&', `GtkFilter*', `Glib::unwrap_copy($3)')
  _WRAP_METHOD(void append(const Glib::RefPtr<Filter>& filter), gtk_multi_filter_append)
  _WRAP_METHOD(void remove(guint position), gtk_multi_filter_remove)

  _WRAP_PROPERTY("item-type", GType)
  _WRAP_PROPERTY("n-items", unsigned int)
};

/** Matches when at least one filter matches.
 *
 * %Gtk::AnyFilter is a subclass of Gtk::MultiFilter that matches an item
 * when at least one of its filters matches.
 *
 * @ingroup ListView
 * @newin{3,98}
 */
class GTKMM_API AnyFilter : public MultiFilter
{
  _CLASS_GOBJECT(AnyFilter, GtkAnyFilter, GTK_ANY_FILTER, Gtk::MultiFilter, GtkMultiFilter, , , GTKMM_API)
  _DO_NOT_DERIVE_GTYPE dnl// GtkAnyFilter is an internal type
  _ABI_AS_WITH_DERIVED_GTYPE dnl// Remove when we can break ABI

protected:
  _CTOR_DEFAULT

public:
  _WRAP_CREATE()
};

/** Matches when each of its filter matches.
 *
 * %Gtk::EveryFilter is a subclass of Gtk::MultiFilter that matches an item
 * when each of its filters matches.
 *
 * @ingroup ListView
 * @newin{3,98}
 */
class GTKMM_API EveryFilter : public MultiFilter
{
  _CLASS_GOBJECT(EveryFilter, GtkEveryFilter, GTK_EVERY_FILTER, Gtk::MultiFilter, GtkMultiFilter, , , GTKMM_API)
  _DO_NOT_DERIVE_GTYPE dnl// GtkEveryFilter is an internal type
  _ABI_AS_WITH_DERIVED_GTYPE dnl// Remove when we can break ABI

protected:
  _CTOR_DEFAULT

public:
  _WRAP_CREATE()
};

} // namespace Gtk
