Top |
Functions
Properties
Types and Values
struct | GtkEntry |
struct | GtkEntryClass |
enum | GtkEntryIconPosition |
enum | GtkInputPurpose |
enum | GtkInputHints |
Implemented Interfaces
GtkEntry implements GtkAccessible, GtkBuildable, GtkConstraintTarget, GtkEditable and GtkCellEditable.
Description
The GtkEntry widget is a single line text entry widget. A fairly large set of key bindings are supported by default. If the entered text is longer than the allocation of the widget, the widget will scroll so that the cursor position is visible.
When using an entry for passwords and other sensitive information,
it can be put into “password mode” using gtk_entry_set_visibility()
.
In this mode, entered text is displayed using a “invisible” character.
By default, GTK picks the best invisible character that is available
in the current font, but it can be changed with
gtk_entry_set_invisible_char()
.
GtkEntry has the ability to display progress or activity
information behind the text. To make an entry display such information,
use gtk_entry_set_progress_fraction()
or gtk_entry_set_progress_pulse_step()
.
Additionally, GtkEntry can show icons at either side of the entry. These
icons can be activatable by clicking, can be set up as drag source and
can have tooltips. To add an icon, use gtk_entry_set_icon_from_gicon()
or
one of the various other functions that set an icon from an icon name or a
paintable. To trigger an action when the user clicks an icon,
connect to the “icon-press” signal. To allow DND operations
from an icon, use gtk_entry_set_icon_drag_source()
. To set a tooltip on
an icon, use gtk_entry_set_icon_tooltip_text()
or the corresponding function
for markup.
Note that functionality or information that is only available by clicking on an icon in an entry may not be accessible at all to users which are not able to use a mouse or other pointing device. It is therefore recommended that any such functionality should also be available by other means, e.g. via the context menu of the entry.
CSS nodes
1 2 3 4 5 |
entry[.flat][.warning][.error] ├── text[.readonly] ├── image.left ├── image.right ╰── [progress[.pulse]] |
GtkEntry has a main node with the name entry. Depending on the properties of the entry, the style classes .read-only and .flat may appear. The style classes .warning and .error may also be used with entries.
When the entry shows icons, it adds subnodes with the name image and the style class .left or .right, depending on where the icon appears.
When the entry shows progress, it adds a subnode with the name progress. The node has the style class .pulse when the shown progress is pulsing.
For all the subnodes added to the text node in various situations, see GtkText.
GtkEntry as GtkBuildable
The GtkEntry implementation of the GtkBuildable interface supports a custom <attributes> element, which supports any number of <attribute> elements. The <attribute> element has attributes named “name“, “value“, “start“ and “end“ and allows you to specify PangoAttribute values for this label.
An example of a UI definition fragment specifying Pango attributes:
1 2 3 4 5 6 |
<object class="GtkEnry"> <attributes> <attribute name="weight" value="PANGO_WEIGHT_BOLD"/> <attribute name="background" value="red" start="5" end="10"/> </attributes> </object> |
The start and end attributes specify the range of characters to which the Pango attribute applies. If start and end are not specified, the attribute is applied to the whole text. Note that specifying ranges does not make much sense with translatable attributes. Use markup embedded in the translatable content instead.
Functions
gtk_entry_new_with_buffer ()
GtkWidget *
gtk_entry_new_with_buffer (GtkEntryBuffer *buffer
);
Creates a new entry with the specified text buffer.
gtk_entry_get_buffer ()
GtkEntryBuffer *
gtk_entry_get_buffer (GtkEntry *entry
);
Get the GtkEntryBuffer object which holds the text for this widget.
gtk_entry_set_buffer ()
void gtk_entry_set_buffer (GtkEntry *entry
,GtkEntryBuffer *buffer
);
Set the GtkEntryBuffer object which holds the text for this widget.
gtk_entry_get_text_length ()
guint16
gtk_entry_get_text_length (GtkEntry *entry
);
Retrieves the current length of the text in
entry
.
This is equivalent to getting entry
's GtkEntryBuffer and
calling gtk_entry_buffer_get_length()
on it.
gtk_entry_set_visibility ()
void gtk_entry_set_visibility (GtkEntry *entry
,gboolean visible
);
Sets whether the contents of the entry are visible or not.
When visibility is set to FALSE
, characters are displayed
as the invisible char, and will also appear that way when
the text in the entry widget is copied elsewhere.
By default, GTK picks the best invisible character available
in the current font, but it can be changed with
gtk_entry_set_invisible_char()
.
Note that you probably want to set “input-purpose”
to GTK_INPUT_PURPOSE_PASSWORD
or GTK_INPUT_PURPOSE_PIN
to
inform input methods about the purpose of this entry,
in addition to setting visibility to FALSE
.
gtk_entry_get_visibility ()
gboolean
gtk_entry_get_visibility (GtkEntry *entry
);
Retrieves whether the text in entry
is visible. See
gtk_entry_set_visibility()
.
gtk_entry_set_invisible_char ()
void gtk_entry_set_invisible_char (GtkEntry *entry
,gunichar ch
);
Sets the character to use in place of the actual text when
gtk_entry_set_visibility()
has been called to set text visibility
to FALSE
. i.e. this is the character used in “password mode” to
show the user how many characters have been typed. By default, GTK
picks the best invisible char available in the current font. If you
set the invisible char to 0, then the user will get no feedback
at all; there will be no text on the screen as they type.
gtk_entry_get_invisible_char ()
gunichar
gtk_entry_get_invisible_char (GtkEntry *entry
);
Retrieves the character displayed in place of the real characters
for entries with visibility set to false. See gtk_entry_set_invisible_char()
.
gtk_entry_unset_invisible_char ()
void
gtk_entry_unset_invisible_char (GtkEntry *entry
);
Unsets the invisible char previously set with
gtk_entry_set_invisible_char()
. So that the
default invisible char is used again.
gtk_entry_set_max_length ()
void gtk_entry_set_max_length (GtkEntry *entry
,int max
);
Sets the maximum allowed length of the contents of the widget. If the current contents are longer than the given length, then they will be truncated to fit.
This is equivalent to getting entry
's GtkEntryBuffer and
calling gtk_entry_buffer_set_max_length()
on it.
Parameters
entry |
a GtkEntry |
|
max |
the maximum length of the entry, or 0 for no maximum. (other than the maximum length of entries.) The value passed in will be clamped to the range 0-65536. |
gtk_entry_get_max_length ()
int
gtk_entry_get_max_length (GtkEntry *entry
);
Retrieves the maximum allowed length of the text in
entry
. See gtk_entry_set_max_length()
.
This is equivalent to getting entry
's GtkEntryBuffer and
calling gtk_entry_buffer_get_max_length()
on it.
gtk_entry_set_activates_default ()
void gtk_entry_set_activates_default (GtkEntry *entry
,gboolean setting
);
If setting
is TRUE
, pressing Enter in the entry
will activate the default
widget for the window containing the entry. This usually means that
the dialog box containing the entry will be closed, since the default
widget is usually one of the dialog buttons.
gtk_entry_get_activates_default ()
gboolean
gtk_entry_get_activates_default (GtkEntry *entry
);
Retrieves the value set by gtk_entry_set_activates_default()
.
gtk_entry_set_has_frame ()
void gtk_entry_set_has_frame (GtkEntry *entry
,gboolean setting
);
Sets whether the entry has a beveled frame around it.
gtk_entry_get_has_frame ()
gboolean
gtk_entry_get_has_frame (GtkEntry *entry
);
Gets the value set by gtk_entry_set_has_frame()
.
gtk_entry_set_alignment ()
void gtk_entry_set_alignment (GtkEntry *entry
,float xalign
);
Sets the alignment for the contents of the entry. This controls the horizontal positioning of the contents when the displayed text is shorter than the width of the entry.
Parameters
entry |
a GtkEntry |
|
xalign |
The horizontal alignment, from 0 (left) to 1 (right). Reversed for RTL layouts |
gtk_entry_get_alignment ()
float
gtk_entry_get_alignment (GtkEntry *entry
);
Gets the value set by gtk_entry_set_alignment()
.
gtk_entry_set_placeholder_text ()
void gtk_entry_set_placeholder_text (GtkEntry *entry
,const char *text
);
Sets text to be displayed in entry
when it is empty.
This can be used to give a visual hint of the expected contents of
the GtkEntry.
Parameters
entry |
a GtkEntry |
|
text |
a string to be displayed when |
[nullable] |
gtk_entry_get_placeholder_text ()
const char *
gtk_entry_get_placeholder_text (GtkEntry *entry
);
Retrieves the text that will be displayed when entry
is empty and unfocused
gtk_entry_set_overwrite_mode ()
void gtk_entry_set_overwrite_mode (GtkEntry *entry
,gboolean overwrite
);
Sets whether the text is overwritten when typing in the GtkEntry.
gtk_entry_get_overwrite_mode ()
gboolean
gtk_entry_get_overwrite_mode (GtkEntry *entry
);
Gets the value set by gtk_entry_set_overwrite_mode()
.
gtk_entry_set_attributes ()
void gtk_entry_set_attributes (GtkEntry *entry
,PangoAttrList *attrs
);
Sets a PangoAttrList; the attributes in the list are applied to the entry text.
gtk_entry_get_attributes ()
PangoAttrList *
gtk_entry_get_attributes (GtkEntry *entry
);
Gets the attribute list that was set on the entry using
gtk_entry_set_attributes()
, if any.
gtk_entry_set_completion ()
void gtk_entry_set_completion (GtkEntry *entry
,GtkEntryCompletion *completion
);
Sets completion
to be the auxiliary completion object to use with entry
.
All further configuration of the completion mechanism is done on
completion
using the GtkEntryCompletion API. Completion is disabled if
completion
is set to NULL
.
gtk_entry_get_completion ()
GtkEntryCompletion *
gtk_entry_get_completion (GtkEntry *entry
);
Returns the auxiliary completion object currently in use by entry
.
gtk_entry_set_progress_fraction ()
void gtk_entry_set_progress_fraction (GtkEntry *entry
,double fraction
);
Causes the entry’s progress indicator to “fill in” the given fraction of the bar. The fraction should be between 0.0 and 1.0, inclusive.
gtk_entry_get_progress_fraction ()
double
gtk_entry_get_progress_fraction (GtkEntry *entry
);
Returns the current fraction of the task that’s been completed.
See gtk_entry_set_progress_fraction()
.
gtk_entry_set_progress_pulse_step ()
void gtk_entry_set_progress_pulse_step (GtkEntry *entry
,double fraction
);
Sets the fraction of total entry width to move the progress
bouncing block for each call to gtk_entry_progress_pulse()
.
gtk_entry_get_progress_pulse_step ()
double
gtk_entry_get_progress_pulse_step (GtkEntry *entry
);
Retrieves the pulse step set with gtk_entry_set_progress_pulse_step()
.
gtk_entry_progress_pulse ()
void
gtk_entry_progress_pulse (GtkEntry *entry
);
Indicates that some progress is made, but you don’t know how much.
Causes the entry’s progress indicator to enter “activity mode,”
where a block bounces back and forth. Each call to
gtk_entry_progress_pulse()
causes the block to move by a little bit
(the amount of movement per pulse is determined by
gtk_entry_set_progress_pulse_step()
).
gtk_entry_reset_im_context ()
void
gtk_entry_reset_im_context (GtkEntry *entry
);
Reset the input method context of the entry if needed.
This can be necessary in the case where modifying the buffer would confuse on-going input method behavior.
gtk_entry_set_tabs ()
void gtk_entry_set_tabs (GtkEntry *entry
,PangoTabArray *tabs
);
Sets a PangoTabArray; the tabstops in the array are applied to the entry text.
gtk_entry_get_tabs ()
PangoTabArray *
gtk_entry_get_tabs (GtkEntry *entry
);
Gets the tabstops that were set on the entry using gtk_entry_set_tabs()
, if
any.
gtk_entry_set_icon_from_paintable ()
void gtk_entry_set_icon_from_paintable (GtkEntry *entry
,GtkEntryIconPosition icon_pos
,GdkPaintable *paintable
);
Sets the icon shown in the specified position using a GdkPaintable
If paintable
is NULL
, no icon will be shown in the specified position.
gtk_entry_set_icon_from_icon_name ()
void gtk_entry_set_icon_from_icon_name (GtkEntry *entry
,GtkEntryIconPosition icon_pos
,const char *icon_name
);
Sets the icon shown in the entry at the specified position from the current icon theme.
If the icon name isn’t known, a “broken image” icon will be displayed instead.
If icon_name
is NULL
, no icon will be shown in the specified position.
Parameters
entry |
A GtkEntry |
|
icon_pos |
The position at which to set the icon |
|
icon_name |
An icon name, or |
[allow-none] |
gtk_entry_set_icon_from_gicon ()
void gtk_entry_set_icon_from_gicon (GtkEntry *entry
,GtkEntryIconPosition icon_pos
,GIcon *icon
);
Sets the icon shown in the entry at the specified position from the current icon theme. If the icon isn’t known, a “broken image” icon will be displayed instead.
If icon
is NULL
, no icon will be shown in the specified position.
Parameters
entry |
A GtkEntry |
|
icon_pos |
The position at which to set the icon |
|
icon |
The icon to set, or |
[allow-none] |
gtk_entry_get_icon_storage_type ()
GtkImageType gtk_entry_get_icon_storage_type (GtkEntry *entry
,GtkEntryIconPosition icon_pos
);
Gets the type of representation being used by the icon
to store image data. If the icon has no image data,
the return value will be GTK_IMAGE_EMPTY
.
gtk_entry_get_icon_paintable ()
GdkPaintable * gtk_entry_get_icon_paintable (GtkEntry *entry
,GtkEntryIconPosition icon_pos
);
Retrieves the GdkPaintable used for the icon.
If no GdkPaintable was used for the icon, NULL
is returned.
Returns
A GdkPaintable, or NULL
if no icon is
set for this position or the icon set is not a GdkPaintable.
[transfer none][nullable]
gtk_entry_get_icon_name ()
const char * gtk_entry_get_icon_name (GtkEntry *entry
,GtkEntryIconPosition icon_pos
);
Retrieves the icon name used for the icon, or NULL
if there is
no icon or if the icon was set by some other method (e.g., by
paintable or gicon).
gtk_entry_get_icon_gicon ()
GIcon * gtk_entry_get_icon_gicon (GtkEntry *entry
,GtkEntryIconPosition icon_pos
);
Retrieves the GIcon used for the icon, or NULL
if there is
no icon or if the icon was set by some other method (e.g., by
paintable or icon name).
gtk_entry_set_icon_activatable ()
void gtk_entry_set_icon_activatable (GtkEntry *entry
,GtkEntryIconPosition icon_pos
,gboolean activatable
);
Sets whether the icon is activatable.
Parameters
entry |
A GtkEntry |
|
icon_pos |
Icon position |
|
activatable |
|
gtk_entry_get_icon_activatable ()
gboolean gtk_entry_get_icon_activatable (GtkEntry *entry
,GtkEntryIconPosition icon_pos
);
Returns whether the icon is activatable.
gtk_entry_set_icon_sensitive ()
void gtk_entry_set_icon_sensitive (GtkEntry *entry
,GtkEntryIconPosition icon_pos
,gboolean sensitive
);
Sets the sensitivity for the specified icon.
Parameters
entry |
A GtkEntry |
|
icon_pos |
Icon position |
|
sensitive |
Specifies whether the icon should appear sensitive or insensitive |
gtk_entry_get_icon_sensitive ()
gboolean gtk_entry_get_icon_sensitive (GtkEntry *entry
,GtkEntryIconPosition icon_pos
);
Returns whether the icon appears sensitive or insensitive.
gtk_entry_get_icon_at_pos ()
int gtk_entry_get_icon_at_pos (GtkEntry *entry
,int x
,int y
);
Finds the icon at the given position and return its index. The
position’s coordinates are relative to the entry
’s top left corner.
If x
, y
doesn’t lie inside an icon, -1 is returned.
This function is intended for use in a “query-tooltip”
signal handler.
Parameters
entry |
a GtkEntry |
|
x |
the x coordinate of the position to find, relative to |
|
y |
the y coordinate of the position to find, relative to |
gtk_entry_set_icon_tooltip_text ()
void gtk_entry_set_icon_tooltip_text (GtkEntry *entry
,GtkEntryIconPosition icon_pos
,const char *tooltip
);
Sets tooltip
as the contents of the tooltip for the icon
at the specified position.
Use NULL
for tooltip
to remove an existing tooltip.
See also gtk_widget_set_tooltip_text()
and
gtk_entry_set_icon_tooltip_markup()
.
If you unset the widget tooltip via gtk_widget_set_tooltip_text()
or
gtk_widget_set_tooltip_markup()
, this sets GtkWidget:has-tooltip to FALSE
,
which suppresses icon tooltips too. You can resolve this by then calling
gtk_widget_set_has_tooltip()
to set GtkWidget:has-tooltip back to TRUE
, or
setting at least one non-empty tooltip on any icon achieves the same result.
Parameters
entry |
a GtkEntry |
|
icon_pos |
the icon position |
|
tooltip |
the contents of the tooltip for the icon, or |
[allow-none] |
gtk_entry_get_icon_tooltip_text ()
char * gtk_entry_get_icon_tooltip_text (GtkEntry *entry
,GtkEntryIconPosition icon_pos
);
Gets the contents of the tooltip on the icon at the specified
position in entry
.
gtk_entry_set_icon_tooltip_markup ()
void gtk_entry_set_icon_tooltip_markup (GtkEntry *entry
,GtkEntryIconPosition icon_pos
,const char *tooltip
);
Sets tooltip
as the contents of the tooltip for the icon at
the specified position. tooltip
is assumed to be marked up with
the Pango text markup language.
Use NULL
for tooltip
to remove an existing tooltip.
See also gtk_widget_set_tooltip_markup()
and
gtk_entry_set_icon_tooltip_text()
.
Parameters
entry |
a GtkEntry |
|
icon_pos |
the icon position |
|
tooltip |
the contents of the tooltip for the icon, or |
[allow-none] |
gtk_entry_get_icon_tooltip_markup ()
char * gtk_entry_get_icon_tooltip_markup (GtkEntry *entry
,GtkEntryIconPosition icon_pos
);
Gets the contents of the tooltip on the icon at the specified
position in entry
.
gtk_entry_set_icon_drag_source ()
void gtk_entry_set_icon_drag_source (GtkEntry *entry
,GtkEntryIconPosition icon_pos
,GdkContentProvider *provider
,GdkDragAction actions
);
Sets up the icon at the given position so that GTK will start a drag operation when the user clicks and drags the icon.
Parameters
entry |
a GtkEntry |
|
icon_pos |
icon position |
|
provider |
||
actions |
a bitmask of the allowed drag actions |
gtk_entry_get_current_icon_drag_source ()
int
gtk_entry_get_current_icon_drag_source
(GtkEntry *entry
);
Returns the index of the icon which is the source of the current DND operation, or -1.
gtk_entry_get_icon_area ()
void gtk_entry_get_icon_area (GtkEntry *entry
,GtkEntryIconPosition icon_pos
,GdkRectangle *icon_area
);
Gets the area where entry’s icon at icon_pos
is drawn.
This function is useful when drawing something to the
entry in a draw callback.
If the entry is not realized or has no icon at the given position,
icon_area
is filled with zeros. Otherwise, icon_area
will be filled
with the icon's allocation, relative to entry
's allocation.
Parameters
entry |
A GtkEntry |
|
icon_pos |
Icon position |
|
icon_area |
Return location for the icon’s area. |
[out] |
gtk_entry_set_input_purpose ()
void gtk_entry_set_input_purpose (GtkEntry *entry
,GtkInputPurpose purpose
);
Sets the “input-purpose” property which can be used by on-screen keyboards and other input methods to adjust their behaviour.
gtk_entry_get_input_purpose ()
GtkInputPurpose
gtk_entry_get_input_purpose (GtkEntry *entry
);
Gets the value of the “input-purpose” property.
gtk_entry_set_input_hints ()
void gtk_entry_set_input_hints (GtkEntry *entry
,GtkInputHints hints
);
Sets the “input-hints” property, which allows input methods to fine-tune their behaviour.
gtk_entry_get_input_hints ()
GtkInputHints
gtk_entry_get_input_hints (GtkEntry *entry
);
Gets the value of the “input-hints” property.
gtk_entry_grab_focus_without_selecting ()
gboolean
gtk_entry_grab_focus_without_selecting
(GtkEntry *entry
);
Causes entry
to have keyboard focus.
It behaves like gtk_widget_grab_focus()
,
except that it doesn't select the contents of the entry.
You only want to call this on some special entries
which the user usually doesn't want to replace all text in,
such as search-as-you-type entries.
gtk_entry_set_extra_menu ()
void gtk_entry_set_extra_menu (GtkEntry *entry
,GMenuModel *model
);
Sets a menu model to add when constructing
the context menu for entry
.
gtk_entry_get_extra_menu ()
GMenuModel *
gtk_entry_get_extra_menu (GtkEntry *entry
);
Gets the menu model set with gtk_entry_set_extra_menu()
.
Types and Values
struct GtkEntryClass
struct GtkEntryClass { GtkWidgetClass parent_class; /* Action signals */ void (* activate) (GtkEntry *entry); };
Class structure for GtkEntry. All virtual functions have a default
implementation. Derived classes may set the virtual function pointers for the
signal handlers to NULL
, but must keep get_text_area_size
and
get_frame_size
non-NULL
; either use the default implementation, or provide
a custom one.
Members
Class handler for the “activate” signal. The default implementation activates the gtk.activate-default action. |
enum GtkInputPurpose
Describes primary purpose of the input widget. This information is useful for on-screen keyboards and similar input methods to decide which keys should be presented to the user.
Note that the purpose is not meant to impose a totally strict rule about allowed characters, and does not replace input validation. It is fine for an on-screen keyboard to let the user override the character set restriction that is expressed by the purpose. The application is expected to validate the entry contents, even if it specified a purpose.
The difference between GTK_INPUT_PURPOSE_DIGITS
and
GTK_INPUT_PURPOSE_NUMBER
is that the former accepts only digits
while the latter also some punctuation (like commas or points, plus,
minus) and “e” or “E” as in 3.14E+000.
This enumeration may be extended in the future; input methods should interpret unknown values as “free form”.
Members
Allow any character |
||
Allow only alphabetic characters |
||
Allow only digits |
||
Edited field expects numbers |
||
Edited field expects phone number |
||
Edited field expects URL |
||
Edited field expects email address |
||
Edited field expects the name of a person |
||
Like |
||
Like |
||
Allow any character, in addition to control codes |
enum GtkInputHints
Describes hints that might be taken into account by input methods or applications. Note that input methods may already tailor their behaviour according to the GtkInputPurpose of the entry.
Some common sense is expected when using these flags - mixing
GTK_INPUT_HINT_LOWERCASE
with any of the uppercase hints makes no sense.
This enumeration may be extended in the future; input methods should ignore unknown values.
Members
No special behaviour suggested |
||
Suggest checking for typos |
||
Suggest not checking for typos |
||
Suggest word completion |
||
Suggest to convert all text to lowercase |
||
Suggest to capitalize all text |
||
Suggest to capitalize the first character of each word |
||
Suggest to capitalize the first word of each sentence |
||
Suggest to not show an onscreen keyboard (e.g for a calculator that already has all the keys). |
||
The text is vertical |
||
Suggest offering Emoji support |
||
Suggest not offering Emoji support |
||
Request that the input method should not update personalized data (like typing history) |
Property Details
The “activates-default”
property
“activates-default” gboolean
Whether to activate the default widget (such as the default button in a dialog) when Enter is pressed.
Owner: GtkEntry
Flags: Read / Write
Default value: FALSE
The “attributes”
property
“attributes” PangoAttrList *
A list of Pango attributes to apply to the text of the entry.
This is mainly useful to change the size or weight of the text.
The PangoAttribute's start_index
and end_index
must refer to the
GtkEntryBuffer text, i.e. without the preedit string.
Owner: GtkEntry
Flags: Read / Write
The “buffer”
property
“buffer” GtkEntryBuffer *
Text buffer object which actually stores entry text.
Owner: GtkEntry
Flags: Read / Write / Construct
The “completion”
property
“completion” GtkEntryCompletion *
The auxiliary completion object to use with the entry.
Owner: GtkEntry
Flags: Read / Write
The “enable-emoji-completion”
property
“enable-emoji-completion” gboolean
Whether to suggest Emoji replacements.
Owner: GtkEntry
Flags: Read / Write
Default value: FALSE
The “extra-menu”
property
“extra-menu” GMenuModel *
A menu model whose contents will be appended to the context menu.
Owner: GtkEntry
Flags: Read / Write
The “has-frame”
property
“has-frame” gboolean
FALSE removes outside bevel from entry.
Owner: GtkEntry
Flags: Read / Write
Default value: TRUE
The “im-module”
property
“im-module” char *
Which IM (input method) module should be used for this entry. See GtkIMContext.
Setting this to a non-NULL
value overrides the
system-wide IM module setting. See the GtkSettings
“gtk-im-module” property.
Owner: GtkEntry
Flags: Read / Write
Default value: NULL
The “input-hints”
property
“input-hints” GtkInputHints
Additional hints (beyond “input-purpose”) that allow input methods to fine-tune their behaviour.
Owner: GtkEntry
Flags: Read / Write
The “input-purpose”
property
“input-purpose” GtkInputPurpose
The purpose of this text field.
This property can be used by on-screen keyboards and other input methods to adjust their behaviour.
Note that setting the purpose to GTK_INPUT_PURPOSE_PASSWORD
or
GTK_INPUT_PURPOSE_PIN
is independent from setting
“visibility”.
Owner: GtkEntry
Flags: Read / Write
Default value: GTK_INPUT_PURPOSE_FREE_FORM
The “invisible-char”
property
“invisible-char” guint
The character to use when masking entry contents (in “password mode”).
Owner: GtkEntry
Flags: Read / Write
Default value: '*'
The “invisible-char-set”
property
“invisible-char-set” gboolean
Whether the invisible char has been set for the GtkEntry.
Owner: GtkEntry
Flags: Read / Write
Default value: FALSE
The “max-length”
property
“max-length” int
Maximum number of characters for this entry. Zero if no maximum.
Owner: GtkEntry
Flags: Read / Write
Allowed values: [0,65535]
Default value: 0
The “overwrite-mode”
property
“overwrite-mode” gboolean
If text is overwritten when typing in the GtkEntry.
Owner: GtkEntry
Flags: Read / Write
Default value: FALSE
The “placeholder-text”
property
“placeholder-text” char *
The text that will be displayed in the GtkEntry when it is empty and unfocused.
Owner: GtkEntry
Flags: Read / Write
Default value: NULL
The “primary-icon-activatable”
property
“primary-icon-activatable” gboolean
Whether the primary icon is activatable.
GTK emits the “icon-press” and “icon-release” signals only on sensitive, activatable icons.
Sensitive, but non-activatable icons can be used for purely informational purposes.
Owner: GtkEntry
Flags: Read / Write
Default value: TRUE
The “primary-icon-gicon”
property
“primary-icon-gicon” GIcon *
The GIcon to use for the primary icon for the entry.
Owner: GtkEntry
Flags: Read / Write
The “primary-icon-name”
property
“primary-icon-name” char *
The icon name to use for the primary icon for the entry.
Owner: GtkEntry
Flags: Read / Write
Default value: NULL
The “primary-icon-paintable”
property
“primary-icon-paintable” GdkPaintable *
A GdkPaintable to use as the primary icon for the entry.
Owner: GtkEntry
Flags: Read / Write
The “primary-icon-sensitive”
property
“primary-icon-sensitive” gboolean
Whether the primary icon is sensitive.
An insensitive icon appears grayed out. GTK does not emit the “icon-press” and “icon-release” signals and does not allow DND from insensitive icons.
An icon should be set insensitive if the action that would trigger when clicked is currently not available.
Owner: GtkEntry
Flags: Read / Write
Default value: TRUE
The “primary-icon-storage-type”
property
“primary-icon-storage-type” GtkImageType
The representation which is used for the primary icon of the entry.
Owner: GtkEntry
Flags: Read
Default value: GTK_IMAGE_EMPTY
The “primary-icon-tooltip-markup”
property
“primary-icon-tooltip-markup” char *
The contents of the tooltip on the primary icon, which is marked up with the Pango text markup language.
Also see gtk_entry_set_icon_tooltip_markup()
.
Owner: GtkEntry
Flags: Read / Write
Default value: NULL
The “primary-icon-tooltip-text”
property
“primary-icon-tooltip-text” char *
The contents of the tooltip on the primary icon.
Also see gtk_entry_set_icon_tooltip_text()
.
Owner: GtkEntry
Flags: Read / Write
Default value: NULL
The “progress-fraction”
property
“progress-fraction” double
The current fraction of the task that's been completed.
Owner: GtkEntry
Flags: Read / Write
Allowed values: [0,1]
Default value: 0
The “progress-pulse-step”
property
“progress-pulse-step” double
The fraction of total entry width to move the progress
bouncing block for each call to gtk_entry_progress_pulse()
.
Owner: GtkEntry
Flags: Read / Write
Allowed values: [0,1]
Default value: 0
The “scroll-offset”
property
“scroll-offset” int
Number of pixels of the entry scrolled off the screen to the left.
Owner: GtkEntry
Flags: Read
Allowed values: >= 0
Default value: 0
The “secondary-icon-activatable”
property
“secondary-icon-activatable” gboolean
Whether the secondary icon is activatable.
GTK emits the “icon-press” and “icon-release” signals only on sensitive, activatable icons.
Sensitive, but non-activatable icons can be used for purely informational purposes.
Owner: GtkEntry
Flags: Read / Write
Default value: TRUE
The “secondary-icon-gicon”
property
“secondary-icon-gicon” GIcon *
The GIcon to use for the secondary icon for the entry.
Owner: GtkEntry
Flags: Read / Write
The “secondary-icon-name”
property
“secondary-icon-name” char *
The icon name to use for the secondary icon for the entry.
Owner: GtkEntry
Flags: Read / Write
Default value: NULL
The “secondary-icon-paintable”
property
“secondary-icon-paintable” GdkPaintable *
A GdkPaintable to use as the secondary icon for the entry.
Owner: GtkEntry
Flags: Read / Write
The “secondary-icon-sensitive”
property
“secondary-icon-sensitive” gboolean
Whether the secondary icon is sensitive.
An insensitive icon appears grayed out. GTK does not emit the “icon-press” and “icon-release” signals and does not allow DND from insensitive icons.
An icon should be set insensitive if the action that would trigger when clicked is currently not available.
Owner: GtkEntry
Flags: Read / Write
Default value: TRUE
The “secondary-icon-storage-type”
property
“secondary-icon-storage-type” GtkImageType
The representation which is used for the secondary icon of the entry.
Owner: GtkEntry
Flags: Read
Default value: GTK_IMAGE_EMPTY
The “secondary-icon-tooltip-markup”
property
“secondary-icon-tooltip-markup” char *
The contents of the tooltip on the secondary icon, which is marked up with the Pango text markup language.
Also see gtk_entry_set_icon_tooltip_markup()
.
Owner: GtkEntry
Flags: Read / Write
Default value: NULL
The “secondary-icon-tooltip-text”
property
“secondary-icon-tooltip-text” char *
The contents of the tooltip on the secondary icon.
Also see gtk_entry_set_icon_tooltip_text()
.
Owner: GtkEntry
Flags: Read / Write
Default value: NULL
The “show-emoji-icon”
property
“show-emoji-icon” gboolean
Whether to show an icon for Emoji.
Owner: GtkEntry
Flags: Read / Write
Default value: FALSE
The “tabs”
property
“tabs” PangoTabArray *
A list of tabstop locations to apply to the text of the entry.
Owner: GtkEntry
Flags: Read / Write
The “text-length”
property
“text-length” guint
The length of the text in the GtkEntry.
Owner: GtkEntry
Flags: Read
Allowed values: <= 65535
Default value: 0
The “truncate-multiline”
property
“truncate-multiline” gboolean
When TRUE
, pasted multi-line text is truncated to the first line.
Owner: GtkEntry
Flags: Read / Write
Default value: FALSE
Signal Details
The “activate”
signal
void user_function (GtkEntry *self, gpointer user_data)
The ::activate signal is forwarded from the “activated” signal, which is a keybinding signal for all forms of the Enter key.
Parameters
self |
The widget on which the signal is emitted |
|
user_data |
user data set when the signal handler was connected. |
Flags: Action
The “icon-press”
signal
void user_function (GtkEntry *entry, GtkEntryIconPosition icon_pos, gpointer user_data)
The ::icon-press signal is emitted when an activatable icon is clicked.
Parameters
entry |
The entry on which the signal is emitted |
|
icon_pos |
The position of the clicked icon |
|
user_data |
user data set when the signal handler was connected. |
Flags: Run Last
The “icon-release”
signal
void user_function (GtkEntry *entry, GtkEntryIconPosition icon_pos, gpointer user_data)
The ::icon-release signal is emitted on the button release from a mouse click over an activatable icon.
Parameters
entry |
The entry on which the signal is emitted |
|
icon_pos |
The position of the clicked icon |
|
user_data |
user data set when the signal handler was connected. |
Flags: Run Last