diff options
author | Benjamin Otte <otte@redhat.com> | 2020-06-14 05:30:06 +0200 |
---|---|---|
committer | Benjamin Otte <otte@redhat.com> | 2020-06-26 07:13:32 +0200 |
commit | 83956980907bcb886744b79209efce688f4cadf8 (patch) | |
tree | 304446fb86e275f5fde2449b1bc94800ee31176b /gtk/gtkselectionmodel.h | |
parent | 277a91dbf88da4c28a7e891948c5b3ddd726eb78 (diff) | |
download | gtk+-83956980907bcb886744b79209efce688f4cadf8.tar.gz |
selectionmodel: Replace query_range() with get_selection()
Diffstat (limited to 'gtk/gtkselectionmodel.h')
-rw-r--r-- | gtk/gtkselectionmodel.h | 38 |
1 files changed, 21 insertions, 17 deletions
diff --git a/gtk/gtkselectionmodel.h b/gtk/gtkselectionmodel.h index 55a012e3d6..e48ce20fee 100644 --- a/gtk/gtkselectionmodel.h +++ b/gtk/gtkselectionmodel.h @@ -24,7 +24,7 @@ #error "Only <gtk/gtk.h> can be included directly." #endif -#include <gdk/gdk.h> +#include <gtk/gtktypes.h> G_BEGIN_DECLS @@ -66,6 +66,9 @@ typedef void (* GtkSelectionCallback) (guint position, /** * GtkSelectionModelInterface: * @is_selected: Return if the item at the given position is selected. + * @get_selection_in_range: Return a bitset with all currently selected + * items in the given range. By default, this function will call + * #GtkSelectionModel::is_selected() on all items in the given range. * @select_item: Select the item in the given position. If the operation * is known to fail, return %FALSE. * @unselect_item: Unselect the item in the given position. If the @@ -81,10 +84,13 @@ typedef void (* GtkSelectionCallback) (guint position, * unsupported or known to fail for all items, return %FALSE. * * The list of virtual functions for the #GtkSelectionModel interface. - * All getter functions are mandatory to implement, but the model does - * not need to implement any functions to support selecting or unselecting - * items. Of course, if the model does not do that, it means that users - * cannot select or unselect items in a list widgets using the model. + * No function must be implemented, but unless #GtkSelectionModel::is_selected() + * is implemented, it will not be possible to select items in the set. + * + * The model does not need to implement any functions to support either + * selecting or unselecting items. Of course, if the model does not do that, + * it means that users cannot select or unselect items in a list widget + * using the model. */ struct _GtkSelectionModelInterface { @@ -94,6 +100,9 @@ struct _GtkSelectionModelInterface /*< public >*/ gboolean (* is_selected) (GtkSelectionModel *model, guint position); + GtkBitset * (* get_selection_in_range) (GtkSelectionModel *model, + guint position, + guint n_items); gboolean (* select_item) (GtkSelectionModel *model, guint position, @@ -116,16 +125,18 @@ struct _GtkSelectionModelInterface gboolean (* unselect_callback) (GtkSelectionModel *model, GtkSelectionCallback callback, gpointer data); - void (* query_range) (GtkSelectionModel *model, - guint position, - guint *start_range, - guint *n_items, - gboolean *selected); }; GDK_AVAILABLE_IN_ALL gboolean gtk_selection_model_is_selected (GtkSelectionModel *model, guint position); +GDK_AVAILABLE_IN_ALL +GtkBitset * gtk_selection_model_get_selection (GtkSelectionModel *model); +GDK_AVAILABLE_IN_ALL +GtkBitset * gtk_selection_model_get_selection_in_range + (GtkSelectionModel *model, + guint position, + guint n_items); GDK_AVAILABLE_IN_ALL gboolean gtk_selection_model_select_item (GtkSelectionModel *model, @@ -158,13 +169,6 @@ gboolean gtk_selection_model_unselect_callback (GtkSelectionMod GtkSelectionCallback callback, gpointer data); -GDK_AVAILABLE_IN_ALL -void gtk_selection_model_query_range (GtkSelectionModel *model, - guint position, - guint *start_range, - guint *n_items, - gboolean *selected); - /* for implementations only */ GDK_AVAILABLE_IN_ALL void gtk_selection_model_selection_changed (GtkSelectionModel *model, |