Class TextView

All Implemented Interfaces:
PointerInterface

public class TextView extends Widget
A widget that displays the contents of a [class@Gtk.TextBuffer].

![An example GtkTextview](multiline-text.png)

You may wish to begin by reading the [conceptual overview](section-text-widget.html),
which gives an overview of all the objects and data types related to the
text widget and how they work together.

## CSS nodes

```
textview.view
├── border.top
├── border.left
├── text
│ ╰── [selection]
├── border.right
├── border.bottom
╰── [window.popup]
```

`GtkTextView` has a main css node with name textview and style class .view,
and subnodes for each of the border windows, and the main text area,
with names border and text, respectively. The border nodes each get
one of the style classes .left, .right, .top or .bottom.

A node representing the selection will appear below the text node.

If a context menu is opened, the window node will appear as a subnode
of the main node.

## Accessibility

`GtkTextView` uses the %GTK_ACCESSIBLE_ROLE_TEXT_BOX role.

https://docs.gtk.org/gtk4/class.TextView.html

  • Field Details

  • Constructor Details

    • TextView

      public TextView(PointerContainer pointer)
    • TextView

      public TextView()
      Creates a new `GtkTextView`.

      If you don’t call [method@Gtk.TextView.set_buffer] before using the
      text view, an empty default buffer will be created for you. Get the
      buffer with [method@Gtk.TextView.get_buffer]. If you want to specify
      your own buffer, consider [ctor@Gtk.TextView.new_with_buffer].
  • Method Details

    • getClassHandler

      public static ClassHandler getClassHandler()
    • newWithBufferTextView

      public static TextView newWithBufferTextView(@Nonnull TextBuffer buffer)
      Creates a new `GtkTextView` widget displaying the buffer @buffer.

      One buffer can be shared among many widgets. @buffer may be %NULL
      to create a default buffer, in which case this function is equivalent
      to [ctor@Gtk.TextView.new]. The text view adds its own reference count
      to the buffer; it does not take over an existing reference.
      Parameters:
      buffer - a `GtkTextBuffer`
      Returns:
      a new `GtkTextView`.
    • addChildAtAnchor

      public void addChildAtAnchor(@Nonnull Widget child, @Nonnull TextChildAnchor anchor)
      Adds a child widget in the text buffer, at the given @anchor.
      Parameters:
      child - a `GtkWidget`
      anchor - a `GtkTextChildAnchor` in the `GtkTextBuffer` for @text_view
    • addOverlay

      public void addOverlay(@Nonnull Widget child, int xpos, int ypos)
      Adds @child at a fixed coordinate in the `GtkTextView`'s text window.

      The @xpos and @ypos must be in buffer coordinates (see
      [method@Gtk.TextView.get_iter_location] to convert to
      buffer coordinates).

      @child will scroll with the text view.

      If instead you want a widget that will not move with the
      `GtkTextView` contents see `GtkOverlay`.
      Parameters:
      child - a `GtkWidget`
      xpos - X position of child in window coordinates
      ypos - Y position of child in window coordinates
    • backwardDisplayLine

      public boolean backwardDisplayLine(@Nonnull TextIter iter)
      Moves the given @iter backward by one display (wrapped) line.

      A display line is different from a paragraph. Paragraphs are
      separated by newlines or other paragraph separator characters.
      Display lines are created by line-wrapping a paragraph. If
      wrapping is turned off, display lines and paragraphs will be the
      same. Display lines are divided differently for each view, since
      they depend on the view’s width; paragraphs are the same in all
      views, since they depend on the contents of the `GtkTextBuffer`.
      Parameters:
      iter - a `GtkTextIter`
      Returns:
      %TRUE if @iter was moved and is not on the end iterator
    • backwardDisplayLineStart

      public boolean backwardDisplayLineStart(@Nonnull TextIter iter)
      Moves the given @iter backward to the next display line start.

      A display line is different from a paragraph. Paragraphs are
      separated by newlines or other paragraph separator characters.
      Display lines are created by line-wrapping a paragraph. If
      wrapping is turned off, display lines and paragraphs will be the
      same. Display lines are divided differently for each view, since
      they depend on the view’s width; paragraphs are the same in all
      views, since they depend on the contents of the `GtkTextBuffer`.
      Parameters:
      iter - a `GtkTextIter`
      Returns:
      %TRUE if @iter was moved and is not on the end iterator
    • bufferToWindowCoords

      public void bufferToWindowCoords(int win, int buffer_x, int buffer_y, @Nullable Int window_x, @Nullable Int window_y)
      Converts buffer coordinates to window coordinates.
      Parameters:
      win - a `GtkTextWindowType`
      buffer_x - buffer x coordinate
      buffer_y - buffer y coordinate
      window_x - window x coordinate return location
      window_y - window y coordinate return location
    • forwardDisplayLine

      public boolean forwardDisplayLine(@Nonnull TextIter iter)
      Moves the given @iter forward by one display (wrapped) line.

      A display line is different from a paragraph. Paragraphs are
      separated by newlines or other paragraph separator characters.
      Display lines are created by line-wrapping a paragraph. If
      wrapping is turned off, display lines and paragraphs will be the
      same. Display lines are divided differently for each view, since
      they depend on the view’s width; paragraphs are the same in all
      views, since they depend on the contents of the `GtkTextBuffer`.
      Parameters:
      iter - a `GtkTextIter`
      Returns:
      %TRUE if @iter was moved and is not on the end iterator
    • forwardDisplayLineEnd

      public boolean forwardDisplayLineEnd(@Nonnull TextIter iter)
      Moves the given @iter forward to the next display line end.

      A display line is different from a paragraph. Paragraphs are
      separated by newlines or other paragraph separator characters.
      Display lines are created by line-wrapping a paragraph. If
      wrapping is turned off, display lines and paragraphs will be the
      same. Display lines are divided differently for each view, since
      they depend on the view’s width; paragraphs are the same in all
      views, since they depend on the contents of the `GtkTextBuffer`.
      Parameters:
      iter - a `GtkTextIter`
      Returns:
      %TRUE if @iter was moved and is not on the end iterator
    • getAcceptsTab

      public boolean getAcceptsTab()
      Returns whether pressing the <kbd>Tab</kbd> key inserts a tab characters.

      See [method@Gtk.TextView.set_accepts_tab].
      Returns:
      %TRUE if pressing the Tab key inserts a tab character, %FALSE if pressing the Tab key moves the keyboard focus.
    • getBottomMargin

      public int getBottomMargin()
      Gets the bottom margin for text in the @text_view.
      Returns:
      bottom margin in pixels
    • getBuffer

      public TextBuffer getBuffer()
      Returns the `GtkTextBuffer` being displayed by this text view.

      The reference count on the buffer is not incremented; the caller
      of this function won’t own a new reference.
      Returns:
      a `GtkTextBuffer`
    • getCursorLocations

      public void getCursorLocations(@Nullable TextIter iter, @Nullable Rectangle strong, @Nullable Rectangle weak)
      Determine the positions of the strong and weak cursors if the
      insertion point is at @iter.

      The position of each cursor is stored as a zero-width rectangle.
      The strong cursor location is the location where characters of
      the directionality equal to the base direction of the paragraph
      are inserted. The weak cursor location is the location where
      characters of the directionality opposite to the base direction
      of the paragraph are inserted.

      If @iter is %NULL, the actual cursor position is used.

      Note that if @iter happens to be the actual cursor position, and
      there is currently an IM preedit sequence being entered, the
      returned locations will be adjusted to account for the preedit
      cursor’s offset within the preedit sequence.

      The rectangle position is in buffer coordinates; use
      [method@Gtk.TextView.buffer_to_window_coords] to convert these
      coordinates to coordinates for one of the windows in the text view.
      Parameters:
      iter - a `GtkTextIter`
      strong - location to store the strong cursor position
      weak - location to store the weak cursor position
    • getCursorVisible

      public boolean getCursorVisible()
      Find out whether the cursor should be displayed.
      Returns:
      whether the insertion mark is visible
    • getEditable

      public boolean getEditable()
      Returns the default editability of the `GtkTextView`.

      Tags in the buffer may override this setting for some ranges of text.
      Returns:
      whether text is editable by default
    • getExtraMenu

      public MenuModel getExtraMenu()
      Gets the menu model that gets added to the context menu
      or %NULL if none has been set.
      Returns:
      the menu model
    • getGutter

      public Widget getGutter(int win)
      Gets a `GtkWidget` that has previously been set as gutter.

      See [method@Gtk.TextView.set_gutter].

      @win must be one of %GTK_TEXT_WINDOW_LEFT, %GTK_TEXT_WINDOW_RIGHT,
      %GTK_TEXT_WINDOW_TOP, or %GTK_TEXT_WINDOW_BOTTOM.
      Parameters:
      win - a `GtkTextWindowType`
      Returns:
      a `GtkWidget`
    • getIndent

      public int getIndent()
      Gets the default indentation of paragraphs in @text_view.

      Tags in the view’s buffer may override the default.
      The indentation may be negative.
      Returns:
      number of pixels of indentation
    • getInputHints

      public int getInputHints()
      Gets the `input-hints` of the `GtkTextView`.
      Returns:
    • getInputPurpose

      public int getInputPurpose()
      Gets the `input-purpose` of the `GtkTextView`.
      Returns:
    • getIterAtLocation

      public boolean getIterAtLocation(@Nonnull TextIter iter, int x, int y)
      Retrieves the iterator at buffer coordinates @x and @y.

      Buffer coordinates are coordinates for the entire buffer, not just
      the currently-displayed portion. If you have coordinates from an
      event, you have to convert those to buffer coordinates with
      [method@Gtk.TextView.window_to_buffer_coords].
      Parameters:
      iter - a `GtkTextIter`
      x - x position, in buffer coordinates
      y - y position, in buffer coordinates
      Returns:
      %TRUE if the position is over text
    • getIterAtPosition

      public boolean getIterAtPosition(@Nonnull TextIter iter, @Nullable Int trailing, int x, int y)
      Retrieves the iterator pointing to the character at buffer
      coordinates @x and @y.

      Buffer coordinates are coordinates for the entire buffer, not just
      the currently-displayed portion. If you have coordinates from an event,
      you have to convert those to buffer coordinates with
      [method@Gtk.TextView.window_to_buffer_coords].

      Note that this is different from [method@Gtk.TextView.get_iter_at_location],
      which returns cursor locations, i.e. positions between characters.
      Parameters:
      iter - a `GtkTextIter`
      trailing - if non-%NULL, location to store an integer indicating where in the grapheme the user clicked. It will either be zero, or the number of characters in the grapheme. 0 represents the trailing edge of the grapheme.
      x - x position, in buffer coordinates
      y - y position, in buffer coordinates
      Returns:
      %TRUE if the position is over text
    • getIterLocation

      public void getIterLocation(@Nonnull TextIter iter, @Nonnull Rectangle location)
      Gets a rectangle which roughly contains the character at @iter.

      The rectangle position is in buffer coordinates; use
      [method@Gtk.TextView.buffer_to_window_coords] to convert these
      coordinates to coordinates for one of the windows in the text view.
      Parameters:
      iter - a `GtkTextIter`
      location - bounds of the character at @iter
    • getJustification

      public int getJustification()
      Gets the default justification of paragraphs in @text_view.

      Tags in the buffer may override the default.
      Returns:
      default justification
    • getLeftMargin

      public int getLeftMargin()
      Gets the default left margin size of paragraphs in the @text_view.

      Tags in the buffer may override the default.
      Returns:
      left margin in pixels
    • getLineAtY

      public void getLineAtY(@Nonnull TextIter target_iter, int y, @Nonnull Int line_top)
      Gets the `GtkTextIter` at the start of the line containing
      the coordinate @y.

      @y is in buffer coordinates, convert from window coordinates with
      [method@Gtk.TextView.window_to_buffer_coords]. If non-%NULL,
      @line_top will be filled with the coordinate of the top edge
      of the line.
      Parameters:
      target_iter - a `GtkTextIter`
      y - a y coordinate
      line_top - return location for top coordinate of the line
    • getLineYrange

      public void getLineYrange(@Nonnull TextIter iter, @Nonnull Int y, @Nonnull Int height)
      Gets the y coordinate of the top of the line containing @iter,
      and the height of the line.

      The coordinate is a buffer coordinate; convert to window
      coordinates with [method@Gtk.TextView.buffer_to_window_coords].
      Parameters:
      iter - a `GtkTextIter`
      y - return location for a y coordinate
      height - return location for a height
    • getLtrContext

      public Context getLtrContext()
      Gets the `PangoContext` that is used for rendering LTR directed
      text layouts.

      The context may be replaced when CSS changes occur.
      Returns:
      a `PangoContext`
    • getMonospace

      public boolean getMonospace()
      Gets whether the `GtkTextView` uses monospace styling.
      Returns:
      %TRUE if monospace fonts are desired
    • getOverwrite

      public boolean getOverwrite()
      Returns whether the `GtkTextView` is in overwrite mode or not.
      Returns:
      whether @text_view is in overwrite mode or not.
    • getPixelsAboveLines

      public int getPixelsAboveLines()
      Gets the default number of pixels to put above paragraphs.

      Adding this function with [method@Gtk.TextView.get_pixels_below_lines]
      is equal to the line space between each paragraph.
      Returns:
      default number of pixels above paragraphs
    • getPixelsBelowLines

      public int getPixelsBelowLines()
      Gets the default number of pixels to put below paragraphs.

      The line space is the sum of the value returned by this function and
      the value returned by [method@Gtk.TextView.get_pixels_above_lines].
      Returns:
      default number of blank pixels below paragraphs
    • getPixelsInsideWrap

      public int getPixelsInsideWrap()
      Gets the default number of pixels to put between wrapped lines
      inside a paragraph.
      Returns:
      default number of pixels of blank space between wrapped lines
    • getRightMargin

      public int getRightMargin()
      Gets the default right margin for text in @text_view.

      Tags in the buffer may override the default.
      Returns:
      right margin in pixels
    • getRtlContext

      public Context getRtlContext()
      Gets the `PangoContext` that is used for rendering RTL directed
      text layouts.

      The context may be replaced when CSS changes occur.
      Returns:
      a `PangoContext`
    • getTabs

      public TabArray getTabs()
      Gets the default tabs for @text_view.

      Tags in the buffer may override the defaults. The returned array
      will be %NULL if “standard” (8-space) tabs are used. Free the
      return value with [method@Pango.TabArray.free].
      Returns:
      copy of default tab array, or %NULL if standard tabs are used; must be freed with [method@Pango.TabArray.free].
    • getTopMargin

      public int getTopMargin()
      Gets the top margin for text in the @text_view.
      Returns:
      top margin in pixels
    • getVisibleRect

      public void getVisibleRect(@Nonnull Rectangle visible_rect)
      Fills @visible_rect with the currently-visible
      region of the buffer, in buffer coordinates.

      Convert to window coordinates with
      [method@Gtk.TextView.buffer_to_window_coords].
      Parameters:
      visible_rect - rectangle to fill
    • getWrapMode

      public int getWrapMode()
      Gets the line wrapping for the view.
      Returns:
      the line wrap setting
    • imContextFilterKeypress

      public boolean imContextFilterKeypress(@Nonnull Event event)
      Allow the `GtkTextView` 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 [method@Gtk.IMContext.filter_keypress].

      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 `GtkTextView`.

      ```c
      static gboolean
      gtk_foo_bar_key_press_event (GtkWidget *widget,
      GdkEvent *event)
      {
      guint keyval;

      gdk_event_get_keyval ((GdkEvent*)event, &keyval);

      if (keyval == GDK_KEY_Return || keyval == GDK_KEY_KP_Enter)
      {
      if (gtk_text_view_im_context_filter_keypress (GTK_TEXT_VIEW (widget), event))
      return TRUE;
      }

      // Do some stuff

      return GTK_WIDGET_CLASS (gtk_foo_bar_parent_class)->key_press_event (widget, event);
      }
      ```
      Parameters:
      event - the key event
      Returns:
      %TRUE if the input method handled the key event.
    • moveMarkOnscreen

      public boolean moveMarkOnscreen(@Nonnull TextMark mark)
      Moves a mark within the buffer so that it's
      located within the currently-visible text area.
      Parameters:
      mark - a `GtkTextMark`
      Returns:
      %TRUE if the mark moved (wasn’t already onscreen)
    • moveOverlay

      public void moveOverlay(@Nonnull Widget child, int xpos, int ypos)
      Updates the position of a child.

      See [method@Gtk.TextView.add_overlay].
      Parameters:
      child - a widget already added with [method@Gtk.TextView.add_overlay]
      xpos - new X position in buffer coordinates
      ypos - new Y position in buffer coordinates
    • moveVisually

      public boolean moveVisually(@Nonnull TextIter iter, int count)
      Move the iterator a given number of characters visually, treating
      it as the strong cursor position.

      If @count is positive, then the new strong cursor position will
      be @count positions to the right of the old cursor position.
      If @count is negative then the new strong cursor position will
      be @count positions to the left of the old cursor position.

      In the presence of bi-directional text, the correspondence
      between logical and visual order will depend on the direction
      of the current run, and there may be jumps when the cursor
      is moved off of the end of a run.
      Parameters:
      iter - a `GtkTextIter`
      count - number of characters to move (negative moves left, positive moves right)
      Returns:
      %TRUE if @iter moved and is not on the end iterator
    • placeCursorOnscreen

      public boolean placeCursorOnscreen()
      Moves the cursor to the currently visible region of the
      buffer.
      Returns:
      %TRUE if the cursor had to be moved.
    • remove

      public void remove(@Nonnull Widget child)
      Removes a child widget from @text_view.
      Parameters:
      child - the child to remove
    • resetCursorBlink

      public void resetCursorBlink()
      Ensures that the cursor is shown.

      This also resets the time that it will stay blinking (or
      visible, in case blinking is disabled).

      This function should be called in response to user input
      (e.g. from derived classes that override the textview's
      event handlers).
    • resetImContext

      public void resetImContext()
      Reset the input method context of the text view if needed.

      This can be necessary in the case where modifying the buffer
      would confuse on-going input method behavior.
    • scrollMarkOnscreen

      public void scrollMarkOnscreen(@Nonnull TextMark mark)
      Scrolls @text_view the minimum distance such that @mark is contained
      within the visible area of the widget.
      Parameters:
      mark - a mark in the buffer for @text_view
    • scrollToIter

      public boolean scrollToIter(@Nonnull TextIter iter, double within_margin, boolean use_align, double xalign, double yalign)
      Scrolls @text_view so that @iter is on the screen in the position
      indicated by @xalign and @yalign.

      An alignment of 0.0 indicates left or top, 1.0 indicates right or
      bottom, 0.5 means center. If @use_align is %FALSE, the text scrolls
      the minimal distance to get the mark onscreen, possibly not scrolling
      at all. The effective screen for purposes of this function is reduced
      by a margin of size @within_margin.

      Note that this function uses the currently-computed height of the
      lines in the text buffer. Line heights are computed in an idle
      handler; so this function may not have the desired effect if it’s
      called before the height computations. To avoid oddness, consider
      using [method@Gtk.TextView.scroll_to_mark] which saves a point to be
      scrolled to after line validation.
      Parameters:
      iter - a `GtkTextIter`
      within_margin - margin as a [0.0,0.5) fraction of screen size
      use_align - whether to use alignment arguments (if %FALSE, just get the mark onscreen)
      xalign - horizontal alignment of mark within visible area
      yalign - vertical alignment of mark within visible area
      Returns:
      %TRUE if scrolling occurred
    • scrollToMark

      public void scrollToMark(@Nonnull TextMark mark, double within_margin, boolean use_align, double xalign, double yalign)
      Scrolls @text_view so that @mark is on the screen in the position
      indicated by @xalign and @yalign.

      An alignment of 0.0 indicates left or top, 1.0 indicates right or
      bottom, 0.5 means center. If @use_align is %FALSE, the text scrolls
      the minimal distance to get the mark onscreen, possibly not scrolling
      at all. The effective screen for purposes of this function is reduced
      by a margin of size @within_margin.
      Parameters:
      mark - a `GtkTextMark`
      within_margin - margin as a [0.0,0.5) fraction of screen size
      use_align - whether to use alignment arguments (if %FALSE, just get the mark onscreen)
      xalign - horizontal alignment of mark within visible area
      yalign - vertical alignment of mark within visible area
    • setAcceptsTab

      public void setAcceptsTab(boolean accepts_tab)
      Sets the behavior of the text widget when the <kbd>Tab</kbd> key is pressed.

      If @accepts_tab is %TRUE, a tab character is inserted. If @accepts_tab
      is %FALSE the keyboard focus is moved to the next widget in the focus
      chain.
      Parameters:
      accepts_tab - %TRUE if pressing the Tab key should insert a tab character, %FALSE, if pressing the Tab key should move the keyboard focus.
    • setBottomMargin

      public void setBottomMargin(int bottom_margin)
      Sets the bottom margin for text in @text_view.

      Note that this function is confusingly named.
      In CSS terms, the value set here is padding.
      Parameters:
      bottom_margin - bottom margin in pixels
    • setBuffer

      public void setBuffer(@Nullable TextBuffer buffer)
      Sets @buffer as the buffer being displayed by @text_view.

      The previous buffer displayed by the text view is unreferenced, and
      a reference is added to @buffer. If you owned a reference to @buffer
      before passing it to this function, you must remove that reference
      yourself; `GtkTextView` will not “adopt” it.
      Parameters:
      buffer - a `GtkTextBuffer`
    • setCursorVisible

      public void setCursorVisible(boolean setting)
      Toggles whether the insertion point should be displayed.

      A buffer with no editable text probably shouldn’t have a visible
      cursor, so you may want to turn the cursor off.

      Note that this property may be overridden by the
      [property@GtkSettings:gtk-keynav-use-caret] setting.
      Parameters:
      setting - whether to show the insertion cursor
    • setEditable

      public void setEditable(boolean setting)
      Sets the default editability of the `GtkTextView`.

      You can override this default setting with tags in the buffer,
      using the “editable” attribute of tags.
      Parameters:
      setting - whether it’s editable
    • setExtraMenu

      public void setExtraMenu(@Nullable MenuModel model)
      Sets a menu model to add when constructing the context
      menu for @text_view.

      You can pass %NULL to remove a previously set extra menu.
      Parameters:
      model - a `GMenuModel`
    • setGutter

      public void setGutter(int win, @Nullable Widget widget)
      Places @widget into the gutter specified by @win.

      @win must be one of %GTK_TEXT_WINDOW_LEFT, %GTK_TEXT_WINDOW_RIGHT,
      %GTK_TEXT_WINDOW_TOP, or %GTK_TEXT_WINDOW_BOTTOM.
      Parameters:
      win - a `GtkTextWindowType`
      widget - a `GtkWidget`
    • setIndent

      public void setIndent(int indent)
      Sets the default indentation for paragraphs in @text_view.

      Tags in the buffer may override the default.
      Parameters:
      indent - indentation in pixels
    • setInputHints

      public void setInputHints(int hints)
      Sets the `input-hints` of the `GtkTextView`.

      The `input-hints` allow input methods to fine-tune
      their behaviour.
      Parameters:
      hints - the hints
    • setInputPurpose

      public void setInputPurpose(int purpose)
      Sets the `input-purpose` of the `GtkTextView`.

      The `input-purpose` can be used by on-screen keyboards
      and other input methods to adjust their behaviour.
      Parameters:
      purpose - the purpose
    • setJustification

      public void setJustification(int justification)
      Sets the default justification of text in @text_view.

      Tags in the view’s buffer may override the default.
      Parameters:
      justification - justification
    • setLeftMargin

      public void setLeftMargin(int left_margin)
      Sets the default left margin for text in @text_view.

      Tags in the buffer may override the default.

      Note that this function is confusingly named.
      In CSS terms, the value set here is padding.
      Parameters:
      left_margin - left margin in pixels
    • setMonospace

      public void setMonospace(boolean monospace)
      Sets whether the `GtkTextView` should display text in
      monospace styling.
      Parameters:
      monospace - %TRUE to request monospace styling
    • setOverwrite

      public void setOverwrite(boolean overwrite)
      Changes the `GtkTextView` overwrite mode.
      Parameters:
      overwrite - %TRUE to turn on overwrite mode, %FALSE to turn it off
    • setPixelsAboveLines

      public void setPixelsAboveLines(int pixels_above_lines)
      Sets the default number of blank pixels above paragraphs in @text_view.

      Tags in the buffer for @text_view may override the defaults.
      Parameters:
      pixels_above_lines - pixels above paragraphs
    • setPixelsBelowLines

      public void setPixelsBelowLines(int pixels_below_lines)
      Sets the default number of pixels of blank space
      to put below paragraphs in @text_view.

      May be overridden by tags applied to @text_view’s buffer.
      Parameters:
      pixels_below_lines - pixels below paragraphs
    • setPixelsInsideWrap

      public void setPixelsInsideWrap(int pixels_inside_wrap)
      Sets the default number of pixels of blank space to leave between
      display/wrapped lines within a paragraph.

      May be overridden by tags in @text_view’s buffer.
      Parameters:
      pixels_inside_wrap - default number of pixels between wrapped lines
    • setRightMargin

      public void setRightMargin(int right_margin)
      Sets the default right margin for text in the text view.

      Tags in the buffer may override the default.

      Note that this function is confusingly named.
      In CSS terms, the value set here is padding.
      Parameters:
      right_margin - right margin in pixels
    • setTabs

      public void setTabs(@Nonnull TabArray tabs)
      Sets the default tab stops for paragraphs in @text_view.

      Tags in the buffer may override the default.
      Parameters:
      tabs - tabs as a `PangoTabArray`
    • setTopMargin

      public void setTopMargin(int top_margin)
      Sets the top margin for text in @text_view.

      Note that this function is confusingly named.
      In CSS terms, the value set here is padding.
      Parameters:
      top_margin - top margin in pixels
    • setWrapMode

      public void setWrapMode(int wrap_mode)
      Sets the line wrapping for the view.
      Parameters:
      wrap_mode - a `GtkWrapMode`
    • startsDisplayLine

      public boolean startsDisplayLine(@Nonnull TextIter iter)
      Determines whether @iter is at the start of a display line.

      See [method@Gtk.TextView.forward_display_line] for an
      explanation of display lines vs. paragraphs.
      Parameters:
      iter - a `GtkTextIter`
      Returns:
      %TRUE if @iter begins a wrapped line
    • windowToBufferCoords

      public void windowToBufferCoords(int win, int window_x, int window_y, @Nullable Int buffer_x, @Nullable Int buffer_y)
      Converts coordinates on the window identified by @win to buffer
      coordinates.
      Parameters:
      win - a `GtkTextWindowType`
      window_x - window x coordinate
      window_y - window y coordinate
      buffer_x - buffer x coordinate return location
      buffer_y - buffer y coordinate return location
    • onBackspace

      public SignalHandler onBackspace(TextView.OnBackspace signal)
      Connect to signal "backspace".
      See TextView.OnBackspace.onBackspace() for signal description.
      Field SIGNAL_ON_BACKSPACE 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.
    • onCopyClipboard

      public SignalHandler onCopyClipboard(TextView.OnCopyClipboard signal)
      Connect to signal "copy-clipboard".
      See TextView.OnCopyClipboard.onCopyClipboard() for signal description.
      Field SIGNAL_ON_COPY_CLIPBOARD 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.
    • onCutClipboard

      public SignalHandler onCutClipboard(TextView.OnCutClipboard signal)
      Connect to signal "cut-clipboard".
      See TextView.OnCutClipboard.onCutClipboard() for signal description.
      Field SIGNAL_ON_CUT_CLIPBOARD 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.
    • onDeleteFromCursor

      public SignalHandler onDeleteFromCursor(TextView.OnDeleteFromCursor signal)
      Connect to signal "delete-from-cursor".
      See TextView.OnDeleteFromCursor.onDeleteFromCursor(int, int) for signal description.
      Field SIGNAL_ON_DELETE_FROM_CURSOR 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.
    • onExtendSelection

      public SignalHandler onExtendSelection(TextView.OnExtendSelection signal)
      Connect to signal "extend-selection".
      See TextView.OnExtendSelection.onExtendSelection(int, ch.bailu.gtk.gtk.TextIter, ch.bailu.gtk.gtk.TextIter, ch.bailu.gtk.gtk.TextIter) for signal description.
      Field SIGNAL_ON_EXTEND_SELECTION 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.
    • onInsertAtCursor

      public SignalHandler onInsertAtCursor(TextView.OnInsertAtCursor signal)
      Connect to signal "insert-at-cursor".
      See TextView.OnInsertAtCursor.onInsertAtCursor(ch.bailu.gtk.type.Str) for signal description.
      Field SIGNAL_ON_INSERT_AT_CURSOR 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.
    • onInsertEmoji

      public SignalHandler onInsertEmoji(TextView.OnInsertEmoji signal)
      Connect to signal "insert-emoji".
      See TextView.OnInsertEmoji.onInsertEmoji() for signal description.
      Field SIGNAL_ON_INSERT_EMOJI 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.
    • onMoveCursor

      public SignalHandler onMoveCursor(TextView.OnMoveCursor signal)
      Connect to signal "move-cursor".
      See TextView.OnMoveCursor.onMoveCursor(int, int, boolean) for signal description.
      Field SIGNAL_ON_MOVE_CURSOR 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.
    • onMoveViewport

      public SignalHandler onMoveViewport(TextView.OnMoveViewport signal)
      Connect to signal "move-viewport".
      See TextView.OnMoveViewport.onMoveViewport(int, int) for signal description.
      Field SIGNAL_ON_MOVE_VIEWPORT 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.
    • onPasteClipboard

      public SignalHandler onPasteClipboard(TextView.OnPasteClipboard signal)
      Connect to signal "paste-clipboard".
      See TextView.OnPasteClipboard.onPasteClipboard() for signal description.
      Field SIGNAL_ON_PASTE_CLIPBOARD 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.
    • onPreeditChanged

      public SignalHandler onPreeditChanged(TextView.OnPreeditChanged signal)
      Connect to signal "preedit-changed".
      See TextView.OnPreeditChanged.onPreeditChanged(ch.bailu.gtk.type.Str) for signal description.
      Field SIGNAL_ON_PREEDIT_CHANGED 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.
    • onSelectAll

      public SignalHandler onSelectAll(TextView.OnSelectAll signal)
      Connect to signal "select-all".
      See TextView.OnSelectAll.onSelectAll(boolean) for signal description.
      Field SIGNAL_ON_SELECT_ALL 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.
    • onSetAnchor

      public SignalHandler onSetAnchor(TextView.OnSetAnchor signal)
      Connect to signal "set-anchor".
      See TextView.OnSetAnchor.onSetAnchor() for signal description.
      Field SIGNAL_ON_SET_ANCHOR 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.
    • onToggleCursorVisible

      public SignalHandler onToggleCursorVisible(TextView.OnToggleCursorVisible signal)
      Connect to signal "toggle-cursor-visible".
      See TextView.OnToggleCursorVisible.onToggleCursorVisible() for signal description.
      Field SIGNAL_ON_TOGGLE_CURSOR_VISIBLE 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.
    • onToggleOverwrite

      public SignalHandler onToggleOverwrite(TextView.OnToggleOverwrite signal)
      Connect to signal "toggle-overwrite".
      See TextView.OnToggleOverwrite.onToggleOverwrite() for signal description.
      Field SIGNAL_ON_TOGGLE_OVERWRITE 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

      public Accessible asAccessible()
      Implements interface Accessible. Call this to get access to interface functions.
      Overrides:
      asAccessible in class Widget
      Returns:
      Accessible
    • asBuildable

      public Buildable asBuildable()
      Implements interface Buildable. Call this to get access to interface functions.
      Overrides:
      asBuildable in class Widget
      Returns:
      Buildable
    • asConstraintTarget

      public ConstraintTarget asConstraintTarget()
      Implements interface ConstraintTarget. Call this to get access to interface functions.
      Overrides:
      asConstraintTarget in class Widget
      Returns:
      ConstraintTarget
    • asScrollable

      public Scrollable asScrollable()
      Implements interface Scrollable. Call this to get access to interface functions.
      Returns:
      Scrollable
    • getTypeID

      public static long getTypeID()
    • getParentTypeID

      public static long getParentTypeID()
    • getTypeSize

      public static TypeSystem.TypeSize getTypeSize()
    • getParentTypeSize

      public static TypeSystem.TypeSize getParentTypeSize()
    • getInstanceSize

      public static int getInstanceSize()