[gtkmm] Gdk, Gtk: Update for the latest gtk4 (add Gtk::Bitset, etc.)
- From: Kjell Ahlstedt <kjellahl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtkmm] Gdk, Gtk: Update for the latest gtk4 (add Gtk::Bitset, etc.)
- Date: Thu, 2 Jul 2020 10:48:09 +0000 (UTC)
commit 2c06453a0f937350e5c7740879db10624b8a1059
Author: Kjell Ahlstedt <kjellahlstedt gmail com>
Date: Thu Jul 2 12:40:53 2020 +0200
Gdk, Gtk: Update for the latest gtk4 (add Gtk::Bitset, etc.)
Add Gtk::Bitset and MultiSelection. Use Bitset in SelectionModel.
.gitignore | 4 +++
gdk/src/device.hg | 3 --
gdk/src/event.ccg | 1 +
gdk/src/event.hg | 4 +++
gdk/src/seat.hg | 2 --
gdk/src/surface.hg | 3 --
gtk/gtkmm.h | 1 +
gtk/gtkmm/meson.build | 2 ++
gtk/src/bitset.ccg | 17 +++++++++
gtk/src/bitset.hg | 85 ++++++++++++++++++++++++++++++++++++++++++++
gtk/src/filelist.am | 2 ++
gtk/src/multiselection.ccg | 17 +++++++++
gtk/src/multiselection.hg | 59 +++++++++++++++++++++++++++++++
gtk/src/scrolledwindow.hg | 1 -
gtk/src/selectionmodel.ccg | 88 ----------------------------------------------
gtk/src/selectionmodel.hg | 51 ++++++---------------------
gtk/src/widget.hg | 6 ----
tools/m4/convert_gtk.m4 | 5 +++
18 files changed, 208 insertions(+), 143 deletions(-)
---
diff --git a/.gitignore b/.gitignore
index 9b7772f6..4872f109 100644
--- a/.gitignore
+++ b/.gitignore
@@ -167,6 +167,8 @@ gtk/gtkmm/assistantpage.cc
gtk/gtkmm/assistantpage.h
gtk/gtkmm/binlayout.cc
gtk/gtkmm/binlayout.h
+gtk/gtkmm/bitset.cc
+gtk/gtkmm/bitset.h
gtk/gtkmm/border.cc
gtk/gtkmm/border.h
gtk/gtkmm/box.cc
@@ -381,6 +383,8 @@ gtk/gtkmm/messagedialog.cc
gtk/gtkmm/messagedialog.h
gtk/gtkmm/modelbutton.cc
gtk/gtkmm/modelbutton.h
+gtk/gtkmm/multiselection.cc
+gtk/gtkmm/multiselection.h
gtk/gtkmm/native.cc
gtk/gtkmm/native.h
gtk/gtkmm/nativedialog.cc
diff --git a/gdk/src/device.hg b/gdk/src/device.hg
index 5557ca2d..92b9fee9 100644
--- a/gdk/src/device.hg
+++ b/gdk/src/device.hg
@@ -104,9 +104,6 @@ public:
*/
Glib::RefPtr<const Surface> get_surface_at_position() const;
- _WRAP_METHOD(Glib::RefPtr<Surface> get_last_event_surface(), gdk_device_get_last_event_surface, refreturn)
- _WRAP_METHOD(Glib::RefPtr<const Surface> get_last_event_surface() const,
gdk_device_get_last_event_surface, refreturn, constversion)
-
_WRAP_METHOD(Glib::ustring get_vendor_id() const, gdk_device_get_vendor_id)
_WRAP_METHOD(Glib::ustring get_product_id(), gdk_device_get_product_id)
diff --git a/gdk/src/event.ccg b/gdk/src/event.ccg
index 3f8b1df6..99be41f6 100644
--- a/gdk/src/event.ccg
+++ b/gdk/src/event.ccg
@@ -19,6 +19,7 @@
#include <gdkmm/devicetool.h>
#include <gdkmm/display.h>
#include <gdkmm/drop.h>
+#include <gdkmm/seat.h>
#include <gdkmm/surface.h>
using Type = Gdk::Event::Type;
diff --git a/gdk/src/event.hg b/gdk/src/event.hg
index f108214b..f8e8956d 100644
--- a/gdk/src/event.hg
+++ b/gdk/src/event.hg
@@ -40,6 +40,7 @@ class GDKMM_API Device;
class GDKMM_API DeviceTool;
class GDKMM_API Display;
class GDKMM_API Drop;
+class GDKMM_API Seat;
class GDKMM_API Surface;
_WRAP_ENUM(KeyMatch, GdkKeyMatch, decl_prefix GDKMM_API)
@@ -72,6 +73,9 @@ public:
_WRAP_METHOD(Glib::RefPtr<Surface> get_surface(), gdk_event_get_surface, refreturn)
_WRAP_METHOD(Glib::RefPtr<const Surface> get_surface() const, gdk_event_get_surface, refreturn,
constversion)
+ _WRAP_METHOD(Glib::RefPtr<Seat> get_seat(), gdk_event_get_seat, refreturn)
+ _WRAP_METHOD(Glib::RefPtr<const Seat> get_seat() const, gdk_event_get_seat, refreturn, constversion)
+
_WRAP_METHOD(Glib::RefPtr<Device> get_device(), gdk_event_get_device, refreturn, newin "3,94")
_WRAP_METHOD(Glib::RefPtr<const Device> get_device() const, gdk_event_get_device, refreturn, constversion,
newin "3,94")
diff --git a/gdk/src/seat.hg b/gdk/src/seat.hg
index 7253a59a..859eb5d7 100644
--- a/gdk/src/seat.hg
+++ b/gdk/src/seat.hg
@@ -57,8 +57,6 @@ public:
_WRAP_METHOD(Glib::RefPtr<const Device> get_pointer() const, gdk_seat_get_pointer, refreturn, constversion)
_WRAP_METHOD(Glib::RefPtr<Device> get_keyboard(), gdk_seat_get_keyboard, refreturn)
_WRAP_METHOD(Glib::RefPtr<const Device> get_keyboard() const, gdk_seat_get_keyboard, refreturn,
constversion)
- _WRAP_METHOD(std::vector<Glib::RefPtr<Device>> get_logical_pointers(Capabilities capabilities),
gdk_seat_get_logical_pointers)
- _WRAP_METHOD(std::vector<Glib::RefPtr<const Device>> get_logical_pointers(Capabilities capabilities)
const, gdk_seat_get_logical_pointers)
// We use no_default_handler because GdkSeatClass is private.
#m4 _CONVERSION(`GdkDevice*',`const Glib::RefPtr<Device>&', Glib::wrap($3, true))
diff --git a/gdk/src/surface.hg b/gdk/src/surface.hg
index 2c98c671..66ebda71 100644
--- a/gdk/src/surface.hg
+++ b/gdk/src/surface.hg
@@ -114,9 +114,6 @@ public:
_WRAP_METHOD(void freeze_updates(), gdk_surface_freeze_updates)
_WRAP_METHOD(void thaw_updates(), gdk_surface_thaw_updates)
- _WRAP_METHOD(void set_support_multidevice(bool support_multidevice = true),
gdk_surface_set_support_multidevice)
- _WRAP_METHOD(bool get_support_multidevice(), gdk_surface_get_support_multidevice)
-
_WRAP_METHOD(Glib::RefPtr<FrameClock> get_frame_clock(), gdk_surface_get_frame_clock, refreturn, newin
"3,24")
_WRAP_METHOD(Glib::RefPtr<const FrameClock> get_frame_clock() const, gdk_surface_get_frame_clock,
refreturn, constversion, newin "3,24")
diff --git a/gtk/gtkmm.h b/gtk/gtkmm.h
index e003dc21..40a26c55 100644
--- a/gtk/gtkmm.h
+++ b/gtk/gtkmm.h
@@ -198,6 +198,7 @@ extern const int gtkmm_micro_version;
#include <gtkmm/mediafile.h>
#include <gtkmm/menubutton.h>
#include <gtkmm/messagedialog.h>
+#include <gtkmm/multiselection.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 be28de04..f5291dbb 100644
--- a/gtk/gtkmm/meson.build
+++ b/gtk/gtkmm/meson.build
@@ -41,6 +41,7 @@ gtkmm_any_hg_ccg_basenames = [
'assistant',
'assistantpage',
'binlayout',
+ 'bitset',
'border',
'box',
'boxlayout',
@@ -147,6 +148,7 @@ gtkmm_any_hg_ccg_basenames = [
'mediastream',
'menubutton',
'messagedialog',
+ 'multiselection',
'native',
'nativedialog',
'noselection',
diff --git a/gtk/src/bitset.ccg b/gtk/src/bitset.ccg
new file mode 100644
index 00000000..57b87fdc
--- /dev/null
+++ b/gtk/src/bitset.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/bitset.hg b/gtk/src/bitset.hg
new file mode 100644
index 00000000..8c6e7d44
--- /dev/null
+++ b/gtk/src/bitset.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/>.
+ */
+
+_CONFIGINCLUDE(gtkmmconfig.h)
+
+_DEFS(gtkmm,gtk)
+
+#include <glibmm/refptr.h>
+
+extern "C" typedef struct _GtkBitset GtkBitset;
+
+namespace Gtk
+{
+
+/** Sets of integers.
+ *
+ * %Gtk::Bitset is a data structure for representing a set of unsigned integers.
+ * Another name for this data structure is "bitmap".
+ *
+ * This version is based on
+ * <a href="https://roaringbitmap.org/">roaring bitmaps</a>.
+ *
+ * A bitset allows adding a set of integers and provides support for set operations
+ * like unions, intersections and checks for equality or if a value is contained
+ * in the set. %Gtk::Bitset also contains various functions to query metadata about
+ * the bitset, such as the minimum or maximum values or its size.
+ *
+ * The main use case for %Gtk::Bitset is implementing complex selections for
+ * Gtk::SelectionModel.
+ *
+ * @see SelectionModel
+ *
+ * @newin{3,98}
+ */
+class GTKMM_API Bitset final
+{
+ // GtkBitset is registered as a boxed type, but it has custom
+ // reference-counting instead of copy/free functions, so we use it via RefPtr.
+ _CLASS_OPAQUE_REFCOUNTED(Bitset, GtkBitset, NONE, gtk_bitset_ref, gtk_bitset_unref, GTKMM_API)
+ _IGNORE(gtk_bitset_ref, gtk_bitset_unref)
+
+public:
+ _WRAP_METHOD(static Glib::RefPtr<Bitset> create(), gtk_bitset_new_empty)
+
+ _WRAP_METHOD(bool contains(guint value) const, gtk_bitset_contains)
+ _WRAP_METHOD(bool is_empty() const, gtk_bitset_is_empty)
+ _WRAP_METHOD(bool equals(const Glib::RefPtr<const Bitset>& other) const, gtk_bitset_equals)
+ _WRAP_METHOD(guint get_minimum() const, gtk_bitset_get_minimum)
+ _WRAP_METHOD(guint get_maximum() const, gtk_bitset_get_maximum)
+ _WRAP_METHOD(Glib::RefPtr<Bitset> copy() const, gtk_bitset_copy)
+ _WRAP_METHOD(void remove_all(), gtk_bitset_remove_all)
+ _WRAP_METHOD(bool add(guint value), gtk_bitset_add)
+ _WRAP_METHOD(bool remove(guint value), gtk_bitset_remove)
+ _WRAP_METHOD(void add_range(guint start, guint n_items), gtk_bitset_add_range)
+ _WRAP_METHOD(void remove_range(guint start, guint n_items), gtk_bitset_remove_range)
+ _WRAP_METHOD(void add_range_closed(guint first, guint last), gtk_bitset_add_range_closed)
+ _WRAP_METHOD(void remove_range_closed(guint first, guint last), gtk_bitset_remove_range_closed)
+ _WRAP_METHOD(void add_rectangle(guint start, guint width, guint height, guint stride),
+ gtk_bitset_add_rectangle)
+ _WRAP_METHOD(void remove_rectangle(guint start, guint width, guint height, guint stride),
+ gtk_bitset_remove_rectangle)
+ // 'union' is a C and C++ keyword. Can't be a method name. (see also Gdk::Rectangle)
+ _WRAP_METHOD(void join(const Glib::RefPtr<const Bitset>& other), gtk_bitset_union)
+ _WRAP_METHOD(void intersect(const Glib::RefPtr<const Bitset>& other), gtk_bitset_intersect)
+ _WRAP_METHOD(void subtract(const Glib::RefPtr<const Bitset>& other), gtk_bitset_subtract)
+ _WRAP_METHOD(void difference(const Glib::RefPtr<const Bitset>& other), gtk_bitset_difference)
+ _WRAP_METHOD(void shift_left(guint amount), gtk_bitset_shift_left)
+ _WRAP_METHOD(void shift_right(guint amount), gtk_bitset_shift_right)
+ _WRAP_METHOD(void slice(guint position, guint removed, guint value), gtk_bitset_slice)
+};
+
+} // namespace Gtk
diff --git a/gtk/src/filelist.am b/gtk/src/filelist.am
index 24546a13..353613cd 100644
--- a/gtk/src/filelist.am
+++ b/gtk/src/filelist.am
@@ -26,6 +26,7 @@ gtkmm_files_any_hg = \
assistant.hg \
assistantpage.hg \
binlayout.hg \
+ bitset.hg \
border.hg \
box.hg \
boxlayout.hg \
@@ -132,6 +133,7 @@ gtkmm_files_any_hg = \
mediastream.hg \
menubutton.hg \
messagedialog.hg \
+ multiselection.hg \
native.hg \
nativedialog.hg \
noselection.hg \
diff --git a/gtk/src/multiselection.ccg b/gtk/src/multiselection.ccg
new file mode 100644
index 00000000..57b87fdc
--- /dev/null
+++ b/gtk/src/multiselection.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/multiselection.hg b/gtk/src/multiselection.hg
new file mode 100644
index 00000000..a26fe17c
--- /dev/null
+++ b/gtk/src/multiselection.hg
@@ -0,0 +1,59 @@
+/* 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 <glibmm/object.h>
+#include <glibmm/refptr.h>
+#include <giomm/listmodel.h>
+#include <gtkmm/selectionmodel.h>
+#include <gtk/gtk.h> // Declares GtkMultiSelection and GtkMultiSelectionClass
+
+_DEFS(gtkmm,gtk)
+_PINCLUDE(glibmm/private/object_p.h)
+
+namespace Gtk
+{
+/** A selection model that allows selecting multiple items.
+ *
+ * %Gtk::MultiSelection is an implementation of the Gtk::SelectionModel interface
+ * that allows selecting multiple elements.
+ *
+ * @see SelectionModel
+ * @newin{3,98}
+ */
+class GTKMM_API MultiSelection : public Glib::Object, public Gio::ListModel, public SelectionModel
+{
+ _CLASS_GOBJECT(MultiSelection, GtkMultiSelection, GTK_MULTI_SELECTION, Glib::Object, GObject, , ,
GTKMM_API)
+ _IMPLEMENTS_INTERFACE(Gio::ListModel)
+ _IMPLEMENTS_INTERFACE(SelectionModel)
+ _STRUCT_NOT_HIDDEN
+
+protected:
+ _CTOR_DEFAULT()
+ _WRAP_CTOR(MultiSelection(const Glib::RefPtr<Gio::ListModel>& model), gtk_multi_selection_new)
+
+public:
+ _WRAP_CREATE()
+ _WRAP_CREATE(const Glib::RefPtr<Gio::ListModel>& model)
+
+ _WRAP_METHOD(Glib::RefPtr<Gio::ListModel> get_model(), gtk_multi_selection_get_model, refreturn)
+ _WRAP_METHOD(Glib::RefPtr<const Gio::ListModel> get_model() const, gtk_multi_selection_get_model,
refreturn, constversion)
+
+ _WRAP_PROPERTY("model", Glib::RefPtr<Gio::ListModel>)
+
+ // There are no signals or vfuncs.
+};
+
+} // namespace Gtk
diff --git a/gtk/src/scrolledwindow.hg b/gtk/src/scrolledwindow.hg
index 8811640d..c868f83b 100644
--- a/gtk/src/scrolledwindow.hg
+++ b/gtk/src/scrolledwindow.hg
@@ -51,7 +51,6 @@ class GTKMM_API ScrolledWindow : public Widget
public:
_CTOR_DEFAULT
- _WRAP_CTOR(ScrolledWindow(const Glib::RefPtr<Adjustment>& hadjustment, const Glib::RefPtr<Adjustment>&
vadjustment), gtk_scrolled_window_new)
//TODO: Add unset_*adjustment().
//But the C API does not do that. murrayc.
diff --git a/gtk/src/selectionmodel.ccg b/gtk/src/selectionmodel.ccg
index fb2691e6..3663c616 100644
--- a/gtk/src/selectionmodel.ccg
+++ b/gtk/src/selectionmodel.ccg
@@ -15,91 +15,3 @@
*/
#include <gtk/gtk.h>
-
-namespace
-{
-
-void SelectionModel_selection_callback(guint position, guint* start_range,
- guint* n_items, gboolean* selected, gpointer data)
-{
- auto the_slot = static_cast<Gtk::SelectionModel::SlotSelection*>(data);
-
- try
- {
- bool selected_cxx = false;
- (*the_slot)(position, *start_range, *n_items, selected_cxx);
- *selected = selected_cxx;
- }
- catch (...)
- {
- Glib::exception_handlers_invoke();
- }
-}
-
-} // anonymous namespace
-
-namespace Gtk
-{
-using SlotSelection = SelectionModel::SlotSelection;
-
-// This vfunc callback and the corresponding vfunc are custom implemented because we want
-// an output argument of the C++ vfunc to be bool& (not gboolean* or gboolean&).
-void SelectionModel_Class::query_range_vfunc_callback(GtkSelectionModel* self, guint position, guint*
start_range, guint* n_items, gboolean* selected)
-{
- const auto obj_base = static_cast<Glib::ObjectBase*>(
- Glib::ObjectBase::_get_current_wrapper((GObject*)self));
-
- // Non-gtkmmproc-generated custom classes implicitly call the default
- // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
- // generated classes can use this optimisation, which avoids the unnecessary
- // parameter conversions if there is no possibility of the virtual function
- // being overridden:
- if(obj_base && obj_base->is_derived_())
- {
- const auto obj = dynamic_cast<CppObjectType* const>(obj_base);
- if(obj) // This can be NULL during destruction.
- {
- try // Trap C++ exceptions which would normally be lost because this is a C callback.
- {
- // Call the virtual member method, which derived classes might override.
- // Assuming that none of start_range, n_items, selected is nullptr.
- // gtk_selection_model_query_range() guarantees it,
- // and gtk_single_selection_query_range() assumes it.
- bool selected_cxx = *selected;
- obj->query_range_vfunc(position, *start_range, *n_items, selected_cxx);
- *selected = selected_cxx;
- return;
- }
- catch(...)
- {
- Glib::exception_handlers_invoke();
- }
- }
- }
-
- BaseClassType *const base = static_cast<BaseClassType*>(
- g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C
interface).
-g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface.
-) );
-
- // Call the original underlying C function:
- if(base && base->query_range)
- (*base->query_range)(self, position, start_range, n_items, selected);
-}
-
-void Gtk::SelectionModel::query_range_vfunc(guint position, guint& start_range, guint& n_items, bool&
selected) const
-{
- const auto base = static_cast<BaseClassType*>(
- g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C
interface).
-g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface.
-) );
-
- if(base && base->query_range)
- {
- gboolean selected_c = selected;
- (*base->query_range)(const_cast<GtkSelectionModel*>(gobj()), position, &start_range, &n_items,
&selected_c);
- selected = selected_c;
- }
-}
-
-} // namespace Gtk
diff --git a/gtk/src/selectionmodel.hg b/gtk/src/selectionmodel.hg
index 93400739..25ee8558 100644
--- a/gtk/src/selectionmodel.hg
+++ b/gtk/src/selectionmodel.hg
@@ -17,6 +17,7 @@
_CONFIGINCLUDE(gtkmmconfig.h)
#include <glibmm/interface.h>
+#include <gtkmm/bitset.h>
_DEFS(gtkmm,gtk)
_PINCLUDE(glibmm/private/interface_p.h)
@@ -72,47 +73,18 @@ class GTKMM_API SelectionModel : public Glib::Interface
_CLASS_INTERFACE(SelectionModel, GtkSelectionModel, GTK_SELECTION_MODEL, GtkSelectionModelInterface, , ,
GTKMM_API)
public:
- /** Callback type for determining items to operate on with
- * select_callback() or unselect_callback().
- *
- * For instance:
- * @code
- * void on_selection(guint position, guint& start_range, guint& n_items, bool& selected);
- * @endcode
- *
- * The callback determines a range of consecutive items around
- * @a position which should either all
- * be changed, in which case @a selected is set to <tt>true</tt>, or all not
- * be changed, in which case @a selected is set to <tt>false</tt>.
- *
- * @a start_range and @a n_items are set to return the range.
- *
- * The callback will be called repeatedly to find all ranges
- * to operate on until it has exhausted the items of the model,
- * or until it returns an empty range (ie @a n_items == 0).
- *
- * @param position The position to query.
- * @param[out] start_range Returns the position of the first element of the range.
- * @param[out] n_items Returns the size of the range.
- * @param[out] selected Returns whether items in @a range are selected.
- *
- * @newin{3,98}
- */
- using SlotSelection = sigc::slot<void(guint position, guint& start_range, guint& n_items, bool& selected)>;
-
_WRAP_METHOD(bool is_selected(guint position) const, gtk_selection_model_is_selected)
+ _WRAP_METHOD(Glib::RefPtr<const Bitset> get_selection() const, gtk_selection_model_get_selection)
+ _WRAP_METHOD(Glib::RefPtr<const Bitset> get_selection(guint position, guint n_items) const,
+ gtk_selection_model_get_selection_in_range)
_WRAP_METHOD(bool select_item(guint position, bool unselect_rest), gtk_selection_model_select_item)
_WRAP_METHOD(bool unselect_item(guint position), gtk_selection_model_unselect_item)
_WRAP_METHOD(bool select_range(guint position, guint n_items, bool unselect_rest),
gtk_selection_model_select_range)
_WRAP_METHOD(bool unselect_range(guint position, guint n_items), gtk_selection_model_unselect_range)
_WRAP_METHOD(bool select_all(), gtk_selection_model_select_all)
_WRAP_METHOD(bool unselect_all(), gtk_selection_model_unselect_all)
- _WRAP_METHOD(bool select_callback(bool unselect_rest, const SlotSelection& slot{callback}),
- gtk_selection_model_select_callback, slot_name slot, slot_callback SelectionModel_selection_callback,
no_slot_copy)
- _WRAP_METHOD(bool unselect_callback(const SlotSelection& slot{callback}),
- gtk_selection_model_unselect_callback, slot_name slot, slot_callback SelectionModel_selection_callback,
no_slot_copy)
- _WRAP_METHOD(void query_range(guint position, guint& start_range, guint& n_items, bool& selected) const,
- gtk_selection_model_query_range)
+ _WRAP_METHOD(bool set_selection(const Glib::RefPtr<const Bitset>& selected,
+ const Glib::RefPtr<const Bitset>& mask), gtk_selection_model_set_selection)
// no_default_handler because the wrapped C signal has no default handler.
_WRAP_SIGNAL(void selection_changed(guint position, guint n_items), "selection-changed",
no_default_handler)
@@ -122,18 +94,17 @@ protected:
_WRAP_METHOD(void selection_changed(guint position, guint n_items), gtk_selection_model_selection_changed)
_WRAP_VFUNC(bool is_selected(guint position) const, is_selected)
+#m4 _CONVERSION(`Glib::RefPtr<const
Bitset>',`GtkBitset*',`Glib::unwrap_copy(std::const_pointer_cast<Bitset>($3))')
+ _WRAP_VFUNC(Glib::RefPtr<const Bitset> get_selection(guint position, guint n_items),
get_selection_in_range)
_WRAP_VFUNC(bool select_item(guint position, bool unselect_rest), select_item)
_WRAP_VFUNC(bool unselect_item(guint position), unselect_item)
_WRAP_VFUNC(bool select_range(guint position, guint n_items, bool unselect_rest), select_range)
_WRAP_VFUNC(bool unselect_range(guint position, guint n_items), unselect_range)
_WRAP_VFUNC(bool select_all(), select_all)
_WRAP_VFUNC(bool unselect_all(), unselect_all)
- _WRAP_VFUNC(bool select_callback(bool unselect_rest, const SlotSelection& slot{callback}),
- select_callback, slot_name slot, slot_callback SelectionModel_selection_callback, no_slot_copy)
- _WRAP_VFUNC(bool unselect_callback(const SlotSelection& slot{callback}),
- unselect_callback, slot_name slot, slot_callback SelectionModel_selection_callback, no_slot_copy)
- _WRAP_VFUNC(void query_range(guint position, guint& start_range, guint& n_items, bool& selected) const,
- query_range, custom_vfunc_callback, custom_vfunc)
+#m4 _CONVERSION(`GtkBitset*',`const Glib::RefPtr<const Bitset>&',`Glib::wrap($3, true)')
+ _WRAP_VFUNC(bool set_selection(const Glib::RefPtr<const Bitset>& selected,
+ const Glib::RefPtr<const Bitset>& mask), set_selection)
};
} // namespace Gtk
diff --git a/gtk/src/widget.hg b/gtk/src/widget.hg
index 07d652cc..d8d75632 100644
--- a/gtk/src/widget.hg
+++ b/gtk/src/widget.hg
@@ -173,7 +173,6 @@ public:
_WRAP_METHOD(bool has_default() const, gtk_widget_has_default)
_WRAP_METHOD(void set_receives_default(bool receives_default = true), gtk_widget_set_receives_default)
_WRAP_METHOD(bool get_receives_default() const, gtk_widget_get_receives_default)
- _WRAP_METHOD(bool device_is_shadowed(const Glib::RefPtr<const Gdk::Device>& device),
gtk_widget_device_is_shadowed)
_WRAP_METHOD(void set_name(const Glib::ustring& name), gtk_widget_set_name)
void unset_name();
@@ -276,9 +275,6 @@ public:
*/
void set_expand(bool expand = true);
- _WRAP_METHOD(bool get_support_multidevice() const, gtk_widget_get_support_multidevice)
- _WRAP_METHOD(void set_support_multidevice(bool support_multidevice = true),
gtk_widget_set_support_multidevice)
-
_WRAP_METHOD(Glib::RefPtr<Atk::Object> get_accessible(), gtk_widget_get_accessible, refreturn, ifdef
GTKMM_ATKMM_ENABLED)
_WRAP_METHOD(Glib::RefPtr<const Atk::Object> get_accessible() const, gtk_widget_get_accessible, refreturn,
constversion, ifdef GTKMM_ATKMM_ENABLED)
@@ -575,8 +571,6 @@ public:
_WRAP_SIGNAL(void direction_changed(TextDirection direction), "direction_changed")
- _WRAP_SIGNAL(void grab_notify(bool was_grabbed), "grab_notify")
-
_WRAP_SIGNAL(bool mnemonic_activate(bool group_cycling), "mnemonic_activate")
#m4begin
diff --git a/tools/m4/convert_gtk.m4 b/tools/m4/convert_gtk.m4
index f1ccba39..369f9d38 100644
--- a/tools/m4/convert_gtk.m4
+++ b/tools/m4/convert_gtk.m4
@@ -547,6 +547,11 @@ _CONVERSION(`GListModel*',`Glib::RefPtr<const Gio::ListModel>',`Glib::wrap($3)')
_CONVERSION(`const Glib::RefPtr<Gio::ListModel>&',`GListModel*',__CONVERT_REFPTR_TO_P)
_CONVERSION(`GtkSelectionModel*',`Glib::RefPtr<SelectionModel>',`Glib::wrap($3)')
+_CONVERSION(`const Glib::RefPtr<const Bitset>&',`GtkBitset*',__CONVERT_CONST_REFPTR_TO_P)
+_CONVERSION(`const Glib::RefPtr<const Bitset>&',`const GtkBitset*',__CONVERT_REFPTR_TO_P)
+_CONVERSION(`GtkBitset*',`Glib::RefPtr<const Bitset>',`Glib::wrap($3)')
+_CONVERSION(`GtkBitset*',`Glib::RefPtr<Bitset>',`Glib::wrap($3)')
+
_CONVERSION(`const
Glib::RefPtr<Gio::ActionGroup>&',`GActionGroup*',__CONVERT_CONST_REFPTR_TO_P_SUN(Gio::ActionGroup))
_CONVERSION(`GActionGroup*',`Glib::RefPtr<Gio::ActionGroup>',`Glib::wrap($3)')
_CONVERSION(`GActionGroup*',`Glib::RefPtr<const Gio::ActionGroup>',`Glib::wrap($3)')
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]