Trait gtk::prelude::TextViewExt[][src]

pub trait TextViewExt: 'static {
Show methods fn add_child_at_anchor<P: IsA<Widget>, Q: IsA<TextChildAnchor>>(
        &self,
        child: &P,
        anchor: &Q
    );
fn add_child_in_window<P: IsA<Widget>>(
        &self,
        child: &P,
        which_window: TextWindowType,
        xpos: i32,
        ypos: i32
    );
fn backward_display_line(&self, iter: &mut TextIter) -> bool;
fn backward_display_line_start(&self, iter: &mut TextIter) -> bool;
fn buffer_to_window_coords(
        &self,
        win: TextWindowType,
        buffer_x: i32,
        buffer_y: i32
    ) -> (i32, i32);
fn forward_display_line(&self, iter: &mut TextIter) -> bool;
fn forward_display_line_end(&self, iter: &mut TextIter) -> bool;
fn accepts_tab(&self) -> bool;
fn border_window_size(&self, type_: TextWindowType) -> i32;
fn bottom_margin(&self) -> i32;
fn buffer(&self) -> Option<TextBuffer>;
fn cursor_locations(
        &self,
        iter: Option<&TextIter>
    ) -> (Rectangle, Rectangle);
fn is_cursor_visible(&self) -> bool;
fn default_attributes(&self) -> TextAttributes;
fn is_editable(&self) -> bool;
fn indent(&self) -> i32;
fn input_hints(&self) -> InputHints;
fn input_purpose(&self) -> InputPurpose;
fn iter_at_location(&self, x: i32, y: i32) -> Option<TextIter>;
fn iter_at_position(&self, x: i32, y: i32) -> Option<(TextIter, i32)>;
fn iter_location(&self, iter: &TextIter) -> Rectangle;
fn justification(&self) -> Justification;
fn left_margin(&self) -> i32;
fn line_at_y(&self, y: i32) -> (TextIter, i32);
fn line_yrange(&self, iter: &TextIter) -> (i32, i32);
fn is_monospace(&self) -> bool;
fn overwrites(&self) -> bool;
fn pixels_above_lines(&self) -> i32;
fn pixels_below_lines(&self) -> i32;
fn pixels_inside_wrap(&self) -> i32;
fn right_margin(&self) -> i32;
fn tabs(&self) -> Option<TabArray>;
fn top_margin(&self) -> i32;
fn visible_rect(&self) -> Rectangle;
fn window(&self, win: TextWindowType) -> Option<Window>;
fn window_type(&self, window: &Window) -> TextWindowType;
fn wrap_mode(&self) -> WrapMode;
fn im_context_filter_keypress(&self, event: &EventKey) -> bool;
fn move_child<P: IsA<Widget>>(&self, child: &P, xpos: i32, ypos: i32);
fn move_mark_onscreen<P: IsA<TextMark>>(&self, mark: &P) -> bool;
fn move_visually(&self, iter: &mut TextIter, count: i32) -> bool;
fn place_cursor_onscreen(&self) -> bool;
fn reset_cursor_blink(&self);
fn reset_im_context(&self);
fn scroll_mark_onscreen<P: IsA<TextMark>>(&self, mark: &P);
fn scroll_to_iter(
        &self,
        iter: &mut TextIter,
        within_margin: f64,
        use_align: bool,
        xalign: f64,
        yalign: f64
    ) -> bool;
fn scroll_to_mark<P: IsA<TextMark>>(
        &self,
        mark: &P,
        within_margin: f64,
        use_align: bool,
        xalign: f64,
        yalign: f64
    );
fn set_accepts_tab(&self, accepts_tab: bool);
fn set_border_window_size(&self, type_: TextWindowType, size: i32);
fn set_bottom_margin(&self, bottom_margin: i32);
fn set_buffer<P: IsA<TextBuffer>>(&self, buffer: Option<&P>);
fn set_cursor_visible(&self, setting: bool);
fn set_editable(&self, setting: bool);
fn set_indent(&self, indent: i32);
fn set_input_hints(&self, hints: InputHints);
fn set_input_purpose(&self, purpose: InputPurpose);
fn set_justification(&self, justification: Justification);
fn set_left_margin(&self, left_margin: i32);
fn set_monospace(&self, monospace: bool);
fn set_overwrite(&self, overwrite: bool);
fn set_pixels_above_lines(&self, pixels_above_lines: i32);
fn set_pixels_below_lines(&self, pixels_below_lines: i32);
fn set_pixels_inside_wrap(&self, pixels_inside_wrap: i32);
fn set_right_margin(&self, right_margin: i32);
fn set_tabs(&self, tabs: &TabArray);
fn set_top_margin(&self, top_margin: i32);
fn set_wrap_mode(&self, wrap_mode: WrapMode);
fn starts_display_line(&self, iter: &TextIter) -> bool;
fn window_to_buffer_coords(
        &self,
        win: TextWindowType,
        window_x: i32,
        window_y: i32
    ) -> (i32, i32);
fn im_module(&self) -> Option<GString>;
fn set_im_module(&self, im_module: Option<&str>);
fn populates_all(&self) -> bool;
fn set_populate_all(&self, populate_all: bool);
fn connect_backspace<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
fn emit_backspace(&self);
fn connect_copy_clipboard<F: Fn(&Self) + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId;
fn emit_copy_clipboard(&self);
fn connect_cut_clipboard<F: Fn(&Self) + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId;
fn emit_cut_clipboard(&self);
fn connect_delete_from_cursor<F: Fn(&Self, DeleteType, i32) + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId;
fn emit_delete_from_cursor(&self, type_: DeleteType, count: i32);
fn connect_extend_selection<F: Fn(&Self, TextExtendSelection, &TextIter, &TextIter, &TextIter) -> Inhibit + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId;
fn connect_insert_at_cursor<F: Fn(&Self, &str) + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId;
fn emit_insert_at_cursor(&self, string: &str);
fn connect_insert_emoji<F: Fn(&Self) + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId;
fn emit_insert_emoji(&self);
fn connect_move_cursor<F: Fn(&Self, MovementStep, i32, bool) + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId;
fn emit_move_cursor(
        &self,
        step: MovementStep,
        count: i32,
        extend_selection: bool
    );
fn connect_move_viewport<F: Fn(&Self, ScrollStep, i32) + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId;
fn emit_move_viewport(&self, step: ScrollStep, count: i32);
fn connect_paste_clipboard<F: Fn(&Self) + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId;
fn emit_paste_clipboard(&self);
fn connect_populate_popup<F: Fn(&Self, &Widget) + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId;
fn connect_preedit_changed<F: Fn(&Self, &str) + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId;
fn emit_preedit_changed(&self, preedit: &str);
fn connect_select_all<F: Fn(&Self, bool) + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId;
fn emit_select_all(&self, select: bool);
fn connect_set_anchor<F: Fn(&Self) + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId;
fn emit_set_anchor(&self);
fn connect_toggle_cursor_visible<F: Fn(&Self) + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId;
fn emit_toggle_cursor_visible(&self);
fn connect_toggle_overwrite<F: Fn(&Self) + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId;
fn emit_toggle_overwrite(&self);
fn connect_accepts_tab_notify<F: Fn(&Self) + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId;
fn connect_bottom_margin_notify<F: Fn(&Self) + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId;
fn connect_buffer_notify<F: Fn(&Self) + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId;
fn connect_cursor_visible_notify<F: Fn(&Self) + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId;
fn connect_editable_notify<F: Fn(&Self) + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId;
fn connect_im_module_notify<F: Fn(&Self) + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId;
fn connect_indent_notify<F: Fn(&Self) + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId;
fn connect_input_hints_notify<F: Fn(&Self) + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId;
fn connect_input_purpose_notify<F: Fn(&Self) + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId;
fn connect_justification_notify<F: Fn(&Self) + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId;
fn connect_left_margin_notify<F: Fn(&Self) + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId;
fn connect_monospace_notify<F: Fn(&Self) + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId;
fn connect_overwrite_notify<F: Fn(&Self) + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId;
fn connect_pixels_above_lines_notify<F: Fn(&Self) + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId;
fn connect_pixels_below_lines_notify<F: Fn(&Self) + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId;
fn connect_pixels_inside_wrap_notify<F: Fn(&Self) + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId;
fn connect_populate_all_notify<F: Fn(&Self) + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId;
fn connect_right_margin_notify<F: Fn(&Self) + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId;
fn connect_tabs_notify<F: Fn(&Self) + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId;
fn connect_top_margin_notify<F: Fn(&Self) + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId;
fn connect_wrap_mode_notify<F: Fn(&Self) + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId;
}
Expand description

Trait containing all TextView methods.

Implementors

TextView

Required methods

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

child

a Widget

anchor

a TextChildAnchor in the TextBuffer for self

Adds a child at fixed coordinates in one of the text widget’s windows.

The window must have nonzero size (see set_border_window_size()). Note that the child coordinates are given relative to scrolling. When placing a child in TextWindowType::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) it will move with the scrolling as needed.

child

a Widget

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

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

iter

a TextIter

Returns

true if iter was moved and is not on the end iterator

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

iter

a TextIter

Returns

true if iter was moved and is not on the end iterator

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

win

a TextWindowType, except TextWindowType::Private

buffer_x

buffer x coordinate

buffer_y

buffer y coordinate

Returns

window_x

window x coordinate return location or None

window_y

window y coordinate return location or None

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

iter

a TextIter

Returns

true if iter was moved and is not on the end iterator

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

iter

a TextIter

Returns

true if iter was moved and is not on the end iterator

Returns whether pressing the Tab key inserts a tab characters. set_accepts_tab().

Returns

true if pressing the Tab key inserts a tab character, false if pressing the Tab key moves the keyboard focus.

Gets the width of the specified border window. See set_border_window_size().

type_

window to return size from

Returns

width of window

Gets the bottom margin for text in the self.

Returns

bottom margin in pixels

Returns the 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

a TextBuffer

Given an 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 iter is None, 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 buffer_to_window_coords() to convert these coordinates to coordinates for one of the windows in the text view.

iter

a TextIter

Returns

strong

location to store the strong cursor position (may be None)

weak

location to store the weak cursor position (may be None)

Find out whether the cursor should be displayed.

Returns

whether the insertion mark is visible

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 [TextIter::attributes()][crate::TextIter::attributes()] 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 with gtk_text_attributes_unref().

Returns

a new TextAttributes

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

Returns

whether text is editable by default

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

Returns

number of pixels of indentation

Gets the value of the property::TextView::input-hints property.

Gets the value of the property::TextView::input-purpose property.

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

x

x position, in buffer coordinates

y

y position, in buffer coordinates

Returns

true if the position is over text

iter

a TextIter

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

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

x

x position, in buffer coordinates

y

y position, in buffer coordinates

Returns

true if the position is over text

iter

a TextIter

trailing

if non-None, 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.

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

iter

a TextIter

Returns

location

bounds of the character at iter

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

Returns

default justification

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

Returns

left margin in pixels

Gets the TextIter at the start of the line containing the coordinate y. y is in buffer coordinates, convert from window coordinates with window_to_buffer_coords(). If non-None, line_top will be filled with the coordinate of the top edge of the line.

y

a y coordinate

Returns

target_iter

a TextIter

line_top

return location for top coordinate of the line

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

iter

a TextIter

Returns

y

return location for a y coordinate

height

return location for a height

Gets the value of the property::TextView::monospace property.

Returns

true if monospace fonts are desired

Returns whether the TextView is in overwrite mode or not.

Returns

whether self is in overwrite mode or not.

Gets the default number of pixels to put above paragraphs. Adding this function with pixels_below_lines() is equal to the line space between each paragraph.

Returns

default number of pixels above paragraphs

Gets the value set by set_pixels_below_lines().

The line space is the sum of the value returned by this function and the value returned by pixels_above_lines().

Returns

default number of blank pixels below paragraphs

Gets the value set by set_pixels_inside_wrap().

Returns

default number of pixels of blank space between wrapped lines

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

Returns

right margin in pixels

Gets the default tabs for self. Tags in the buffer may override the defaults. The returned array will be None if “standard” (8-space) tabs are used. Free the return value with pango_tab_array_free().

Returns

copy of default tab array, or None if “standard“ tabs are used; must be freed with pango_tab_array_free().

Gets the top margin for text in the self.

Returns

top margin in pixels

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

Returns

visible_rect

rectangle to fill

Retrieves the gdk::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 None and nonexistent if their width or height is 0, and are nonexistent before the widget has been realized.

win

window to get

Returns

a gdk::Window, or None

Usually used to find out which window an event corresponds to.

If you connect to an event signal on self, this function should be called on event->window to see which window it was.

window

a window type

Returns

the window type.

Gets the line wrapping for the view.

Returns

the line wrap setting

Allow the TextView 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 IMContextExt::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 TextView.

⚠️ The following code is in C ⚠️

static gboolean
gtk_foo_bar_key_press_event (GtkWidget   *widget,
                             GdkEventKey *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);
}

event

the key event

Returns

true if the input method handled the key event.

Updates the position of a child, as for add_child_in_window().

child

child widget already added to the text view

xpos

new X position in window coordinates

ypos

new Y position in window coordinates

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

mark

a TextMark

Returns

true if the mark moved (wasn’t already onscreen)

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.

iter

a TextIter

count

number of characters to move (negative moves left, positive moves right)

Returns

true if iter moved and is not on the end iterator

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

Returns

true if the cursor had to be moved.

This is supported on crate feature v3_20 only.

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 signal::Widget::key-press-event handler).

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.

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

mark

a mark in the buffer for self

Scrolls self 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 scroll_to_mark() which saves a point to be scrolled to after line validation.

iter

a TextIter

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

Scrolls self 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.

mark

a TextMark

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

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.

accepts_tab

true if pressing the Tab key should insert a tab character, false, if pressing the Tab key should move the keyboard focus.

Sets the width of TextWindowType::Left or TextWindowType::Right, or the height of TextWindowType::Top or 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”, and it won’t work with TextWindowType::Widget, TextWindowType::Text, or TextWindowType::Private.

type_

window to affect

size

width or height of the window

Sets the bottom margin for text in self.

Note that this function is confusingly named. In CSS terms, the value set here is padding.

bottom_margin

bottom margin in pixels

Sets buffer as the buffer being displayed by self. 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; TextView will not “adopt” it.

buffer

a TextBuffer

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

setting

whether to show the insertion cursor

Sets the default editability of the TextView. You can override this default setting with tags in the buffer, using the “editable” attribute of tags.

setting

whether it’s editable

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

indent

indentation in pixels

Sets the property::TextView::input-hints property, which allows input methods to fine-tune their behaviour.

hints

the hints

Sets the property::TextView::input-purpose property which can be used by on-screen keyboards and other input methods to adjust their behaviour.

purpose

the purpose

Sets the default justification of text in self. Tags in the view’s buffer may override the default.

justification

justification

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

Note that this function is confusingly named. In CSS terms, the value set here is padding.

left_margin

left margin in pixels

Sets the property::TextView::monospace property, which indicates that the text view should use monospace fonts.

monospace

true to request monospace styling

Changes the TextView overwrite mode.

overwrite

true to turn on overwrite mode, false to turn it off

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

pixels_above_lines

pixels above paragraphs

Sets the default number of pixels of blank space to put below paragraphs in self. May be overridden by tags applied to self’s buffer.

pixels_below_lines

pixels below paragraphs

Sets the default number of pixels of blank space to leave between display/wrapped lines within a paragraph. May be overridden by tags in self’s buffer.

pixels_inside_wrap

default number of pixels between wrapped lines

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.

right_margin

right margin in pixels

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

tabs

tabs as a pango::TabArray

Sets the top margin for text in self.

Note that this function is confusingly named. In CSS terms, the value set here is padding.

top_margin

top margin in pixels

Sets the line wrapping for the view.

wrap_mode

a WrapMode

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

iter

a TextIter

Returns

true if iter begins a wrapped line

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

win

a TextWindowType except TextWindowType::Private

window_x

window x coordinate

window_y

window y coordinate

Returns

buffer_x

buffer x coordinate return location or None

buffer_y

buffer y coordinate return location or None

Which IM (input method) module should be used for this text_view. See IMContext.

Setting this to a non-None value overrides the system-wide IM module setting. See the GtkSettings property::Settings::gtk-im-module property.

Which IM (input method) module should be used for this text_view. See IMContext.

Setting this to a non-None value overrides the system-wide IM module setting. See the GtkSettings property::Settings::gtk-im-module property.

If :populate-all is true, the signal::TextView::populate-popup signal is also emitted for touch popups.

If :populate-all is true, the signal::TextView::populate-popup signal is also emitted for touch popups.

The ::backspace signal is a [keybinding signal][GtkBindingSignal] which gets emitted when the user asks for it.

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

The ::copy-clipboard signal is a [keybinding signal][GtkBindingSignal] which gets emitted to copy the selection to the clipboard.

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

The ::cut-clipboard signal is a [keybinding signal][GtkBindingSignal] which gets emitted to cut the selection to the clipboard.

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

The ::delete-from-cursor signal is a [keybinding signal][GtkBindingSignal] which gets emitted when the user initiates a text deletion.

If the type_ is DeleteType::Chars, GTK+ deletes the selection if there is one, otherwise it deletes the requested number of characters.

The default bindings for this signal are Delete for deleting a character, Ctrl-Delete for deleting a word and Ctrl-Backspace for deleting a word backwords.

type_

the granularity of the deletion, as a DeleteType

count

the number of type_ units to delete

The ::extend-selection signal is emitted when the selection needs to be extended at location.

granularity

the granularity type

location

the location where to extend the selection

start

where the selection should start

end

where the selection should end

Returns

GDK_EVENT_STOP to stop other handlers from being invoked for the event. GDK_EVENT_PROPAGATE to propagate the event further.

The ::insert-at-cursor signal is a [keybinding signal][GtkBindingSignal] which gets emitted when the user initiates the insertion of a fixed string at the cursor.

This signal has no default bindings.

string

the string to insert

This is supported on crate feature v3_22_26 only.

The ::insert-emoji signal is a [keybinding signal][GtkBindingSignal] which gets emitted to present the Emoji chooser for the text_view.

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

This is supported on crate feature v3_22_26 only.

The ::move-cursor signal is a [keybinding signal][GtkBindingSignal] which gets emitted when the user initiates a cursor movement. If the cursor is not visible in text_view, this signal causes the viewport to be moved instead.

Applications should not connect to it, but may emit it with g_signal_emit_by_name() if they need to control the cursor programmatically.

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

  • Arrow keys move by individual characters/lines
  • Ctrl-arrow key combinations move by words/paragraphs
  • Home/End keys move to the ends of the buffer
  • PageUp/PageDown keys move vertically by pages
  • Ctrl-PageUp/PageDown keys move horizontally by pages

step

the granularity of the move, as a MovementStep

count

the number of step units to move

extend_selection

true if the move should extend the selection

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

There are no default bindings for this signal.

step

the granularity of the movement, as a ScrollStep

count

the number of step units to move

The ::paste-clipboard signal is a [keybinding signal][GtkBindingSignal] which gets emitted to paste the contents of the clipboard into the text view.

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

The ::populate-popup signal gets emitted before showing the context menu of the text view.

If you need to add items to the context menu, connect to this signal and append your items to the popup, which will be a Menu in this case.

If property::TextView::populate-all is true, this signal will also be emitted to populate touch popups. In this case, popup will be a different container, e.g. a Toolbar.

The signal handler should not make assumptions about the type of widget, but check whether popup is a Menu or Toolbar or another kind of container.

the container that is being populated

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

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

preedit

the current preedit string

The ::select-all signal is a [keybinding signal][GtkBindingSignal] which gets emitted to select or unselect the complete contents of the text view.

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

select

true to select, false to unselect

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

This signal has no default bindings.

The ::toggle-cursor-visible signal is a [keybinding signal][GtkBindingSignal] which gets emitted to toggle the property::TextView::cursor-visible property.

The default binding for this signal is F7.

The ::toggle-overwrite signal is a [keybinding signal][GtkBindingSignal] which gets emitted to toggle the overwrite mode of the text view.

The default bindings for this signal is Insert.

Implementors