gtkentry.h 12 KB
Newer Older
Cody Russell's avatar
Cody Russell committed
1
/* GTK - The GIMP Toolkit
Elliot Lee's avatar
Elliot Lee committed
2
3
 * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
 *
4
5
6
7
 * Copyright (C) 2004-2006 Christian Hammond
 * Copyright (C) 2008 Cody Russell
 * Copyright (C) 2008 Red Hat, Inc.
 *
Elliot Lee's avatar
Elliot Lee committed
8
 * This library is free software; you can redistribute it and/or
9
 * modify it under the terms of the GNU Lesser General Public
Elliot Lee's avatar
Elliot Lee committed
10
11
12
13
14
15
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16
 * Lesser General Public License for more details.
Elliot Lee's avatar
Elliot Lee committed
17
 *
18
 * You should have received a copy of the GNU Lesser General Public
Javier Jardón's avatar
Javier Jardón committed
19
 * License along with this library. If not, see <http://www.gnu.org/licenses/>.
Elliot Lee's avatar
Elliot Lee committed
20
 */
21
22

/*
23
 * Modified by the GTK+ Team and others 1997-2000.  See the AUTHORS
24
25
 * file for a list of people on the GTK+ Team.  See the ChangeLog
 * files for a list of changes.  These files are distributed with
26
 * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
27
28
 */

Elliot Lee's avatar
Elliot Lee committed
29
30
31
32
#ifndef __GTK_ENTRY_H__
#define __GTK_ENTRY_H__


33
34
35
36
#if !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION)
#error "Only <gtk/gtk.h> can be included directly."
#endif

37
#include <gtk/gtkeditable.h>
38
#include <gtk/gtkimcontext.h>
39
#include <gtk/gtkentrybuffer.h>
40
#include <gtk/gtkentrycompletion.h>
41
#include <gtk/gtkimage.h>
Elliot Lee's avatar
Elliot Lee committed
42

43

44
G_BEGIN_DECLS
Elliot Lee's avatar
Elliot Lee committed
45

46
#define GTK_TYPE_ENTRY                  (gtk_entry_get_type ())
Manish Singh's avatar
Manish Singh committed
47
48
49
50
51
#define GTK_ENTRY(obj)                  (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_ENTRY, GtkEntry))
#define GTK_ENTRY_CLASS(klass)          (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_ENTRY, GtkEntryClass))
#define GTK_IS_ENTRY(obj)               (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_ENTRY))
#define GTK_IS_ENTRY_CLASS(klass)       (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_ENTRY))
#define GTK_ENTRY_GET_CLASS(obj)        (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_ENTRY, GtkEntryClass))
Elliot Lee's avatar
Elliot Lee committed
52

53
54
55
56
57
58
59
/**
 * GtkEntryIconPosition:
 * @GTK_ENTRY_ICON_PRIMARY: At the beginning of the entry (depending on the text direction).
 * @GTK_ENTRY_ICON_SECONDARY: At the end of the entry (depending on the text direction).
 *
 * Specifies the side of the entry at which an icon is placed.
 */
60
61
62
63
64
typedef enum
{
  GTK_ENTRY_ICON_PRIMARY,
  GTK_ENTRY_ICON_SECONDARY
} GtkEntryIconPosition;
Elliot Lee's avatar
Elliot Lee committed
65

66
67
typedef struct _GtkEntry              GtkEntry;
typedef struct _GtkEntryClass         GtkEntryClass;
Elliot Lee's avatar
Elliot Lee committed
68
69
70

struct _GtkEntry
{
71
  /*< private >*/
72
  GtkWidget  parent_instance;
Elliot Lee's avatar
Elliot Lee committed
73
74
};

75
76
77
/**
 * GtkEntryClass:
 * @parent_class: The parent class.
Matthias Clasen's avatar
Matthias Clasen committed
78
 * @activate: Class handler for the `GtkEntry::activate` signal. The default
79
 *   implementation activates the gtk.activate-default action.
80
 *
Matthias Clasen's avatar
Matthias Clasen committed
81
 * Class structure for `GtkEntry`. All virtual functions have a default
82
83
84
85
86
 * implementation. Derived classes may set the virtual function pointers for the
 * signal handlers to %NULL, but must keep @get_text_area_size and
 * @get_frame_size non-%NULL; either use the default implementation, or provide
 * a custom one.
 */
Elliot Lee's avatar
Elliot Lee committed
87
88
struct _GtkEntryClass
{
Owen Taylor's avatar
Owen Taylor committed
89
90
91
92
  GtkWidgetClass parent_class;

  /* Action signals
   */
93
  void (* activate)           (GtkEntry             *entry);
94

95
96
  /*< private >*/

Matthias Clasen's avatar
Matthias Clasen committed
97
  gpointer padding[8];
Elliot Lee's avatar
Elliot Lee committed
98
99
};

100
GDK_AVAILABLE_IN_ALL
Manish Singh's avatar
Manish Singh committed
101
GType      gtk_entry_get_type       		(void) G_GNUC_CONST;
102
GDK_AVAILABLE_IN_ALL
103
GtkWidget* gtk_entry_new            		(void);
104
GDK_AVAILABLE_IN_ALL
105
GtkWidget* gtk_entry_new_with_buffer            (GtkEntryBuffer *buffer);
106

107
GDK_AVAILABLE_IN_ALL
108
GtkEntryBuffer* gtk_entry_get_buffer            (GtkEntry       *entry);
109
GDK_AVAILABLE_IN_ALL
110
111
void       gtk_entry_set_buffer                 (GtkEntry       *entry,
                                                 GtkEntryBuffer *buffer);
112

113
GDK_AVAILABLE_IN_ALL
Owen Taylor's avatar
Owen Taylor committed
114
115
void       gtk_entry_set_visibility 		(GtkEntry      *entry,
						 gboolean       visible);
116
GDK_AVAILABLE_IN_ALL
117
gboolean   gtk_entry_get_visibility             (GtkEntry      *entry);
118

119
GDK_AVAILABLE_IN_ALL
120
121
void       gtk_entry_set_invisible_char         (GtkEntry      *entry,
                                                 gunichar       ch);
122
GDK_AVAILABLE_IN_ALL
123
gunichar   gtk_entry_get_invisible_char         (GtkEntry      *entry);
124
GDK_AVAILABLE_IN_ALL
125
void       gtk_entry_unset_invisible_char       (GtkEntry      *entry);
126

127
GDK_AVAILABLE_IN_ALL
Havoc Pennington's avatar
Havoc Pennington committed
128
129
void       gtk_entry_set_has_frame              (GtkEntry      *entry,
                                                 gboolean       setting);
130
GDK_AVAILABLE_IN_ALL
Havoc Pennington's avatar
Havoc Pennington committed
131
gboolean   gtk_entry_get_has_frame              (GtkEntry      *entry);
132

133
GDK_AVAILABLE_IN_ALL
Tim Janik's avatar
Tim Janik committed
134
135
void       gtk_entry_set_overwrite_mode         (GtkEntry      *entry,
                                                 gboolean       overwrite);
136
GDK_AVAILABLE_IN_ALL
Tim Janik's avatar
Tim Janik committed
137
gboolean   gtk_entry_get_overwrite_mode         (GtkEntry      *entry);
138

Owen Taylor's avatar
Owen Taylor committed
139
/* text is truncated if needed */
140
GDK_AVAILABLE_IN_ALL
Owen Taylor's avatar
Owen Taylor committed
141
void       gtk_entry_set_max_length 		(GtkEntry      *entry,
Benjamin Otte's avatar
Benjamin Otte committed
142
						 int            max);
143
GDK_AVAILABLE_IN_ALL
Benjamin Otte's avatar
Benjamin Otte committed
144
int        gtk_entry_get_max_length             (GtkEntry      *entry);
145
GDK_AVAILABLE_IN_ALL
Tim Janik's avatar
Tim Janik committed
146
guint16    gtk_entry_get_text_length            (GtkEntry      *entry);
147

148
GDK_AVAILABLE_IN_ALL
149
150
void       gtk_entry_set_activates_default      (GtkEntry      *entry,
                                                 gboolean       setting);
151
GDK_AVAILABLE_IN_ALL
152
gboolean   gtk_entry_get_activates_default      (GtkEntry      *entry);
Owen Taylor's avatar
Owen Taylor committed
153

154
GDK_AVAILABLE_IN_ALL
155
void       gtk_entry_set_alignment              (GtkEntry      *entry,
Benjamin Otte's avatar
Benjamin Otte committed
156
                                                 float          xalign);
157
GDK_AVAILABLE_IN_ALL
Benjamin Otte's avatar
Benjamin Otte committed
158
float      gtk_entry_get_alignment              (GtkEntry      *entry);
159

160
GDK_AVAILABLE_IN_ALL
161
162
void                gtk_entry_set_completion (GtkEntry           *entry,
                                              GtkEntryCompletion *completion);
163
GDK_AVAILABLE_IN_ALL
164
165
GtkEntryCompletion *gtk_entry_get_completion (GtkEntry           *entry);

166
167
/* Progress API
 */
168
GDK_AVAILABLE_IN_ALL
169
void           gtk_entry_set_progress_fraction   (GtkEntry     *entry,
170
                                                  double        fraction);
171
GDK_AVAILABLE_IN_ALL
172
double         gtk_entry_get_progress_fraction   (GtkEntry     *entry);
173

174
GDK_AVAILABLE_IN_ALL
175
void           gtk_entry_set_progress_pulse_step (GtkEntry     *entry,
176
                                                  double        fraction);
177
GDK_AVAILABLE_IN_ALL
178
double         gtk_entry_get_progress_pulse_step (GtkEntry     *entry);
179

180
GDK_AVAILABLE_IN_ALL
181
void           gtk_entry_progress_pulse          (GtkEntry     *entry);
Matthias Clasen's avatar
Matthias Clasen committed
182
GDK_AVAILABLE_IN_ALL
Benjamin Otte's avatar
Benjamin Otte committed
183
const char *   gtk_entry_get_placeholder_text    (GtkEntry             *entry);
Matthias Clasen's avatar
Matthias Clasen committed
184
GDK_AVAILABLE_IN_ALL
185
void           gtk_entry_set_placeholder_text    (GtkEntry             *entry,
Benjamin Otte's avatar
Benjamin Otte committed
186
                                                  const char           *text);
187
188
/* Setting and managing icons
 */
Matthias Clasen's avatar
Matthias Clasen committed
189
GDK_AVAILABLE_IN_ALL
Benjamin Otte's avatar
Benjamin Otte committed
190
void           gtk_entry_set_icon_from_paintable         (GtkEntry             *entry,
191
							  GtkEntryIconPosition  icon_pos,
Benjamin Otte's avatar
Benjamin Otte committed
192
							  GdkPaintable         *paintable);
193
GDK_AVAILABLE_IN_ALL
194
195
void           gtk_entry_set_icon_from_icon_name         (GtkEntry             *entry,
							  GtkEntryIconPosition  icon_pos,
Benjamin Otte's avatar
Benjamin Otte committed
196
							  const char           *icon_name);
197
GDK_AVAILABLE_IN_ALL
198
199
200
void           gtk_entry_set_icon_from_gicon             (GtkEntry             *entry,
							  GtkEntryIconPosition  icon_pos,
							  GIcon                *icon);
201
GDK_AVAILABLE_IN_ALL
202
GtkImageType   gtk_entry_get_icon_storage_type           (GtkEntry             *entry,
203
							  GtkEntryIconPosition  icon_pos);
Matthias Clasen's avatar
Matthias Clasen committed
204
GDK_AVAILABLE_IN_ALL
Benjamin Otte's avatar
Benjamin Otte committed
205
GdkPaintable * gtk_entry_get_icon_paintable              (GtkEntry             *entry,
206
							  GtkEntryIconPosition  icon_pos);
207
GDK_AVAILABLE_IN_ALL
Benjamin Otte's avatar
Benjamin Otte committed
208
const char * gtk_entry_get_icon_name                     (GtkEntry             *entry,
209
							  GtkEntryIconPosition  icon_pos);
210
GDK_AVAILABLE_IN_ALL
211
GIcon*       gtk_entry_get_icon_gicon                    (GtkEntry             *entry,
212
							  GtkEntryIconPosition  icon_pos);
213
GDK_AVAILABLE_IN_ALL
214
215
216
void         gtk_entry_set_icon_activatable              (GtkEntry             *entry,
							  GtkEntryIconPosition  icon_pos,
							  gboolean              activatable);
217
GDK_AVAILABLE_IN_ALL
218
219
gboolean     gtk_entry_get_icon_activatable              (GtkEntry             *entry,
							  GtkEntryIconPosition  icon_pos);
220
GDK_AVAILABLE_IN_ALL
221
222
223
void         gtk_entry_set_icon_sensitive                (GtkEntry             *entry,
							  GtkEntryIconPosition  icon_pos,
							  gboolean              sensitive);
224
GDK_AVAILABLE_IN_ALL
225
226
gboolean     gtk_entry_get_icon_sensitive                (GtkEntry             *entry,
							  GtkEntryIconPosition  icon_pos);
227
GDK_AVAILABLE_IN_ALL
Benjamin Otte's avatar
Benjamin Otte committed
228
229
230
int          gtk_entry_get_icon_at_pos                   (GtkEntry             *entry,
							  int                   x,
							  int                   y);
231
GDK_AVAILABLE_IN_ALL
232
233
void         gtk_entry_set_icon_tooltip_text             (GtkEntry             *entry,
							  GtkEntryIconPosition  icon_pos,
Benjamin Otte's avatar
Benjamin Otte committed
234
							  const char           *tooltip);
235
GDK_AVAILABLE_IN_ALL
Benjamin Otte's avatar
Benjamin Otte committed
236
char *      gtk_entry_get_icon_tooltip_text             (GtkEntry             *entry,
237
                                                          GtkEntryIconPosition  icon_pos);
238
GDK_AVAILABLE_IN_ALL
239
240
void         gtk_entry_set_icon_tooltip_markup           (GtkEntry             *entry,
							  GtkEntryIconPosition  icon_pos,
Benjamin Otte's avatar
Benjamin Otte committed
241
							  const char           *tooltip);
242
GDK_AVAILABLE_IN_ALL
Benjamin Otte's avatar
Benjamin Otte committed
243
char *      gtk_entry_get_icon_tooltip_markup           (GtkEntry             *entry,
244
                                                          GtkEntryIconPosition  icon_pos);
245
GDK_AVAILABLE_IN_ALL
246
247
void         gtk_entry_set_icon_drag_source              (GtkEntry             *entry,
							  GtkEntryIconPosition  icon_pos,
248
							  GdkContentProvider   *provider,
249
							  GdkDragAction         actions);
250
GDK_AVAILABLE_IN_ALL
Benjamin Otte's avatar
Benjamin Otte committed
251
int          gtk_entry_get_current_icon_drag_source      (GtkEntry             *entry);
252
GDK_AVAILABLE_IN_ALL
253
254
255
void         gtk_entry_get_icon_area                     (GtkEntry             *entry,
                                                          GtkEntryIconPosition  icon_pos,
                                                          GdkRectangle         *icon_area);
256

257
GDK_AVAILABLE_IN_ALL
258
259
void        gtk_entry_reset_im_context                   (GtkEntry             *entry);

Matthias Clasen's avatar
Matthias Clasen committed
260
GDK_AVAILABLE_IN_ALL
261
262
void            gtk_entry_set_input_purpose                  (GtkEntry             *entry,
                                                              GtkInputPurpose       purpose);
Matthias Clasen's avatar
Matthias Clasen committed
263
GDK_AVAILABLE_IN_ALL
264
265
GtkInputPurpose gtk_entry_get_input_purpose                  (GtkEntry             *entry);

Matthias Clasen's avatar
Matthias Clasen committed
266
GDK_AVAILABLE_IN_ALL
267
268
void            gtk_entry_set_input_hints                    (GtkEntry             *entry,
                                                              GtkInputHints         hints);
Matthias Clasen's avatar
Matthias Clasen committed
269
GDK_AVAILABLE_IN_ALL
270
271
GtkInputHints   gtk_entry_get_input_hints                    (GtkEntry             *entry);

Matthias Clasen's avatar
Matthias Clasen committed
272
GDK_AVAILABLE_IN_ALL
273
274
void            gtk_entry_set_attributes                     (GtkEntry             *entry,
                                                              PangoAttrList        *attrs);
Matthias Clasen's avatar
Matthias Clasen committed
275
GDK_AVAILABLE_IN_ALL
276
PangoAttrList  *gtk_entry_get_attributes                     (GtkEntry             *entry);
277

Matthias Clasen's avatar
Matthias Clasen committed
278
GDK_AVAILABLE_IN_ALL
279
280
281
void            gtk_entry_set_tabs                           (GtkEntry             *entry,
                                                              PangoTabArray        *tabs);

Matthias Clasen's avatar
Matthias Clasen committed
282
GDK_AVAILABLE_IN_ALL
283
284
PangoTabArray  *gtk_entry_get_tabs                           (GtkEntry             *entry);

Matthias Clasen's avatar
Matthias Clasen committed
285
GDK_AVAILABLE_IN_ALL
286
gboolean       gtk_entry_grab_focus_without_selecting        (GtkEntry             *entry);
287

288
289
290
291
292
293
GDK_AVAILABLE_IN_ALL
void           gtk_entry_set_extra_menu                      (GtkEntry             *entry,
                                                              GMenuModel           *model);
GDK_AVAILABLE_IN_ALL
GMenuModel *   gtk_entry_get_extra_menu                      (GtkEntry             *entry);

294
G_END_DECLS
Elliot Lee's avatar
Elliot Lee committed
295
296

#endif /* __GTK_ENTRY_H__ */