[gtkmm: 1/3] Add Gtk::ColumnView
- From: Kjell Ahlstedt <kjellahl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtkmm: 1/3] Add Gtk::ColumnView
- Date: Tue, 4 Aug 2020 09:19:29 +0000 (UTC)
commit 4c8925e594e977d78d3dda78fe5e2f8e61963061
Author: Andreas Persson <andreasp56 outlook com>
Date: Sun Aug 2 17:49:08 2020 +0200
Add Gtk::ColumnView
Add bindings for ColumnView and its help class ColumnViewColumn. Also
include a binding for Gtk::Sorter, which maybe isn't complete: the
Sorter::compare method and vfunc have gpointers as arguments to raw Gtk
objects. I'm not sure a proper gtkmm wrap there is a good idea, because
of perfomance reasons.
gtk/gtkmm.h | 1 +
gtk/gtkmm/meson.build | 3 +
gtk/src/columnview.ccg | 17 +++
gtk/src/columnview.hg | 115 ++++++++++++++++++
gtk/src/columnviewcolumn.ccg | 17 +++
gtk/src/columnviewcolumn.hg | 97 ++++++++++++++++
gtk/src/enums.hg | 1 +
gtk/src/filelist.am | 3 +
gtk/src/gtk_docs_override.xml | 1 +
gtk/src/gtk_extra_objects.defs | 18 +++
gtk/src/gtk_signals.defs | 187 ++++++++++++++++++++++++++++++
gtk/src/gtk_vfuncs.defs | 16 +++
gtk/src/sorter.ccg | 20 ++++
gtk/src/sorter.hg | 70 +++++++++++
tools/extra_defs_gen/generate_defs_gtk.cc | 3 +
tools/m4/convert_gtk.m4 | 5 +
16 files changed, 574 insertions(+)
---
diff --git a/gtk/gtkmm.h b/gtk/gtkmm.h
index 52804e9e..050a24bf 100644
--- a/gtk/gtkmm.h
+++ b/gtk/gtkmm.h
@@ -128,6 +128,7 @@ extern const int gtkmm_micro_version;
#include <gtkmm/colorbutton.h>
#include <gtkmm/colorchooser.h>
#include <gtkmm/colorchooserdialog.h>
+#include <gtkmm/columnview.h>
#include <gtkmm/combobox.h>
#include <gtkmm/comboboxtext.h>
#include <gtkmm/constraintlayout.h>
diff --git a/gtk/gtkmm/meson.build b/gtk/gtkmm/meson.build
index 4c3dce00..06508cb8 100644
--- a/gtk/gtkmm/meson.build
+++ b/gtk/gtkmm/meson.build
@@ -72,6 +72,8 @@ gtkmm_any_hg_ccg_basenames = [
'colorbutton',
'colorchooser',
'colorchooserdialog',
+ 'columnview',
+ 'columnviewcolumn',
'combobox',
'comboboxtext',
'constraint',
@@ -205,6 +207,7 @@ gtkmm_any_hg_ccg_basenames = [
'singleselection',
'sizegroup',
'snapshot',
+ 'sorter',
'spinbutton',
'spinner',
'stack',
diff --git a/gtk/src/columnview.ccg b/gtk/src/columnview.ccg
new file mode 100644
index 00000000..57b87fdc
--- /dev/null
+++ b/gtk/src/columnview.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/columnview.hg b/gtk/src/columnview.hg
new file mode 100644
index 00000000..b67af033
--- /dev/null
+++ b/gtk/src/columnview.hg
@@ -0,0 +1,115 @@
+/* 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/widget.h>
+#include <giomm/listmodel.h>
+#include <gtkmm/columnviewcolumn.h>
+#include <gtkmm/scrollable.h>
+
+_DEFS(gtkmm,gtk)
+_PINCLUDE(gtkmm/private/widget_p.h)
+
+namespace Gtk
+{
+
+class ColumnViewColumn;
+class Sorter;
+
+/** A widget for displaying lists in multiple columns.
+ *
+ * %Gtk::ColumnView is a widget to present a view into a large dynamic list of items
+ * using multiple columns with headers.
+ *
+ * %Gtk::ColumnView uses the factories of its columns to generate a cell widget for
+ * each column, for each visible item and displays them together as the row for
+ * this item. The property_show_row_separators() and
+ * property_show_column_separators() properties offer a simple way to display
+ * separators between the rows or columns.
+ *
+ * %Gtk::ColumnView allows the user to select items according to the selection
+ * characteristics of the model. If the provided model is not a Gtk::SelectionModel,
+ * %Gtk::ColumnView will wrap it in a Gtk::SingleSelection. For models that allow
+ * multiple selected items, it is possible to turn on *rubberband selection*,
+ * using set_enable_rubberband().
+ *
+ * The column view supports sorting that can be customized by the user by
+ * clicking on column headers. To set this up, the Gtk::Sorter returned by
+ * get_sorter() must be attached to a sort model for the data
+ * that the view is showing, and the columns must have sorters attached to them
+ * by calling Gtk::ColumnViewColumn::set_sorter(). The initial sort order can be
+ * set with sort_by_column().
+ *
+ * The column view also supports interactive resizing and reordering of
+ * columns, via Drag-and-Drop of the column headers. This can be enabled or
+ * disabled with the property_reorderable() and
+ * Gtk::ColumnViewColumn::property_resizable() properties.
+ *
+ * @see Gtk::ColumnViewColumn, Gtk::TreeView
+ *
+ * @ingroup Widgets
+ *
+ * @newin{3,98}
+ */
+class GTKMM_API ColumnView : public Widget, public Scrollable
+{
+ _CLASS_GTKOBJECT(ColumnView, GtkColumnView, GTK_COLUMN_VIEW, Gtk::Widget, GtkWidget, , , GTKMM_API)
+ _IMPLEMENTS_INTERFACE(Scrollable)
+ _STRUCT_NOT_HIDDEN
+
+public:
+ _WRAP_CTOR(ColumnView(const Glib::RefPtr<Gio::ListModel>& model = {}), gtk_column_view_new)
+
+ _WRAP_METHOD(Glib::RefPtr<Gio::ListModel> get_columns(), gtk_column_view_get_columns, refreturn)
+ _WRAP_METHOD(Glib::RefPtr<const Gio::ListModel> get_columns() const, gtk_column_view_get_columns,
refreturn, constversion)
+#m4 _CONVERSION(`const Glib::RefPtr<ColumnViewColumn>&', `GtkColumnViewColumn*', __CONVERT_REFPTR_TO_P)
+ _WRAP_METHOD(void append_column(const Glib::RefPtr<ColumnViewColumn>& column),
gtk_column_view_append_column)
+ _WRAP_METHOD(void remove_column(const Glib::RefPtr<ColumnViewColumn>& column),
gtk_column_view_remove_column)
+ _WRAP_METHOD(void instert_column(guint position, const Glib::RefPtr<ColumnViewColumn>& column),
gtk_column_view_insert_column)
+
+ _WRAP_METHOD(Glib::RefPtr<Gio::ListModel> get_model(), gtk_column_view_get_model, refreturn)
+ _WRAP_METHOD(Glib::RefPtr<const Gio::ListModel> get_model() const, gtk_column_view_get_model, refreturn,
constversion)
+ _WRAP_METHOD(void set_model(const Glib::RefPtr<Gio::ListModel>& model), gtk_column_view_set_model)
+
+ _WRAP_METHOD(bool get_show_row_separators() const, gtk_column_view_get_show_row_separators)
+ _WRAP_METHOD(void set_show_row_separators(bool show_separators = true),
gtk_column_view_set_show_row_separators)
+
+ _WRAP_METHOD(bool get_show_column_separators() const, gtk_column_view_get_show_column_separators)
+ _WRAP_METHOD(void set_show_column_separators(bool show_separators = true),
gtk_column_view_set_show_column_separators)
+
+ _WRAP_METHOD(Glib::RefPtr<Sorter> get_sorter(), gtk_column_view_get_sorter, refreturn)
+ _WRAP_METHOD(Glib::RefPtr<const Sorter> get_sorter() const, gtk_column_view_get_sorter, refreturn,
constversion)
+ _WRAP_METHOD(void sort_by_column(const Glib::RefPtr<ColumnViewColumn>& column, SortType direction),
gtk_column_view_sort_by_column)
+
+ _WRAP_METHOD(void set_single_click_activate(bool single_click_activate = true),
gtk_column_view_set_single_click_activate)
+ _WRAP_METHOD(bool get_single_click_activate() const, gtk_column_view_get_single_click_activate)
+ _WRAP_METHOD(void set_reorderable(bool reorderable = true), gtk_column_view_set_reorderable)
+ _WRAP_METHOD(bool get_reorderable() const, gtk_column_view_get_reorderable)
+ _WRAP_METHOD(void set_enable_rubberband(bool enable_rubberband = true),
gtk_column_view_set_enable_rubberband)
+ _WRAP_METHOD(bool get_enable_rubberband() const, gtk_column_view_get_enable_rubberband)
+
+ _WRAP_PROPERTY("columns", Glib::RefPtr<Gio::ListModel>)
+ _WRAP_PROPERTY("model", Glib::RefPtr<Gio::ListModel>)
+ _WRAP_PROPERTY("show-row-separators", bool)
+ _WRAP_PROPERTY("show-column-separators", bool)
+ _WRAP_PROPERTY("sorter", Glib::RefPtr<Sorter>)
+ _WRAP_PROPERTY("single-click-activate", bool)
+ _WRAP_PROPERTY("reorderable", bool)
+ _WRAP_PROPERTY("enable-rubberband", bool)
+
+ _WRAP_SIGNAL(void activate(guint pos), "activate", no_default_handler)
+};
+
+} // namespace Gtk
diff --git a/gtk/src/columnviewcolumn.ccg b/gtk/src/columnviewcolumn.ccg
new file mode 100644
index 00000000..57b87fdc
--- /dev/null
+++ b/gtk/src/columnviewcolumn.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/columnviewcolumn.hg b/gtk/src/columnviewcolumn.hg
new file mode 100644
index 00000000..8949d04b
--- /dev/null
+++ b/gtk/src/columnviewcolumn.hg
@@ -0,0 +1,97 @@
+/* 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 <glibmm/object.h>
+#include <gtkmm/listitemfactory.h>
+#include <giomm/menumodel.h>
+#include <gtkmm/columnview.h>
+#include <gtkmm/sorter.h>
+
+_DEFS(gtkmm,gtk)
+_PINCLUDE(glibmm/private/object_p.h)
+
+namespace Gtk
+{
+class ColumnView;
+
+/** The column added to Gtk::ColumnView.
+ *
+ * %Gtk::ColumnViewColumn represents the columns being added to Gtk::ColumnView.
+ *
+ * @see Gtk::ColumnView
+ */
+class GTKMM_API ColumnViewColumn : public Glib::Object
+{
+ _CLASS_GOBJECT(ColumnViewColumn, GtkColumnViewColumn, GTK_COLUMN_VIEW_COLUMN, Glib::Object, GObject, , ,
GTKMM_API)
+
+protected:
+ _WRAP_CTOR(ColumnViewColumn(const Glib::ustring& title), gtk_column_view_column_new)
+ _WRAP_CTOR(ColumnViewColumn(const Glib::ustring& title, const Glib::RefPtr<ListItemFactory>& factory),
+ gtk_column_view_column_new_with_factory)
+
+public:
+ _WRAP_CREATE(const Glib::ustring& title)
+ _WRAP_CREATE(const Glib::ustring& title, const Glib::RefPtr<ListItemFactory>& factory)
+
+#m4 _CONVERSION(`GtkColumnView*',`ColumnView*',__RP2P)
+ _WRAP_METHOD(ColumnView* get_column_view(), gtk_column_view_column_get_column_view)
+ _WRAP_METHOD(const ColumnView* get_column_view() const, gtk_column_view_column_get_column_view,
constversion)
+ _WRAP_METHOD(void set_factory(const Glib::RefPtr<ListItemFactory>& factory),
+ gtk_column_view_column_set_factory)
+ _WRAP_METHOD(Glib::RefPtr<ListItemFactory> get_factory(), gtk_column_view_column_get_factory, refreturn)
+ _WRAP_METHOD(Glib::RefPtr<const ListItemFactory> get_factory() const,
+ gtk_column_view_column_get_factory, refreturn, constversion)
+
+ _WRAP_METHOD(void set_title(const Glib::ustring& title), gtk_column_view_column_set_title)
+ _WRAP_METHOD(Glib::ustring get_title() const, gtk_column_view_column_get_title)
+
+ _WRAP_METHOD(void set_sorter(const Glib::RefPtr<Sorter>& sorter), gtk_column_view_column_set_sorter)
+ _WRAP_METHOD(Glib::RefPtr<Sorter> get_sorter(), gtk_column_view_column_get_sorter, refreturn)
+ _WRAP_METHOD(Glib::RefPtr<const Sorter> get_sorter() const, gtk_column_view_column_get_sorter, refreturn,
constversion)
+
+ _WRAP_METHOD(void set_visible(bool visible = true), gtk_column_view_column_set_visible)
+ _WRAP_METHOD(bool get_visible() const, gtk_column_view_column_get_visible)
+
+ _WRAP_METHOD(void set_header_menu(const Glib::RefPtr<Gio::MenuModel>& model),
+ gtk_column_view_column_set_header_menu)
+ _WRAP_METHOD(Glib::RefPtr<Gio::MenuModel> get_header_menu(),
+ gtk_column_view_column_get_header_menu, refreturn)
+ _WRAP_METHOD(Glib::RefPtr<const Gio::MenuModel> get_header_menu() const,
+ gtk_column_view_column_get_header_menu, refreturn, constversion)
+
+ _WRAP_METHOD(void set_fixed_width(int fixed_width), gtk_column_view_column_set_fixed_width)
+ _WRAP_METHOD(int get_fixed_width() const, gtk_column_view_column_get_fixed_width)
+
+ _WRAP_METHOD(void set_resizable(bool resizable = true), gtk_column_view_column_set_resizable)
+ _WRAP_METHOD(bool get_resizable() const, gtk_column_view_column_get_resizable)
+
+ _WRAP_METHOD(void set_expand(bool expand = true), gtk_column_view_column_set_expand)
+ _WRAP_METHOD(bool get_expand() const, gtk_column_view_column_get_expand)
+
+ _WRAP_PROPERTY("column-view", ColumnView*)
+ _WRAP_PROPERTY("factory", Glib::RefPtr<ListItemFactory>)
+ _WRAP_PROPERTY("title", Glib::ustring)
+ _WRAP_PROPERTY("sorter", Glib::RefPtr<Sorter>)
+ _WRAP_PROPERTY("visible", bool)
+ _WRAP_PROPERTY("header-menu", Glib::RefPtr<Gio::MenuModel>)
+ _WRAP_PROPERTY("resizable", bool)
+ _WRAP_PROPERTY("expand", bool)
+ _WRAP_PROPERTY("fixed-width", int)
+};
+
+} // namespace Gtk
diff --git a/gtk/src/enums.hg b/gtk/src/enums.hg
index aa1ba0f4..d87d091f 100644
--- a/gtk/src/enums.hg
+++ b/gtk/src/enums.hg
@@ -52,6 +52,7 @@ _WRAP_ENUM(SelectionMode, GtkSelectionMode, decl_prefix GTKMM_API)
_WRAP_ENUM(StackTransitionType, GtkStackTransitionType, decl_prefix GTKMM_API)
_WRAP_ENUM(WrapMode, GtkWrapMode, decl_prefix GTKMM_API)
_WRAP_ENUM(SortType, GtkSortType, decl_prefix GTKMM_API)
+_WRAP_ENUM(Ordering, GtkOrdering, decl_prefix GTKMM_API)
_WRAP_ENUM(PageOrientation, GtkPageOrientation, decl_prefix GTKMM_API)
_WRAP_ENUM(SensitivityType, GtkSensitivityType, decl_prefix GTKMM_API)
_WRAP_ENUM(SizeRequestMode, GtkSizeRequestMode, decl_prefix GTKMM_API)
diff --git a/gtk/src/filelist.am b/gtk/src/filelist.am
index a3c72c1a..c7063948 100644
--- a/gtk/src/filelist.am
+++ b/gtk/src/filelist.am
@@ -57,6 +57,8 @@ gtkmm_files_any_hg = \
colorbutton.hg \
colorchooser.hg \
colorchooserdialog.hg \
+ columnview.hg \
+ columnviewcolumn.hg \
combobox.hg \
comboboxtext.hg \
constraint.hg \
@@ -190,6 +192,7 @@ gtkmm_files_any_hg = \
singleselection.hg \
sizegroup.hg \
snapshot.hg \
+ sorter.hg \
spinbutton.hg \
spinner.hg \
stack.hg \
diff --git a/gtk/src/gtk_docs_override.xml b/gtk/src/gtk_docs_override.xml
index eee95bbb..1c16ae7a 100644
--- a/gtk/src/gtk_docs_override.xml
+++ b/gtk/src/gtk_docs_override.xml
@@ -125,6 +125,7 @@
<substitute_enumerator_name from_prefix="GTK_CONSTRAINT_ATTRIBUTE_" to_prefix="Gtk::Constraint::Attribute::"
/>
<substitute_enumerator_name from_prefix="GTK_CONSTRAINT_RELATION_" to_prefix="Gtk::Constraint::Relation::" />
<substitute_enumerator_name from_prefix="GTK_CONSTRAINT_STRENGTH_" to_prefix="Gtk::Constraint::Strength::" />
+<substitute_enumerator_name from_prefix="GTK_ORDERING_" to_prefix="Gtk::Ordering::" />
<!-- GdkWindowWindowClass is not wrapped in gtkmm. Don't substitute its enumerator names. -->
<substitute_enumerator_name from="GDK_INPUT_ONLY" to="GDK_INPUT_ONLY" />
<substitute_enumerator_name from="GDK_INPUT_OUTPUT" to="GDK_INPUT_OUTPUT" />
diff --git a/gtk/src/gtk_extra_objects.defs b/gtk/src/gtk_extra_objects.defs
index 1531af62..455b44ca 100644
--- a/gtk/src/gtk_extra_objects.defs
+++ b/gtk/src/gtk_extra_objects.defs
@@ -90,6 +90,18 @@
(gtype-id "GTK_TYPE_COLOR_CHOOSER")
)
+(define-object ColumnView
+ (in-module "Gtk")
+ (c-name "GtkColumnView")
+ (gtype-id "GTK_TYPE_COLUMN_VIEW")
+)
+
+(define-object ColumnViewColumn
+ (in-module "Gtk")
+ (c-name "GtkColumnViewColumn")
+ (gtype-id "GTK_TYPE_COLUMN_VIEW_COLUMN")
+)
+
(define-object ComboBoxText
(in-module "Gtk")
(c-name "GtkComboBoxText")
@@ -490,6 +502,12 @@
(gtype-id "GTK_TYPE_SNAPSHOT")
)
+(define-object Sorter
+ (in-module "Gtk")
+ (c-name "GtkSorter")
+ (gtype-id "GTK_TYPE_SORTER")
+)
+
(define-object SpinButton
(in-module "Gtk")
(c-name "GtkSpinButton")
diff --git a/gtk/src/gtk_signals.defs b/gtk/src/gtk_signals.defs
index ed916ed2..f0516ad2 100644
--- a/gtk/src/gtk_signals.defs
+++ b/gtk/src/gtk_signals.defs
@@ -2275,6 +2275,182 @@
(default-value "FALSE")
)
+;; From GtkColumnView
+
+(define-signal activate
+ (of-object "GtkColumnView")
+ (return-type "void")
+ (flags "Run Last")
+ (parameters
+ '("guint" "p0")
+ )
+)
+
+(define-property columns
+ (of-object "GtkColumnView")
+ (prop-type "GParamObject")
+ (docs "List of columns")
+ (readable #t)
+ (writable #f)
+ (construct-only #f)
+)
+
+(define-property model
+ (of-object "GtkColumnView")
+ (prop-type "GParamObject")
+ (docs "Model for the items displayed")
+ (readable #t)
+ (writable #t)
+ (construct-only #f)
+)
+
+(define-property show-row-separators
+ (of-object "GtkColumnView")
+ (prop-type "GParamBoolean")
+ (docs "Show separators between rows")
+ (readable #t)
+ (writable #t)
+ (construct-only #f)
+ (default-value "FALSE")
+)
+
+(define-property show-column-separators
+ (of-object "GtkColumnView")
+ (prop-type "GParamBoolean")
+ (docs "Show separators between columns")
+ (readable #t)
+ (writable #t)
+ (construct-only #f)
+ (default-value "FALSE")
+)
+
+(define-property sorter
+ (of-object "GtkColumnView")
+ (prop-type "GParamObject")
+ (docs "Sorter with sorting choices of the user")
+ (readable #t)
+ (writable #f)
+ (construct-only #f)
+)
+
+(define-property single-click-activate
+ (of-object "GtkColumnView")
+ (prop-type "GParamBoolean")
+ (docs "Activate rows on single click")
+ (readable #t)
+ (writable #t)
+ (construct-only #f)
+ (default-value "FALSE")
+)
+
+(define-property reorderable
+ (of-object "GtkColumnView")
+ (prop-type "GParamBoolean")
+ (docs "Whether columns are reorderable")
+ (readable #t)
+ (writable #t)
+ (construct-only #f)
+ (default-value "TRUE")
+)
+
+(define-property enable-rubberband
+ (of-object "GtkColumnView")
+ (prop-type "GParamBoolean")
+ (docs "Allow selecting items by dragging with the mouse")
+ (readable #t)
+ (writable #t)
+ (construct-only #f)
+ (default-value "FALSE")
+)
+
+;; From GtkColumnViewColumn
+
+(define-property column-view
+ (of-object "GtkColumnViewColumn")
+ (prop-type "GParamObject")
+ (docs "Column view this column is a part of")
+ (readable #t)
+ (writable #f)
+ (construct-only #f)
+)
+
+(define-property factory
+ (of-object "GtkColumnViewColumn")
+ (prop-type "GParamObject")
+ (docs "Factory for populating list items")
+ (readable #t)
+ (writable #t)
+ (construct-only #f)
+)
+
+(define-property title
+ (of-object "GtkColumnViewColumn")
+ (prop-type "GParamString")
+ (docs "Title displayed in the header")
+ (readable #t)
+ (writable #t)
+ (construct-only #f)
+ (default-value "")
+)
+
+(define-property sorter
+ (of-object "GtkColumnViewColumn")
+ (prop-type "GParamObject")
+ (docs "Sorter for sorting items according to this column")
+ (readable #t)
+ (writable #t)
+ (construct-only #f)
+)
+
+(define-property visible
+ (of-object "GtkColumnViewColumn")
+ (prop-type "GParamBoolean")
+ (docs "Whether this column is visible")
+ (readable #t)
+ (writable #t)
+ (construct-only #f)
+ (default-value "TRUE")
+)
+
+(define-property header-menu
+ (of-object "GtkColumnViewColumn")
+ (prop-type "GParamObject")
+ (docs "Menu to use on the title of this column")
+ (readable #t)
+ (writable #t)
+ (construct-only #f)
+)
+
+(define-property resizable
+ (of-object "GtkColumnViewColumn")
+ (prop-type "GParamBoolean")
+ (docs "Whether this column is resizable")
+ (readable #t)
+ (writable #t)
+ (construct-only #f)
+ (default-value "FALSE")
+)
+
+(define-property expand
+ (of-object "GtkColumnViewColumn")
+ (prop-type "GParamBoolean")
+ (docs "column gets share of extra width")
+ (readable #t)
+ (writable #t)
+ (construct-only #f)
+ (default-value "FALSE")
+)
+
+(define-property fixed-width
+ (of-object "GtkColumnViewColumn")
+ (prop-type "GParamInt")
+ (docs "Fixed width of this column")
+ (readable #t)
+ (writable #t)
+ (construct-only #f)
+ (default-value "-1")
+)
+
;; From GtkComboBox
(define-signal changed
@@ -9531,6 +9707,17 @@
(default-value "GTK_SIZE_GROUP_HORIZONTAL")
)
+;; From GtkSorter
+
+(define-signal changed
+ (of-object "GtkSorter")
+ (return-type "void")
+ (flags "Run Last")
+ (parameters
+ '("GtkSorterChange" "p0")
+ )
+)
+
;; From GtkSpinner
(define-property spinning
diff --git a/gtk/src/gtk_vfuncs.defs b/gtk/src/gtk_vfuncs.defs
index b64cdc5e..00d3a581 100644
--- a/gtk/src/gtk_vfuncs.defs
+++ b/gtk/src/gtk_vfuncs.defs
@@ -572,6 +572,22 @@
)
)
+; GtkSorter
+
+(define-vfunc compare
+ (of-object "GtkSorter")
+ (return-type "GtkOrdering")
+ (parameters
+ '("gpointer" "item1")
+ '("gpointer" "item2")
+ )
+)
+
+(define-vfunc get_order
+ (of-object "GtkSorter")
+ (return-type "GtkSorterOrder")
+)
+
; GtkToolShell
(define-vfunc get_orientation
diff --git a/gtk/src/sorter.ccg b/gtk/src/sorter.ccg
new file mode 100644
index 00000000..60c8f0be
--- /dev/null
+++ b/gtk/src/sorter.ccg
@@ -0,0 +1,20 @@
+/* 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>
+
+using Order = Gtk::Sorter::Order;
+using Change = Gtk::Sorter::Change;
diff --git a/gtk/src/sorter.hg b/gtk/src/sorter.hg
new file mode 100644
index 00000000..8302f297
--- /dev/null
+++ b/gtk/src/sorter.hg
@@ -0,0 +1,70 @@
+/* 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/enums.h>
+
+_DEFS(gtkmm,gtk)
+_PINCLUDE(glibmm/private/object_p.h)
+
+namespace Gtk
+{
+
+/** Sorting items.
+ *
+ * %Gtk::Sorter is the way to describe sorting criteria.
+ * Its primary user is Gtk::SortListModel.
+ *
+ * The model will use a sorter to determine the order in which its items should appear
+ * by calling compare() for pairs of items.
+ *
+ * Sorters may change their sorting behavior through their lifetime. In that case,
+ * they will emit the singal_changed() signal to notify that the sort order is
+ * no longer valid and should be updated by calling compare() again.
+ *
+ * GTK provides various pre-made sorter implementations for common sorting operations.
+ * Gtk::ColumnView has built-in support for sorting lists via the
+ * Gtk::ColumnViewColumn::property_sorter(), where the user can change the sorting by
+ * clicking on list headers.
+ *
+ * Of course, in particular for large lists, it is also possible to subclass %Gtk::Sorter
+ * and provide one's own sorter.
+ *
+ * @see Gtk::SortListModel
+ * @newin{3,98}
+ */
+class GTKMM_API Sorter : public Glib::Object
+{
+ _CLASS_GOBJECT(Sorter, GtkSorter, GTK_SORTER, Glib::Object, GObject, , , GTKMM_API)
+
+protected:
+ _CTOR_DEFAULT
+
+public:
+ _WRAP_ENUM(Order, GtkSorterOrder, decl_prefix GTKMM_API)
+ _WRAP_ENUM(Change, GtkSorterChange, decl_prefix GTKMM_API)
+
+ _WRAP_METHOD(Ordering compare(gpointer item1, gpointer item2), gtk_sorter_compare)
+ _WRAP_METHOD(Order get_order() const, gtk_sorter_get_order)
+ _WRAP_METHOD(void changed(Change change), gtk_sorter_changed)
+
+ _WRAP_SIGNAL(void changed(Change change), "changed", no_default_handler)
+
+protected:
+ _WRAP_VFUNC(Ordering compare(gpointer item1, gpointer item2), compare)
+ _WRAP_VFUNC(Order get_order(), get_order)
+};
+
+} // namespace Gtk
diff --git a/tools/extra_defs_gen/generate_defs_gtk.cc b/tools/extra_defs_gen/generate_defs_gtk.cc
index 3c7f18b3..7d5c337e 100644
--- a/tools/extra_defs_gen/generate_defs_gtk.cc
+++ b/tools/extra_defs_gen/generate_defs_gtk.cc
@@ -81,6 +81,8 @@ int main(int /* argc */, char** /* argv */)
<< get_defs( GTK_TYPE_COLOR_BUTTON )
<< get_defs( GTK_TYPE_COLOR_CHOOSER )
<< get_defs( GTK_TYPE_COLOR_CHOOSER_DIALOG )
+ << get_defs( GTK_TYPE_COLUMN_VIEW )
+ << get_defs( GTK_TYPE_COLUMN_VIEW_COLUMN )
<< get_defs( GTK_TYPE_COMBO_BOX )
<< get_defs( GTK_TYPE_CONSTRAINT )
<< get_defs( GTK_TYPE_CONSTRAINT_GUIDE )
@@ -207,6 +209,7 @@ int main(int /* argc */, char** /* argv */)
<< get_defs( GTK_TYPE_SIGNAL_LIST_ITEM_FACTORY )
<< get_defs( GTK_TYPE_SINGLE_SELECTION )
<< get_defs( GTK_TYPE_SIZE_GROUP )
+ << get_defs( GTK_TYPE_SORTER )
<< get_defs( GTK_TYPE_SPINNER )
<< get_defs( GTK_TYPE_SPIN_BUTTON )
<< get_defs( GTK_TYPE_STACK )
diff --git a/tools/m4/convert_gtk.m4 b/tools/m4/convert_gtk.m4
index 08464bfc..b5dadec3 100644
--- a/tools/m4/convert_gtk.m4
+++ b/tools/m4/convert_gtk.m4
@@ -58,6 +58,7 @@ _CONV_ENUM(Gtk,MessageType)
_CONV_ENUM(Gtk,MovementStep)
_CONV_ENUM(Gtk,NotebookTab)
_CONV_ENUM(Gtk,Orientation)
+_CONV_ENUM(Gtk,Ordering)
_CONV_ENUM(Gtk,Overflow)
_CONV_ENUM(Gtk,PackType)
_CONV_ENUM(Gtk,PanDirection)
@@ -78,6 +79,8 @@ _CONV_ENUM(Gtk,SelectionMode)
_CONV_ENUM(Gtk,ShortcutScope)
_CONV_ENUM(Gtk,ShortcutType)
_CONV_INCLASS_ENUM(Gtk,SizeGroup,Mode)
+_CONV_INCLASS_ENUM(Gtk,Sorter,Change)
+_CONV_INCLASS_ENUM(Gtk,Sorter,Order)
_CONV_ENUM(Gtk,SortType)
_CONV_INCLASS_ENUM(Gtk,SpinButton,UpdatePolicy)
_CONV_ENUM(Gtk,SpinType)
@@ -584,3 +587,5 @@ _CONVERSION(`const Glib::RefPtr<ConstraintTarget>&',`gpointer',__CONVERT_REFPTR_
_CONVERSION(`const Glib::RefPtr<ListItemFactory>&', `GtkListItemFactory*', __CONVERT_REFPTR_TO_P)
_CONVERSION(`GtkListItemFactory*',`Glib::RefPtr<ListItemFactory>',`Glib::wrap($3)')
_CONVERSION(`GtkStringObject*',`Glib::RefPtr<StringObject>',`Glib::wrap($3)')
+_CONVERSION(`const Glib::RefPtr<Sorter>&', `GtkSorter*', __CONVERT_REFPTR_TO_P)
+_CONVERSION(`GtkSorter*',`Glib::RefPtr<Sorter>',`Glib::wrap($3)')
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]