GTK+ Reference Manual | ||||
---|---|---|---|---|
Top | Description | Object Hierarchy | Properties | Signals |
#include <gtk/gtk.h> GtkEntryBuffer; GtkEntryBuffer* gtk_entry_buffer_new (const gchar *initial_chars
,gint n_initial_chars
); const gchar* gtk_entry_buffer_get_text (GtkEntryBuffer *buffer
); void gtk_entry_buffer_set_text (GtkEntryBuffer *buffer
,const gchar *chars
,gint n_chars
); gsize gtk_entry_buffer_get_bytes (GtkEntryBuffer *buffer
); guint gtk_entry_buffer_get_length (GtkEntryBuffer *buffer
); gint gtk_entry_buffer_get_max_length (GtkEntryBuffer *buffer
); void gtk_entry_buffer_set_max_length (GtkEntryBuffer *buffer
,gint max_length
); guint gtk_entry_buffer_insert_text (GtkEntryBuffer *buffer
,guint position
,const gchar *chars
,gint n_chars
); guint gtk_entry_buffer_delete_text (GtkEntryBuffer *buffer
,guint position
,gint n_chars
); void gtk_entry_buffer_emit_deleted_text (GtkEntryBuffer *buffer
,guint position
,guint n_chars
); void gtk_entry_buffer_emit_inserted_text (GtkEntryBuffer *buffer
,guint position
,const gchar *chars
,guint n_chars
);
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.
GtkEntryBuffer* gtk_entry_buffer_new (const gchar *initial_chars
,gint n_initial_chars
);
Create a new GtkEntryBuffer object.
Optionally, specify initial text to set in the buffer.
|
initial buffer text, or NULL . allow-none. |
|
number of characters in initial_chars , or -1
|
Returns : |
A new GtkEntryBuffer object. |
Since 2.18
const gchar* 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.
|
a GtkEntryBuffer |
Returns : |
a pointer to the contents of the widget as a string. This string points to internally allocated storage in the buffer and must not be freed, modified or stored. |
Since 2.18
void gtk_entry_buffer_set_text (GtkEntryBuffer *buffer
,const gchar *chars
,gint 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.
|
a GtkEntryBuffer |
|
the new text |
|
the number of characters in text , or -1
|
Since 2.18
gsize gtk_entry_buffer_get_bytes (GtkEntryBuffer *buffer
);
Retrieves the length in bytes of the buffer.
See gtk_entry_buffer_get_length()
.
|
a GtkEntryBuffer |
Returns : |
The byte length of the buffer. |
Since 2.18
guint gtk_entry_buffer_get_length (GtkEntryBuffer *buffer
);
Retrieves the length in characters of the buffer.
|
a GtkEntryBuffer |
Returns : |
The number of characters in the buffer. |
Since 2.18
gint 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()
.
|
a GtkEntryBuffer |
Returns : |
the maximum allowed number of characters in GtkEntryBuffer, or 0 if there is no maximum. |
Since 2.18
void gtk_entry_buffer_set_max_length (GtkEntryBuffer *buffer
,gint 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.
|
a GtkEntryBuffer |
|
the maximum length of the entry buffer, or 0 for no maximum. (other than the maximum length of entries.) The value passed in will be clamped to the range 0-65536. |
Since 2.18
guint gtk_entry_buffer_insert_text (GtkEntryBuffer *buffer
,guint position
,const gchar *chars
,gint 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.
|
a GtkEntryBuffer |
|
the position at which to insert text. |
|
the text to insert into the buffer. |
|
the length of the text in characters, or -1 |
Returns : |
The number of characters actually inserted. |
Since 2.18
guint gtk_entry_buffer_delete_text (GtkEntryBuffer *buffer
,guint position
,gint 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.
|
a GtkEntryBuffer |
|
position at which to delete text |
|
number of characters to delete |
Returns : |
The number of characters deleted. |
Since 2.18
void gtk_entry_buffer_emit_deleted_text (GtkEntryBuffer *buffer
,guint position
,guint n_chars
);
Used when subclassing GtkEntryBuffer
|
a GtkEntryBuffer |
|
position at which text was deleted |
|
number of characters deleted |
Since 2.18
void gtk_entry_buffer_emit_inserted_text (GtkEntryBuffer *buffer
,guint position
,const gchar *chars
,guint n_chars
);
Used when subclassing GtkEntryBuffer
|
a GtkEntryBuffer |
|
position at which text was inserted |
|
text that was inserted |
|
number of characters inserted |
Since 2.18
"length"
property"length" guint : Read
The length (in characters) of the text in buffer.
Allowed values: <= 65535
Default value: 0
Since 2.18
"max-length"
property"max-length" gint : Read / Write
The maximum length (in characters) of the text in the buffer.
Allowed values: [0,65535]
Default value: 0
Since 2.18
"text"
property"text" gchar* : Read / Write
The contents of the buffer.
Default value: ""
Since 2.18
"deleted-text"
signalvoid user_function (GtkEntryBuffer *entrybuffer, guint arg1, guint arg2, gpointer user_data) : Run First
|
the object which received the signal. |
|
|
|
|
|
user data set when the signal handler was connected. |
"inserted-text"
signalvoid user_function (GtkEntryBuffer *entrybuffer, guint arg1, gchar *arg2, guint arg3, gpointer user_data) : Run First
|
the object which received the signal. |
|
|
|
|
|
|
|
user data set when the signal handler was connected. |