~logan/ubuntu/trusty/pinentry/0.8.3-1ubuntu1

« back to all changes in this revision

Viewing changes to gtk+-2/gtksecentry.h

  • Committer: Bazaar Package Importer
  • Author(s): Peter Eisentraut
  • Date: 2005-01-27 19:10:07 UTC
  • mfrom: (1.1.1 upstream) (2.1.1 hoary)
  • Revision ID: james.westby@ubuntu.com-20050127191007-83ptn4mcw63mu085
Tags: 0.7.2-1
* New upstream release
* Added new -gtk2 flavor.
* Build dependencies revised accordingly.
* Added more copyright holders to debian/copyright.
* Removed compatibility symlinks.
* Converted to CDBS.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* GTK - The GIMP Toolkit
 
2
 * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
 
3
 * Copyright (C) 2004 Albrecht Dre�
 
4
 *
 
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.
 
9
 *
 
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.
 
14
 *
 
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.
 
19
 */
 
20
 
 
21
/*
 
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/. 
 
26
 */
 
27
 
 
28
/*
 
29
 * Heavily stripped down for use in pinentry-gtk-2 by Albrecht Dre�
 
30
 * <albrecht.dress@arcor.de> Feb. 2004:
 
31
 *
 
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.
 
35
 */
 
36
 
 
37
#ifndef __GTK_SECURE_ENTRY_H__
 
38
#define __GTK_SECURE_ENTRY_H__
 
39
 
 
40
 
 
41
#include <gtk/gtk.h>
 
42
 
 
43
#ifdef __cplusplus
 
44
extern "C" {
 
45
#ifdef MAKE_EMACS_HAPPY
 
46
}
 
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;
 
57
 
 
58
struct _GtkSecureEntry {
 
59
    GtkWidget widget;
 
60
 
 
61
    gchar *text;
 
62
 
 
63
    guint overwrite_mode:1;
 
64
 
 
65
    guint16 text_length;        /* length in use, in chars */
 
66
    guint16 text_max_length;
 
67
 
 
68
    /*< private > */
 
69
    GdkWindow *text_area;
 
70
    GtkIMContext *im_context;
 
71
 
 
72
    gint current_pos;
 
73
    gint selection_bound;
 
74
 
 
75
    PangoLayout *cached_layout;
 
76
    guint cache_includes_preedit:1;
 
77
 
 
78
    guint need_im_reset:1;
 
79
 
 
80
    guint has_frame:1;
 
81
 
 
82
    guint activates_default:1;
 
83
 
 
84
    guint cursor_visible:1;
 
85
 
 
86
    guint in_click:1;           /* Flag so we don't select all when clicking in entry to focus in */
 
87
 
 
88
    guint is_cell_renderer:1;
 
89
    guint editing_canceled:1;   /* Only used by GtkCellRendererText */
 
90
 
 
91
    guint mouse_cursor_obscured:1;
 
92
 
 
93
    guint resolved_dir : 4; /* PangoDirection */
 
94
 
 
95
    guint button;
 
96
    guint blink_timeout;
 
97
    guint recompute_idle;
 
98
    gint scroll_offset;
 
99
    gint ascent;                /* font ascent, in pango units  */
 
100
    gint descent;               /* font descent, in pango units  */
 
101
 
 
102
    guint16 text_size;          /* allocated size, in bytes */
 
103
    guint16 n_bytes;            /* length in use, in bytes */
 
104
 
 
105
    guint16 preedit_length;     /* length of preedit string, in bytes */
 
106
    guint16 preedit_cursor;     /* offset of cursor within preedit string, in chars */
 
107
 
 
108
    gunichar invisible_char;
 
109
 
 
110
    gint width_chars;
 
111
};
 
112
 
 
113
struct _GtkSecureEntryClass {
 
114
    GtkWidgetClass parent_class;
 
115
 
 
116
    /* Action signals
 
117
     */
 
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);
 
125
 
 
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);
 
131
};
 
132
 
 
133
GType
 
134
gtk_secure_entry_get_type(void)
 
135
    G_GNUC_CONST;
 
136
GtkWidget *
 
137
gtk_secure_entry_new(void);
 
138
void
 
139
gtk_secure_entry_set_invisible_char(GtkSecureEntry * entry, gunichar ch);
 
140
gunichar
 
141
gtk_secure_entry_get_invisible_char(GtkSecureEntry * entry);
 
142
void
 
143
gtk_secure_entry_set_has_frame(GtkSecureEntry * entry, gboolean setting);
 
144
gboolean
 
145
gtk_secure_entry_get_has_frame(GtkSecureEntry * entry);
 
146
/* text is truncated if needed */
 
147
void
 
148
gtk_secure_entry_set_max_length(GtkSecureEntry * entry, gint max);
 
149
gint
 
150
gtk_secure_entry_get_max_length(GtkSecureEntry * entry);
 
151
void
 
152
gtk_secure_entry_set_activates_default(GtkSecureEntry * entry,
 
153
                                       gboolean setting);
 
154
gboolean
 
155
gtk_secure_entry_get_activates_default(GtkSecureEntry * entry);
 
156
 
 
157
void
 
158
gtk_secure_entry_set_width_chars(GtkSecureEntry * entry, gint n_chars);
 
159
gint
 
160
gtk_secure_entry_get_width_chars(GtkSecureEntry * entry);
 
161
 
 
162
/* Somewhat more convenient than the GtkEditable generic functions
 
163
 */
 
164
void
 
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);
 
169
 
 
170
PangoLayout *
 
171
gtk_secure_entry_get_layout(GtkSecureEntry * entry);
 
172
void
 
173
gtk_secure_entry_get_layout_offsets(GtkSecureEntry * entry,
 
174
                                    gint * x, gint * y);
 
175
 
 
176
#ifdef __cplusplus
 
177
}
 
178
#endif                          /* __cplusplus */
 
179
 
 
180
 
 
181
#endif                          /* __GTK_SECURE_ENTRY_H__ */