Package ch.bailu.gtk.gtk
Class Entry
- All Implemented Interfaces:
PointerInterface
`GtkEntry` is a single line text entry widget.
![An example GtkEntry](entry.png)
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 [method@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
[method@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 [method@Gtk.Entry.set_progress_fraction] or
[method@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
[method@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 [signal@Gtk.Entry::icon-press] signal.
To allow DND operations from an icon, use
[method@Gtk.Entry.set_icon_drag_source]. To set a tooltip on an icon, use
[method@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
```
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 [class@Gtk.Text].
# 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:
```xml
<object class="GtkEntry">
<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.
# Accessibility
`GtkEntry` uses the %GTK_ACCESSIBLE_ROLE_TEXT_BOX role.
![An example GtkEntry](entry.png)
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 [method@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
[method@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 [method@Gtk.Entry.set_progress_fraction] or
[method@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
[method@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 [signal@Gtk.Entry::icon-press] signal.
To allow DND operations from an icon, use
[method@Gtk.Entry.set_icon_drag_source]. To set a tooltip on an icon, use
[method@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
```
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 [class@Gtk.Text].
# 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:
```xml
<object class="GtkEntry">
<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.
# Accessibility
`GtkEntry` uses the %GTK_ACCESSIBLE_ROLE_TEXT_BOX role.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic interface
static interface
static interface
Nested classes/interfaces inherited from class ch.bailu.gtk.gtk.Widget
Widget.OnDestroy, Widget.OnDestroyNotify, Widget.OnDirectionChanged, Widget.OnHide, Widget.OnKeynavFailed, Widget.OnMap, Widget.OnMnemonicActivate, Widget.OnMoveFocus, Widget.OnQueryTooltip, Widget.OnRealize, Widget.OnShow, Widget.OnStateFlagsChanged, Widget.OnTickCallback, Widget.OnUnmap, Widget.OnUnrealize
Nested classes/interfaces inherited from class ch.bailu.gtk.gobject.Object
Object.OnBindingTransformFunc, Object.OnDuplicateFunc, Object.OnNotify, Object.OnToggleNotify, Object.OnWeakNotify
-
Field Summary
Fields inherited from class ch.bailu.gtk.gtk.Widget
SIGNAL_ON_DESTROY, SIGNAL_ON_DIRECTION_CHANGED, SIGNAL_ON_HIDE, SIGNAL_ON_KEYNAV_FAILED, SIGNAL_ON_MAP, SIGNAL_ON_MNEMONIC_ACTIVATE, SIGNAL_ON_MOVE_FOCUS, SIGNAL_ON_QUERY_TOOLTIP, SIGNAL_ON_REALIZE, SIGNAL_ON_SHOW, SIGNAL_ON_STATE_FLAGS_CHANGED, SIGNAL_ON_UNMAP, SIGNAL_ON_UNREALIZE
Fields inherited from class ch.bailu.gtk.gobject.Object
SIGNAL_ON_NOTIFY
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionImplements interfaceAccessible
.Implements interfaceBuildable
.Implements interfaceCellEditable
.Implements interfaceConstraintTarget
.Implements interfaceEditable
.boolean
Retrieves the value set by gtk_entry_set_activates_default().float
Gets the value set by gtk_entry_set_alignment().Gets the attribute list of the `GtkEntry`.Get the `GtkEntryBuffer` object which holds the text for
this widget.static ClassHandler
Returns the auxiliary completion object currently
in use by @entry.int
Returns the index of the icon which is the source of the
current DND operation, or -1.Gets the menu model set with gtk_entry_set_extra_menu().boolean
Gets the value set by gtk_entry_set_has_frame().boolean
getIconActivatable
(int icon_pos) Returns whether the icon is activatable.void
getIconArea
(int icon_pos, Rectangle icon_area) Gets the area where entry’s icon at @icon_pos is drawn.int
getIconAtPos
(int x, int y) Finds the icon at the given position and return its index.getIconGicon
(int icon_pos) Retrieves the `GIcon` used for the icon.getIconName
(int icon_pos) Retrieves the icon name used for the icon.getIconPaintable
(int icon_pos) Retrieves the `GdkPaintable` used for the icon.boolean
getIconSensitive
(int icon_pos) Returns whether the icon appears sensitive or insensitive.int
getIconStorageType
(int icon_pos) Gets the type of representation being used by the icon
to store image data.getIconTooltipMarkup
(int icon_pos) Gets the contents of the tooltip on the icon at the specified
position in @entry.getIconTooltipText
(int icon_pos) Gets the contents of the tooltip on the icon at the specified
position in @entry.int
Gets the input hints of this `GtkEntry`.int
Gets the input purpose of the `GtkEntry`.static int
byte
Retrieves the character displayed in place of the actual text
in “password mode”.int
Retrieves the maximum allowed length of the text in @entry.boolean
Gets whether the `GtkEntry` is in overwrite mode.static long
static TypeSystem.TypeSize
Retrieves the text that will be displayed when @entry
is empty and unfocuseddouble
Returns the current fraction of the task that’s been completed.double
Retrieves the pulse step set with
gtk_entry_set_progress_pulse_step().getTabs()
Gets the tabstops of the `GtkEntry.int
Retrieves the current length of the text in @entry.static long
static TypeSystem.TypeSize
boolean
Retrieves whether the text in @entry is visible.boolean
Causes @entry to have keyboard focus.static Entry
newWithBufferEntry
(EntryBuffer buffer) Creates a new entry with the specified text buffer.onActivate
(Entry.OnActivate signal) Connect to signal "activate".onIconPress
(Entry.OnIconPress signal) Connect to signal "icon-press".onIconRelease
(Entry.OnIconRelease signal) Connect to signal "icon-release".void
Indicates that some progress is made, but you don’t
know how much.void
Reset the input method context of the entry if needed.void
setActivatesDefault
(boolean setting) Sets whether pressing Enter in the @entry will activate the default
widget for the window containing the entry.void
setAlignment
(float xalign) Sets the alignment for the contents of the entry.void
setAttributes
(AttrList attrs) Sets a `PangoAttrList`.void
setBuffer
(EntryBuffer buffer) Set the `GtkEntryBuffer` object which holds the text for
this widget.void
setCompletion
(EntryCompletion completion) Sets @completion to be the auxiliary completion object
to use with @entry.void
setExtraMenu
(MenuModel model) Sets a menu model to add when constructing
the context menu for @entry.void
setHasFrame
(boolean setting) Sets whether the entry has a beveled frame around it.void
setIconActivatable
(int icon_pos, boolean activatable) Sets whether the icon is activatable.void
setIconDragSource
(int icon_pos, ContentProvider provider, int actions) Sets up the icon at the given position as drag source.void
setIconFromGicon
(int icon_pos, Icon icon) Sets the icon shown in the entry at the specified position
from the current icon theme.void
setIconFromIconName
(int icon_pos, Str icon_name) Sets the icon shown in the entry at the specified position
from the current icon theme.void
setIconFromIconName
(int icon_pos, String icon_name) Sets the icon shown in the entry at the specified position
from the current icon theme.void
setIconFromPaintable
(int icon_pos, Paintable paintable) Sets the icon shown in the specified position using a `GdkPaintable`.void
setIconSensitive
(int icon_pos, boolean sensitive) Sets the sensitivity for the specified icon.void
setIconTooltipMarkup
(int icon_pos, Str tooltip) Sets @tooltip as the contents of the tooltip for the icon at
the specified position.void
setIconTooltipMarkup
(int icon_pos, String tooltip) Sets @tooltip as the contents of the tooltip for the icon at
the specified position.void
setIconTooltipText
(int icon_pos, Str tooltip) Sets @tooltip as the contents of the tooltip for the icon
at the specified position.void
setIconTooltipText
(int icon_pos, String tooltip) Sets @tooltip as the contents of the tooltip for the icon
at the specified position.void
setInputHints
(int hints) Set additional hints which allow input methods to
fine-tune their behavior.void
setInputPurpose
(int purpose) Sets the input purpose which can be used by input methods
to adjust their behavior.void
setInvisibleChar
(byte ch) Sets the character to use in place of the actual text
in “password mode”.void
setMaxLength
(int max) Sets the maximum allowed length of the contents of the widget.void
setOverwriteMode
(boolean overwrite) Sets whether the text is overwritten when typing in the `GtkEntry`.void
setPlaceholderText
(Str text) Sets text to be displayed in @entry when it is empty.void
setPlaceholderText
(String text) Sets text to be displayed in @entry when it is empty.void
setProgressFraction
(double fraction) Causes the entry’s progress indicator to “fill in” the given
fraction of the bar.void
setProgressPulseStep
(double fraction) Sets the fraction of total entry width to move the progress
bouncing block for each pulse.void
Sets a `PangoTabArray`.void
setVisibility
(boolean visible) Sets whether the contents of the entry are visible or not.void
Unsets the invisible char, so that the default invisible char
is used again.Methods inherited from class ch.bailu.gtk.gtk.Widget
actionSetEnabled, actionSetEnabled, activate, activateAction, activateAction, activateActionVariant, activateActionVariant, activateDefault, addController, addCssClass, addCssClass, addMnemonicLabel, addTickCallback, allocate, childFocus, computeBounds, computeExpand, computePoint, computeTransform, contains, createPangoContext, createPangoLayout, createPangoLayout, disposeTemplate, dragCheckThreshold, errorBell, getAllocatedBaseline, getAllocatedHeight, getAllocatedWidth, getAllocation, getAncestor, getCanFocus, getCanTarget, getChildVisible, getClipboard, getCssClasses, getCssName, getCursor, getDefaultDirection, getDirection, getDisplay, getFirstChild, getFocusable, getFocusChild, getFocusOnClick, getFontMap, getFontOptions, getFrameClock, getHalign, getHasTooltip, getHeight, getHexpand, getHexpandSet, getLastChild, getLayoutManager, getMapped, getMarginBottom, getMarginEnd, getMarginStart, getMarginTop, getName, getNative, getNextSibling, getOpacity, getOverflow, getPangoContext, getParent, getPreferredSize, getPrevSibling, getPrimaryClipboard, getRealized, getReceivesDefault, getRequestMode, getRoot, getScaleFactor, getSensitive, getSettings, getSize, getSizeRequest, getStateFlags, getStyleContext, getTemplateChild, getTemplateChild, getTooltipMarkup, getTooltipText, getValign, getVexpand, getVexpandSet, getVisible, getWidth, grabFocus, hasCssClass, hasCssClass, hasDefault, hasFocus, hasVisibleFocus, hide, inDestruction, initTemplate, insertActionGroup, insertActionGroup, insertAfter, insertBefore, isAncestor, isDrawable, isFocus, isSensitive, isVisible, keynavFailed, listMnemonicLabels, map, measure, mnemonicActivate, observeChildren, observeControllers, onDestroy, onDirectionChanged, onHide, onKeynavFailed, onMap, onMnemonicActivate, onMoveFocus, onQueryTooltip, onRealize, onShow, onStateFlagsChanged, onUnmap, onUnrealize, pick, queueAllocate, queueDraw, queueResize, realize, removeController, removeCssClass, removeCssClass, removeMnemonicLabel, removeTickCallback, setCanFocus, setCanTarget, setChildVisible, setCssClasses, setCursor, setCursorFromName, setCursorFromName, setDefaultDirection, setDirection, setFocusable, setFocusChild, setFocusOnClick, setFontMap, setFontOptions, setHalign, setHasTooltip, setHexpand, setHexpandSet, setLayoutManager, setMarginBottom, setMarginEnd, setMarginStart, setMarginTop, setName, setName, setOpacity, setOverflow, setParent, setReceivesDefault, setSensitive, setSizeRequest, setStateFlags, setTooltipMarkup, setTooltipMarkup, setTooltipText, setTooltipText, setValign, setVexpand, setVexpandSet, setVisible, shouldLayout, show, sizeAllocate, snapshotChild, triggerTooltipQuery, unmap, unparent, unrealize, unsetStateFlags
Methods inherited from class ch.bailu.gtk.gobject.Object
addToggleRef, bindProperty, bindProperty, bindPropertyFull, bindPropertyFull, bindPropertyWithClosures, bindPropertyWithClosures, compatControl, connect, connect, disconnect, disconnect, dupData, dupData, dupQdata, forceFloating, freezeNotify, get, get, getData, getData, getProperty, getProperty, getQdata, interfaceFindProperty, interfaceInstallProperty, isFloating, notify, notify, notifyByPspec, onNotify, ref, refSink, removeToggleRef, replaceData, replaceData, replaceQdata, runDispose, set, set, setData, setData, setDataFull, setDataFull, setProperty, setProperty, setQdata, setQdataFull, stealData, stealData, stealQdata, takeRef, thawNotify, unref, watchClosure, weakRef, weakUnref
Methods inherited from class ch.bailu.gtk.type.Pointer
asCPointer, cast, connectSignal, disconnectSignals, disconnectSignals, equals, hashCode, throwIfNull, throwNullPointerException, toString, unregisterCallbacks, unregisterCallbacks
Methods inherited from class ch.bailu.gtk.type.Type
asCPointer, asCPointer, asCPointerNotNull, asJnaPointer, asJnaPointer, asPointer, asPointer, cast, cast, throwIfNull
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface ch.bailu.gtk.type.PointerInterface
asCPointerNotNull, asJnaPointer, asPointer, isNotNull, isNull
-
Field Details
-
SIGNAL_ON_ACTIVATE
- See Also:
-
SIGNAL_ON_ICON_PRESS
- See Also:
-
SIGNAL_ON_ICON_RELEASE
- See Also:
-
-
Constructor Details
-
Entry
-
Entry
public Entry()Creates a new entry.
-
-
Method Details
-
getClassHandler
-
newWithBufferEntry
Creates a new entry with the specified text buffer.- Parameters:
buffer
- The buffer to use for the new `GtkEntry`.- Returns:
- a new `GtkEntry`
-
getActivatesDefault
public boolean getActivatesDefault()Retrieves the value set by gtk_entry_set_activates_default().- Returns:
- %TRUE if the entry will activate the default widget
-
getAlignment
public float getAlignment()Gets the value set by gtk_entry_set_alignment().
See also: [property@Gtk.Editable:xalign]- Returns:
- the alignment
-
getAttributes
Gets the attribute list of the `GtkEntry`.
See [method@Gtk.Entry.set_attributes].- Returns:
- the attribute list
-
getBuffer
Get the `GtkEntryBuffer` object which holds the text for
this widget.- Returns:
- A `GtkEntryBuffer` object.
-
getCompletion
Returns the auxiliary completion object currently
in use by @entry.- Returns:
- The auxiliary completion object currently in use by @entry
-
getCurrentIconDragSource
public int getCurrentIconDragSource()Returns the index of the icon which is the source of the
current DND operation, or -1.- Returns:
- index of the icon which is the source of the current DND operation, or -1.
-
getExtraMenu
Gets the menu model set with gtk_entry_set_extra_menu().- Returns:
- the menu model
-
getHasFrame
public boolean getHasFrame()Gets the value set by gtk_entry_set_has_frame().- Returns:
- whether the entry has a beveled frame
-
getIconActivatable
public boolean getIconActivatable(int icon_pos) Returns whether the icon is activatable.- Parameters:
icon_pos
- Icon position- Returns:
- %TRUE if the icon is activatable.
-
getIconArea
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:
icon_pos
- Icon positionicon_area
- Return location for the icon’s area
-
getIconAtPos
public int getIconAtPos(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
[signal@Gtk.Widget::query-tooltip] signal handler.- Parameters:
x
- the x coordinate of the position to find, relative to @entryy
- the y coordinate of the position to find, relative to @entry- Returns:
- the index of the icon at the given position, or -1
-
getIconGicon
Retrieves the `GIcon` used for the icon.
%NULL will be returned if there is no icon or if the icon was
set by some other method (e.g., by `GdkPaintable` or icon name).- Parameters:
icon_pos
- Icon position- Returns:
- A `GIcon`
-
getIconName
Retrieves the icon name used for the icon.
%NULL is returned if there is no icon or if the icon was set
by some other method (e.g., by `GdkPaintable` or gicon).- Parameters:
icon_pos
- Icon position- Returns:
- An icon name
-
getIconPaintable
Retrieves the `GdkPaintable` used for the icon.
If no `GdkPaintable` was used for the icon, %NULL is returned.- Parameters:
icon_pos
- Icon position- Returns:
- A `GdkPaintable` if no icon is set for this position or the icon set is not a `GdkPaintable`.
-
getIconSensitive
public boolean getIconSensitive(int icon_pos) Returns whether the icon appears sensitive or insensitive.- Parameters:
icon_pos
- Icon position- Returns:
- %TRUE if the icon is sensitive.
-
getIconStorageType
public int getIconStorageType(int 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.- Parameters:
icon_pos
- Icon position- Returns:
- image representation being used
-
getIconTooltipMarkup
Gets the contents of the tooltip on the icon at the specified
position in @entry.- Parameters:
icon_pos
- the icon position- Returns:
- the tooltip text
-
getIconTooltipText
Gets the contents of the tooltip on the icon at the specified
position in @entry.- Parameters:
icon_pos
- the icon position- Returns:
- the tooltip text
-
getInputHints
public int getInputHints()Gets the input hints of this `GtkEntry`.- Returns:
- the input hints
-
getInputPurpose
public int getInputPurpose()Gets the input purpose of the `GtkEntry`.- Returns:
- the input purpose
-
getInvisibleChar
public byte getInvisibleChar()Retrieves the character displayed in place of the actual text
in “password mode”.- Returns:
- the current invisible char, or 0, if the entry does not show invisible text at all.
-
getMaxLength
public int getMaxLength()Retrieves the maximum allowed length of the text in @entry.
See [method@Gtk.Entry.set_max_length].- Returns:
- the maximum allowed number of characters in `GtkEntry`, or 0 if there is no maximum.
-
getOverwriteMode
public boolean getOverwriteMode()Gets whether the `GtkEntry` is in overwrite mode.- Returns:
- whether the text is overwritten when typing.
-
getPlaceholderText
Retrieves the text that will be displayed when @entry
is empty and unfocused- Returns:
- a pointer to the placeholder text as a string. This string points to internally allocated storage in the widget and must not be freed, modified or stored. If no placeholder text has been set, %NULL will be returned.
-
getProgressFraction
public double getProgressFraction()Returns the current fraction of the task that’s been completed.
See [method@Gtk.Entry.set_progress_fraction].- Returns:
- a fraction from 0.0 to 1.0
-
getProgressPulseStep
public double getProgressPulseStep()Retrieves the pulse step set with
gtk_entry_set_progress_pulse_step().- Returns:
- a fraction from 0.0 to 1.0
-
getTabs
Gets the tabstops of the `GtkEntry.
See [method@Gtk.Entry.set_tabs].- Returns:
- the tabstops
-
getTextLength
public int getTextLength()Retrieves the current length of the text in @entry.
This is equivalent to getting @entry's `GtkEntryBuffer`
and calling [method@Gtk.EntryBuffer.get_length] on it.- Returns:
- the current number of characters in `GtkEntry`, or 0 if there are none.
-
getVisibility
public boolean getVisibility()Retrieves whether the text in @entry is visible.
See [method@Gtk.Entry.set_visibility].- Returns:
- %TRUE if the text is currently visible
-
grabFocusWithoutSelecting
public boolean grabFocusWithoutSelecting()Causes @entry to have keyboard focus.
It behaves like [method@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.- Returns:
- %TRUE if focus is now inside @self
-
progressPulse
public void progressPulse()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 [method@Gtk.Entry.set_progress_pulse_step]). -
resetImContext
public void resetImContext()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. -
setActivatesDefault
public void setActivatesDefault(boolean setting) Sets whether pressing Enter in the @entry will activate the default
widget for the window containing the entry.
This usually means that the dialog containing the entry will be closed,
since the default widget is usually one of the dialog buttons.- Parameters:
setting
- %TRUE to activate window’s default widget on Enter keypress
-
setAlignment
public void setAlignment(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.
See also: [property@Gtk.Editable:xalign]- Parameters:
xalign
- The horizontal alignment, from 0 (left) to 1 (right). Reversed for RTL layouts
-
setAttributes
Sets a `PangoAttrList`.
The attributes in the list are applied to the entry text.
Since the attributes will be applies to text that changes
as the user types, it makes most sense to use attributes
with unlimited extent.- Parameters:
attrs
- a `PangoAttrList`
-
setBuffer
Set the `GtkEntryBuffer` object which holds the text for
this widget.- Parameters:
buffer
- a `GtkEntryBuffer`
-
setCompletion
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.- Parameters:
completion
- The `GtkEntryCompletion`
-
setExtraMenu
Sets a menu model to add when constructing
the context menu for @entry.- Parameters:
model
- a `GMenuModel`
-
setHasFrame
public void setHasFrame(boolean setting) Sets whether the entry has a beveled frame around it.- Parameters:
setting
- new value
-
setIconActivatable
public void setIconActivatable(int icon_pos, boolean activatable) Sets whether the icon is activatable.- Parameters:
icon_pos
- Icon positionactivatable
- %TRUE if the icon should be activatable
-
setIconDragSource
Sets up the icon at the given position as drag source.
This makes it so that GTK will start a drag
operation when the user clicks and drags the icon.- Parameters:
icon_pos
- icon positionprovider
- a `GdkContentProvider`actions
- a bitmask of the allowed drag actions
-
setIconFromGicon
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:
icon_pos
- The position at which to set the iconicon
- The icon to set
-
setIconFromIconName
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:
icon_pos
- The position at which to set the iconicon_name
- An icon name
-
setIconFromIconName
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:
icon_pos
- The position at which to set the iconicon_name
- An icon name
-
setIconFromPaintable
Sets the icon shown in the specified position using a `GdkPaintable`.
If @paintable is %NULL, no icon will be shown in the specified position.- Parameters:
icon_pos
- Icon positionpaintable
- A `GdkPaintable`
-
setIconSensitive
public void setIconSensitive(int icon_pos, boolean sensitive) Sets the sensitivity for the specified icon.- Parameters:
icon_pos
- Icon positionsensitive
- Specifies whether the icon should appear sensitive or insensitive
-
setIconTooltipMarkup
Sets @tooltip as the contents of the tooltip for the icon at
the specified position.
@tooltip is assumed to be marked up with Pango Markup.
Use %NULL for @tooltip to remove an existing tooltip.
See also [method@Gtk.Widget.set_tooltip_markup] and
[method@Gtk.Entry.set_icon_tooltip_text].- Parameters:
icon_pos
- the icon positiontooltip
- the contents of the tooltip for the icon
-
setIconTooltipMarkup
Sets @tooltip as the contents of the tooltip for the icon at
the specified position.
@tooltip is assumed to be marked up with Pango Markup.
Use %NULL for @tooltip to remove an existing tooltip.
See also [method@Gtk.Widget.set_tooltip_markup] and
[method@Gtk.Entry.set_icon_tooltip_text].- Parameters:
icon_pos
- the icon positiontooltip
- the contents of the tooltip for the icon
-
setIconTooltipText
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 [method@Gtk.Widget.set_tooltip_text] and
[method@Gtk.Entry.set_icon_tooltip_markup].
If you unset the widget tooltip via
[method@Gtk.Widget.set_tooltip_text] or
[method@Gtk.Widget.set_tooltip_markup], this sets
[property@Gtk.Widget:has-tooltip] to %FALSE, which suppresses
icon tooltips too. You can resolve this by then calling
[method@Gtk.Widget.set_has_tooltip] to set
[property@Gtk.Widget:has-tooltip] back to %TRUE, or
setting at least one non-empty tooltip on any icon
achieves the same result.- Parameters:
icon_pos
- the icon positiontooltip
- the contents of the tooltip for the icon
-
setIconTooltipText
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 [method@Gtk.Widget.set_tooltip_text] and
[method@Gtk.Entry.set_icon_tooltip_markup].
If you unset the widget tooltip via
[method@Gtk.Widget.set_tooltip_text] or
[method@Gtk.Widget.set_tooltip_markup], this sets
[property@Gtk.Widget:has-tooltip] to %FALSE, which suppresses
icon tooltips too. You can resolve this by then calling
[method@Gtk.Widget.set_has_tooltip] to set
[property@Gtk.Widget:has-tooltip] back to %TRUE, or
setting at least one non-empty tooltip on any icon
achieves the same result.- Parameters:
icon_pos
- the icon positiontooltip
- the contents of the tooltip for the icon
-
setInputHints
public void setInputHints(int hints) Set additional hints which allow input methods to
fine-tune their behavior.- Parameters:
hints
- the hints
-
setInputPurpose
public void setInputPurpose(int purpose) Sets the input purpose which can be used by input methods
to adjust their behavior.- Parameters:
purpose
- the purpose
-
setInvisibleChar
public void setInvisibleChar(byte ch) Sets the character to use in place of the actual text
in “password mode”.
See [method@Gtk.Entry.set_visibility] for how to enable
“password mode”.
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.- Parameters:
ch
- a Unicode character
-
setMaxLength
public void setMaxLength(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. The length is is in characters.
This is equivalent to getting @entry's `GtkEntryBuffer` and
calling [method@Gtk.EntryBuffer.set_max_length] on it.- Parameters:
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.
-
setOverwriteMode
public void setOverwriteMode(boolean overwrite) Sets whether the text is overwritten when typing in the `GtkEntry`.- Parameters:
overwrite
- new value
-
setPlaceholderText
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:
text
- a string to be displayed when @entry is empty and unfocused
-
setPlaceholderText
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:
text
- a string to be displayed when @entry is empty and unfocused
-
setProgressFraction
public void setProgressFraction(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.- Parameters:
fraction
- fraction of the task that’s been completed
-
setProgressPulseStep
public void setProgressPulseStep(double fraction) Sets the fraction of total entry width to move the progress
bouncing block for each pulse.
Use [method@Gtk.Entry.progress_pulse] to pulse
the progress.- Parameters:
fraction
- fraction between 0.0 and 1.0
-
setTabs
Sets a `PangoTabArray`.
The tabstops in the array are applied to the entry text.- Parameters:
tabs
- a `PangoTabArray`
-
setVisibility
public void setVisibility(boolean 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
[method@Gtk.Entry.set_invisible_char].
Note that you probably want to set [property@Gtk.Entry: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.- Parameters:
visible
- %TRUE if the contents of the entry are displayed as plaintext
-
unsetInvisibleChar
public void unsetInvisibleChar()Unsets the invisible char, so that the default invisible char
is used again. See [method@Gtk.Entry.set_invisible_char]. -
onActivate
Connect to signal "activate".
SeeEntry.OnActivate.onActivate()
for signal description.
FieldSIGNAL_ON_ACTIVATE
contains original signal name and can be used as resource reference.- Parameters:
signal
- callback function (lambda).- Returns:
SignalHandler
. Can be used to disconnect signal and to release callback function.
-
onIconPress
Connect to signal "icon-press".
SeeEntry.OnIconPress.onIconPress(int)
for signal description.
FieldSIGNAL_ON_ICON_PRESS
contains original signal name and can be used as resource reference.- Parameters:
signal
- callback function (lambda).- Returns:
SignalHandler
. Can be used to disconnect signal and to release callback function.
-
onIconRelease
Connect to signal "icon-release".
SeeEntry.OnIconRelease.onIconRelease(int)
for signal description.
FieldSIGNAL_ON_ICON_RELEASE
contains original signal name and can be used as resource reference.- Parameters:
signal
- callback function (lambda).- Returns:
SignalHandler
. Can be used to disconnect signal and to release callback function.
-
asAccessible
Implements interfaceAccessible
. Call this to get access to interface functions.- Overrides:
asAccessible
in classWidget
- Returns:
Accessible
-
asBuildable
Implements interfaceBuildable
. Call this to get access to interface functions.- Overrides:
asBuildable
in classWidget
- Returns:
Buildable
-
asCellEditable
Implements interfaceCellEditable
. Call this to get access to interface functions.- Returns:
CellEditable
-
asConstraintTarget
Implements interfaceConstraintTarget
. Call this to get access to interface functions.- Overrides:
asConstraintTarget
in classWidget
- Returns:
ConstraintTarget
-
asEditable
Implements interfaceEditable
. Call this to get access to interface functions.- Returns:
Editable
-
getTypeID
public static long getTypeID() -
getParentTypeID
public static long getParentTypeID() -
getTypeSize
-
getParentTypeSize
-
getInstanceSize
public static int getInstanceSize()
-