1/* gtkentrycompletion.h
2 * Copyright (C) 2003 Kristian Rietveld <[email protected]>
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, write to the
16 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17 * Boston, MA 02111-1307, USA.
18 */
19
20#ifndef __GTK_ENTRY_COMPLETION_H__
21#define __GTK_ENTRY_COMPLETION_H__
22
23#if defined(GTK_DISABLE_SINGLE_INCLUDES) && !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION)
24#error "Only <gtk/gtk.h> can be included directly."
25#endif
26
27#include <gtk/gtktreemodel.h>
28#include <gtk/gtkliststore.h>
29#include <gtk/gtktreeviewcolumn.h>
30#include <gtk/gtktreemodelfilter.h>
31
32G_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_ENTRY_COMPLETION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_ENTRY_COMPLETION, GtkEntryCompletionClass))
37#define GTK_IS_ENTRY_COMPLETION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_ENTRY_COMPLETION))
38#define GTK_IS_ENTRY_COMPLETION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_ENTRY_COMPLETION))
39#define GTK_ENTRY_COMPLETION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_ENTRY_COMPLETION, GtkEntryCompletionClass))
40
41typedef struct _GtkEntryCompletion GtkEntryCompletion;
42typedef struct _GtkEntryCompletionClass GtkEntryCompletionClass;
43typedef struct _GtkEntryCompletionPrivate GtkEntryCompletionPrivate;
44
45typedef gboolean (* GtkEntryCompletionMatchFunc) (GtkEntryCompletion *completion,
46 const gchar *key,
47 GtkTreeIter *iter,
48 gpointer user_data);
49
50
51struct _GtkEntryCompletion
52{
53 GObject parent_instance;
54
55 /*< private >*/
56 GtkEntryCompletionPrivate *GSEAL (priv);
57};
58
59struct _GtkEntryCompletionClass
60{
61 GObjectClass parent_class;
62
63 gboolean (* match_selected) (GtkEntryCompletion *completion,
64 GtkTreeModel *model,
65 GtkTreeIter *iter);
66 void (* action_activated) (GtkEntryCompletion *completion,
67 gint index_);
68 gboolean (* insert_prefix) (GtkEntryCompletion *completion,
69 const gchar *prefix);
70 gboolean (* cursor_on_match) (GtkEntryCompletion *completion,
71 GtkTreeModel *model,
72 GtkTreeIter *iter);
73
74 /* Padding for future expansion */
75 void (*_gtk_reserved0) (void);
76 void (*_gtk_reserved1) (void);
77};
78
79/* core */
80GType gtk_entry_completion_get_type (void) G_GNUC_CONST;
81GtkEntryCompletion *gtk_entry_completion_new (void);
82
83GtkWidget *gtk_entry_completion_get_entry (GtkEntryCompletion *completion);
84
85void gtk_entry_completion_set_model (GtkEntryCompletion *completion,
86 GtkTreeModel *model);
87GtkTreeModel *gtk_entry_completion_get_model (GtkEntryCompletion *completion);
88
89void gtk_entry_completion_set_match_func (GtkEntryCompletion *completion,
90 GtkEntryCompletionMatchFunc func,
91 gpointer func_data,
92 GDestroyNotify func_notify);
93void gtk_entry_completion_set_minimum_key_length (GtkEntryCompletion *completion,
94 gint length);
95gint gtk_entry_completion_get_minimum_key_length (GtkEntryCompletion *completion);
96void gtk_entry_completion_complete (GtkEntryCompletion *completion);
97void gtk_entry_completion_insert_prefix (GtkEntryCompletion *completion);
98
99void gtk_entry_completion_insert_action_text (GtkEntryCompletion *completion,
100 gint index_,
101 const gchar *text);
102void gtk_entry_completion_insert_action_markup (GtkEntryCompletion *completion,
103 gint index_,
104 const gchar *markup);
105void gtk_entry_completion_delete_action (GtkEntryCompletion *completion,
106 gint index_);
107
108void gtk_entry_completion_set_inline_completion (GtkEntryCompletion *completion,
109 gboolean inline_completion);
110gboolean gtk_entry_completion_get_inline_completion (GtkEntryCompletion *completion);
111void gtk_entry_completion_set_inline_selection (GtkEntryCompletion *completion,
112 gboolean inline_selection);
113gboolean gtk_entry_completion_get_inline_selection (GtkEntryCompletion *completion);
114void gtk_entry_completion_set_popup_completion (GtkEntryCompletion *completion,
115 gboolean popup_completion);
116gboolean gtk_entry_completion_get_popup_completion (GtkEntryCompletion *completion);
117void gtk_entry_completion_set_popup_set_width (GtkEntryCompletion *completion,
118 gboolean popup_set_width);
119gboolean gtk_entry_completion_get_popup_set_width (GtkEntryCompletion *completion);
120void gtk_entry_completion_set_popup_single_match (GtkEntryCompletion *completion,
121 gboolean popup_single_match);
122gboolean gtk_entry_completion_get_popup_single_match (GtkEntryCompletion *completion);
123
124const gchar *gtk_entry_completion_get_completion_prefix (GtkEntryCompletion *completion);
125/* convenience */
126void gtk_entry_completion_set_text_column (GtkEntryCompletion *completion,
127 gint column);
128gint gtk_entry_completion_get_text_column (GtkEntryCompletion *completion);
129
130G_END_DECLS
131
132#endif /* __GTK_ENTRY_COMPLETION_H__ */
133