1
/* GTK - The GIMP Toolkit
2
* Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
3
* Copyright (C) 2004 Albrecht Dre�
5
* This library is free software; you can redistribute it and/or
6
* modify it under the terms of the GNU Lesser General Public
7
* License as published by the Free Software Foundation; either
8
* version 2 of the License, or (at your option) any later version.
10
* This library is distributed in the hope that it will be useful,
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13
* Lesser General Public License for more details.
15
* You should have received a copy of the GNU Lesser General Public
16
* License along with this library; if not, write to the
17
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18
* Boston, MA 02111-1307, USA.
22
* Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
23
* file for a list of people on the GTK+ Team. See the ChangeLog
24
* files for a list of changes. These files are distributed with
25
* GTK+ at ftp://ftp.gtk.org/pub/gtk/.
29
* Heavily stripped down for use in pinentry-gtk-2 by Albrecht Dre�
30
* <albrecht.dress@arcor.de> Feb. 2004:
32
* The entry is now always invisible, uses secure memory methods to
33
* allocate the text memory, and all potentially dangerous methods
34
* (copy & paste, popup, etc.) have been removed.
37
#ifndef __GTK_SECURE_ENTRY_H__
38
#define __GTK_SECURE_ENTRY_H__
45
#ifdef MAKE_EMACS_HAPPY
47
#endif /* MAKE_EMACS_HAPPY */
48
#endif /* __cplusplus */
49
#define GTK_TYPE_SECURE_ENTRY (gtk_secure_entry_get_type ())
50
#define GTK_SECURE_ENTRY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_SECURE_ENTRY, GtkSecureEntry))
51
#define GTK_SECURE_ENTRY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_SECURE_ENTRY, GtkSecureEntryClass))
52
#define GTK_IS_SECURE_ENTRY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_SECURE_ENTRY))
53
#define GTK_IS_SECURE_ENTRY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_SECURE_ENTRY))
54
#define GTK_SECURE_ENTRY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_SECURE_ENTRY, GtkSecureEntryClass))
55
typedef struct _GtkSecureEntry GtkSecureEntry;
56
typedef struct _GtkSecureEntryClass GtkSecureEntryClass;
58
struct _GtkSecureEntry {
63
guint overwrite_mode:1;
65
guint16 text_length; /* length in use, in chars */
66
guint16 text_max_length;
70
GtkIMContext *im_context;
75
PangoLayout *cached_layout;
76
guint cache_includes_preedit:1;
78
guint need_im_reset:1;
82
guint activates_default:1;
84
guint cursor_visible:1;
86
guint in_click:1; /* Flag so we don't select all when clicking in entry to focus in */
88
guint is_cell_renderer:1;
89
guint editing_canceled:1; /* Only used by GtkCellRendererText */
91
guint mouse_cursor_obscured:1;
93
guint resolved_dir : 4; /* PangoDirection */
99
gint ascent; /* font ascent, in pango units */
100
gint descent; /* font descent, in pango units */
102
guint16 text_size; /* allocated size, in bytes */
103
guint16 n_bytes; /* length in use, in bytes */
105
guint16 preedit_length; /* length of preedit string, in bytes */
106
guint16 preedit_cursor; /* offset of cursor within preedit string, in chars */
108
gunichar invisible_char;
113
struct _GtkSecureEntryClass {
114
GtkWidgetClass parent_class;
118
void (*activate) (GtkSecureEntry * entry);
119
void (*move_cursor) (GtkSecureEntry * entry,
120
GtkMovementStep step,
121
gint count, gboolean extend_selection);
122
void (*insert_at_cursor) (GtkSecureEntry * entry, const gchar * str);
123
void (*delete_from_cursor) (GtkSecureEntry * entry,
124
GtkDeleteType type, gint count);
126
/* Padding for future expansion */
127
void (*_gtk_reserved1) (void);
128
void (*_gtk_reserved2) (void);
129
void (*_gtk_reserved3) (void);
130
void (*_gtk_reserved4) (void);
134
gtk_secure_entry_get_type(void)
137
gtk_secure_entry_new(void);
139
gtk_secure_entry_set_invisible_char(GtkSecureEntry * entry, gunichar ch);
141
gtk_secure_entry_get_invisible_char(GtkSecureEntry * entry);
143
gtk_secure_entry_set_has_frame(GtkSecureEntry * entry, gboolean setting);
145
gtk_secure_entry_get_has_frame(GtkSecureEntry * entry);
146
/* text is truncated if needed */
148
gtk_secure_entry_set_max_length(GtkSecureEntry * entry, gint max);
150
gtk_secure_entry_get_max_length(GtkSecureEntry * entry);
152
gtk_secure_entry_set_activates_default(GtkSecureEntry * entry,
155
gtk_secure_entry_get_activates_default(GtkSecureEntry * entry);
158
gtk_secure_entry_set_width_chars(GtkSecureEntry * entry, gint n_chars);
160
gtk_secure_entry_get_width_chars(GtkSecureEntry * entry);
162
/* Somewhat more convenient than the GtkEditable generic functions
165
gtk_secure_entry_set_text(GtkSecureEntry * entry, const gchar * text);
166
/* returns a reference to the text */
167
G_CONST_RETURN gchar *
168
gtk_secure_entry_get_text(GtkSecureEntry * entry);
171
gtk_secure_entry_get_layout(GtkSecureEntry * entry);
173
gtk_secure_entry_get_layout_offsets(GtkSecureEntry * entry,
178
#endif /* __cplusplus */
181
#endif /* __GTK_SECURE_ENTRY_H__ */