[gtkmm/boolfilter_multisorter] Add Gtk::BoolFilter and Gtk::MultiSorter
- From: Andreas Persson <andreasp src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtkmm/boolfilter_multisorter] Add Gtk::BoolFilter and Gtk::MultiSorter
- Date: Sat, 26 Sep 2020 08:44:41 +0000 (UTC)
commit 1356612b3397c31bb4197a7081e20bc79356e0f3
Author: Andreas Persson <andreasp56 outlook com>
Date: Sat Sep 26 10:43:02 2020 +0200
Add Gtk::BoolFilter and Gtk::MultiSorter
.gitignore | 4 +++
gtk/gtkmm.h | 2 ++
gtk/gtkmm/meson.build | 2 ++
gtk/src/boolfilter.ccg | 17 ++++++++++
gtk/src/boolfilter.hg | 54 +++++++++++++++++++++++++++++++
gtk/src/filelist.am | 2 ++
gtk/src/gtk_signals.defs | 27 ++++++++++++++++
gtk/src/multisorter.ccg | 17 ++++++++++
gtk/src/multisorter.hg | 49 ++++++++++++++++++++++++++++
tools/extra_defs_gen/generate_defs_gtk.cc | 1 +
tools/m4/convert_gtk.m4 | 3 ++
11 files changed, 178 insertions(+)
---
diff --git a/.gitignore b/.gitignore
index f31b4327..9e61c4a1 100644
--- a/.gitignore
+++ b/.gitignore
@@ -171,6 +171,8 @@ gtk/gtkmm/binlayout.cc
gtk/gtkmm/binlayout.h
gtk/gtkmm/bitset.cc
gtk/gtkmm/bitset.h
+gtk/gtkmm/boolfilter.cc
+gtk/gtkmm/boolfilter.h
gtk/gtkmm/border.cc
gtk/gtkmm/border.h
gtk/gtkmm/box.cc
@@ -415,6 +417,8 @@ gtk/gtkmm/modelbutton.cc
gtk/gtkmm/modelbutton.h
gtk/gtkmm/multiselection.cc
gtk/gtkmm/multiselection.h
+gtk/gtkmm/multisorter.cc
+gtk/gtkmm/multisorter.h
gtk/gtkmm/native.cc
gtk/gtkmm/native.h
gtk/gtkmm/nativedialog.cc
diff --git a/gtk/gtkmm.h b/gtk/gtkmm.h
index 520ddac1..8496ba92 100644
--- a/gtk/gtkmm.h
+++ b/gtk/gtkmm.h
@@ -104,6 +104,7 @@ extern const int gtkmm_micro_version;
#include <gtkmm/aspectframe.h>
#include <gtkmm/assistant.h>
#include <gtkmm/binlayout.h>
+#include <gtkmm/boolfilter.h>
#include <gtkmm/border.h>
#include <gtkmm/box.h>
#include <gtkmm/boxlayout.h>
@@ -204,6 +205,7 @@ extern const int gtkmm_micro_version;
#include <gtkmm/menubutton.h>
#include <gtkmm/messagedialog.h>
#include <gtkmm/multiselection.h>
+#include <gtkmm/multisorter.h>
#include <gtkmm/noselection.h>
#include <gtkmm/notebook.h>
#include <gtkmm/object.h>
diff --git a/gtk/gtkmm/meson.build b/gtk/gtkmm/meson.build
index f6519ec0..80c8d2ef 100644
--- a/gtk/gtkmm/meson.build
+++ b/gtk/gtkmm/meson.build
@@ -42,6 +42,7 @@ gtkmm_any_hg_ccg_basenames = [
'assistantpage',
'binlayout',
'bitset',
+ 'boolfilter',
'border',
'box',
'boxlayout',
@@ -163,6 +164,7 @@ gtkmm_any_hg_ccg_basenames = [
'menubutton',
'messagedialog',
'multiselection',
+ 'multisorter',
'native',
'nativedialog',
'noselection',
diff --git a/gtk/src/boolfilter.ccg b/gtk/src/boolfilter.ccg
new file mode 100644
index 00000000..57b87fdc
--- /dev/null
+++ b/gtk/src/boolfilter.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/boolfilter.hg b/gtk/src/boolfilter.hg
new file mode 100644
index 00000000..966ada5f
--- /dev/null
+++ b/gtk/src/boolfilter.hg
@@ -0,0 +1,54 @@
+/* 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/expression.h>
+
+_DEFS(gtkmm,gtk)
+_PINCLUDE(gtkmm/private/filter_p.h)
+
+namespace Gtk
+{
+
+/** Filtering by boolean expressions.
+ *
+ * %Gtk::BoolFilter is a simple filter that takes a boolean Gtk::Expression
+ * to determine whether to include items.
+ *
+ * @newin{3,98}
+ */
+class GTKMM_API BoolFilter : public Filter
+{
+ _CLASS_GOBJECT(BoolFilter, GtkBoolFilter, GTK_BOOL_FILTER, Gtk::Filter, GtkFilter, , , GTKMM_API)
+ _STRUCT_NOT_HIDDEN
+
+protected:
+ _WRAP_CTOR(BoolFilter(const Glib::RefPtr<Expression<bool>>& expression), gtk_bool_filter_new)
+
+public:
+ _WRAP_CREATE(const Glib::RefPtr<Expression<bool>>& expression)
+
+ _WRAP_METHOD(Glib::RefPtr<Expression<bool>> get_expression(), gtk_bool_filter_get_expression, refreturn)
+ _WRAP_METHOD(Glib::RefPtr<const Expression<bool>> get_expression() const, gtk_bool_filter_get_expression,
refreturn)
+ _WRAP_METHOD(void set_expression(const Glib::RefPtr<Expression<bool>>& expression),
gtk_bool_filter_set_expression)
+ _WRAP_METHOD(bool get_invert() const, gtk_bool_filter_get_invert)
+ _WRAP_METHOD(void set_invert(bool invert = true), gtk_bool_filter_set_invert)
+
+ _WRAP_PROPERTY("expression", Glib::RefPtr<Expression<bool>>)
+ _WRAP_PROPERTY("invert", bool)
+};
+
+} // namespace Gtk
diff --git a/gtk/src/filelist.am b/gtk/src/filelist.am
index 400b3647..18d091f8 100644
--- a/gtk/src/filelist.am
+++ b/gtk/src/filelist.am
@@ -27,6 +27,7 @@ gtkmm_files_any_hg = \
assistantpage.hg \
binlayout.hg \
bitset.hg \
+ boolfilter.hg \
border.hg \
box.hg \
boxlayout.hg \
@@ -148,6 +149,7 @@ gtkmm_files_any_hg = \
menubutton.hg \
messagedialog.hg \
multiselection.hg \
+ multisorter.hg \
native.hg \
nativedialog.hg \
noselection.hg \
diff --git a/gtk/src/gtk_signals.defs b/gtk/src/gtk_signals.defs
index 19d61b20..b1a0bc02 100644
--- a/gtk/src/gtk_signals.defs
+++ b/gtk/src/gtk_signals.defs
@@ -697,6 +697,27 @@
(default-value "FALSE")
)
+;; From GtkBoolFilter
+
+(define-property expression
+ (of-object "GtkBoolFilter")
+ (prop-type "GtkParamSpecExpression")
+ (docs "Expression to evaluate")
+ (readable #t)
+ (writable #t)
+ (construct-only #f)
+)
+
+(define-property invert
+ (of-object "GtkBoolFilter")
+ (prop-type "GParamBoolean")
+ (docs "If the expression result should be inverted")
+ (readable #t)
+ (writable #t)
+ (construct-only #f)
+ (default-value "FALSE")
+)
+
;; From GtkBox
(define-property spacing
@@ -7532,6 +7553,12 @@
;; From GtkPasswordEntry
+(define-signal activate
+ (of-object "GtkPasswordEntry")
+ (return-type "void")
+ (flags "Run Last, Action")
+)
+
(define-property placeholder-text
(of-object "GtkPasswordEntry")
(prop-type "GParamString")
diff --git a/gtk/src/multisorter.ccg b/gtk/src/multisorter.ccg
new file mode 100644
index 00000000..57b87fdc
--- /dev/null
+++ b/gtk/src/multisorter.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/multisorter.hg b/gtk/src/multisorter.hg
new file mode 100644
index 00000000..ab7a3142
--- /dev/null
+++ b/gtk/src/multisorter.hg
@@ -0,0 +1,49 @@
+/* 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/sorter.h>
+
+_DEFS(gtkmm,gtk)
+_PINCLUDE(gtkmm/private/sorter_p.h)
+
+namespace Gtk
+{
+
+/** Combining multiple sorters.
+ *
+ * %Gtk::MultiSorter combines multiple sorters by trying them
+ * in turn. If the first sorter compares two items as equal,
+ * the second is tried next, and so on.
+ *
+ * @newin{3,98}
+ */
+class GTKMM_API MultiSorter : public Sorter
+{
+ _CLASS_GOBJECT(MultiSorter, GtkMultiSorter, GTK_MULTI_SORTER, Gtk::Sorter, GtkSorter, , , GTKMM_API)
+ _STRUCT_NOT_HIDDEN
+
+protected:
+ _CTOR_DEFAULT
+
+public:
+ _WRAP_CREATE()
+
+#m4 _CONVERSION(`const Glib::RefPtr<Sorter>&', `GtkSorter*', `Glib::unwrap_copy($3)')
+ _WRAP_METHOD(void append(const Glib::RefPtr<Sorter>& sorter), gtk_multi_sorter_append)
+ _WRAP_METHOD(void remove(guint position), gtk_multi_sorter_remove)
+};
+
+} // namespace Gtk
diff --git a/tools/extra_defs_gen/generate_defs_gtk.cc b/tools/extra_defs_gen/generate_defs_gtk.cc
index a7b5b83b..94d90ce7 100644
--- a/tools/extra_defs_gen/generate_defs_gtk.cc
+++ b/tools/extra_defs_gen/generate_defs_gtk.cc
@@ -57,6 +57,7 @@ int main(int /* argc */, char** /* argv */)
<< get_defs( GTK_TYPE_ASPECT_FRAME )
<< get_defs( GTK_TYPE_ASSISTANT )
<< get_defs( GTK_TYPE_ASSISTANT_PAGE )
+ << get_defs( GTK_TYPE_BOOL_FILTER )
<< get_defs( GTK_TYPE_BOX )
<< get_defs( GTK_TYPE_BOX_LAYOUT )
<< get_defs( GTK_TYPE_BUILDER )
diff --git a/tools/m4/convert_gtk.m4 b/tools/m4/convert_gtk.m4
index 0218e224..30d06d5b 100644
--- a/tools/m4/convert_gtk.m4
+++ b/tools/m4/convert_gtk.m4
@@ -608,3 +608,6 @@ _CONVERSION(`GtkFilter*',`Glib::RefPtr<Filter>',`Glib::wrap($3)')
_CONVERSION(`const Glib::RefPtr<Expression<Glib::ustring>>&',`GtkExpression*',`(($3) ? ($3)->gobj() :
nullptr)')
_CONVERSION(`GtkExpression*',`Glib::RefPtr<Expression<Glib::ustring>>',`Glib::wrap<Glib::ustring>($3)')
_CONVERSION(`GtkExpression*',`Glib::RefPtr<const Expression<Glib::ustring>>',`Glib::wrap<Glib::ustring>($3)')
+_CONVERSION(`const Glib::RefPtr<Expression<bool>>&',`GtkExpression*',`(($3) ? ($3)->gobj() : nullptr)')
+_CONVERSION(`GtkExpression*',`Glib::RefPtr<Expression<bool>>',`Glib::wrap<bool>($3)')
+_CONVERSION(`GtkExpression*',`Glib::RefPtr<const Expression<bool>>',`Glib::wrap<bool>($3)')
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]