Github User Fetcher 1.0.0
C Application with Server and GUI
Loading...
Searching...
No Matches
gtkselectionmodel.h
Go to the documentation of this file.
1/*
2 * Copyright © 2018 Benjamin Otte
3 *
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
8 *
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
13 *
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library. If not, see <http://www.gnu.org/licenses/>.
16 *
17 * Authors: Benjamin Otte <otte@gnome.org>
18 */
19
20#pragma once
21
22#if !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION)
23#error "Only <gtk/gtk.h> can be included directly."
24#endif
25
26#include <gtk/gtktypes.h>
27
29
30#define GTK_TYPE_SELECTION_MODEL (gtk_selection_model_get_type ())
31
33G_DECLARE_INTERFACE (GtkSelectionModel, gtk_selection_model, GTK, SELECTION_MODEL, GListModel)
34
35/**
36 * GtkSelectionModelInterface:
37 * @is_selected: Return if the item at the given position is selected.
38 * @get_selection_in_range: Return a bitset with all currently selected
39 * items in the given range. By default, this function will call
40 * `GtkSelectionModel::is_selected()` on all items in the given range.
41 * @select_item: Select the item in the given position. If the operation
42 * is known to fail, return %FALSE.
43 * @unselect_item: Unselect the item in the given position. If the
44 * operation is known to fail, return %FALSE.
45 * @select_range: Select all items in the given range. If the operation
46 * is unsupported or known to fail for all items, return %FALSE.
47 * @unselect_range: Unselect all items in the given range. If the
48 * operation is unsupported or known to fail for all items, return
49 * %FALSE.
50 * @select_all: Select all items in the model. If the operation is
51 * unsupported or known to fail for all items, return %FALSE.
52 * @unselect_all: Unselect all items in the model. If the operation is
53 * unsupported or known to fail for all items, return %FALSE.
54 * @set_selection: Set selection state of all items in mask to selected.
55 * See gtk_selection_model_set_selection() for a detailed explanation
56 * of this function.
57 *
58 * The list of virtual functions for the `GtkSelectionModel` interface.
59 * No function must be implemented, but unless `GtkSelectionModel::is_selected()`
60 * is implemented, it will not be possible to select items in the set.
61 *
62 * The model does not need to implement any functions to support either
63 * selecting or unselecting items. Of course, if the model does not do that,
64 * it means that users cannot select or unselect items in a list widget
65 * using the model.
66 *
67 * All selection functions fall back to `GtkSelectionModel::set_selection()`
68 * so it is sufficient to implement just that function for full selection
69 * support.
70 */
72{
73 /*< private >*/
75
76 /*< public >*/
77 gboolean (* is_selected) (GtkSelectionModel *model,
78 guint position);
79 GtkBitset * (* get_selection_in_range) (GtkSelectionModel *model,
80 guint position,
81 guint n_items);
82
83 gboolean (* select_item) (GtkSelectionModel *model,
84 guint position,
85 gboolean unselect_rest);
86 gboolean (* unselect_item) (GtkSelectionModel *model,
87 guint position);
88 gboolean (* select_range) (GtkSelectionModel *model,
89 guint position,
90 guint n_items,
91 gboolean unselect_rest);
92 gboolean (* unselect_range) (GtkSelectionModel *model,
93 guint position,
94 guint n_items);
95 gboolean (* select_all) (GtkSelectionModel *model);
96 gboolean (* unselect_all) (GtkSelectionModel *model);
97 gboolean (* set_selection) (GtkSelectionModel *model,
98 GtkBitset *selected,
100};
101
104 guint position);
106GtkBitset * gtk_selection_model_get_selection (GtkSelectionModel *model);
109 (GtkSelectionModel *model,
110 guint position,
111 guint n_items);
112
115 guint position,
116 gboolean unselect_rest);
119 guint position);
122 guint position,
123 guint n_items,
124 gboolean unselect_rest);
127 guint position,
128 guint n_items);
130gboolean gtk_selection_model_select_all (GtkSelectionModel *model);
135 GtkBitset *selected,
136 GtkBitset *mask);
137
138/* for implementations only */
140void gtk_selection_model_selection_changed (GtkSelectionModel *model,
141 guint position,
142 guint n_items);
143
145
#define GDK_AVAILABLE_IN_ALL
#define G_END_DECLS
Definition gmacros.h:910
#define G_BEGIN_DECLS
Definition gmacros.h:909
GDK_AVAILABLE_IN_ALL gboolean gtk_selection_model_unselect_all(GtkSelectionModel *model)
GDK_AVAILABLE_IN_ALL gboolean gtk_selection_model_unselect_item(GtkSelectionModel *model, guint position)
GDK_AVAILABLE_IN_ALL gboolean gtk_selection_model_select_all(GtkSelectionModel *model)
GDK_AVAILABLE_IN_ALL gboolean gtk_selection_model_select_range(GtkSelectionModel *model, guint position, guint n_items, gboolean unselect_rest)
GDK_AVAILABLE_IN_ALL void gtk_selection_model_selection_changed(GtkSelectionModel *model, guint position, guint n_items)
GDK_AVAILABLE_IN_ALL gboolean gtk_selection_model_unselect_range(GtkSelectionModel *model, guint position, guint n_items)
GDK_AVAILABLE_IN_ALL GtkBitset * gtk_selection_model_get_selection(GtkSelectionModel *model)
GDK_AVAILABLE_IN_ALL gboolean gtk_selection_model_is_selected(GtkSelectionModel *model, guint position)
GDK_AVAILABLE_IN_ALL gboolean gtk_selection_model_set_selection(GtkSelectionModel *model, GtkBitset *selected, GtkBitset *mask)
GDK_AVAILABLE_IN_ALL gboolean gtk_selection_model_select_item(GtkSelectionModel *model, guint position, gboolean unselect_rest)
GDK_AVAILABLE_IN_ALL GtkBitset * gtk_selection_model_get_selection_in_range(GtkSelectionModel *model, guint position, guint n_items)
struct _GtkBitset GtkBitset
Definition gtktypes.h:37
#define G_DECLARE_INTERFACE(ModuleObjName, module_obj_name, MODULE, OBJ_NAME, PrerequisiteName)
Definition gtype.h:1797
gint gboolean
Definition gtypes.h:56
unsigned int guint
Definition gtypes.h:61
#define mask(n)