Class Entry.Builder<B extends Entry.Builder<B>>

Type Parameters:
B - the type of the Builder that is returned
All Implemented Interfaces:
Accessible.Builder<B>, CellEditable.Builder<B>, Editable.Builder<B>, BuilderInterface
Enclosing class:
Entry

public static class Entry.Builder<B extends Entry.Builder<B>> extends Widget.Builder<B> implements Accessible.Builder<B>, CellEditable.Builder<B>, Editable.Builder<B>
Inner class implementing a builder pattern to construct a GObject with properties.
  • Constructor Details

    • Builder

      protected Builder()
      Default constructor for a Builder object.
  • Method Details

    • build

      public Entry build()
      Finish building the Entry object. This will call GObject.withProperties(Type, String[], Value[]) to create a new GObject instance, which is then cast to Entry.
      Overrides:
      build in class Widget.Builder<B extends Entry.Builder<B>>
      Returns:
      a new instance of Entry with the properties that were set in the Builder object.
    • setActivatesDefault

      public B setActivatesDefault(boolean activatesDefault)
      Whether to activate the default widget when Enter is pressed.
      Parameters:
      activatesDefault - the value for the activates-default property
      Returns:
      the Builder instance is returned, to allow method chaining
    • setAttributes

      public B setAttributes(AttrList attributes)

      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 startIndex and endIndex must refer to the EntryBuffer text, i.e. without the preedit string.

      Parameters:
      attributes - the value for the attributes property
      Returns:
      the Builder instance is returned, to allow method chaining
    • setBuffer

      public B setBuffer(EntryBuffer buffer)
      The buffer object which actually stores the text.
      Parameters:
      buffer - the value for the buffer property
      Returns:
      the Builder instance is returned, to allow method chaining
    • setCompletion

      @Deprecated public B setCompletion(EntryCompletion completion)
      Deprecated.
      GtkEntryCompletion will be removed in GTK 5.
      The auxiliary completion object to use with the entry.
      Parameters:
      completion - the value for the completion property
      Returns:
      the Builder instance is returned, to allow method chaining
    • setEnableEmojiCompletion

      public B setEnableEmojiCompletion(boolean enableEmojiCompletion)
      Whether to suggest Emoji replacements for :-delimited names like :heart:.
      Parameters:
      enableEmojiCompletion - the value for the enable-emoji-completion property
      Returns:
      the Builder instance is returned, to allow method chaining
    • setExtraMenu

      public B setExtraMenu(MenuModel extraMenu)
      A menu model whose contents will be appended to the context menu.
      Parameters:
      extraMenu - the value for the extra-menu property
      Returns:
      the Builder instance is returned, to allow method chaining
    • setHasFrame

      public B setHasFrame(boolean hasFrame)
      Whether the entry should draw a frame.
      Parameters:
      hasFrame - the value for the has-frame property
      Returns:
      the Builder instance is returned, to allow method chaining
    • setImModule

      public B setImModule(String imModule)

      Which IM (input method) module should be used for this entry.

      See IMContext.

      Setting this to a non-null value overrides the system-wide IM module setting. See the GtkSettings Gtk.Settings:gtk-im-module property.

      Parameters:
      imModule - the value for the im-module property
      Returns:
      the Builder instance is returned, to allow method chaining
    • setInputHints

      public B setInputHints(Set<InputHints> inputHints)

      Additional hints that allow input methods to fine-tune their behavior.

      Also see Gtk.Entry:input-purpose

      Parameters:
      inputHints - the value for the input-hints property
      Returns:
      the Builder instance is returned, to allow method chaining
    • setInputPurpose

      public B setInputPurpose(InputPurpose inputPurpose)

      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 InputPurpose.PASSWORD or InputPurpose.PIN is independent from setting Gtk.Entry:visibility.

      Parameters:
      inputPurpose - the value for the input-purpose property
      Returns:
      the Builder instance is returned, to allow method chaining
    • setInvisibleChar

      public B setInvisibleChar(int invisibleChar)
      The character to use when masking entry contents (“password mode”).
      Parameters:
      invisibleChar - the value for the invisible-char property
      Returns:
      the Builder instance is returned, to allow method chaining
    • setInvisibleCharSet

      public B setInvisibleCharSet(boolean invisibleCharSet)
      Whether the invisible char has been set for the GtkEntry.
      Parameters:
      invisibleCharSet - the value for the invisible-char-set property
      Returns:
      the Builder instance is returned, to allow method chaining
    • setMaxLength

      public B setMaxLength(int maxLength)
      Maximum number of characters for this entry.
      Parameters:
      maxLength - the value for the max-length property
      Returns:
      the Builder instance is returned, to allow method chaining
    • setMenuEntryIconPrimaryText

      public B setMenuEntryIconPrimaryText(String menuEntryIconPrimaryText)

      Text for an item in the context menu to activate the primary icon action.

      When the primary icon is activatable and this property has been set, a new entry in the context menu of this GtkEntry will appear with this text. Selecting that menu entry will result in the primary icon being activated, exactly in the same way as it would be activated from a mouse click.

      This simplifies adding accessibility support to applications using activatable icons. The activatable icons aren't focusable when navigating the interface with the keyboard This is why Gtk recommends to also add those actions in the context menu. This set of methods greatly simplifies this, by adding a menu item that, when enabled, calls the same callback than clicking on the icon.

      Parameters:
      menuEntryIconPrimaryText - the value for the menu-entry-icon-primary-text property
      Returns:
      the Builder instance is returned, to allow method chaining
      Since:
      4.20
    • setMenuEntryIconSecondaryText

      public B setMenuEntryIconSecondaryText(String menuEntryIconSecondaryText)

      Text for an item in the context menu to activate the secondary icon action.

      When the primary icon is activatable and this property has been set, a new entry in the context menu of this GtkEntry will appear with this text. Selecting that menu entry will result in the primary icon being activated, exactly in the same way as it would be activated from a mouse click.

      This simplifies adding accessibility support to applications using activatable icons. The activatable icons aren't focusable when navigating the interface with the keyboard This is why Gtk recommends to also add those actions in the context menu. This set of methods greatly simplifies this, by adding a menu item that, when enabled, calls the same callback than clicking on the icon.

      Parameters:
      menuEntryIconSecondaryText - the value for the menu-entry-icon-secondary-text property
      Returns:
      the Builder instance is returned, to allow method chaining
      Since:
      4.20
    • setOverwriteMode

      public B setOverwriteMode(boolean overwriteMode)
      If text is overwritten when typing in the GtkEntry.
      Parameters:
      overwriteMode - the value for the overwrite-mode property
      Returns:
      the Builder instance is returned, to allow method chaining
    • setPlaceholderText

      public B setPlaceholderText(String placeholderText)
      The text that will be displayed in the GtkEntry when it is empty and unfocused.
      Parameters:
      placeholderText - the value for the placeholder-text property
      Returns:
      the Builder instance is returned, to allow method chaining
    • setPrimaryIconActivatable

      public B setPrimaryIconActivatable(boolean primaryIconActivatable)

      Whether the primary icon is activatable.

      GTK emits the Gtk.Entry::icon-press and Gtk.Entry::icon-release signals only on sensitive, activatable icons.

      Sensitive, but non-activatable icons can be used for purely informational purposes.

      Parameters:
      primaryIconActivatable - the value for the primary-icon-activatable property
      Returns:
      the Builder instance is returned, to allow method chaining
    • setPrimaryIconGicon

      public B setPrimaryIconGicon(Icon primaryIconGicon)
      The GIcon to use for the primary icon for the entry.
      Parameters:
      primaryIconGicon - the value for the primary-icon-gicon property
      Returns:
      the Builder instance is returned, to allow method chaining
    • setPrimaryIconName

      public B setPrimaryIconName(String primaryIconName)
      The icon name to use for the primary icon for the entry.
      Parameters:
      primaryIconName - the value for the primary-icon-name property
      Returns:
      the Builder instance is returned, to allow method chaining
    • setPrimaryIconPaintable

      public B setPrimaryIconPaintable(Paintable primaryIconPaintable)
      A GdkPaintable to use as the primary icon for the entry.
      Parameters:
      primaryIconPaintable - the value for the primary-icon-paintable property
      Returns:
      the Builder instance is returned, to allow method chaining
    • setPrimaryIconSensitive

      public B setPrimaryIconSensitive(boolean primaryIconSensitive)

      Whether the primary icon is sensitive.

      An insensitive icon appears grayed out. GTK does not emit the Gtk.Entry::icon-press and Gtk.Entry::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.

      Parameters:
      primaryIconSensitive - the value for the primary-icon-sensitive property
      Returns:
      the Builder instance is returned, to allow method chaining
    • setPrimaryIconTooltipMarkup

      public B setPrimaryIconTooltipMarkup(String primaryIconTooltipMarkup)

      The contents of the tooltip on the primary icon, with markup.

      Also see Entry.setIconTooltipMarkup(EntryIconPosition, String).

      Parameters:
      primaryIconTooltipMarkup - the value for the primary-icon-tooltip-markup property
      Returns:
      the Builder instance is returned, to allow method chaining
    • setPrimaryIconTooltipText

      public B setPrimaryIconTooltipText(String primaryIconTooltipText)

      The contents of the tooltip on the primary icon.

      Also see Entry.setIconTooltipText(EntryIconPosition, String).

      Parameters:
      primaryIconTooltipText - the value for the primary-icon-tooltip-text property
      Returns:
      the Builder instance is returned, to allow method chaining
    • setProgressFraction

      public B setProgressFraction(double progressFraction)
      The current fraction of the task that's been completed.
      Parameters:
      progressFraction - the value for the progress-fraction property
      Returns:
      the Builder instance is returned, to allow method chaining
    • setProgressPulseStep

      public B setProgressPulseStep(double progressPulseStep)

      The fraction of total entry width to move the progress bouncing block for each pulse.

      See Entry.progressPulse().

      Parameters:
      progressPulseStep - the value for the progress-pulse-step property
      Returns:
      the Builder instance is returned, to allow method chaining
    • setSecondaryIconActivatable

      public B setSecondaryIconActivatable(boolean secondaryIconActivatable)

      Whether the secondary icon is activatable.

      GTK emits the Gtk.Entry::icon-press and Gtk.Entry::icon-release signals only on sensitive, activatable icons.

      Sensitive, but non-activatable icons can be used for purely informational purposes.

      Parameters:
      secondaryIconActivatable - the value for the secondary-icon-activatable property
      Returns:
      the Builder instance is returned, to allow method chaining
    • setSecondaryIconGicon

      public B setSecondaryIconGicon(Icon secondaryIconGicon)
      The GIcon to use for the secondary icon for the entry.
      Parameters:
      secondaryIconGicon - the value for the secondary-icon-gicon property
      Returns:
      the Builder instance is returned, to allow method chaining
    • setSecondaryIconName

      public B setSecondaryIconName(String secondaryIconName)
      The icon name to use for the secondary icon for the entry.
      Parameters:
      secondaryIconName - the value for the secondary-icon-name property
      Returns:
      the Builder instance is returned, to allow method chaining
    • setSecondaryIconPaintable

      public B setSecondaryIconPaintable(Paintable secondaryIconPaintable)
      A GdkPaintable to use as the secondary icon for the entry.
      Parameters:
      secondaryIconPaintable - the value for the secondary-icon-paintable property
      Returns:
      the Builder instance is returned, to allow method chaining
    • setSecondaryIconSensitive

      public B setSecondaryIconSensitive(boolean secondaryIconSensitive)

      Whether the secondary icon is sensitive.

      An insensitive icon appears grayed out. GTK does not emit the Gtk.Entry::icon-press[ and [signal@Gtk.Entry::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.

      Parameters:
      secondaryIconSensitive - the value for the secondary-icon-sensitive property
      Returns:
      the Builder instance is returned, to allow method chaining
    • setSecondaryIconTooltipMarkup

      public B setSecondaryIconTooltipMarkup(String secondaryIconTooltipMarkup)

      The contents of the tooltip on the secondary icon, with markup.

      Also see Entry.setIconTooltipMarkup(EntryIconPosition, String).

      Parameters:
      secondaryIconTooltipMarkup - the value for the secondary-icon-tooltip-markup property
      Returns:
      the Builder instance is returned, to allow method chaining
    • setSecondaryIconTooltipText

      public B setSecondaryIconTooltipText(String secondaryIconTooltipText)

      The contents of the tooltip on the secondary icon.

      Also see Entry.setIconTooltipText(EntryIconPosition, String).

      Parameters:
      secondaryIconTooltipText - the value for the secondary-icon-tooltip-text property
      Returns:
      the Builder instance is returned, to allow method chaining
    • setShowEmojiIcon

      public B setShowEmojiIcon(boolean showEmojiIcon)
      Whether the entry will show an Emoji icon in the secondary icon position to open the Emoji chooser.
      Parameters:
      showEmojiIcon - the value for the show-emoji-icon property
      Returns:
      the Builder instance is returned, to allow method chaining
    • setTabs

      public B setTabs(TabArray tabs)
      A list of tabstops to apply to the text of the entry.
      Parameters:
      tabs - the value for the tabs property
      Returns:
      the Builder instance is returned, to allow method chaining
    • setTruncateMultiline

      public B setTruncateMultiline(boolean truncateMultiline)
      When true, pasted multi-line text is truncated to the first line.
      Parameters:
      truncateMultiline - the value for the truncate-multiline property
      Returns:
      the Builder instance is returned, to allow method chaining
    • setVisibility

      public B setVisibility(boolean visibility)
      Whether the entry should show the “invisible char” instead of the actual text (“password mode”).
      Parameters:
      visibility - the value for the visibility property
      Returns:
      the Builder instance is returned, to allow method chaining
    • setInputHints

      public B setInputHints(InputHints... inputHints)

      Additional hints that allow input methods to fine-tune their behavior.

      Also see Gtk.Entry:input-purpose

      Parameters:
      inputHints - the value for the input-hints property
      Returns:
      the Builder instance is returned, to allow method chaining
    • onActivate

      public B onActivate(Entry.ActivateCallback handler)

      Emitted when the entry is activated.

      The keybindings for this signal are all forms of the Enter key.

      Parameters:
      handler - the signal handler
      Returns:
      the Builder instance is returned, to allow method chaining
      See Also:
    • onIconPress

      public B onIconPress(Entry.IconPressCallback handler)
      Emitted when an activatable icon is clicked.
      Parameters:
      handler - the signal handler
      Returns:
      the Builder instance is returned, to allow method chaining
      See Also:
    • onIconRelease

      public B onIconRelease(Entry.IconReleaseCallback handler)
      Emitted on the button release from a mouse click over an activatable icon.
      Parameters:
      handler - the signal handler
      Returns:
      the Builder instance is returned, to allow method chaining
      See Also: