[gtkmm/selectionfiltermodel] Add Gtk::SelectionFilterModel




commit 770407e706c22481cf263f84cd4c4a9f350eff29
Author: Andreas Persson <andreasp56 outlook com>
Date:   Sun Oct 4 09:22:07 2020 +0200

    Add Gtk::SelectionFilterModel

 .gitignore                                |  2 ++
 gtk/gtkmm.h                               |  1 +
 gtk/gtkmm/meson.build                     |  1 +
 gtk/src/filelist.am                       |  1 +
 gtk/src/gtk_signals.defs                  | 11 +++++++
 gtk/src/selectionfiltermodel.ccg          | 17 ++++++++++
 gtk/src/selectionfiltermodel.hg           | 55 +++++++++++++++++++++++++++++++
 tools/extra_defs_gen/generate_defs_gtk.cc |  1 +
 8 files changed, 89 insertions(+)
---
diff --git a/.gitignore b/.gitignore
index 9e61c4a1..4448b726 100644
--- a/.gitignore
+++ b/.gitignore
@@ -499,6 +499,8 @@ gtk/gtkmm/searchentry.cc
 gtk/gtkmm/searchentry.h
 gtk/gtkmm/selectiondata.cc
 gtk/gtkmm/selectiondata.h
+gtk/gtkmm/selectionfiltermodel.cc
+gtk/gtkmm/selectionfiltermodel.h
 gtk/gtkmm/selectionmodel.cc
 gtk/gtkmm/selectionmodel.h
 gtk/gtkmm/separator.cc
diff --git a/gtk/gtkmm.h b/gtk/gtkmm.h
index 8496ba92..08bea86b 100644
--- a/gtk/gtkmm.h
+++ b/gtk/gtkmm.h
@@ -245,6 +245,7 @@ extern const int gtkmm_micro_version;
 #include <gtkmm/searchbar.h>
 #include <gtkmm/searchentry.h>
 #include <gtkmm/separator.h>
+#include <gtkmm/selectionfiltermodel.h>
 #include <gtkmm/settings.h>
 #include <gtkmm/shortcutcontroller.h>
 #include <gtkmm/shortcutlabel.h>
diff --git a/gtk/gtkmm/meson.build b/gtk/gtkmm/meson.build
index 25a3feda..4aabad5f 100644
--- a/gtk/gtkmm/meson.build
+++ b/gtk/gtkmm/meson.build
@@ -200,6 +200,7 @@ gtkmm_any_hg_ccg_basenames = [
   'scrolledwindow',
   'searchbar',
   'searchentry',
+  'selectionfiltermodel',
   'selectionmodel',
   'separator',
   'settings',
diff --git a/gtk/src/filelist.am b/gtk/src/filelist.am
index 18d091f8..774a8a3b 100644
--- a/gtk/src/filelist.am
+++ b/gtk/src/filelist.am
@@ -185,6 +185,7 @@ gtkmm_files_any_hg =                \
        scrolledwindow.hg       \
        searchbar.hg            \
        searchentry.hg          \
+       selectionfiltermodel.hg \
        selectionmodel.hg \
        separator.hg            \
        settings.hg             \
diff --git a/gtk/src/gtk_signals.defs b/gtk/src/gtk_signals.defs
index b1a0bc02..2d96d981 100644
--- a/gtk/src/gtk_signals.defs
+++ b/gtk/src/gtk_signals.defs
@@ -9019,6 +9019,17 @@
   )
 )
 
+;; From GtkSelectionFilterModel
+
+(define-property model
+  (of-object "GtkSelectionFilterModel")
+  (prop-type "GParamObject")
+  (docs "The model being filtered")
+  (readable #t)
+  (writable #t)
+  (construct-only #f)
+)
+
 ;; From GtkSeparator
 
 ;; From GtkSettings
diff --git a/gtk/src/selectionfiltermodel.ccg b/gtk/src/selectionfiltermodel.ccg
new file mode 100644
index 00000000..57b87fdc
--- /dev/null
+++ b/gtk/src/selectionfiltermodel.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/selectionfiltermodel.hg b/gtk/src/selectionfiltermodel.hg
new file mode 100644
index 00000000..050a1253
--- /dev/null
+++ b/gtk/src/selectionfiltermodel.hg
@@ -0,0 +1,55 @@
+/* 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
+ * @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)
+  _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("model", Glib::RefPtr<SelectionModel>)
+};
+
+} // namespace Gtk
diff --git a/tools/extra_defs_gen/generate_defs_gtk.cc b/tools/extra_defs_gen/generate_defs_gtk.cc
index 94d90ce7..e6b0356e 100644
--- a/tools/extra_defs_gen/generate_defs_gtk.cc
+++ b/tools/extra_defs_gen/generate_defs_gtk.cc
@@ -205,6 +205,7 @@ int main(int /* argc */, char** /* argv */)
             << get_defs( GTK_TYPE_SEARCH_BAR )
             << get_defs( GTK_TYPE_SEARCH_ENTRY )
             << get_defs( GTK_TYPE_SELECTION_MODEL )
+            << get_defs( GTK_TYPE_SELECTION_FILTER_MODEL )
             << get_defs( GTK_TYPE_SEPARATOR )
             << get_defs( GTK_TYPE_SETTINGS )
             << get_defs( GTK_TYPE_SHORTCUT )


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