Top |
Functions
GtkEntryBuffer * | gtk_entry_buffer_new () |
const char * | gtk_entry_buffer_get_text () |
void | gtk_entry_buffer_set_text () |
gsize | gtk_entry_buffer_get_bytes () |
guint | gtk_entry_buffer_get_length () |
int | gtk_entry_buffer_get_max_length () |
void | gtk_entry_buffer_set_max_length () |
guint | gtk_entry_buffer_insert_text () |
guint | gtk_entry_buffer_delete_text () |
void | gtk_entry_buffer_emit_deleted_text () |
void | gtk_entry_buffer_emit_inserted_text () |
Description
The GtkEntryBuffer class contains the actual text displayed in a GtkEntry widget.
A single GtkEntryBuffer object can be shared by multiple GtkEntry widgets which will then share the same text content, but not the cursor position, visibility attributes, icon etc.
GtkEntryBuffer may be derived from. Such a derived class might allow text to be stored in an alternate location, such as non-pageable memory, useful in the case of important passwords. Or a derived class could integrate with an application’s concept of undo/redo.
Functions
gtk_entry_buffer_new ()
GtkEntryBuffer * gtk_entry_buffer_new (const char *initial_chars
,int n_initial_chars
);
Create a new GtkEntryBuffer object.
Optionally, specify initial text to set in the buffer.
gtk_entry_buffer_get_text ()
const char *
gtk_entry_buffer_get_text (GtkEntryBuffer *buffer
);
Retrieves the contents of the buffer.
The memory pointer returned by this call will not change unless this object emits a signal, or is finalized.
gtk_entry_buffer_set_text ()
void gtk_entry_buffer_set_text (GtkEntryBuffer *buffer
,const char *chars
,int n_chars
);
Sets the text in the buffer.
This is roughly equivalent to calling gtk_entry_buffer_delete_text()
and gtk_entry_buffer_insert_text()
.
Note that n_chars
is in characters, not in bytes.
gtk_entry_buffer_get_bytes ()
gsize
gtk_entry_buffer_get_bytes (GtkEntryBuffer *buffer
);
Retrieves the length in bytes of the buffer.
See gtk_entry_buffer_get_length()
.
gtk_entry_buffer_get_length ()
guint
gtk_entry_buffer_get_length (GtkEntryBuffer *buffer
);
Retrieves the length in characters of the buffer.
gtk_entry_buffer_get_max_length ()
int
gtk_entry_buffer_get_max_length (GtkEntryBuffer *buffer
);
Retrieves the maximum allowed length of the text in
buffer
. See gtk_entry_buffer_set_max_length()
.
gtk_entry_buffer_set_max_length ()
void gtk_entry_buffer_set_max_length (GtkEntryBuffer *buffer
,int max_length
);
Sets the maximum allowed length of the contents of the buffer. If the current contents are longer than the given length, then they will be truncated to fit.
gtk_entry_buffer_insert_text ()
guint gtk_entry_buffer_insert_text (GtkEntryBuffer *buffer
,guint position
,const char *chars
,int n_chars
);
Inserts n_chars
characters of chars
into the contents of the
buffer, at position position
.
If n_chars
is negative, then characters from chars will be inserted
until a null-terminator is found. If position
or n_chars
are out of
bounds, or the maximum buffer text length is exceeded, then they are
coerced to sane values.
Note that the position and length are in characters, not in bytes.
gtk_entry_buffer_delete_text ()
guint gtk_entry_buffer_delete_text (GtkEntryBuffer *buffer
,guint position
,int n_chars
);
Deletes a sequence of characters from the buffer. n_chars
characters are
deleted starting at position
. If n_chars
is negative, then all characters
until the end of the text are deleted.
If position
or n_chars
are out of bounds, then they are coerced to sane
values.
Note that the positions are specified in characters, not bytes.
gtk_entry_buffer_emit_deleted_text ()
void gtk_entry_buffer_emit_deleted_text (GtkEntryBuffer *buffer
,guint position
,guint n_chars
);
Used when subclassing GtkEntryBuffer
gtk_entry_buffer_emit_inserted_text ()
void gtk_entry_buffer_emit_inserted_text (GtkEntryBuffer *buffer
,guint position
,const char *chars
,guint n_chars
);
Used when subclassing GtkEntryBuffer
Property Details
The “length”
property
“length” guint
The length (in characters) of the text in buffer.
Owner: GtkEntryBuffer
Flags: Read
Allowed values: <= 65535
Default value: 0
The “max-length”
property
“max-length” int
The maximum length (in characters) of the text in the buffer.
Owner: GtkEntryBuffer
Flags: Read / Write
Allowed values: [0,65535]
Default value: 0
Signal Details
The “deleted-text”
signal
void user_function (GtkEntryBuffer *buffer, guint position, guint n_chars, gpointer user_data)
The text is altered in the default handler for this signal. If you want
access to the text after the text has been modified, use
G_CONNECT_AFTER
.
Parameters
buffer |
||
position |
the position the text was deleted at. |
|
n_chars |
The number of characters that were deleted. |
|
user_data |
user data set when the signal handler was connected. |
Flags: Run Last
The “inserted-text”
signal
void user_function (GtkEntryBuffer *buffer, guint position, char *chars, guint n_chars, gpointer user_data)
This signal is emitted after text is inserted into the buffer.
Parameters
buffer |
||
position |
the position the text was inserted at. |
|
chars |
The text that was inserted. |
|
n_chars |
The number of characters that were inserted. |
|
user_data |
user data set when the signal handler was connected. |
Flags: Run First