Class Text.Builder<B extends Text.Builder<B>>

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

public static class Text.Builder<B extends Text.Builder<B>> extends Widget.Builder<B> implements Accessible.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 Text build()
      Finish building the Text object. This will call GObject.withProperties(Type, String[], Value[]) to create a new GObject instance, which is then cast to Text.
      Overrides:
      build in class Widget.Builder<B extends Text.Builder<B>>
      Returns:
      a new instance of Text 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.

      This is mainly useful to change the size or weight of the text.

      The PangoAttribute's startIndex and endIndex must refer to the GtkEntryBuffer 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 GtkEntryBuffer object which stores the text.
      Parameters:
      buffer - the value for the buffer property
      Returns:
      the Builder instance is returned, to allow method chaining
    • setEnableEmojiCompletion

      public B setEnableEmojiCompletion(boolean enableEmojiCompletion)
      Whether to suggest Emoji replacements.
      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
    • setImModule

      public B setImModule(String imModule)

      Which input method module should be used.

      See IMMulticontext.

      Setting this to a non-NULL value overrides the system-wide input method. See the Gtk.Settings:gtk-im-module setting.

      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 behaviour.
      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 information can be used by on-screen keyboards and other input methods to adjust their behaviour.

      Note that setting the purpose to Gtk.InputPurpose.password or Gtk.InputPurpose.pin is independent from setting Gtk.Text: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 used when masking contents (in “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.
      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 that are allowed.

      Zero indicates no limit.

      Parameters:
      maxLength - the value for the max-length property
      Returns:
      the Builder instance is returned, to allow method chaining
    • setOverwriteMode

      public B setOverwriteMode(boolean overwriteMode)
      If text is overwritten when typing.
      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 GtkText 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
    • setPropagateTextWidth

      public B setPropagateTextWidth(boolean propagateTextWidth)
      Whether the widget should grow and shrink with the content.
      Parameters:
      propagateTextWidth - the value for the propagate-text-width property
      Returns:
      the Builder instance is returned, to allow method chaining
    • setTabs

      public B setTabs(TabArray tabs)
      Custom tabs for this text widget.
      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)
      If false, the text is masked with the “invisible char”.
      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 behaviour.
      Parameters:
      inputHints - the value for the input-hints property
      Returns:
      the Builder instance is returned, to allow method chaining
    • onActivate

      public B onActivate(Text.ActivateCallback handler)

      Emitted when the user hits the Enter key.

      The default bindings 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:
    • onBackspace

      public B onBackspace(Text.BackspaceCallback handler)

      Emitted when the user asks for it.

      This is a keybinding signal.

      The default bindings for this signal are Backspace and Shift+Backspace.

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

      public B onCopyClipboard(Text.CopyClipboardCallback handler)

      Emitted to copy the selection to the clipboard.

      This is a keybinding signal.

      The default bindings for this signal are Ctrl+c and Ctrl+Insert.

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

      public B onCutClipboard(Text.CutClipboardCallback handler)

      Emitted to cut the selection to the clipboard.

      This is a keybinding signal.

      The default bindings for this signal are Ctrl+x and Shift+Delete.

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

      public B onDeleteFromCursor(Text.DeleteFromCursorCallback handler)

      Emitted when the user initiates a text deletion.

      This is a keybinding signal.

      If the type is Gtk.DeleteType.chars, GTK deletes the selection if there is one, otherwise it deletes the requested number of characters.

      The default bindings for this signal are Delete for deleting a character and Ctrl+Delete for deleting a word.

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

      public B onInsertAtCursor(Text.InsertAtCursorCallback handler)

      Emitted when the user initiates the insertion of a fixed string at the cursor.

      This is a keybinding signal.

      This signal has no default bindings.

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

      public B onInsertEmoji(Text.InsertEmojiCallback handler)

      Emitted to present the Emoji chooser.

      This is a keybinding signal.

      The default bindings for this signal are Ctrl+. and Ctrl+;

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

      public B onMoveCursor(Text.MoveCursorCallback handler)

      Emitted when the user initiates a cursor movement.

      If the cursor is not visible in self, this signal causes the viewport to be moved instead.

      This is a keybinding signal.

      Applications should not connect to it, but may emit it with GObjects#signalEmitByName if they need to control the cursor programmatically.

      The default bindings for this signal come in two variants, the variant with the Shift modifier extends the selection, the variant without it does not. There are too many key combinations to list them all here.

      • , , , move by individual characters/lines
      • Ctrl+, etc. move by words/paragraphs
      • Home and End move to the ends of the buffer
      Parameters:
      handler - the signal handler
      Returns:
      the Builder instance is returned, to allow method chaining
      See Also:
    • onPasteClipboard

      public B onPasteClipboard(Text.PasteClipboardCallback handler)

      Emitted to paste the contents of the clipboard.

      This is a keybinding signal.

      The default bindings for this signal are Ctrl+v and Shift+Insert.

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

      public B onPreeditChanged(Text.PreeditChangedCallback handler)

      Emitted when the preedit text changes.

      If an input method is used, the typed text will not immediately be committed to the buffer. So if you are interested in the text, connect to this signal.

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

      public B onToggleOverwrite(Text.ToggleOverwriteCallback handler)

      Emitted to toggle the overwrite mode.

      This is a keybinding signal.

      The default bindings for this signal is Insert.

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