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