1 | /* gtkentrycompletion.h |
2 | * Copyright (C) 2003 Kristian Rietveld <kris@gtk.org> |
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 | #ifndef __GTK_ENTRY_COMPLETION_H__ |
19 | #define __GTK_ENTRY_COMPLETION_H__ |
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 <gdk/gdk.h> |
26 | #include <gtk/gtktreemodel.h> |
27 | #include <gtk/gtkliststore.h> |
28 | #include <gtk/gtkcellarea.h> |
29 | #include <gtk/gtktreeviewcolumn.h> |
30 | #include <gtk/gtktreemodelfilter.h> |
31 | |
32 | G_BEGIN_DECLS |
33 | |
34 | #define GTK_TYPE_ENTRY_COMPLETION (gtk_entry_completion_get_type ()) |
35 | #define GTK_ENTRY_COMPLETION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_ENTRY_COMPLETION, GtkEntryCompletion)) |
36 | #define GTK_IS_ENTRY_COMPLETION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_ENTRY_COMPLETION)) |
37 | |
38 | typedef struct _GtkEntryCompletion GtkEntryCompletion; |
39 | |
40 | /** |
41 | * GtkEntryCompletionMatchFunc: |
42 | * @completion: the `GtkEntryCompletion` |
43 | * @key: the string to match, normalized and case-folded |
44 | * @iter: a `GtkTreeIter` indicating the row to match |
45 | * @user_data: user data given to gtk_entry_completion_set_match_func() |
46 | * |
47 | * A function which decides whether the row indicated by @iter matches |
48 | * a given @key, and should be displayed as a possible completion for @key. |
49 | * |
50 | * Note that @key is normalized and case-folded (see g_utf8_normalize() |
51 | * and g_utf8_casefold()). If this is not appropriate, match functions |
52 | * have access to the unmodified key via |
53 | * `gtk_editable_get_text (GTK_EDITABLE (gtk_entry_completion_get_entry ()))`. |
54 | * |
55 | * Returns: %TRUE if @iter should be displayed as a possible completion |
56 | * for @key |
57 | */ |
58 | typedef gboolean (* GtkEntryCompletionMatchFunc) (GtkEntryCompletion *completion, |
59 | const char *key, |
60 | GtkTreeIter *iter, |
61 | gpointer user_data); |
62 | |
63 | |
64 | GDK_AVAILABLE_IN_ALL |
65 | GType gtk_entry_completion_get_type (void) G_GNUC_CONST; |
66 | GDK_AVAILABLE_IN_ALL |
67 | GtkEntryCompletion *gtk_entry_completion_new (void); |
68 | GDK_AVAILABLE_IN_ALL |
69 | GtkEntryCompletion *gtk_entry_completion_new_with_area (GtkCellArea *area); |
70 | |
71 | GDK_AVAILABLE_IN_ALL |
72 | GtkWidget *gtk_entry_completion_get_entry (GtkEntryCompletion *completion); |
73 | |
74 | GDK_AVAILABLE_IN_ALL |
75 | void gtk_entry_completion_set_model (GtkEntryCompletion *completion, |
76 | GtkTreeModel *model); |
77 | GDK_AVAILABLE_IN_ALL |
78 | GtkTreeModel *gtk_entry_completion_get_model (GtkEntryCompletion *completion); |
79 | |
80 | GDK_AVAILABLE_IN_ALL |
81 | void gtk_entry_completion_set_match_func (GtkEntryCompletion *completion, |
82 | GtkEntryCompletionMatchFunc func, |
83 | gpointer func_data, |
84 | GDestroyNotify func_notify); |
85 | GDK_AVAILABLE_IN_ALL |
86 | void gtk_entry_completion_set_minimum_key_length (GtkEntryCompletion *completion, |
87 | int length); |
88 | GDK_AVAILABLE_IN_ALL |
89 | int gtk_entry_completion_get_minimum_key_length (GtkEntryCompletion *completion); |
90 | GDK_AVAILABLE_IN_ALL |
91 | char * gtk_entry_completion_compute_prefix (GtkEntryCompletion *completion, |
92 | const char *key); |
93 | GDK_AVAILABLE_IN_ALL |
94 | void gtk_entry_completion_complete (GtkEntryCompletion *completion); |
95 | GDK_AVAILABLE_IN_ALL |
96 | void gtk_entry_completion_insert_prefix (GtkEntryCompletion *completion); |
97 | |
98 | GDK_AVAILABLE_IN_ALL |
99 | void gtk_entry_completion_set_inline_completion (GtkEntryCompletion *completion, |
100 | gboolean inline_completion); |
101 | GDK_AVAILABLE_IN_ALL |
102 | gboolean gtk_entry_completion_get_inline_completion (GtkEntryCompletion *completion); |
103 | GDK_AVAILABLE_IN_ALL |
104 | void gtk_entry_completion_set_inline_selection (GtkEntryCompletion *completion, |
105 | gboolean inline_selection); |
106 | GDK_AVAILABLE_IN_ALL |
107 | gboolean gtk_entry_completion_get_inline_selection (GtkEntryCompletion *completion); |
108 | GDK_AVAILABLE_IN_ALL |
109 | void (GtkEntryCompletion *completion, |
110 | gboolean ); |
111 | GDK_AVAILABLE_IN_ALL |
112 | gboolean (GtkEntryCompletion *completion); |
113 | GDK_AVAILABLE_IN_ALL |
114 | void (GtkEntryCompletion *completion, |
115 | gboolean ); |
116 | GDK_AVAILABLE_IN_ALL |
117 | gboolean (GtkEntryCompletion *completion); |
118 | GDK_AVAILABLE_IN_ALL |
119 | void (GtkEntryCompletion *completion, |
120 | gboolean ); |
121 | GDK_AVAILABLE_IN_ALL |
122 | gboolean (GtkEntryCompletion *completion); |
123 | |
124 | GDK_AVAILABLE_IN_ALL |
125 | const char *gtk_entry_completion_get_completion_prefix (GtkEntryCompletion *completion); |
126 | /* convenience */ |
127 | GDK_AVAILABLE_IN_ALL |
128 | void gtk_entry_completion_set_text_column (GtkEntryCompletion *completion, |
129 | int column); |
130 | GDK_AVAILABLE_IN_ALL |
131 | int gtk_entry_completion_get_text_column (GtkEntryCompletion *completion); |
132 | |
133 | G_END_DECLS |
134 | |
135 | #endif /* __GTK_ENTRY_COMPLETION_H__ */ |
136 | |