Class TextView.Builder<B extends TextView.Builder<B>>

Type Parameters:
B - the type of the Builder that is returned
All Implemented Interfaces:
Accessible.Builder<B>, Scrollable.Builder<B>, BuilderInterface
Direct Known Subclasses:
View.Builder
Enclosing class:
TextView

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

      public B setAcceptsTab(boolean acceptsTab)
      Whether Tab will result in a tab character being entered.
      Parameters:
      acceptsTab - the value for the accepts-tab property
      Returns:
      the Builder instance is returned, to allow method chaining
    • setBottomMargin

      public B setBottomMargin(int bottomMargin)

      The bottom margin for text in the text view.

      Note that this property is confusingly named. In CSS terms, the value set here is padding, and it is applied in addition to the padding from the theme.

      Don't confuse this property with Gtk.Widget:margin-bottom.

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

      public B setBuffer(TextBuffer buffer)
      The buffer which is displayed.
      Parameters:
      buffer - the value for the buffer property
      Returns:
      the Builder instance is returned, to allow method chaining
    • setCursorVisible

      public B setCursorVisible(boolean cursorVisible)
      If the insertion cursor is shown.
      Parameters:
      cursorVisible - the value for the cursor-visible property
      Returns:
      the Builder instance is returned, to allow method chaining
    • setEditable

      public B setEditable(boolean editable)
      Whether the text can be modified by the user.
      Parameters:
      editable - the value for the editable 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 IM (input method) module should be used for this text_view.

      See IMMulticontext.

      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
    • setIndent

      public B setIndent(int indent)

      Amount to indent the paragraph, in pixels.

      A negative value of indent will produce a hanging indentation. That is, the first line will have the full width, and subsequent lines will be indented by the absolute value of indent.

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

      public B setInputHints(Set<InputHints> inputHints)
      Additional hints (beyond Gtk.TextView:input-purpose) 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 property can be used by on-screen keyboards and other input methods to adjust their behaviour.

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

      public B setJustification(Justification justification)
      Left, right, or center justification.
      Parameters:
      justification - the value for the justification property
      Returns:
      the Builder instance is returned, to allow method chaining
    • setLeftMargin

      public B setLeftMargin(int leftMargin)

      The default left margin for text in the text view.

      Tags in the buffer may override the default.

      Note that this property is confusingly named. In CSS terms, the value set here is padding, and it is applied in addition to the padding from the theme.

      Parameters:
      leftMargin - the value for the left-margin property
      Returns:
      the Builder instance is returned, to allow method chaining
    • setMonospace

      public B setMonospace(boolean monospace)

      Whether text should be displayed in a monospace font.

      If true, set the .monospace style class on the text view to indicate that a monospace font is desired.

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

      public B setOverwrite(boolean overwrite)
      Whether entered text overwrites existing contents.
      Parameters:
      overwrite - the value for the overwrite property
      Returns:
      the Builder instance is returned, to allow method chaining
    • setPixelsAboveLines

      public B setPixelsAboveLines(int pixelsAboveLines)
      Pixels of blank space above paragraphs.
      Parameters:
      pixelsAboveLines - the value for the pixels-above-lines property
      Returns:
      the Builder instance is returned, to allow method chaining
    • setPixelsBelowLines

      public B setPixelsBelowLines(int pixelsBelowLines)
      Pixels of blank space below paragraphs.
      Parameters:
      pixelsBelowLines - the value for the pixels-below-lines property
      Returns:
      the Builder instance is returned, to allow method chaining
    • setPixelsInsideWrap

      public B setPixelsInsideWrap(int pixelsInsideWrap)
      Pixels of blank space between wrapped lines in a paragraph.
      Parameters:
      pixelsInsideWrap - the value for the pixels-inside-wrap property
      Returns:
      the Builder instance is returned, to allow method chaining
    • setRightMargin

      public B setRightMargin(int rightMargin)

      The default right margin for text in the text view.

      Tags in the buffer may override the default.

      Note that this property is confusingly named. In CSS terms, the value set here is padding, and it is applied in addition to the padding from the theme.

      Parameters:
      rightMargin - the value for the right-margin property
      Returns:
      the Builder instance is returned, to allow method chaining
    • setTabs

      public B setTabs(TabArray tabs)
      Custom tabs for this text.
      Parameters:
      tabs - the value for the tabs property
      Returns:
      the Builder instance is returned, to allow method chaining
    • setTopMargin

      public B setTopMargin(int topMargin)

      The top margin for text in the text view.

      Note that this property is confusingly named. In CSS terms, the value set here is padding, and it is applied in addition to the padding from the theme.

      Don't confuse this property with Gtk.Widget:margin-top.

      Parameters:
      topMargin - the value for the top-margin property
      Returns:
      the Builder instance is returned, to allow method chaining
    • setWrapMode

      public B setWrapMode(WrapMode wrapMode)
      Whether to wrap lines never, at word boundaries, or at character boundaries.
      Parameters:
      wrapMode - the value for the wrap-mode property
      Returns:
      the Builder instance is returned, to allow method chaining
    • setInputHints

      public B setInputHints(InputHints... inputHints)
      Additional hints (beyond Gtk.TextView:input-purpose) 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
    • onBackspace

      public B onBackspace(TextView.BackspaceCallback handler)

      Gets emitted when the user asks for it.

      The ::backspace signal 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(TextView.CopyClipboardCallback handler)

      Gets emitted to copy the selection to the clipboard.

      The ::copy-clipboard signal 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(TextView.CutClipboardCallback handler)

      Gets emitted to cut the selection to the clipboard.

      The ::cut-clipboard signal 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(TextView.DeleteFromCursorCallback handler)

      Gets emitted when the user initiates a text deletion.

      The ::delete-from-cursor signal is a keybinding signal.

      If the type is 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, Ctrl+Delete for deleting a word and Ctrl+Backspace for deleting a word backwards.

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

      public B onExtendSelection(TextView.ExtendSelectionCallback handler)
      Emitted when the selection needs to be extended at location.
      Parameters:
      handler - the signal handler
      Returns:
      the Builder instance is returned, to allow method chaining
      See Also:
    • onInsertAtCursor

      public B onInsertAtCursor(TextView.InsertAtCursorCallback handler)

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

      The ::insert-at-cursor signal 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(TextView.InsertEmojiCallback handler)

      Gets emitted to present the Emoji chooser for the textView.

      The ::insert-emoji signal 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(TextView.MoveCursorCallback handler)

      Gets emitted when the user initiates a cursor movement.

      The ::move-cursor signal is a keybinding signal. If the cursor is not visible in textView, this signal causes the viewport to be moved instead.

      Applications should not connect to it, but may emit it with g_signal_emit_by_name() 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
      • PgUp and PgDn move vertically by pages
      • Ctrl+PgUp and Ctrl+PgDn move horizontally by pages
      Parameters:
      handler - the signal handler
      Returns:
      the Builder instance is returned, to allow method chaining
      See Also:
    • onMoveViewport

      public B onMoveViewport(TextView.MoveViewportCallback handler)

      Gets emitted to move the viewport.

      The ::move-viewport signal is a keybinding signal, which can be bound to key combinations to allow the user to move the viewport, i.e. change what part of the text view is visible in a containing scrolled window.

      There are no default bindings for this signal.

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

      public B onPasteClipboard(TextView.PasteClipboardCallback handler)

      Gets emitted to paste the contents of the clipboard into the text view.

      The ::paste-clipboard signal 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(TextView.PreeditChangedCallback handler)

      Emitted when preedit text of the active IM 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.

      This signal is only emitted if the text at the given position is actually editable.

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

      public B onSelectAll(TextView.SelectAllCallback handler)

      Gets emitted to select or unselect the complete contents of the text view.

      The ::select-all signal is a keybinding signal.

      The default bindings for this signal are Ctrl+a and Ctrl+/ for selecting and Shift+Ctrl+a and Ctrl+\ for unselecting.

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

      public B onSetAnchor(TextView.SetAnchorCallback handler)

      Gets emitted when the user initiates settings the "anchor" mark.

      The ::set-anchor signal is a keybinding signal which gets emitted when the user initiates setting the "anchor" mark. The "anchor" mark gets placed at the same position as the "insert" mark.

      This signal has no default bindings.

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

      public B onToggleCursorVisible(TextView.ToggleCursorVisibleCallback handler)

      Gets emitted to toggle the cursor-visible property.

      The ::toggle-cursor-visible signal is a keybinding signal.

      The default binding for this signal is F7.

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

      public B onToggleOverwrite(TextView.ToggleOverwriteCallback handler)

      Gets emitted to toggle the overwrite mode of the text view.

      The ::toggle-overwrite signal is a keybinding signal.

      The default binding for this signal is Insert.

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