### ----------------------------------------------------
### -- Gnome::Gtk3
### -- Licenses: Artistic-2.0
### -- Authors: Marcel Timmerman
### -- File: lib/Gnome/Gtk3/TextView.rakumod
### ----------------------------------------------------
### -- Chunk 1 of 5
#TL:1:Gnome::Gtk3::TextView:

use v6;
#-------------------------------------------------------------------------------
=begin pod

=head1 Gnome::Gtk3::TextView

Widget that displays a B<Gnome::Gtk3::TextBuffer>

![](images/multiline-text.png)

=head1 Description

You may wish to begin by reading the [text widget conceptual overview](https://developer.gnome.org/gtk3/3.24/TextWidget.html) which gives an overview of all the objects and data types related to the text widget and how they work together.

=head2 Css Nodes

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

B<Gnome::Gtk3::TextView> 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.


=head2 See Also

B<Gnome::Gtk3::TextBuffer>, B<Gnome::Gtk3::TextIter>

=head1 Synopsis
=head2 Declaration

  unit class Gnome::Gtk3::TextView;
  also is Gnome::Gtk3::Container;
  also does Gnome::Gtk3::Scrollable;

=comment head2 Example

=end pod

#-------------------------------------------------------------------------------
use NativeCall;

use Gnome::N::X:api<1>;
use Gnome::N::N-GObject:api<1>;
use Gnome::N::NativeLib:api<1>;
use Gnome::Gdk3::Events:api<1>;
use Gnome::Gtk3::Container:api<1>;

use Gnome::Gtk3::Buildable:api<1>;
use Gnome::Gtk3::Scrollable:api<1>;

#-------------------------------------------------------------------------------
# See /usr/include/gtk-3.0/gtk/gtktextview.h
# https://developer.gnome.org/gtk3/stable/GtkTextView.html
unit class Gnome::Gtk3::TextView:auth<github:MARTIMM>:api<1>;
also is Gnome::Gtk3::Container;
also does Gnome::Gtk3::Scrollable;

#-------------------------------------------------------------------------------
=begin pod
=head1 Types
=end pod
#-------------------------------------------------------------------------------
=begin pod
=head2 enum GtkTextWindowType

Used to reference the parts of B<Gnome::Gtk3::TextView>.

=item GTK_TEXT_WINDOW_PRIVATE: Invalid value, used as a marker
=item GTK_TEXT_WINDOW_WIDGET: Window that floats over scrolling areas.
=item GTK_TEXT_WINDOW_TEXT: Scrollable text window.
=item GTK_TEXT_WINDOW_LEFT: Left side border window.
=item GTK_TEXT_WINDOW_RIGHT: Right side border window.
=item GTK_TEXT_WINDOW_TOP: Top border window.
=item GTK_TEXT_WINDOW_BOTTOM: Bottom border window.

=end pod

#TE:0:GtkTextWindowType:
enum GtkTextWindowType is export (
  'GTK_TEXT_WINDOW_PRIVATE',
  'GTK_TEXT_WINDOW_WIDGET',
  'GTK_TEXT_WINDOW_TEXT',
  'GTK_TEXT_WINDOW_LEFT',
  'GTK_TEXT_WINDOW_RIGHT',
  'GTK_TEXT_WINDOW_TOP',
  'GTK_TEXT_WINDOW_BOTTOM'
);

#-------------------------------------------------------------------------------
=begin pod
=head2 enum GtkTextViewLayer

Used to reference the layers of B<Gnome::Gtk3::TextView> for the purpose of customized drawing with the sig I<draw_layer> vfunc.

=item GTK_TEXT_VIEW_LAYER_BELOW: Old deprecated layer, use C<GTK_TEXT_VIEW_LAYER_BELOW_TEXT> instead
=item GTK_TEXT_VIEW_LAYER_ABOVE: Old deprecated layer, use C<GTK_TEXT_VIEW_LAYER_ABOVE_TEXT> instead
=item GTK_TEXT_VIEW_LAYER_BELOW_TEXT: The layer rendered below the text (but above the background).  Since: 3.20
=item GTK_TEXT_VIEW_LAYER_ABOVE_TEXT: The layer rendered above the text.  Since: 3.20

=end pod

#TE:0:GtkTextViewLayer:
enum GtkTextViewLayer is export (
  'GTK_TEXT_VIEW_LAYER_BELOW',
  'GTK_TEXT_VIEW_LAYER_ABOVE',
  'GTK_TEXT_VIEW_LAYER_BELOW_TEXT',
  'GTK_TEXT_VIEW_LAYER_ABOVE_TEXT'
);

#-------------------------------------------------------------------------------
=begin pod
=head2 enum GtkTextExtendSelection

Granularity types that extend the text selection. Use the sig C<extend-selection> signal to customize the selection.

Since: 3.16


=item GTK_TEXT_EXTEND_SELECTION_WORD: Selects the current word. It is triggered by a double-click for example.
=item GTK_TEXT_EXTEND_SELECTION_LINE: Selects the current line. It is triggered by a triple-click for example.


=end pod

#TE:0:GtkTextExtendSelection:
enum GtkTextExtendSelection is export (
  'GTK_TEXT_EXTEND_SELECTION_WORD',
  'GTK_TEXT_EXTEND_SELECTION_LINE'
);

#-------------------------------------------------------------------------------
my Bool $signals-added = False;
#-------------------------------------------------------------------------------
=begin pod
=head1 Methods
=head2 new

Create a new plain object.

  multi method new ( )

Create an object using a native object from elsewhere. See also B<Gnome::GObject::Object>.

  multi method new ( N-GObject :$native-object! )

Create an object using a native object from a builder. See also B<Gnome::GObject::Object>.

  multi method new ( Str :$build-id! )

=end pod

#TM:1:new():
#TM:0:new(:native-object):
#TM:0:new(:build-id):

submethod BUILD ( *%options ) {

  $signals-added = self.add-signal-types( $?CLASS.^name,
    :w0<set-anchor backspace cut-clipboard copy-clipboard paste-clipboard toggle-overwrite toggle-cursor-visible>,
    :w1<insert-at-cursor populate-popup select-all preedit-changed>,
    :w3<move-cursor>,
    :w2<move-viewport delete-from-cursor>,
    :w4<extend-selection>,
  ) unless $signals-added;

  # prevent creating wrong native-objects
  return unless self.^name eq 'Gnome::Gtk3::TextView';

  if ? %options<native-object> || ? %options<widget> || ? %options<build-id> {
    # provided in GObject
  }

  elsif %options.keys.elems {
    die X::Gnome.new(
      :message('Unsupported options for ' ~ self.^name ~
               ': ' ~ %options.keys.join(', ')
              )
    );
  }

  else {#if ? %options<empty> {
    self._set-native-object(gtk_text_view_new());
  }

  # only after creating the native-object, the gtype is known
  self._set-class-info('GtkTextView');
}

#-------------------------------------------------------------------------------
method _fallback ( $native-sub is copy --> Callable ) {

  my Callable $s;
  try { $s = &::("gtk_text_view_$native-sub"); };
  try { $s = &::("gtk_$native-sub"); } unless ?$s;
  try { $s = &::($native-sub); } if !$s and $native-sub ~~ m/^ 'gtk_' /;

  self._set-class-name-of-sub('GtkTextView');
  $s = callsame unless ?$s;

  $s;
}

#-------------------------------------------------------------------------------
#TM:2:gtk_text_view_new:new(:e,pty)
=begin pod
=head2 [gtk_] text_view_new

Creates a new B<Gnome::Gtk3::TextView>. If you don’t call C<gtk_text_view_set_buffer()>
before using the text view, an empty default buffer will be created
for you. Get the buffer with C<gtk_text_view_get_buffer()>. If you want
to specify your own buffer, consider C<gtk_text_view_new_with_buffer()>.

Returns: a new B<Gnome::Gtk3::TextView>

  method gtk_text_view_new ( --> N-GObject  )


=end pod

sub gtk_text_view_new (  )
  returns N-GObject
  is native(&gtk-lib)
  { * }

#-------------------------------------------------------------------------------
#TM:0:gtk_text_view_new_with_buffer:
=begin pod
=head2 [[gtk_] text_view_] new_with_buffer

Creates a new B<Gnome::Gtk3::TextView> widget displaying the buffer
I<buffer>. One buffer can be shared among many widgets.
I<buffer> may be C<Any> to create a default buffer, in which case
this function is equivalent to C<gtk_text_view_new()>. The
text view adds its own reference count to the buffer; it does not
take over an existing reference.

Returns: a new B<Gnome::Gtk3::TextView>.

  method gtk_text_view_new_with_buffer ( N-GObject $buffer --> N-GObject  )

=item N-GObject $buffer; a B<Gnome::Gtk3::TextBuffer>

=end pod

sub gtk_text_view_new_with_buffer ( N-GObject $buffer )
  returns N-GObject
  is native(&gtk-lib)
  { * }

#-------------------------------------------------------------------------------
#TM:0:gtk_text_view_set_buffer:
=begin pod
=head2 [[gtk_] text_view_] set_buffer

Sets I<buffer> as the buffer being displayed by I<text_view>. The previous
buffer displayed by the text view is unreferenced, and a reference is
added to I<buffer>. If you owned a reference to I<buffer> before passing it
to this function, you must remove that reference yourself; B<Gnome::Gtk3::TextView>
will not “adopt” it.

  method gtk_text_view_set_buffer ( N-GObject $buffer )

=item N-GObject $buffer; (allow-none): a B<Gnome::Gtk3::TextBuffer>

=end pod

sub gtk_text_view_set_buffer ( N-GObject $text_view, N-GObject $buffer )
  is native(&gtk-lib)
  { * }

#-------------------------------------------------------------------------------
#TM:0:gtk_text_view_get_buffer:
=begin pod
=head2 [[gtk_] text_view_] get_buffer

Returns the B<Gnome::Gtk3::TextBuffer> 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: (transfer none): a B<Gnome::Gtk3::TextBuffer>

  method gtk_text_view_get_buffer ( --> N-GObject  )


=end pod

sub gtk_text_view_get_buffer ( N-GObject $text_view )
  returns N-GObject
  is native(&gtk-lib)
  { * }

#-------------------------------------------------------------------------------
#TM:0:gtk_text_view_scroll_to_iter:
=begin pod
=head2 [[gtk_] text_view_] scroll_to_iter

Scrolls I<text_view> so that I<iter> is on the screen in the position
indicated by I<xalign> and I<yalign>. An alignment of 0.0 indicates
left or top, 1.0 indicates right or bottom, 0.5 means center.
If I<use_align> is C<0>, 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
I<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 C<gtk_text_view_scroll_to_mark()> which saves a point to be
scrolled to after line validation.

Returns: C<1> if scrolling occurred

  method gtk_text_view_scroll_to_iter ( N-GObject $iter, Num $within_margin, Int $use_align, Num $xalign, Num $yalign --> Int  )

=item N-GObject $iter; a B<Gnome::Gtk3::TextIter>
=item Num $within_margin; margin as a [0.0,0.5) fraction of screen size
=item Int $use_align; whether to use alignment arguments (if C<0>, just get the mark onscreen)
=item Num $xalign; horizontal alignment of mark within visible area
=item Num $yalign; vertical alignment of mark within visible area

=end pod

sub gtk_text_view_scroll_to_iter ( N-GObject $text_view, N-GObject $iter, num64 $within_margin, int32 $use_align, num64 $xalign, num64 $yalign )
  returns int32
  is native(&gtk-lib)
  { * }

#-------------------------------------------------------------------------------
#TM:0:gtk_text_view_scroll_to_mark:
=begin pod
=head2 [[gtk_] text_view_] scroll_to_mark

Scrolls I<text_view> so that I<mark> is on the screen in the position
indicated by I<xalign> and I<yalign>. An alignment of 0.0 indicates
left or top, 1.0 indicates right or bottom, 0.5 means center.
If I<use_align> is C<0>, 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
I<within_margin>.

  method gtk_text_view_scroll_to_mark ( N-GObject $mark, Num $within_margin, Int $use_align, Num $xalign, Num $yalign )

=item N-GObject $mark; a B<Gnome::Gtk3::TextMark>
=item Num $within_margin; margin as a [0.0,0.5) fraction of screen size
=item Int $use_align; whether to use alignment arguments (if C<0>, just  get the mark onscreen)
=item Num $xalign; horizontal alignment of mark within visible area
=item Num $yalign; vertical alignment of mark within visible area

=end pod

sub gtk_text_view_scroll_to_mark ( N-GObject $text_view, N-GObject $mark, num64 $within_margin, int32 $use_align, num64 $xalign, num64 $yalign )
  is native(&gtk-lib)
  { * }

#-------------------------------------------------------------------------------
#TM:0:gtk_text_view_scroll_mark_onscreen:
=begin pod
=head2 [[gtk_] text_view_] scroll_mark_onscreen

Scrolls I<text_view> the minimum distance such that I<mark> is contained
within the visible area of the widget.

  method gtk_text_view_scroll_mark_onscreen ( N-GObject $mark )

=item N-GObject $mark; a mark in the buffer for I<text_view>

=end pod

sub gtk_text_view_scroll_mark_onscreen ( N-GObject $text_view, N-GObject $mark )
  is native(&gtk-lib)
  { * }

#-------------------------------------------------------------------------------
#TM:0:gtk_text_view_move_mark_onscreen:
=begin pod
=head2 [[gtk_] text_view_] move_mark_onscreen

Moves a mark within the buffer so that it's
located within the currently-visible text area.

Returns: C<1> if the mark moved (wasn’t already onscreen)

  method gtk_text_view_move_mark_onscreen ( N-GObject $mark --> Int  )

=item N-GObject $mark; a B<Gnome::Gtk3::TextMark>

=end pod

sub gtk_text_view_move_mark_onscreen ( N-GObject $text_view, N-GObject $mark )
  returns int32
  is native(&gtk-lib)
  { * }

#-------------------------------------------------------------------------------
#TM:0:gtk_text_view_place_cursor_onscreen:
=begin pod
=head2 [[gtk_] text_view_] place_cursor_onscreen

Moves the cursor to the currently visible region of the
buffer, it it isn’t there already.

Returns: C<1> if the cursor had to be moved.

  method gtk_text_view_place_cursor_onscreen ( --> Int  )


=end pod

sub gtk_text_view_place_cursor_onscreen ( N-GObject $text_view )
  returns int32
  is native(&gtk-lib)
  { * }

#-------------------------------------------------------------------------------
#TM:0:gtk_text_view_get_visible_rect:
=begin pod
=head2 [[gtk_] text_view_] get_visible_rect

Fills I<visible_rect> with the currently-visible
region of the buffer, in buffer coordinates. Convert to window coordinates
with C<gtk_text_view_buffer_to_window_coords()>.

  method gtk_text_view_get_visible_rect ( N-GObject $visible_rect )

=item N-GObject $visible_rect; (out): rectangle to fill

=end pod

sub gtk_text_view_get_visible_rect ( N-GObject $text_view, N-GObject $visible_rect )
  is native(&gtk-lib)
  { * }

#-------------------------------------------------------------------------------
#TM:0:gtk_text_view_set_cursor_visible:
=begin pod
=head2 [[gtk_] text_view_] set_cursor_visible

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
 I<gtk-keynave-use-caret> settings.

  method gtk_text_view_set_cursor_visible ( Int $setting )

=item Int $setting; whether to show the insertion cursor

=end pod

sub gtk_text_view_set_cursor_visible ( N-GObject $text_view, int32 $setting )
  is native(&gtk-lib)
  { * }

#-------------------------------------------------------------------------------
#TM:0:gtk_text_view_get_cursor_visible:
=begin pod
=head2 [[gtk_] text_view_] get_cursor_visible

Find out whether the cursor should be displayed.

Returns: whether the insertion mark is visible

  method gtk_text_view_get_cursor_visible ( --> Int  )


=end pod

sub gtk_text_view_get_cursor_visible ( N-GObject $text_view )
  returns int32
  is native(&gtk-lib)
  { * }

#-------------------------------------------------------------------------------
#TM:0:gtk_text_view_reset_cursor_blink:
=begin pod
=head2 [[gtk_] text_view_] reset_cursor_blink

Ensures that the cursor is shown (i.e. not in an 'off' blink
interval) and 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
 I<key-press-event> handler).

Since: 3.20

  method gtk_text_view_reset_cursor_blink ( )


=end pod

sub gtk_text_view_reset_cursor_blink ( N-GObject $text_view )
  is native(&gtk-lib)
  { * }

#-------------------------------------------------------------------------------
#TM:0:gtk_text_view_get_cursor_locations:
=begin pod
=head2 [[gtk_] text_view_] get_cursor_locations

Given an I<iter> within a text layout, determine the positions of the
strong and weak cursors if the insertion point is at that
iterator. 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 I<iter> is C<Any>, the actual cursor position is used.

Note that if I<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
C<gtk_text_view_buffer_to_window_coords()> to convert these
coordinates to coordinates for one of the windows in the text view.

Since: 3.0

  method gtk_text_view_get_cursor_locations ( N-GObject $iter, N-GObject $strong, N-GObject $weak )

=item N-GObject $iter; (allow-none): a B<Gnome::Gtk3::TextIter>
=item N-GObject $strong; (out) (allow-none): location to store the strong cursor position (may be C<Any>)
=item N-GObject $weak; (out) (allow-none): location to store the weak cursor position (may be C<Any>)

=end pod

sub gtk_text_view_get_cursor_locations ( N-GObject $text_view, N-GObject $iter, N-GObject $strong, N-GObject $weak )
  is native(&gtk-lib)
  { * }

#-------------------------------------------------------------------------------
#TM:0:gtk_text_view_get_iter_location:
=begin pod
=head2 [[gtk_] text_view_] get_iter_location

Gets a rectangle which roughly contains the character at I<iter>.
The rectangle position is in buffer coordinates; use
C<gtk_text_view_buffer_to_window_coords()> to convert these
coordinates to coordinates for one of the windows in the text view.

  method gtk_text_view_get_iter_location ( N-GObject $iter, N-GObject $location )

=item N-GObject $iter; a B<Gnome::Gtk3::TextIter>
=item N-GObject $location; (out): bounds of the character at I<iter>

=end pod

sub gtk_text_view_get_iter_location ( N-GObject $text_view, N-GObject $iter, N-GObject $location )
  is native(&gtk-lib)
  { * }

#-------------------------------------------------------------------------------
#TM:0:gtk_text_view_get_iter_at_location:
=begin pod
=head2 [[gtk_] text_view_] get_iter_at_location

Retrieves the iterator at buffer coordinates I<x> and I<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
C<gtk_text_view_window_to_buffer_coords()>.

Returns: C<1> if the position is over text

  method gtk_text_view_get_iter_at_location ( N-GObject $iter, Int $x, Int $y --> Int  )

=item N-GObject $iter; (out): a B<Gnome::Gtk3::TextIter>
=item Int $x; x position, in buffer coordinates
=item Int $y; y position, in buffer coordinates

=end pod

sub gtk_text_view_get_iter_at_location ( N-GObject $text_view, N-GObject $iter, int32 $x, int32 $y )
  returns int32
  is native(&gtk-lib)
  { * }

#-------------------------------------------------------------------------------
#TM:0:gtk_text_view_get_iter_at_position:
=begin pod
=head2 [[gtk_] text_view_] get_iter_at_position

Retrieves the iterator pointing to the character at buffer
coordinates I<x> and I<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
C<gtk_text_view_window_to_buffer_coords()>.

Note that this is different from C<gtk_text_view_get_iter_at_location()>,
which returns cursor locations, i.e. positions between
characters.

Returns: C<1> if the position is over text

Since: 2.6

  method gtk_text_view_get_iter_at_position ( N-GObject $iter, Int $trailing, Int $x, Int $y --> Int  )

=item N-GObject $iter; (out): a B<Gnome::Gtk3::TextIter>
=item Int $trailing; (out) (allow-none): if non-C<Any>, 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.
=item Int $x; x position, in buffer coordinates
=item Int $y; y position, in buffer coordinates

=end pod

sub gtk_text_view_get_iter_at_position ( N-GObject $text_view, N-GObject $iter, int32 $trailing, int32 $x, int32 $y )
  returns int32
  is native(&gtk-lib)
  { * }

#-------------------------------------------------------------------------------
#TM:0:gtk_text_view_get_line_yrange:
=begin pod
=head2 [[gtk_] text_view_] get_line_yrange

Gets the y coordinate of the top of the line containing I<iter>,
and the height of the line. The coordinate is a buffer coordinate;
convert to window coordinates with C<gtk_text_view_buffer_to_window_coords()>.

  method gtk_text_view_get_line_yrange ( N-GObject $iter, Int $y, Int $height )

=item N-GObject $iter; a B<Gnome::Gtk3::TextIter>
=item Int $y; (out): return location for a y coordinate
=item Int $height; (out): return location for a height

=end pod

sub gtk_text_view_get_line_yrange ( N-GObject $text_view, N-GObject $iter, int32 $y, int32 $height )
  is native(&gtk-lib)
  { * }

#-------------------------------------------------------------------------------
#TM:0:gtk_text_view_get_line_at_y:
=begin pod
=head2 [[gtk_] text_view_] get_line_at_y

Gets the B<Gnome::Gtk3::TextIter> at the start of the line containing
the coordinate I<y>. I<y> is in buffer coordinates, convert from
window coordinates with C<gtk_text_view_window_to_buffer_coords()>.
If non-C<Any>, I<line_top> will be filled with the coordinate of the top
edge of the line.

  method gtk_text_view_get_line_at_y ( N-GObject $target_iter, Int $y, Int $line_top )

=item N-GObject $target_iter; (out): a B<Gnome::Gtk3::TextIter>
=item Int $y; a y coordinate
=item Int $line_top; (out): return location for top coordinate of the line

=end pod

sub gtk_text_view_get_line_at_y ( N-GObject $text_view, N-GObject $target_iter, int32 $y, int32 $line_top )
  is native(&gtk-lib)
  { * }

#-------------------------------------------------------------------------------
#TM:0:gtk_text_view_buffer_to_window_coords:
=begin pod
=head2 [[gtk_] text_view_] buffer_to_window_coords

Converts coordinate (I<buffer_x>, I<buffer_y>) to coordinates for the window
I<win>, and stores the result in (I<window_x>, I<window_y>).

Note that you can’t convert coordinates for a nonexisting window (see
C<gtk_text_view_set_border_window_size()>).

  method gtk_text_view_buffer_to_window_coords ( GtkTextWindowType $win, Int $buffer_x, Int $buffer_y, Int $window_x, Int $window_y )

=item GtkTextWindowType $win; a B<Gnome::Gtk3::TextWindowType> except B<GTK_TEXT_WINDOW_PRIVATE>
=item Int $buffer_x; buffer x coordinate
=item Int $buffer_y; buffer y coordinate
=item Int $window_x; (out) (allow-none): window x coordinate return location or C<Any>
=item Int $window_y; (out) (allow-none): window y coordinate return location or C<Any>

=end pod

sub gtk_text_view_buffer_to_window_coords ( N-GObject $text_view, int32 $win, int32 $buffer_x, int32 $buffer_y, int32 $window_x, int32 $window_y )
  is native(&gtk-lib)
  { * }

#-------------------------------------------------------------------------------
#TM:0:gtk_text_view_window_to_buffer_coords:
=begin pod
=head2 [[gtk_] text_view_] window_to_buffer_coords

Converts coordinates on the window identified by I<win> to buffer
coordinates, storing the result in (I<buffer_x>,I<buffer_y>).

Note that you can’t convert coordinates for a nonexisting window (see
C<gtk_text_view_set_border_window_size()>).

  method gtk_text_view_window_to_buffer_coords ( GtkTextWindowType $win, Int $window_x, Int $window_y, Int $buffer_x, Int $buffer_y )

=item GtkTextWindowType $win; a B<Gnome::Gtk3::TextWindowType> except B<GTK_TEXT_WINDOW_PRIVATE>
=item Int $window_x; window x coordinate
=item Int $window_y; window y coordinate
=item Int $buffer_x; (out) (allow-none): buffer x coordinate return location or C<Any>
=item Int $buffer_y; (out) (allow-none): buffer y coordinate return location or C<Any>

=end pod

sub gtk_text_view_window_to_buffer_coords ( N-GObject $text_view, int32 $win, int32 $window_x, int32 $window_y, int32 $buffer_x, int32 $buffer_y )
  is native(&gtk-lib)
  { * }

#-------------------------------------------------------------------------------
#TM:0:gtk_text_view_get_window:
=begin pod
=head2 [[gtk_] text_view_] get_window

Retrieves the B<Gnome::Gdk3::Window> corresponding to an area of the text view;
possible windows include the overall widget window, child windows
on the left, right, top, bottom, and the window that displays the
text buffer. Windows are C<Any> and nonexistent if their width or
height is 0, and are nonexistent before the widget has been
realized.

Returns: (nullable) (transfer none): a B<Gnome::Gdk3::Window>, or C<Any>

  method gtk_text_view_get_window ( GtkTextWindowType $win --> N-GObject  )

=item GtkTextWindowType $win; window to get

=end pod

sub gtk_text_view_get_window ( N-GObject $text_view, int32 $win )
  returns N-GObject
  is native(&gtk-lib)
  { * }

#-------------------------------------------------------------------------------
#TM:0:gtk_text_view_get_window_type:
=begin pod
=head2 [[gtk_] text_view_] get_window_type

Usually used to find out which window an event corresponds to.
If you connect to an event signal on I<text_view>, this function
should be called on `event->window` to
see which window it was.

Returns: the window type.

  method gtk_text_view_get_window_type ( N-GObject $window --> GtkTextWindowType  )

=item N-GObject $window; a window type

=end pod

sub gtk_text_view_get_window_type ( N-GObject $text_view, N-GObject $window )
  returns int32
  is native(&gtk-lib)
  { * }

#-------------------------------------------------------------------------------
#TM:0:gtk_text_view_set_border_window_size:
=begin pod
=head2 [[gtk_] text_view_] set_border_window_size

Sets the width of C<GTK_TEXT_WINDOW_LEFT> or C<GTK_TEXT_WINDOW_RIGHT>,
or the height of C<GTK_TEXT_WINDOW_TOP> or C<GTK_TEXT_WINDOW_BOTTOM>.
Automatically destroys the corresponding window if the size is set
to 0, and creates the window if the size is set to non-zero.  This
function can only be used for the “border windows,” it doesn’t work
with B<GTK_TEXT_WINDOW_WIDGET>, B<GTK_TEXT_WINDOW_TEXT>, or
B<GTK_TEXT_WINDOW_PRIVATE>.

  method gtk_text_view_set_border_window_size ( GtkTextWindowType $type, Int $size )

=item GtkTextWindowType $type; window to affect
=item Int $size; width or height of the window

=end pod

sub gtk_text_view_set_border_window_size ( N-GObject $text_view, int32 $type, int32 $size )
  is native(&gtk-lib)
  { * }

#-------------------------------------------------------------------------------
#TM:0:gtk_text_view_get_border_window_size:
=begin pod
=head2 [[gtk_] text_view_] get_border_window_size

Gets the width of the specified border window. See
C<gtk_text_view_set_border_window_size()>.

Returns: width of window

  method gtk_text_view_get_border_window_size ( GtkTextWindowType $type --> Int  )

=item GtkTextWindowType $type; window to return size from

=end pod

sub gtk_text_view_get_border_window_size ( N-GObject $text_view, int32 $type )
  returns int32
  is native(&gtk-lib)
  { * }

#-------------------------------------------------------------------------------
#TM:0:gtk_text_view_forward_display_line:
=begin pod
=head2 [[gtk_] text_view_] forward_display_line

Moves the given I<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 B<Gnome::Gtk3::TextBuffer>.

Returns: C<1> if I<iter> was moved and is not on the end iterator

  method gtk_text_view_forward_display_line ( N-GObject $iter --> Int  )

=item N-GObject $iter; a B<Gnome::Gtk3::TextIter>

=end pod

sub gtk_text_view_forward_display_line ( N-GObject $text_view, N-GObject $iter )
  returns int32
  is native(&gtk-lib)
  { * }

#-------------------------------------------------------------------------------
#TM:0:gtk_text_view_backward_display_line:
=begin pod
=head2 [[gtk_] text_view_] backward_display_line

Moves the given I<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 B<Gnome::Gtk3::TextBuffer>.

Returns: C<1> if I<iter> was moved and is not on the end iterator

  method gtk_text_view_backward_display_line ( N-GObject $iter --> Int  )

=item N-GObject $iter; a B<Gnome::Gtk3::TextIter>

=end pod

sub gtk_text_view_backward_display_line ( N-GObject $text_view, N-GObject $iter )
  returns int32
  is native(&gtk-lib)
  { * }

#-------------------------------------------------------------------------------
#TM:0:gtk_text_view_forward_display_line_end:
=begin pod
=head2 [[gtk_] text_view_] forward_display_line_end

Moves the given I<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 B<Gnome::Gtk3::TextBuffer>.

Returns: C<1> if I<iter> was moved and is not on the end iterator

  method gtk_text_view_forward_display_line_end ( N-GObject $iter --> Int  )

=item N-GObject $iter; a B<Gnome::Gtk3::TextIter>

=end pod

sub gtk_text_view_forward_display_line_end ( N-GObject $text_view, N-GObject $iter )
  returns int32
  is native(&gtk-lib)
  { * }

#-------------------------------------------------------------------------------
#TM:0:gtk_text_view_backward_display_line_start:
=begin pod
=head2 [[gtk_] text_view_] backward_display_line_start

Moves the given I<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 B<Gnome::Gtk3::TextBuffer>.

Returns: C<1> if I<iter> was moved and is not on the end iterator

  method gtk_text_view_backward_display_line_start ( N-GObject $iter --> Int  )

=item N-GObject $iter; a B<Gnome::Gtk3::TextIter>

=end pod

sub gtk_text_view_backward_display_line_start ( N-GObject $text_view, N-GObject $iter )
  returns int32
  is native(&gtk-lib)
  { * }

#-------------------------------------------------------------------------------
#TM:0:gtk_text_view_starts_display_line:
=begin pod
=head2 [[gtk_] text_view_] starts_display_line

Determines whether I<iter> is at the start of a display line.
See C<gtk_text_view_forward_display_line()> for an explanation of
display lines vs. paragraphs.

Returns: C<1> if I<iter> begins a wrapped line

  method gtk_text_view_starts_display_line ( N-GObject $iter --> Int  )

=item N-GObject $iter; a B<Gnome::Gtk3::TextIter>

=end pod

sub gtk_text_view_starts_display_line ( N-GObject $text_view, N-GObject $iter )
  returns int32
  is native(&gtk-lib)
  { * }

#-------------------------------------------------------------------------------
#TM:0:gtk_text_view_move_visually:
=begin pod
=head2 [[gtk_] text_view_] move_visually

Move the iterator a given number of characters visually, treating
it as the strong cursor position. If I<count> is positive, then the
new strong cursor position will be I<count> positions to the right of
the old cursor position. If I<count> is negative then the new strong
cursor position will be I<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