W Wrapl, The Programming Language

Libraries:Gtk:Gtk:TextView

Types

T

Inherits from:

You may wish to begin by reading the text widget conceptual overview which gives an overview of all the objects and data types related to the text widget and how they work together.



Constants

Nil : T

Functions

GetType() : Gtk.GObject.Type.T



New() : Gtk.Gtk.TextView.T

Creates a new T. If you don't call SetBuffer before using the text view, an empty default buffer will be created for you. Get the buffer with GetBuffer. If you want to specify your own buffer, consider gtk_text_view_new_with_buffer().

Returns a new T


NewWithBuffer(buffer @ Gtk.Gtk.TextBuffer.T) : Gtk.Gtk.TextView.T

Creates a new T 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 gtk_text_view_new(). The text view adds its own reference count to the buffer; it does not take over an existing reference.

buffer a Gtk.Gtk.TextBuffer.T
Returns a new T.


Methods

:AddChildAtAnchor(self @ T, child @ Gtk.Gtk.Widget.T, anchor @ Gtk.Gtk.TextChildAnchor.T) : Std.Object.T

Adds a child widget in the text buffer, at the given anchor.

text_view a T
child a Gtk.Gtk.Widget.T
anchor a Gtk.Gtk.TextChildAnchor.T in the Gtk.Gtk.TextBuffer.T for text_view


:AddChildInWindow(self @ T, child @ Gtk.Gtk.Widget.T, which_window @ Gtk.Gtk.TextWindowType.T, xpos @ Std.Integer.SmallT, ypos @ Std.Integer.SmallT) : Std.Object.T

Adds a child at fixed coordinates in one of the text widget's windows. The window must have nonzero size (see SetBorderWindowSize). Note that the child coordinates are given relative to the Gtk.Gdk.Window.T in question, and that these coordinates have no sane relationship to scrolling. When placing a child in GTK_TEXT_WINDOW_WIDGET, scrolling is irrelevant, the child floats above all scrollable areas. But when placing a child in one of the scrollable windows (border windows or text window), you'll need to compute the child's correct position in buffer coordinates any time scrolling occurs or buffer changes occur, and then call MoveChild to update the child's position. Unfortunately there's no good way to detect that scrolling has occurred, using the current API; a possible hack would be to update all child positions when the scroll adjustments change or the text buffer changes. See bug 64518 on bugzilla.gnome.org for status of fixing this issue.

text_view a T
child a Gtk.Gtk.Widget.T
which_window which window the child should appear in
xpos X position of child in window coordinates
ypos Y position of child in window coordinates


:BackwardDisplayLine(self @ T, iter @ Gtk.Gtk.TextIter.T) : Std.Symbol.T

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 Gtk.Gtk.TextBuffer.T.

text_view a T
iter a Gtk.Gtk.TextIter.T
Returns TRUE if iter was moved and is not on the end iterator


:BackwardDisplayLineStart(self @ T, iter @ Gtk.Gtk.TextIter.T) : Std.Symbol.T

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 Gtk.Gtk.TextBuffer.T.

text_view a T
iter a Gtk.Gtk.TextIter.T
Returns TRUE if iter was moved and is not on the end iterator


:BufferToWindowCoords(self @ T, win @ Gtk.Gtk.TextWindowType.T, buffer_x @ Std.Integer.SmallT, buffer_y @ Std.Integer.SmallT, window_x, window_y) : Std.Object.T

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

Note that you can't convert coordinates for a nonexisting window (see SetBorderWindowSize).

text_view a T
win a Gtk.Gtk.TextWindowType.T except GTK_TEXT_WINDOW_PRIVATE
buffer_x buffer x coordinate
buffer_y buffer y coordinate
window_x window x coordinate return location or NULL. [out][allow-none]
window_y window y coordinate return location or NULL. [out][allow-none]


:ForwardDisplayLine(self @ T, iter @ Gtk.Gtk.TextIter.T) : Std.Symbol.T

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 Gtk.Gtk.TextBuffer.T.

text_view a T
iter a Gtk.Gtk.TextIter.T
Returns TRUE if iter was moved and is not on the end iterator


:ForwardDisplayLineEnd(self @ T, iter @ Gtk.Gtk.TextIter.T) : Std.Symbol.T

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 Gtk.Gtk.TextBuffer.T.

text_view a T
iter a Gtk.Gtk.TextIter.T
Returns TRUE if iter was moved and is not on the end iterator


:GetAcceptsTab(self @ T) : Std.Symbol.T

Returns whether pressing the Tab key inserts a tab characters. SetAcceptsTab.

text_view A T
Returns TRUE if pressing the Tab key inserts a tab character, FALSE if pressing the Tab key moves the keyboard focus.


:GetBorderWindowSize(self @ T, type @ Gtk.Gtk.TextWindowType.T) : Std.Integer.SmallT

Gets the width of the specified border window. See SetBorderWindowSize.

text_view a T
type window to return size from
Returns width of window


:GetBuffer(self @ T) : Gtk.Gtk.TextBuffer.T

Returns the Gtk.Gtk.TextBuffer.T 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.

text_view a T
Returns a Gtk.Gtk.TextBuffer.T. [transfer none]


:GetCursorVisible(self @ T) : Std.Symbol.T

Find out whether the cursor is being displayed.

text_view a T
Returns whether the insertion mark is visible


:GetDefaultAttributes(self @ T) : Gtk.Gtk.TextAttributes.T

Obtains a copy of the default text attributes. These are the attributes used for text unless a tag overrides them. You'd typically pass the default attributes in to Gtk.Gtk.TextIter.GetAttributes in order to get the attributes in effect at a given text position.

The return value is a copy owned by the caller of this function, and should be freed.

text_view a T
Returns a new Gtk.Gtk.TextAttributes.T


:GetEditable(self @ T) : Std.Symbol.T

Returns the default editability of the T. Tags in the buffer may override this setting for some ranges of text.

text_view a T
Returns whether text is editable by default


:GetHadjustment(self @ T) : Gtk.Gtk.Adjustment.T

Gets the horizontal-scrolling Gtk.Gtk.Adjustment.T.

text_view a T
Returns pointer to the horizontal Gtk.Gtk.Adjustment.T. [transfer none]


:GetIndent(self @ T) : Std.Integer.SmallT

Gets the default indentation of paragraphs in text_view. Tags in the view's buffer may override the default. The indentation may be negative.

text_view a T
Returns number of pixels of indentation


:GetIterAtLocation(self @ T, iter @ Gtk.Gtk.TextIter.T, x @ Std.Integer.SmallT, y @ Std.Integer.SmallT) : Std.Object.T

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 WindowToBufferCoords.

text_view a T
iter a Gtk.Gtk.TextIter.T. [out]
x x position, in buffer coordinates
y y position, in buffer coordinates


:GetIterAtPosition(self @ T, iter @ Gtk.Gtk.TextIter.T, trailing @ Std.Object.T, x @ Std.Integer.SmallT, y @ Std.Integer.SmallT) : Std.Object.T

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 WindowToBufferCoords.

Note that this is different from GetIterAtLocation, which returns cursor locations, i.e. positions between characters.

text_view a T
iter a Gtk.Gtk.TextIter.T. [out]
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. [out][allow-none]
x x position, in buffer coordinates
y y position, in buffer coordinates


:GetIterLocation(self @ T, iter @ Gtk.Gtk.TextIter.T, location @ Gtk.Gdk.Rectangle.T) : Std.Object.T

Gets a rectangle which roughly contains the character at iter. The rectangle position is in buffer coordinates; use BufferToWindowCoords to convert these coordinates to coordinates for one of the windows in the text view.

text_view a T
iter a Gtk.Gtk.TextIter.T
location bounds of the character at iter. [out]


:GetJustification(self @ T) : Gtk.Gtk.Justification.T

Gets the default justification of paragraphs in text_view. Tags in the buffer may override the default.

text_view a T
Returns default justification


:GetLeftMargin(self @ T) : Std.Integer.SmallT

Gets the default left margin size of paragraphs in the text_view. Tags in the buffer may override the default.

text_view a T
Returns left margin in pixels


:GetLineAtY(self @ T, target_iter @ Gtk.Gtk.TextIter.T, y @ Std.Integer.SmallT, line_top @ Std.Object.T) : Std.Object.T

Gets the Gtk.Gtk.TextIter.T at the start of the line containing the coordinate y. y is in buffer coordinates, convert from window coordinates with WindowToBufferCoords. If non-NULL, line_top will be filled with the coordinate of the top edge of the line.

text_view a T
target_iter a Gtk.Gtk.TextIter.T. [out]
y a y coordinate
line_top return location for top coordinate of the line. [out]


:GetLineYrange(self @ T, iter @ Gtk.Gtk.TextIter.T, y @ Std.Object.T, height @ Std.Object.T) : Std.Object.T

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 BufferToWindowCoords.

text_view a T
iter a Gtk.Gtk.TextIter.T
y return location for a y coordinate. [out]
height return location for a height. [out]


:GetOverwrite(self @ T) : Std.Symbol.T

Returns whether the T is in overwrite mode or not.

text_view a T
Returns whether text_view is in overwrite mode or not.


:GetPixelsAboveLines(self @ T) : Std.Integer.SmallT

Gets the default number of pixels to put above paragraphs.

text_view a T
Returns default number of pixels above paragraphs


:GetPixelsBelowLines(self @ T) : Std.Integer.SmallT

Gets the value set by SetPixelsBelowLines.

text_view a T
Returns default number of blank pixels below paragraphs


:GetPixelsInsideWrap(self @ T) : Std.Integer.SmallT

Gets the value set by SetPixelsInsideWrap.

text_view a T
Returns default number of pixels of blank space between wrapped lines


:GetRightMargin(self @ T) : Std.Integer.SmallT

Gets the default right margin for text in text_view. Tags in the buffer may override the default.

text_view a T
Returns right margin in pixels


:GetTabs(self @ T) : Gtk.Pango.TabArray.T

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 pango_tab_array_free().

text_view a T
Returns copy of default tab array, or NULL if "standard" tabs are used; must be freed with pango_tab_array_free().


:GetVadjustment(self @ T) : Gtk.Gtk.Adjustment.T

Gets the vertical-scrolling Gtk.Gtk.Adjustment.T.

text_view a T
Returns pointer to the vertical Gtk.Gtk.Adjustment.T. [transfer none]


:GetVisibleRect(self @ T, visible_rect @ Gtk.Gdk.Rectangle.T) : Std.Object.T

Fills visible_rect with the currently-visible region of the buffer, in buffer coordinates. Convert to window coordinates with BufferToWindowCoords.

text_view a T
visible_rect rectangle to fill. [out]


:GetWindow(self @ T, win @ Gtk.Gtk.TextWindowType.T) : Gtk.Gdk.Window.T

Retrieves the Gtk.Gdk.Window.T 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 NULL and nonexistent if their width or height is 0, and are nonexistent before the widget has been realized.

text_view a T
win window to get
Returns a Gtk.Gdk.Window.T, or NULL. [transfer none]


:GetWindowType(self @ T, window @ Gtk.Gdk.Window.T) : Gtk.Gtk.TextWindowType.T

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

text_view a T
window a window type
Returns the window type.


:GetWrapMode(self @ T) : Gtk.Gtk.WrapMode.T

Gets the line wrapping for the view.

text_view a T
Returns the line wrap setting


:ImContextFilterKeypress(self @ T, event @ Gtk.Gdk.EventKey.T) : Std.Symbol.T

Allow the T 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 Gtk.Gtk.IMContext.FilterKeypress.

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 T.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
static gboolean
gtk_foo_bar_key_press_event (GtkWidget   *widget,
                             GdkEventKey *event)
{
  if ((key->keyval == GDK_Return || key->keyval == GDK_KP_Enter))
    {
      if (gtk_text_view_im_context_filter_keypress (GTK_TEXT_VIEW (view), event))
        return TRUE;
    }

    /* Do some stuff */

  return GTK_WIDGET_CLASS (gtk_foo_bar_parent_class)->key_press_event (widget, event);
}


:MoveChild(self @ T, child @ Gtk.Gtk.Widget.T, xpos @ Std.Integer.SmallT, ypos @ Std.Integer.SmallT) : Std.Object.T

Updates the position of a child, as for AddChildInWindow.

text_view a T
child child widget already added to the text view
xpos new X position in window coordinates
ypos new Y position in window coordinates


:MoveMarkOnscreen(self @ T, mark @ Gtk.Gtk.TextMark.T) : Std.Symbol.T

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

text_view a T
mark a Gtk.Gtk.TextMark.T
Returns TRUE if the mark moved (wasn't already onscreen)


:MoveVisually(self @ T, iter @ Gtk.Gtk.TextIter.T, count @ Std.Integer.SmallT) : Std.Symbol.T

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.

text_view a T
iter a Gtk.Gtk.TextIter.T
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(self @ T) : Std.Symbol.T

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

text_view a T
Returns TRUE if the cursor had to be moved.


:ResetImContext(self @ T) : Std.Object.T

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.

text_view a T


:ScrollMarkOnscreen(self @ T, mark @ Gtk.Gtk.TextMark.T) : Std.Object.T

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

text_view a T
mark a mark in the buffer for text_view


:ScrollToIter(self @ T, iter @ Gtk.Gtk.TextIter.T, within_margin @ Std.Real.T, use_align @ Std.Symbol.T, xalign @ Std.Real.T, yalign @ Std.Real.T) : Std.Symbol.T

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 ScrollToMark which saves a point to be scrolled to after line validation.

text_view a T
iter a Gtk.Gtk.TextIter.T
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(self @ T, mark @ Gtk.Gtk.TextMark.T, within_margin @ Std.Real.T, use_align @ Std.Symbol.T, xalign @ Std.Real.T, yalign @ Std.Real.T) : Std.Object.T

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.

text_view a T
mark a Gtk.Gtk.TextMark.T
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(self @ T, accepts_tab @ Std.Symbol.T) : Std.Object.T

Sets the behavior of the text widget when the Tab 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.

text_view A T
accepts_tab TRUE if pressing the Tab key should insert a tab character, FALSE, if pressing the Tab key should move the keyboard focus.


:SetBorderWindowSize(self @ T, type @ Gtk.Gtk.TextWindowType.T, size @ Std.Integer.SmallT) : Std.Object.T

Sets the width of Gtk.Gtk.TextWindowType.Left or Gtk.Gtk.TextWindowType.Right, or the height of Gtk.Gtk.TextWindowType.Top or Gtk.Gtk.TextWindowType.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 GTK_TEXT_WINDOW_WIDGET, GTK_TEXT_WINDOW_TEXT, or GTK_TEXT_WINDOW_PRIVATE.

text_view a T
type window to affect
size width or height of the window


:SetBuffer(self @ T, buffer @ Gtk.Gtk.TextBuffer.T) : Std.Object.T

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; T will not "adopt" it.

text_view a T
buffer a Gtk.Gtk.TextBuffer.T. [allow-none]


:SetCursorVisible(self @ T, setting @ Std.Symbol.T) : Std.Object.T

Toggles whether the insertion point is displayed. A buffer with no editable text probably shouldn't have a visible cursor, so you may want to turn the cursor off.

text_view a T
setting whether to show the insertion cursor


:SetEditable(self @ T, setting @ Std.Symbol.T) : Std.Object.T

Sets the default editability of the T. You can override this default setting with tags in the buffer, using the "editable" attribute of tags.

text_view a T
setting whether it's editable


:SetIndent(self @ T, indent @ Std.Integer.SmallT) : Std.Object.T

Sets the default indentation for paragraphs in text_view. Tags in the buffer may override the default.

text_view a T
indent indentation in pixels


:SetJustification(self @ T, justification @ Gtk.Gtk.Justification.T) : Std.Object.T

Sets the default justification of text in text_view. Tags in the view's buffer may override the default.

text_view a T
justification justification


:SetLeftMargin(self @ T, left_margin @ Std.Integer.SmallT) : Std.Object.T

Sets the default left margin for text in text_view. Tags in the buffer may override the default.

text_view a T
left_margin left margin in pixels


:SetOverwrite(self @ T, overwrite @ Std.Symbol.T) : Std.Object.T

Changes the T overwrite mode.

text_view a T
overwrite TRUE to turn on overwrite mode, FALSE to turn it off


:SetPixelsAboveLines(self @ T, pixels_above_lines @ Std.Integer.SmallT) : Std.Object.T

Sets the default number of blank pixels above paragraphs in text_view. Tags in the buffer for text_view may override the defaults.

text_view a T
pixels_above_lines pixels above paragraphs


:SetPixelsBelowLines(self @ T, pixels_below_lines @ Std.Integer.SmallT) : Std.Object.T

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.

text_view a T
pixels_below_lines pixels below paragraphs


:SetPixelsInsideWrap(self @ T, pixels_inside_wrap @ Std.Integer.SmallT) : Std.Object.T

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.

text_view a T
pixels_inside_wrap default number of pixels between wrapped lines


:SetRightMargin(self @ T, right_margin @ Std.Integer.SmallT) : Std.Object.T

Sets the default right margin for text in the text view. Tags in the buffer may override the default.

text_view a T
right_margin right margin in pixels


:SetTabs(self @ T, tabs @ Gtk.Pango.TabArray.T) : Std.Object.T

Sets the default tab stops for paragraphs in text_view. Tags in the buffer may override the default.

text_view a T
tabs tabs as a PangoTabArray


:SetWrapMode(self @ T, wrap_mode @ Gtk.Gtk.WrapMode.T) : Std.Object.T

Sets the line wrapping for the view.

text_view a T
wrap_mode a Gtk.Gtk.WrapMode.T


:StartsDisplayLine(self @ T, iter @ Gtk.Gtk.TextIter.T) : Std.Symbol.T

Determines whether iter is at the start of a display line. See ForwardDisplayLine for an explanation of display lines vs. paragraphs.

text_view a T
iter a Gtk.Gtk.TextIter.T
Returns TRUE if iter begins a wrapped line


:WindowToBufferCoords(self @ T, win @ Gtk.Gtk.TextWindowType.T, window_x @ Std.Integer.SmallT, window_y @ Std.Integer.SmallT, buffer_x, buffer_y) : Std.Object.T

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

Note that you can't convert coordinates for a nonexisting window (see SetBorderWindowSize).

text_view a T
win a Gtk.Gtk.TextWindowType.T except GTK_TEXT_WINDOW_PRIVATE
window_x window x coordinate
window_y window y coordinate
buffer_x buffer x coordinate return location or NULL. [out][allow-none]
buffer_y buffer y coordinate return location or NULL. [out][allow-none]