GtkEntryBuffer holds text for GtkEntry

Adds a 'model' type buffer for GtkEntry in which the actual
textual data is stored. GtkEntryBuffer can be subclassed.

Among other things, this allows GtkEntry to be used for secrets
that need to be stored in non-pageable memory. It also allows
buffers to be shared by entries.

See bug #576801.
This commit is contained in:
Stef Walter
2009-07-08 20:41:53 -05:00
parent 9ef87ea11e
commit eab02f697a
15 changed files with 1764 additions and 447 deletions

View File

@ -39,6 +39,7 @@
#include <gtk/gtkeditable.h>
#include <gtk/gtkimcontext.h>
#include <gtk/gtkmenu.h>
#include <gtk/gtkentrybuffer.h>
#include <gtk/gtkentrycompletion.h>
#include <gtk/gtkimage.h>
#include <gtk/gtkselection.h>
@ -66,7 +67,7 @@ struct _GtkEntry
{
GtkWidget widget;
gchar *GSEAL (text);
gchar *GSEAL (text); /* COMPAT: Deprecated, not used. Remove in GTK+ 3.x */
guint GSEAL (editable) : 1;
guint GSEAL (visible) : 1;
@ -74,8 +75,8 @@ struct _GtkEntry
guint GSEAL (in_drag) : 1; /* FIXME: Should be private?
Dragging within the selection */
guint16 GSEAL (text_length); /* length in use, in chars */
guint16 GSEAL (text_max_length);
guint16 GSEAL (text_length); /* COMPAT: Deprecated, not used. Remove in GTK+ 3.x */
guint16 GSEAL (text_max_length); /* COMPAT: Deprecated, not used. Remove in GTK+ 3.x */
/*< private >*/
GdkWindow *GSEAL (text_area);
@ -108,8 +109,8 @@ struct _GtkEntry
gint GSEAL (ascent); /* font ascent in pango units */
gint GSEAL (descent); /* font descent in pango units */
guint16 GSEAL (text_size); /* allocated size, in bytes */
guint16 GSEAL (n_bytes); /* length in use, in bytes */
guint16 GSEAL (x_text_size); /* allocated size, in bytes */
guint16 GSEAL (x_n_bytes); /* length in use, in bytes */
guint16 GSEAL (preedit_length); /* length of preedit string, in bytes */
guint16 GSEAL (preedit_cursor); /* offset of cursor within preedit string, in chars */
@ -164,6 +165,10 @@ struct _GtkEntryClass
GType gtk_entry_get_type (void) G_GNUC_CONST;
GtkWidget* gtk_entry_new (void);
GtkWidget* gtk_entry_new_with_buffer (GtkEntryBuffer *buffer);
GtkEntryBuffer* gtk_entry_get_buffer (GtkEntry *entry);
void gtk_entry_set_buffer (GtkEntry *entry,
GtkEntryBuffer *buffer);
void gtk_entry_set_visibility (GtkEntry *entry,
gboolean visible);
gboolean gtk_entry_get_visibility (GtkEntry *entry);