[gtkmm/multifilter] Add Gtk::MultiFilter, AnyFilter and EveryFilter




commit 696934876466568265f2b233f08eafe8bad30e87
Author: Andreas Persson <andreasp56 outlook com>
Date:   Sun Oct 4 08:42:46 2020 +0200

    Add Gtk::MultiFilter, AnyFilter and EveryFilter

 .gitignore              |  2 ++
 gtk/gtkmm.h             |  1 +
 gtk/gtkmm/meson.build   |  1 +
 gtk/src/filelist.am     |  1 +
 gtk/src/multifilter.ccg | 17 ++++++++++
 gtk/src/multifilter.hg  | 85 +++++++++++++++++++++++++++++++++++++++++++++++++
 6 files changed, 107 insertions(+)
---
diff --git a/.gitignore b/.gitignore
index 9e61c4a1..442b1a43 100644
--- a/.gitignore
+++ b/.gitignore
@@ -415,6 +415,8 @@ gtk/gtkmm/messagedialog.cc
 gtk/gtkmm/messagedialog.h
 gtk/gtkmm/modelbutton.cc
 gtk/gtkmm/modelbutton.h
+gtk/gtkmm/multifilter.cc
+gtk/gtkmm/multifilter.h
 gtk/gtkmm/multiselection.cc
 gtk/gtkmm/multiselection.h
 gtk/gtkmm/multisorter.cc
diff --git a/gtk/gtkmm.h b/gtk/gtkmm.h
index 8496ba92..50d21a7e 100644
--- a/gtk/gtkmm.h
+++ b/gtk/gtkmm.h
@@ -204,6 +204,7 @@ extern const int gtkmm_micro_version;
 #include <gtkmm/mediafile.h>
 #include <gtkmm/menubutton.h>
 #include <gtkmm/messagedialog.h>
+#include <gtkmm/multifilter.h>
 #include <gtkmm/multiselection.h>
 #include <gtkmm/multisorter.h>
 #include <gtkmm/noselection.h>
diff --git a/gtk/gtkmm/meson.build b/gtk/gtkmm/meson.build
index 25a3feda..0c66f0d8 100644
--- a/gtk/gtkmm/meson.build
+++ b/gtk/gtkmm/meson.build
@@ -163,6 +163,7 @@ gtkmm_any_hg_ccg_basenames = [
   'mediastream',
   'menubutton',
   'messagedialog',
+  'multifilter',
   'multiselection',
   'multisorter',
   'native',
diff --git a/gtk/src/filelist.am b/gtk/src/filelist.am
index 18d091f8..688c8fb9 100644
--- a/gtk/src/filelist.am
+++ b/gtk/src/filelist.am
@@ -148,6 +148,7 @@ gtkmm_files_any_hg =                \
        mediastream.hg \
        menubutton.hg           \
        messagedialog.hg        \
+       multifilter.hg \
        multiselection.hg \
        multisorter.hg \
        native.hg \
diff --git a/gtk/src/multifilter.ccg b/gtk/src/multifilter.ccg
new file mode 100644
index 00000000..57b87fdc
--- /dev/null
+++ b/gtk/src/multifilter.ccg
@@ -0,0 +1,17 @@
+/* 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 <gtk/gtk.h>
diff --git a/gtk/src/multifilter.hg b/gtk/src/multifilter.hg
new file mode 100644
index 00000000..704610f6
--- /dev/null
+++ b/gtk/src/multifilter.hg
@@ -0,0 +1,85 @@
+/* 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.
+ *
+ * @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)
+
+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)
+};
+
+/** 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.
+ *
+ * @newin{3,98}
+ */
+class GTKMM_API AnyFilter : public MultiFilter
+{
+  _CLASS_GOBJECT(AnyFilter, GtkAnyFilter, GTK_ANY_FILTER, Gtk::MultiFilter, GtkMultiFilter, , , GTKMM_API)
+
+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.
+ *
+ * @newin{3,98}
+ */
+class GTKMM_API EveryFilter : public MultiFilter
+{
+  _CLASS_GOBJECT(EveryFilter, GtkEveryFilter, GTK_EVERY_FILTER, Gtk::MultiFilter, GtkMultiFilter, , , 
GTKMM_API)
+
+protected:
+  _CTOR_DEFAULT
+
+public:
+  _WRAP_CREATE()
+};
+
+} // namespace Gtk


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]