| 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, 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 | |
| 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_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 | |
| 41 | typedef struct _GtkEntryCompletion GtkEntryCompletion; |
| 42 | typedef struct _GtkEntryCompletionClass GtkEntryCompletionClass; |
| 43 | typedef struct _GtkEntryCompletionPrivate GtkEntryCompletionPrivate; |
| 44 | |
| 45 | typedef gboolean (* GtkEntryCompletionMatchFunc) (GtkEntryCompletion *completion, |
| 46 | const gchar *key, |
| 47 | GtkTreeIter *iter, |
| 48 | gpointer user_data); |
| 49 | |
| 50 | |
| 51 | struct _GtkEntryCompletion |
| 52 | { |
| 53 | GObject parent_instance; |
| 54 | |
| 55 | /*< private >*/ |
| 56 | GtkEntryCompletionPrivate *GSEAL (priv); |
| 57 | }; |
| 58 | |
| 59 | struct _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 */ |
| 80 | GType gtk_entry_completion_get_type (void) G_GNUC_CONST; |
| 81 | GtkEntryCompletion *gtk_entry_completion_new (void); |
| 82 | |
| 83 | GtkWidget *gtk_entry_completion_get_entry (GtkEntryCompletion *completion); |
| 84 | |
| 85 | void gtk_entry_completion_set_model (GtkEntryCompletion *completion, |
| 86 | GtkTreeModel *model); |
| 87 | GtkTreeModel *gtk_entry_completion_get_model (GtkEntryCompletion *completion); |
| 88 | |
| 89 | void gtk_entry_completion_set_match_func (GtkEntryCompletion *completion, |
| 90 | GtkEntryCompletionMatchFunc func, |
| 91 | gpointer func_data, |
| 92 | GDestroyNotify func_notify); |
| 93 | void gtk_entry_completion_set_minimum_key_length (GtkEntryCompletion *completion, |
| 94 | gint length); |
| 95 | gint gtk_entry_completion_get_minimum_key_length (GtkEntryCompletion *completion); |
| 96 | void gtk_entry_completion_complete (GtkEntryCompletion *completion); |
| 97 | void gtk_entry_completion_insert_prefix (GtkEntryCompletion *completion); |
| 98 | |
| 99 | void gtk_entry_completion_insert_action_text (GtkEntryCompletion *completion, |
| 100 | gint index_, |
| 101 | const gchar *text); |
| 102 | void gtk_entry_completion_insert_action_markup (GtkEntryCompletion *completion, |
| 103 | gint index_, |
| 104 | const gchar *markup); |
| 105 | void gtk_entry_completion_delete_action (GtkEntryCompletion *completion, |
| 106 | gint index_); |
| 107 | |
| 108 | void gtk_entry_completion_set_inline_completion (GtkEntryCompletion *completion, |
| 109 | gboolean inline_completion); |
| 110 | gboolean gtk_entry_completion_get_inline_completion (GtkEntryCompletion *completion); |
| 111 | void gtk_entry_completion_set_inline_selection (GtkEntryCompletion *completion, |
| 112 | gboolean inline_selection); |
| 113 | gboolean gtk_entry_completion_get_inline_selection (GtkEntryCompletion *completion); |
| 114 | void (GtkEntryCompletion *completion, |
| 115 | gboolean ); |
| 116 | gboolean (GtkEntryCompletion *completion); |
| 117 | void (GtkEntryCompletion *completion, |
| 118 | gboolean ); |
| 119 | gboolean (GtkEntryCompletion *completion); |
| 120 | void (GtkEntryCompletion *completion, |
| 121 | gboolean ); |
| 122 | gboolean (GtkEntryCompletion *completion); |
| 123 | |
| 124 | const gchar *gtk_entry_completion_get_completion_prefix (GtkEntryCompletion *completion); |
| 125 | /* convenience */ |
| 126 | void gtk_entry_completion_set_text_column (GtkEntryCompletion *completion, |
| 127 | gint column); |
| 128 | gint gtk_entry_completion_get_text_column (GtkEntryCompletion *completion); |
| 129 | |
| 130 | G_END_DECLS |
| 131 | |
| 132 | #endif /* __GTK_ENTRY_COMPLETION_H__ */ |
| 133 | |