Github User Fetcher 1.0.0
C Application with Server and GUI
Loading...
Searching...
No Matches
gtktreesortable.h
Go to the documentation of this file.
1/* gtktreesortable.h
2 * Copyright (C) 2001 Red Hat, Inc.
3 *
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Library General Public
6 * License as published by the Free Software Foundation; either
7 * version 2 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 * Library General Public License for more details.
13 *
14 * You should have received a copy of the GNU Library General Public
15 * License along with this library. If not, see <http://www.gnu.org/licenses/>.
16 */
17
18#pragma once
19
20
21#if !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION)
22#error "Only <gtk/gtk.h> can be included directly."
23#endif
24
25#include <gtk/gtkenums.h>
27
28
30
31#define GTK_TYPE_TREE_SORTABLE (gtk_tree_sortable_get_type ())
32#define GTK_TREE_SORTABLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_TREE_SORTABLE, GtkTreeSortable))
33#define GTK_IS_TREE_SORTABLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_TREE_SORTABLE))
34#define GTK_TREE_SORTABLE_GET_IFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GTK_TYPE_TREE_SORTABLE, GtkTreeSortableIface))
35
36/**
37 * GTK_TREE_SORTABLE_DEFAULT_SORT_COLUMN_ID:
38 *
39 * Uses the default sort function in a [iface@Gtk.TreeSortable].
40 *
41 * See also: [method@Gtk.TreeSortable.set_sort_column_id]
42 */
43#define GTK_TREE_SORTABLE_DEFAULT_SORT_COLUMN_ID (-1)
44
45/**
46 * GTK_TREE_SORTABLE_UNSORTED_SORT_COLUMN_ID:
47 *
48 * Disables sorting in a [iface@Gtk.TreeSortable].
49 *
50 * See also: [method@Gtk.TreeSortable.set_sort_column_id]
51 */
52#define GTK_TREE_SORTABLE_UNSORTED_SORT_COLUMN_ID (-2)
53
54typedef struct _GtkTreeSortable GtkTreeSortable; /* Dummy typedef */
56
57/**
58 * GtkTreeIterCompareFunc:
59 * @model: The `GtkTreeModel` the comparison is within
60 * @a: A `GtkTreeIter` in @model
61 * @b: Another `GtkTreeIter` in @model
62 * @user_data: Data passed when the compare func is assigned e.g. by
63 * gtk_tree_sortable_set_sort_func()
64 *
65 * A GtkTreeIterCompareFunc should return a negative integer, zero, or a positive
66 * integer if @a sorts before @b, @a sorts with @b, or @a sorts after @b
67 * respectively.
68 *
69 * If two iters compare as equal, their order in the sorted model
70 * is undefined. In order to ensure that the `GtkTreeSortable` behaves as
71 * expected, the GtkTreeIterCompareFunc must define a partial order on
72 * the model, i.e. it must be reflexive, antisymmetric and transitive.
73 *
74 * For example, if @model is a product catalogue, then a compare function
75 * for the “price” column could be one which returns
76 * `price_of(@a) - price_of(@b)`.
77 *
78 * Returns: a negative integer, zero or a positive integer depending on whether
79 * @a sorts before, with or after @b
80 */
81typedef int (* GtkTreeIterCompareFunc) (GtkTreeModel *model,
83 GtkTreeIter *b,
84 gpointer user_data);
85
86
87/**
88 * GtkTreeSortableIface:
89 * @sort_column_changed: Signal emitted when the sort column or sort
90 * order of sortable is changed.
91 * @get_sort_column_id: Fills in sort_column_id and order with the
92 * current sort column and the order.
93 * @set_sort_column_id: Sets the current sort column to be
94 * sort_column_id.
95 * @set_sort_func: Sets the comparison function used when sorting to
96 * be sort_func.
97 * @set_default_sort_func: Sets the default comparison function used
98 * when sorting to be sort_func.
99 * @has_default_sort_func: %TRUE if the model has a default sort
100 * function.
101 */
103{
104 /*< private >*/
106
107 /*< public >*/
108
109 /* signals */
111
112 /* virtual table */
114 int *sort_column_id,
115 GtkSortType *order);
117 int sort_column_id,
118 GtkSortType order);
119 void (* set_sort_func) (GtkTreeSortable *sortable,
120 int sort_column_id,
121 GtkTreeIterCompareFunc sort_func,
122 gpointer user_data,
123 GDestroyNotify destroy);
125 GtkTreeIterCompareFunc sort_func,
126 gpointer user_data,
127 GDestroyNotify destroy);
129};
130
131
134
139 int *sort_column_id,
140 GtkSortType *order);
143 int sort_column_id,
144 GtkSortType order);
147 int sort_column_id,
148 GtkTreeIterCompareFunc sort_func,
149 gpointer user_data,
150 GDestroyNotify destroy);
153 GtkTreeIterCompareFunc sort_func,
154 gpointer user_data,
155 GDestroyNotify destroy);
158
160
162
#define GDK_DEPRECATED_IN_4_10
#define GDK_AVAILABLE_IN_ALL
#define G_END_DECLS
Definition gmacros.h:910
#define G_BEGIN_DECLS
Definition gmacros.h:909
#define G_GNUC_CONST
Definition gmacros.h:637
#define G_DEFINE_AUTOPTR_CLEANUP_FUNC(TypeName, func)
Definition gmacros.h:1400
GOBJECT_AVAILABLE_IN_ALL void g_object_unref(gpointer object)
GtkSortType
Definition gtkenums.h:593
struct _GtkTreeModel GtkTreeModel
GDK_DEPRECATED_IN_4_10 void gtk_tree_sortable_sort_column_changed(GtkTreeSortable *sortable)
GDK_DEPRECATED_IN_4_10 void gtk_tree_sortable_set_default_sort_func(GtkTreeSortable *sortable, GtkTreeIterCompareFunc sort_func, gpointer user_data, GDestroyNotify destroy)
struct _GtkTreeSortable GtkTreeSortable
GDK_DEPRECATED_IN_4_10 gboolean gtk_tree_sortable_get_sort_column_id(GtkTreeSortable *sortable, int *sort_column_id, GtkSortType *order)
GDK_DEPRECATED_IN_4_10 gboolean gtk_tree_sortable_has_default_sort_func(GtkTreeSortable *sortable)
GDK_DEPRECATED_IN_4_10 void gtk_tree_sortable_set_sort_column_id(GtkTreeSortable *sortable, int sort_column_id, GtkSortType order)
int(* GtkTreeIterCompareFunc)(GtkTreeModel *model, GtkTreeIter *a, GtkTreeIter *b, gpointer user_data)
GDK_AVAILABLE_IN_ALL GType gtk_tree_sortable_get_type(void) G_GNUC_CONST
GDK_DEPRECATED_IN_4_10 void gtk_tree_sortable_set_sort_func(GtkTreeSortable *sortable, int sort_column_id, GtkTreeIterCompareFunc sort_func, gpointer user_data, GDestroyNotify destroy)
gsize GType
Definition gtype.h:427
gint gboolean
Definition gtypes.h:56
void * gpointer
Definition gtypes.h:109
void(* GDestroyNotify)(gpointer data)
Definition gtypes.h:140
gboolean(* has_default_sort_func)(GtkTreeSortable *sortable)
void(* set_sort_func)(GtkTreeSortable *sortable, int sort_column_id, GtkTreeIterCompareFunc sort_func, gpointer user_data, GDestroyNotify destroy)
void(* sort_column_changed)(GtkTreeSortable *sortable)
void(* set_default_sort_func)(GtkTreeSortable *sortable, GtkTreeIterCompareFunc sort_func, gpointer user_data, GDestroyNotify destroy)
void(* set_sort_column_id)(GtkTreeSortable *sortable, int sort_column_id, GtkSortType order)
gboolean(* get_sort_column_id)(GtkTreeSortable *sortable, int *sort_column_id, GtkSortType *order)