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