W Wrapl, The Programming Language

Libraries:Gtk:Gtk:Entry

Types

T

Inherits from:

The T 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 SetVisibility. 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 SetInvisibleChar. Since 2.16, GTK+ displays a warning when Caps Lock or input methods might interfere with entering text in a password entry. The warning can be turned off with the "caps-lock-warning" property.

Since 2.16, GtkEntry has the ability to display progress or activity information behind the text. To make an entry display such information, use SetProgressFraction or SetProgressPulseStep.

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 SetIconFromGicon or one of the various other functions that set an icon from a stock id, an icon name or a pixbuf. To trigger an action when the user clicks an icon, connect to the "icon-press" signal. To allow DND operations from an icon, use SetIconDragSource. To set a tooltip on an icon, use SetIconTooltipText 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.



Constants

Nil : T

Functions

GetType() : Gtk.GObject.Type.T



New() : Gtk.Gtk.Entry.T

Creates a new entry.

Returns a new T.


NewWithBuffer(buffer @ Gtk.Gtk.EntryBuffer.T) : Gtk.Gtk.Entry.T

Creates a new entry with the specified text buffer.

buffer The buffer to use for the new T.
Returns a new T


NewWithMaxLength(max @ Std.Integer.SmallT) : Gtk.Gtk.Entry.T

Warning

gtk_entry_new_with_max_length has been deprecated since version 2.0 and should not be used in newly-written code. Use SetMaxLength instead.



Methods

:AppendText(self @ T, text @ Std.String.T) : Std.Object.T

Warning

AppendText has been deprecated since version 2.0 and should not be used in newly-written code. Use Gtk.Gtk.Editable.InsertText instead.



:GetActivatesDefault(self @ T) : Std.Symbol.T

Retrieves the value set by SetActivatesDefault.

entry a T
Returns TRUE if the entry will activate the default widget


:GetAlignment(self @ T) : Std.Real.T

Gets the value set by SetAlignment.

entry a T
Returns the alignment


:GetBuffer(self @ T) : Gtk.Gtk.EntryBuffer.T

Get the Gtk.Gtk.EntryBuffer.T object which holds the text for this widget.

entry a T
Returns A Gtk.Gtk.EntryBuffer.T object. [transfer none]


:GetCompletion(self @ T) : Gtk.Gtk.EntryCompletion.T

Returns the auxiliary completion object currently in use by entry.

entry A T
Returns The auxiliary completion object currently in use by entry. [transfer none]


:GetCurrentIconDragSource(self @ T) : Std.Integer.SmallT

Returns the index of the icon which is the source of the current DND operation, or -1.

This function is meant to be used in a "drag-data-get" callback.

entry a GtkIconEntry
Returns index of the icon which is the source of the current DND operation, or -1.


:GetCursorHadjustment(self @ T) : Gtk.Gtk.Adjustment.T

Retrieves the horizontal cursor adjustment for the entry. See SetCursorHadjustment.

entry a T
Returns the horizontal cursor adjustment, or NULL if none has been set. [transfer none]


:GetHasFrame(self @ T) : Std.Symbol.T

Gets the value set by SetHasFrame.

entry a T
Returns whether the entry has a beveled frame


:GetIconActivatable(self @ T, icon_pos @ Gtk.Gtk.EntryIconPosition.T) : Std.Symbol.T

Returns whether the icon is activatable.

entry a T
icon_pos Icon position
Returns TRUE if the icon is activatable.


:GetIconAtPos(self @ T, x @ Std.Integer.SmallT, y @ Std.Integer.SmallT) : Std.Integer.SmallT

Finds the icon at the given position and return its index. If x, y doesn't lie inside an icon, -1 is returned. This function is intended for use in a "query-tooltip" signal handler.

entry a T
x the x coordinate of the position to find
y the y coordinate of the position to find
Returns the index of the icon at the given position, or -1


:GetIconGicon(self @ T, icon_pos @ Gtk.Gtk.EntryIconPosition.T) : Gtk.Gio.GIcon.T

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 stock, pixbuf, or icon name).

entry A T
icon_pos Icon position
Returns A GIcon, or NULL if no icon is set or if the icon is not a GIcon. [transfer none]


:GetIconName(self @ T, icon_pos @ Gtk.Gtk.EntryIconPosition.T) : Std.String.T

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 pixbuf, stock or gicon).

entry A T
icon_pos Icon position
Returns An icon name, or NULL if no icon is set or if the icon wasn't set from an icon name


:GetIconPixbuf(self @ T, icon_pos @ Gtk.Gtk.EntryIconPosition.T) : Gtk.Gdk.Pixbuf.T

Retrieves the image used for the icon.

Unlike the other methods of setting and getting icon data, this method will work regardless of whether the icon was set using a Gtk.Gdk.Pixbuf.T, a GIcon, a stock item, or an icon name.

entry A T
icon_pos Icon position
Returns A Gtk.Gdk.Pixbuf.T, or NULL if no icon is set for this position. [transfer none]


:GetIconSensitive(self @ T, icon_pos @ Gtk.Gtk.EntryIconPosition.T) : Std.Symbol.T

Returns whether the icon appears sensitive or insensitive.

entry a T
icon_pos Icon position
Returns TRUE if the icon is sensitive.


:GetIconStock(self @ T, icon_pos @ Gtk.Gtk.EntryIconPosition.T) : Std.String.T

Retrieves the stock id used for the icon, or NULL if there is no icon or if the icon was set by some other method (e.g., by pixbuf, icon name or gicon).

entry A T
icon_pos Icon position
Returns A stock id, or NULL if no icon is set or if the icon wasn't set from a stock id


:GetIconStorageType(self @ T, icon_pos @ Gtk.Gtk.EntryIconPosition.T) : Gtk.Gtk.ImageType.T

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.Gtk.ImageType.Empty.

entry a T
icon_pos Icon position
Returns image representation being used


:GetIconTooltipMarkup(self @ T, icon_pos @ Gtk.Gtk.EntryIconPosition.T) : Std.String.T

Gets the contents of the tooltip on the icon at the specified position in entry.

entry a T
icon_pos the icon position
Returns the tooltip text, or NULL. Free the returned string with g_free() when done.


:GetIconTooltipText(self @ T, icon_pos @ Gtk.Gtk.EntryIconPosition.T) : Std.String.T

Gets the contents of the tooltip on the icon at the specified position in entry.

entry a T
icon_pos the icon position
Returns the tooltip text, or NULL. Free the returned string with g_free() when done.


:GetIconWindow(self @ T, icon_pos @ Gtk.Gtk.EntryIconPosition.T) : Gtk.Gdk.Window.T

Returns the Gtk.Gdk.Window.T which contains the entry's icon at icon_pos. This function is useful when drawing something to the entry in an expose-event callback because it enables the callback to distinguish between the text window and entry's icon windows.

See also GetTextWindow.

Note that GTK+ 3 does not have this function anymore; it has been replaced by gtk_entry_get_icon_area().

entry A T
icon_pos Icon position
Returns the entry's icon window at icon_pos. [transfer none]


:GetInnerBorder(self @ T) : Gtk.Gtk.Border.T

This function returns the entry's "inner-border" property. See SetInnerBorder for more information.

entry a T
Returns the entry's Gtk.Gtk.Border.T, or NULL if none was set. [transfer none]


:GetInvisibleChar(self @ T) : Std.Integer.SmallT

Retrieves the character displayed in place of the real characters for entries with visibility set to false. See SetInvisibleChar.

entry a T
Returns the current invisible char, or 0, if the entry does not show invisible text at all.


:GetLayout(self @ T) : Gtk.Pango.Layout.T

Gets the PangoLayout used to display the entry. The layout is useful to e.g. convert text positions to pixel positions, in combination with GetLayoutOffsets. The returned layout is owned by the entry and must not be modified or freed by the caller.

Keep in mind that the layout text may contain a preedit string, so LayoutIndexToTextIndex and TextIndexToLayoutIndex are needed to convert byte indices in the layout to byte indices in the entry contents.

entry a T
Returns the PangoLayout for this entry. [transfer none]


:GetLayoutOffsets(self @ T, x @ Std.Object.T, y @ Std.Object.T) : Std.Object.T

Obtains the position of the PangoLayout used to render text in the entry, in widget coordinates. Useful if you want to line up the text in an entry with some other text, e.g. when using the entry to implement editable cells in a sheet widget.

Also useful to convert mouse events into coordinates inside the PangoLayout, e.g. to take some action if some part of the entry text is clicked.

Note that as the user scrolls around in the entry the offsets will change; you'll need to connect to the "notify::scroll-offset" signal to track this. Remember when using the PangoLayout functions you need to convert to and from pixels using PANGO_PIXELS() or PANGO_SCALE.

Keep in mind that the layout text may contain a preedit string, so LayoutIndexToTextIndex and TextIndexToLayoutIndex are needed to convert byte indices in the layout to byte indices in the entry contents.

entry a T
x location to store X offset of layout, or NULL. [out][allow-none]
y location to store Y offset of layout, or NULL. [out][allow-none]


:GetMaxLength(self @ T) : Std.Integer.SmallT

Retrieves the maximum allowed length of the text in entry. See SetMaxLength.

This is equivalent to:



:GetOverwriteMode(self @ T) : Std.Symbol.T

Gets the value set by SetOverwriteMode.

entry a T
Returns whether the text is overwritten when typing.


:GetProgressFraction(self @ T) : Std.Real.T

Returns the current fraction of the task that's been completed. See SetProgressFraction.

entry a T
Returns a fraction from 0.0 to 1.0


:GetProgressPulseStep(self @ T) : Std.Real.T

Retrieves the pulse step set with SetProgressPulseStep.

entry a T
Returns a fraction from 0.0 to 1.0


:GetText(self @ T) : Std.String.T

Retrieves the contents of the entry widget. See also Gtk.Gtk.Editable.GetChars.

This is equivalent to:



:GetTextLength(self @ T) : Std.Integer.SmallT

Retrieves the current length of the text in entry.

This is equivalent to:



:GetTextWindow(self @ T) : Gtk.Gdk.Window.T

Returns the Gtk.Gdk.Window.T which contains the text. This function is useful when drawing something to the entry in an expose-event callback because it enables the callback to distinguish between the text window and entry's icon windows.

See also GetIconWindow.

Note that GTK+ 3 does not have this function anymore; it has been replaced by gtk_entry_get_text_area().

entry a T
Returns the entry's text window. [transfer none]


:GetVisibility(self @ T) : Std.Symbol.T

Retrieves whether the text in entry is visible. See SetVisibility.

entry a T
Returns TRUE if the text is currently visible


:GetWidthChars(self @ T) : Std.Integer.SmallT

Gets the value set by SetWidthChars.

entry a T
Returns number of chars to request space for, or negative if unset


:ImContextFilterKeypress(self @ T, event @ Gtk.Gdk.EventKey.T) : Std.Symbol.T

Allow the T input method to internally handle key press and release events. If this function returns TRUE, then no further processing should be done for this key event. See Gtk.Gtk.IMContext.FilterKeypress.

Note that you are expected to call this function from your handler when overriding key event handling. This is needed in the case when you need to insert your own key handling between the input method and the default key event handling of the T. See Gtk.Gtk.TextView.ResetImContext for an example of use.

entry a T
event the key event
Returns TRUE if the input method handled the key event.


:LayoutIndexToTextIndex(self @ T, layout_index @ Std.Integer.SmallT) : Std.Integer.SmallT

Converts from a position in the entry contents (returned by GetText) to a position in the entry's PangoLayout (returned by GetLayout, with text retrieved via pango_layout_get_text()).

entry a T
layout_index byte index into the entry layout text
Returns byte index into the entry contents


:PrependText(self @ T, text @ Std.String.T) : Std.Object.T

Warning

PrependText has been deprecated since version 2.0 and should not be used in newly-written code. Use Gtk.Gtk.Editable.InsertText instead.



:ProgressPulse(self @ T) : Std.Object.T

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 ProgressPulse causes the block to move by a little bit (the amount of movement per pulse is determined by SetProgressPulseStep).

entry a T


:ResetImContext(self @ T) : Std.Object.T

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.

entry a T


:SelectRegion(self @ T, start @ Std.Integer.SmallT, end @ Std.Integer.SmallT) : Std.Object.T

Warning

SelectRegion has been deprecated since version 2.0 and should not be used in newly-written code. Use Gtk.Gtk.Editable.SelectRegion instead.



:SetActivatesDefault(self @ T, setting @ Std.Symbol.T) : Std.Object.T

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.

(For experts: if setting is TRUE, the entry calls Gtk.Gtk.Window.ActivateDefault on the window containing the entry, in the default handler for the "activate" signal.)

entry a T
setting TRUE to activate window's default widget on Enter keypress


:SetAlignment(self @ T, xalign @ Std.Real.T) : Std.Object.T

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.

entry a T
xalign The horizontal alignment, from 0 (left) to 1 (right). Reversed for RTL layouts


:SetBuffer(self @ T, buffer @ Gtk.Gtk.EntryBuffer.T) : Std.Object.T

Set the Gtk.Gtk.EntryBuffer.T object which holds the text for this widget.

entry a T
buffer a Gtk.Gtk.EntryBuffer.T


:SetCompletion(self @ T, completion @ Gtk.Gtk.EntryCompletion.T) : Std.Object.T

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 Gtk.Gtk.EntryCompletion.T API. Completion is disabled if completion is set to NULL.

entry A T
completion The Gtk.Gtk.EntryCompletion.T or NULL. [allow-none]


:SetCursorHadjustment(self @ T, adjustment @ Gtk.Gtk.Adjustment.T) : Std.Object.T

Hooks up an adjustment to the cursor position in an entry, so that when the cursor is moved, the adjustment is scrolled to show that position. See Gtk.Gtk.ScrolledWindow.GetHadjustment for a typical way of obtaining the adjustment.

The adjustment has to be in pixel units and in the same coordinate system as the entry.

entry a T
adjustment an adjustment which should be adjusted when the cursor is moved, or NULL


:SetEditable(self @ T, editable @ Std.Symbol.T) : Std.Object.T

Warning

SetEditable has been deprecated since version 2.0 and should not be used in newly-written code. Use Gtk.Gtk.Editable.SetEditable instead.



:SetHasFrame(self @ T, setting @ Std.Symbol.T) : Std.Object.T

Sets whether the entry has a beveled frame around it.

entry a T
setting new value


:SetIconActivatable(self @ T, icon_pos @ Gtk.Gtk.EntryIconPosition.T, activatable @ Std.Symbol.T) : Std.Object.T

Sets whether the icon is activatable.

entry A T
icon_pos Icon position
activatable TRUE if the icon should be activatable


:SetIconDragSource(self @ T, icon_pos @ Gtk.Gtk.EntryIconPosition.T, target_list @ Gtk.Gtk.TargetList.T, actions @ Std.Integer.SmallT) : Std.Object.T

Sets up the icon at the given position so that GTK+ will start a drag operation when the user clicks and drags the icon.

To handle the drag operation, you need to connect to the usual "drag-data-get" (or possibly "drag-data-delete") signal, and use GetCurrentIconDragSource in your signal handler to find out if the drag was started from an icon.

By default, GTK+ uses the icon as the drag icon. You can use the "drag-begin" signal to set a different icon. Note that you have to use g_signal_connect_after() to ensure that your signal handler gets executed after the default handler.

entry a GtkIconEntry
icon_pos icon position
target_list the targets (data formats) in which the data can be provided
actions a bitmask of the allowed drag actions


:SetIconFromGicon(self @ T, icon_pos @ Gtk.Gtk.EntryIconPosition.T, icon @ Gtk.Gio.GIcon.T) : Std.Object.T

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.

entry A T
icon_pos The position at which to set the icon
icon The icon to set, or NULL. [allow-none]


:SetIconFromIconName(self @ T, icon_pos @ Gtk.Gtk.EntryIconPosition.T, icon_name @ Std.String.T) : Std.Object.T

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.

entry A T
icon_pos The position at which to set the icon
icon_name An icon name, or NULL. [allow-none]


:SetIconFromPixbuf(self @ T, icon_pos @ Gtk.Gtk.EntryIconPosition.T, pixbuf @ Gtk.Gdk.Pixbuf.T) : Std.Object.T

Sets the icon shown in the specified position using a pixbuf.

If pixbuf is NULL, no icon will be shown in the specified position.

entry a T
icon_pos Icon position
pixbuf A Gtk.Gdk.Pixbuf.T, or NULL. [allow-none]


:SetIconFromStock(self @ T, icon_pos @ Gtk.Gtk.EntryIconPosition.T, stock_id @ Std.String.T) : Std.Object.T

Sets the icon shown in the entry at the specified position from a stock image.

If stock_id is NULL, no icon will be shown in the specified position.

entry A T
icon_pos Icon position
stock_id The name of the stock item, or NULL. [allow-none]


:SetIconSensitive(self @ T, icon_pos @ Gtk.Gtk.EntryIconPosition.T, sensitive @ Std.Symbol.T) : Std.Object.T

Sets the sensitivity for the specified icon.

entry A T
icon_pos Icon position
sensitive Specifies whether the icon should appear sensitive or insensitive


:SetIconTooltipMarkup(self @ T, icon_pos @ Gtk.Gtk.EntryIconPosition.T, tooltip @ Std.String.T) : Std.Object.T

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.Gtk.Widget.SetTooltipMarkup and gtk_enty_set_icon_tooltip_text().

entry a T
icon_pos the icon position
tooltip the contents of the tooltip for the icon, or NULL. [allow-none]


:SetIconTooltipText(self @ T, icon_pos @ Gtk.Gtk.EntryIconPosition.T, tooltip @ Std.String.T) : Std.Object.T

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.Gtk.Widget.SetTooltipText and SetIconTooltipMarkup.

entry a T
icon_pos the icon position
tooltip the contents of the tooltip for the icon, or NULL. [allow-none]


:SetInnerBorder(self @ T, border @ Gtk.Gtk.Border.T) : Std.Object.T

Sets entry's inner-border property to border, or clears it if NULL is passed. The inner-border is the area around the entry's text, but inside its frame.

If set, this property overrides the inner-border style property. Overriding the style-provided border is useful when you want to do in-place editing of some text in a canvas or list widget, where pixel-exact positioning of the entry is important.

entry a T
border a Gtk.Gtk.Border.T, or NULL. [allow-none]


:SetInvisibleChar(self @ T, ch @ Std.Integer.SmallT) : Std.Object.T

Sets the character to use in place of the actual text when SetVisibility 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.

entry a T
ch a Unicode character


:SetMaxLength(self @ T, max @ Std.Integer.SmallT) : Std.Object.T

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:



:SetOverwriteMode(self @ T, overwrite @ Std.Symbol.T) : Std.Object.T

Sets whether the text is overwritten when typing in the T.

entry a T
overwrite new value


:SetPosition(self @ T, position @ Std.Integer.SmallT) : Std.Object.T

Warning

SetPosition has been deprecated since version 2.0 and should not be used in newly-written code. Use Gtk.Gtk.Editable.SetPosition instead.



:SetProgressFraction(self @ T, fraction @ Std.Real.T) : Std.Object.T

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.

entry a T
fraction fraction of the task that's been completed


:SetProgressPulseStep(self @ T, fraction @ Std.Real.T) : Std.Object.T

Sets the fraction of total entry width to move the progress bouncing block for each call to ProgressPulse.

entry a T
fraction fraction between 0.0 and 1.0


:SetText(self @ T, text @ Std.String.T) : Std.Object.T

Sets the text in the widget to the given value, replacing the current contents.

See Gtk.Gtk.EntryBuffer.SetText.

entry a T
text the new text


:SetVisibility(self @ T, visible @ Std.Symbol.T) : Std.Object.T

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 SetInvisibleChar.

entry a T
visible TRUE if the contents of the entry are displayed as plaintext


:SetWidthChars(self @ T, n_chars @ Std.Integer.SmallT) : Std.Object.T

Changes the size request of the entry to be about the right size for n_chars characters. Note that it changes the size request, the size can still be affected by how you pack the widget into containers. If n_chars is -1, the size reverts to the default entry size.

entry a T
n_chars width in chars


:TextIndexToLayoutIndex(self @ T, text_index @ Std.Integer.SmallT) : Std.Integer.SmallT

Converts from a position in the entry's PangoLayout (returned by GetLayout) to a position in the entry contents (returned by GetText).

entry a T
text_index byte index into the entry contents
Returns byte index into the entry layout text


:UnsetInvisibleChar(self @ T) : Std.Object.T

Unsets the invisible char previously set with SetInvisibleChar. So that the default invisible char is used again.

entry a T


:Within(self @ T) : Std.Object.T

:setWithin(self @ T, value @ Std.Object.T) : Std.Object.T