pub trait TextViewExt:
IsA<TextView>
+ Sealed
+ 'static {
Show 123 methods
// Provided methods
fn add_child_at_anchor(
&self,
child: &impl IsA<Widget>,
anchor: &impl IsA<TextChildAnchor>,
) { ... }
fn add_overlay(&self, child: &impl IsA<Widget>, 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 bottom_margin(&self) -> i32 { ... }
fn buffer(&self) -> TextBuffer { ... }
fn cursor_locations(
&self,
iter: Option<&TextIter>,
) -> (Rectangle, Rectangle) { ... }
fn is_cursor_visible(&self) -> bool { ... }
fn is_editable(&self) -> bool { ... }
fn extra_menu(&self) -> MenuModel { ... }
fn gutter(&self, win: TextWindowType) -> Option<Widget> { ... }
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 ltr_context(&self) -> Context { ... }
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 rtl_context(&self) -> Context { ... }
fn tabs(&self) -> Option<TabArray> { ... }
fn top_margin(&self) -> i32 { ... }
fn visible_rect(&self) -> Rectangle { ... }
fn wrap_mode(&self) -> WrapMode { ... }
fn im_context_filter_keypress(&self, event: impl AsRef<Event>) -> bool { ... }
fn move_mark_onscreen(&self, mark: &impl IsA<TextMark>) -> bool { ... }
fn move_overlay(&self, child: &impl IsA<Widget>, xpos: i32, ypos: i32) { ... }
fn move_visually(&self, iter: &mut TextIter, count: i32) -> bool { ... }
fn place_cursor_onscreen(&self) -> bool { ... }
fn remove(&self, child: &impl IsA<Widget>) { ... }
fn reset_cursor_blink(&self) { ... }
fn reset_im_context(&self) { ... }
fn scroll_mark_onscreen(&self, mark: &impl IsA<TextMark>) { ... }
fn scroll_to_iter(
&self,
iter: &mut TextIter,
within_margin: f64,
use_align: bool,
xalign: f64,
yalign: f64,
) -> bool { ... }
fn scroll_to_mark(
&self,
mark: &impl IsA<TextMark>,
within_margin: f64,
use_align: bool,
xalign: f64,
yalign: f64,
) { ... }
fn set_accepts_tab(&self, accepts_tab: bool) { ... }
fn set_bottom_margin(&self, bottom_margin: i32) { ... }
fn set_buffer(&self, buffer: Option<&impl IsA<TextBuffer>>) { ... }
fn set_cursor_visible(&self, setting: bool) { ... }
fn set_editable(&self, setting: bool) { ... }
fn set_extra_menu(&self, model: Option<&impl IsA<MenuModel>>) { ... }
fn set_gutter(&self, win: TextWindowType, widget: Option<&impl IsA<Widget>>) { ... }
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 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) -> Propagation + '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_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_extra_menu_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_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 { ... }
}
Provided Methods§
Sourcefn add_child_at_anchor(
&self,
child: &impl IsA<Widget>,
anchor: &impl IsA<TextChildAnchor>,
)
fn add_child_at_anchor( &self, child: &impl IsA<Widget>, anchor: &impl IsA<TextChildAnchor>, )
Adds a child widget in the text buffer, at the given @anchor.
§child
a Widget
§anchor
a TextChildAnchor
in the TextBuffer
for @self
Sourcefn add_overlay(&self, child: &impl IsA<Widget>, xpos: i32, ypos: i32)
fn add_overlay(&self, child: &impl IsA<Widget>, xpos: i32, ypos: i32)
Adds @child at a fixed coordinate in the TextView
’s text window.
The @xpos and @ypos must be in buffer coordinates (see
iter_location()
to convert to
buffer coordinates).
@child will scroll with the text view.
If instead you want a widget that will not move with the
TextView
contents see Overlay
.
§child
a Widget
§xpos
X position of child in window coordinates
§ypos
Y position of child in window coordinates
Sourcefn backward_display_line(&self, iter: &mut TextIter) -> bool
fn backward_display_line(&self, iter: &mut TextIter) -> bool
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
Sourcefn backward_display_line_start(&self, iter: &mut TextIter) -> bool
fn backward_display_line_start(&self, iter: &mut TextIter) -> bool
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
Sourcefn buffer_to_window_coords(
&self,
win: TextWindowType,
buffer_x: i32,
buffer_y: i32,
) -> (i32, i32)
fn buffer_to_window_coords( &self, win: TextWindowType, buffer_x: i32, buffer_y: i32, ) -> (i32, i32)
Sourcefn forward_display_line(&self, iter: &mut TextIter) -> bool
fn forward_display_line(&self, iter: &mut TextIter) -> bool
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
Sourcefn forward_display_line_end(&self, iter: &mut TextIter) -> bool
fn forward_display_line_end(&self, iter: &mut TextIter) -> bool
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
Sourcefn accepts_tab(&self) -> bool
fn accepts_tab(&self) -> bool
Returns whether pressing the Tab key inserts a tab characters.
See set_accepts_tab()
.
§Returns
true
if pressing the Tab key inserts a tab character,
false
if pressing the Tab key moves the keyboard focus.
Sourcefn bottom_margin(&self) -> i32
fn bottom_margin(&self) -> i32
Sourcefn buffer(&self) -> TextBuffer
fn buffer(&self) -> TextBuffer
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
Sourcefn cursor_locations(&self, iter: Option<&TextIter>) -> (Rectangle, Rectangle)
fn cursor_locations(&self, iter: Option<&TextIter>) -> (Rectangle, Rectangle)
Determine the positions of the strong and weak cursors if the insertion point is at @iter.
The position of each cursor is stored as a zero-width rectangle. The strong cursor location is the location where characters of the directionality equal to the base direction of the paragraph are inserted. The weak cursor location is the location where characters of the directionality opposite to the base direction of the paragraph are inserted.
If @iter is 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
§weak
location to store the weak cursor position
Sourcefn is_cursor_visible(&self) -> bool
fn is_cursor_visible(&self) -> bool
Sourcefn is_editable(&self) -> bool
fn is_editable(&self) -> bool
Sourcefn gutter(&self, win: TextWindowType) -> Option<Widget>
fn gutter(&self, win: TextWindowType) -> Option<Widget>
Gets a Widget
that has previously been set as gutter.
See set_gutter()
.
@win must be one of TextWindowType::Left
, TextWindowType::Right
,
TextWindowType::Top
, or TextWindowType::Bottom
.
§win
§Returns
a Widget
Sourcefn indent(&self) -> i32
fn indent(&self) -> i32
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
Sourcefn input_hints(&self) -> InputHints
fn input_hints(&self) -> InputHints
Sourcefn input_purpose(&self) -> InputPurpose
fn input_purpose(&self) -> InputPurpose
Sourcefn iter_at_location(&self, x: i32, y: i32) -> Option<TextIter>
fn iter_at_location(&self, x: i32, y: i32) -> Option<TextIter>
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
Sourcefn iter_at_position(&self, x: i32, y: i32) -> Option<(TextIter, i32)>
fn iter_at_position(&self, x: i32, y: i32) -> Option<(TextIter, i32)>
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.
Sourcefn iter_location(&self, iter: &TextIter) -> Rectangle
fn iter_location(&self, iter: &TextIter) -> Rectangle
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
Sourcefn justification(&self) -> Justification
fn justification(&self) -> Justification
Gets the default justification of paragraphs in @self.
Tags in the buffer may override the default.
§Returns
default justification
Sourcefn left_margin(&self) -> i32
fn left_margin(&self) -> i32
Gets the default left margin size of paragraphs in the @self.
Tags in the buffer may override the default.
§Returns
left margin in pixels
Sourcefn line_at_y(&self, y: i32) -> (TextIter, i32)
fn line_at_y(&self, y: i32) -> (TextIter, i32)
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
Sourcefn line_yrange(&self, iter: &TextIter) -> (i32, i32)
fn line_yrange(&self, iter: &TextIter) -> (i32, i32)
Sourcefn ltr_context(&self) -> Context
Available on crate feature v4_4
only.
fn ltr_context(&self) -> Context
v4_4
only.Gets the pango::Context
that is used for rendering LTR directed
text layouts.
The context may be replaced when CSS changes occur.
§Returns
Sourcefn is_monospace(&self) -> bool
fn is_monospace(&self) -> bool
Sourcefn overwrites(&self) -> bool
fn overwrites(&self) -> bool
Sourcefn pixels_above_lines(&self) -> i32
fn pixels_above_lines(&self) -> i32
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
Sourcefn pixels_below_lines(&self) -> i32
fn pixels_below_lines(&self) -> i32
Gets the default number of pixels to put below paragraphs.
The line space is the sum of the value returned by this function and
the value returned by pixels_above_lines()
.
§Returns
default number of blank pixels below paragraphs
Sourcefn pixels_inside_wrap(&self) -> i32
fn pixels_inside_wrap(&self) -> i32
Gets the default number of pixels to put between wrapped lines inside a paragraph.
§Returns
default number of pixels of blank space between wrapped lines
Sourcefn right_margin(&self) -> i32
fn right_margin(&self) -> i32
Gets the default right margin for text in @self.
Tags in the buffer may override the default.
§Returns
right margin in pixels
Sourcefn rtl_context(&self) -> Context
Available on crate feature v4_4
only.
fn rtl_context(&self) -> Context
v4_4
only.Gets the pango::Context
that is used for rendering RTL directed
text layouts.
The context may be replaced when CSS changes occur.
§Returns
Sourcefn tabs(&self) -> Option<TabArray>
fn tabs(&self) -> Option<TabArray>
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::TabArray::free()
.
§Returns
copy of default tab array,
or None
if standard tabs are used; must be freed with
Pango::TabArray::free()
.
Sourcefn top_margin(&self) -> i32
fn top_margin(&self) -> i32
Sourcefn visible_rect(&self) -> Rectangle
fn visible_rect(&self) -> Rectangle
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
Sourcefn im_context_filter_keypress(&self, event: impl AsRef<Event>) -> bool
fn im_context_filter_keypress(&self, event: impl AsRef<Event>) -> bool
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,
GdkEvent *event)
{
guint keyval;
gdk_event_get_keyval ((GdkEvent*)event, &keyval);
if (keyval == GDK_KEY_Return || keyval == GDK_KEY_KP_Enter)
{
if (gtk_text_view_im_context_filter_keypress (GTK_TEXT_VIEW (widget), event))
return TRUE;
}
// Do some stuff
return GTK_WIDGET_CLASS (gtk_foo_bar_parent_class)->key_press_event (widget, event);
}
§event
the key event
§Returns
true
if the input method handled the key event.
Sourcefn move_mark_onscreen(&self, mark: &impl IsA<TextMark>) -> bool
fn move_mark_onscreen(&self, mark: &impl IsA<TextMark>) -> bool
Sourcefn move_overlay(&self, child: &impl IsA<Widget>, xpos: i32, ypos: i32)
fn move_overlay(&self, child: &impl IsA<Widget>, xpos: i32, ypos: i32)
Updates the position of a child.
See add_overlay()
.
§child
a widget already added with add_overlay()
§xpos
new X position in buffer coordinates
§ypos
new Y position in buffer coordinates
Sourcefn move_visually(&self, iter: &mut TextIter, count: i32) -> bool
fn move_visually(&self, iter: &mut TextIter, count: i32) -> bool
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
Sourcefn place_cursor_onscreen(&self) -> bool
fn place_cursor_onscreen(&self) -> bool
Sourcefn reset_cursor_blink(&self)
fn reset_cursor_blink(&self)
Ensures that the cursor is shown.
This also resets the time that it will stay blinking (or visible, in case blinking is disabled).
This function should be called in response to user input (e.g. from derived classes that override the textview’s event handlers).
Sourcefn reset_im_context(&self)
fn reset_im_context(&self)
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.
Sourcefn scroll_mark_onscreen(&self, mark: &impl IsA<TextMark>)
fn scroll_mark_onscreen(&self, mark: &impl IsA<TextMark>)
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
Sourcefn scroll_to_iter(
&self,
iter: &mut TextIter,
within_margin: f64,
use_align: bool,
xalign: f64,
yalign: f64,
) -> bool
fn scroll_to_iter( &self, iter: &mut TextIter, within_margin: f64, use_align: bool, xalign: f64, yalign: f64, ) -> bool
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
Sourcefn scroll_to_mark(
&self,
mark: &impl IsA<TextMark>,
within_margin: f64,
use_align: bool,
xalign: f64,
yalign: f64,
)
fn scroll_to_mark( &self, mark: &impl IsA<TextMark>, within_margin: f64, use_align: bool, xalign: f64, yalign: f64, )
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
Sourcefn set_accepts_tab(&self, accepts_tab: bool)
fn set_accepts_tab(&self, accepts_tab: bool)
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.
Focus can always be moved using Ctrl+Tab.
§accepts_tab
true
if pressing the Tab key should insert a tab
character, false
, if pressing the Tab key should move the
keyboard focus.
Sourcefn set_bottom_margin(&self, bottom_margin: i32)
fn set_bottom_margin(&self, bottom_margin: i32)
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
Sourcefn set_buffer(&self, buffer: Option<&impl IsA<TextBuffer>>)
fn set_buffer(&self, buffer: Option<&impl IsA<TextBuffer>>)
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
Sourcefn set_cursor_visible(&self, setting: bool)
fn set_cursor_visible(&self, setting: bool)
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
gtk-keynav-use-caret
setting.
§setting
whether to show the insertion cursor
Sourcefn set_editable(&self, setting: bool)
fn set_editable(&self, setting: bool)
Sourcefn set_gutter(&self, win: TextWindowType, widget: Option<&impl IsA<Widget>>)
fn set_gutter(&self, win: TextWindowType, widget: Option<&impl IsA<Widget>>)
Places @widget into the gutter specified by @win.
@win must be one of TextWindowType::Left
, TextWindowType::Right
,
TextWindowType::Top
, or TextWindowType::Bottom
.
§win
§widget
a Widget
Sourcefn set_indent(&self, indent: i32)
fn set_indent(&self, indent: i32)
Sets the default indentation for paragraphs in @self.
Tags in the buffer may override the default.
§indent
indentation in pixels
Sourcefn set_input_hints(&self, hints: InputHints)
fn set_input_hints(&self, hints: InputHints)
Sourcefn set_input_purpose(&self, purpose: InputPurpose)
fn set_input_purpose(&self, purpose: InputPurpose)
Sourcefn set_justification(&self, justification: Justification)
fn set_justification(&self, justification: Justification)
Sets the default justification of text in @self.
Tags in the view’s buffer may override the default.
§justification
justification
Sourcefn set_left_margin(&self, left_margin: i32)
fn set_left_margin(&self, left_margin: i32)
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
Sourcefn set_monospace(&self, monospace: bool)
fn set_monospace(&self, monospace: bool)
Sourcefn set_overwrite(&self, overwrite: bool)
fn set_overwrite(&self, overwrite: bool)
Sourcefn set_pixels_above_lines(&self, pixels_above_lines: i32)
fn set_pixels_above_lines(&self, pixels_above_lines: i32)
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
Sourcefn set_pixels_below_lines(&self, pixels_below_lines: i32)
fn set_pixels_below_lines(&self, pixels_below_lines: i32)
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
Sourcefn set_pixels_inside_wrap(&self, pixels_inside_wrap: i32)
fn set_pixels_inside_wrap(&self, pixels_inside_wrap: i32)
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
Sourcefn set_right_margin(&self, right_margin: i32)
fn set_right_margin(&self, right_margin: i32)
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
Sourcefn set_tabs(&self, tabs: &TabArray)
fn set_tabs(&self, tabs: &TabArray)
Sets the default tab stops for paragraphs in @self.
Tags in the buffer may override the default.
§tabs
tabs as a pango::TabArray
Sourcefn set_top_margin(&self, top_margin: i32)
fn set_top_margin(&self, top_margin: i32)
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
Sourcefn set_wrap_mode(&self, wrap_mode: WrapMode)
fn set_wrap_mode(&self, wrap_mode: WrapMode)
Sourcefn starts_display_line(&self, iter: &TextIter) -> bool
fn starts_display_line(&self, iter: &TextIter) -> bool
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
Sourcefn window_to_buffer_coords(
&self,
win: TextWindowType,
window_x: i32,
window_y: i32,
) -> (i32, i32)
fn window_to_buffer_coords( &self, win: TextWindowType, window_x: i32, window_y: i32, ) -> (i32, i32)
Sourcefn im_module(&self) -> Option<GString>
fn im_module(&self) -> Option<GString>
Which IM (input method) module should be used for this text_view.
See IMMulticontext
.
Setting this to a non-None
value overrides the system-wide IM module
setting. See the GtkSettings gtk-im-module
property.
Sourcefn set_im_module(&self, im_module: Option<&str>)
fn set_im_module(&self, im_module: Option<&str>)
Which IM (input method) module should be used for this text_view.
See IMMulticontext
.
Setting this to a non-None
value overrides the system-wide IM module
setting. See the GtkSettings gtk-im-module
property.
Sourcefn connect_backspace<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId
fn connect_backspace<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId
Gets emitted when the user asks for it.
The ::backspace signal is a keybinding signal.
The default bindings for this signal are Backspace and Shift+Backspace.
fn emit_backspace(&self)
Sourcefn connect_copy_clipboard<F: Fn(&Self) + 'static>(
&self,
f: F,
) -> SignalHandlerId
fn connect_copy_clipboard<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId
Gets emitted to copy the selection to the clipboard.
The ::copy-clipboard signal is a keybinding signal.
The default bindings for this signal are Ctrl+c and Ctrl+Insert.
fn emit_copy_clipboard(&self)
Sourcefn connect_cut_clipboard<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId
fn connect_cut_clipboard<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId
Gets emitted to cut the selection to the clipboard.
The ::cut-clipboard signal is a keybinding signal.
The default bindings for this signal are Ctrl+x and Shift+Delete.
fn emit_cut_clipboard(&self)
Sourcefn connect_delete_from_cursor<F: Fn(&Self, DeleteType, i32) + 'static>(
&self,
f: F,
) -> SignalHandlerId
fn connect_delete_from_cursor<F: Fn(&Self, DeleteType, i32) + 'static>( &self, f: F, ) -> SignalHandlerId
Gets emitted when the user initiates a text deletion.
The ::delete-from-cursor signal is a keybinding signal.
If the @type_ is DeleteType::Chars
, GTK deletes the selection
if there is one, otherwise it deletes the requested number
of characters.
The default bindings for this signal are Delete for deleting a character, Ctrl+Delete for deleting a word and Ctrl+Backspace for deleting a word backwards.
§type_
the granularity of the deletion, as a DeleteType
§count
the number of @type_ units to delete
fn emit_delete_from_cursor(&self, type_: DeleteType, count: i32)
Sourcefn connect_extend_selection<F: Fn(&Self, TextExtendSelection, &TextIter, &TextIter, &TextIter) -> Propagation + 'static>(
&self,
f: F,
) -> SignalHandlerId
fn connect_extend_selection<F: Fn(&Self, TextExtendSelection, &TextIter, &TextIter, &TextIter) -> Propagation + 'static>( &self, f: F, ) -> SignalHandlerId
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.
Sourcefn connect_insert_at_cursor<F: Fn(&Self, &str) + 'static>(
&self,
f: F,
) -> SignalHandlerId
fn connect_insert_at_cursor<F: Fn(&Self, &str) + 'static>( &self, f: F, ) -> SignalHandlerId
Gets emitted when the user initiates the insertion of a fixed string at the cursor.
The ::insert-at-cursor signal is a keybinding signal.
This signal has no default bindings.
§string
the string to insert
fn emit_insert_at_cursor(&self, string: &str)
Sourcefn connect_insert_emoji<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId
fn connect_insert_emoji<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId
Gets emitted to present the Emoji chooser for the @text_view.
The ::insert-emoji signal is a keybinding signal.
The default bindings for this signal are Ctrl+. and Ctrl+;
fn emit_insert_emoji(&self)
Sourcefn connect_move_cursor<F: Fn(&Self, MovementStep, i32, bool) + 'static>(
&self,
f: F,
) -> SignalHandlerId
fn connect_move_cursor<F: Fn(&Self, MovementStep, i32, bool) + 'static>( &self, f: F, ) -> SignalHandlerId
Gets emitted when the user initiates a cursor movement.
The ::move-cursor signal is a keybinding signal. 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 it does not. There are too many key combinations to list them all here.
- ←, →, ↑, ↓ move by individual characters/lines
- Ctrl+←, etc. move by words/paragraphs
- Home and End move to the ends of the buffer
- PgUp and PgDn move vertically by pages
- Ctrl+PgUp and Ctrl+PgDn move horizontally by pages
§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
fn emit_move_cursor( &self, step: MovementStep, count: i32, extend_selection: bool, )
Sourcefn connect_move_viewport<F: Fn(&Self, ScrollStep, i32) + 'static>(
&self,
f: F,
) -> SignalHandlerId
fn connect_move_viewport<F: Fn(&Self, ScrollStep, i32) + 'static>( &self, f: F, ) -> SignalHandlerId
Gets emitted to move the viewport.
The ::move-viewport signal is a keybinding signal, which can be bound to key combinations to allow the user to move the viewport, i.e. change what part of the text view is visible in a containing scrolled window.
There are no default bindings for this signal.
§step
the granularity of the movement, as a ScrollStep
§count
the number of @step units to move
fn emit_move_viewport(&self, step: ScrollStep, count: i32)
Sourcefn connect_paste_clipboard<F: Fn(&Self) + 'static>(
&self,
f: F,
) -> SignalHandlerId
fn connect_paste_clipboard<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId
Gets emitted to paste the contents of the clipboard into the text view.
The ::paste-clipboard signal is a keybinding signal.
The default bindings for this signal are Ctrl+v and Shift+Insert.
fn emit_paste_clipboard(&self)
Sourcefn connect_preedit_changed<F: Fn(&Self, &str) + 'static>(
&self,
f: F,
) -> SignalHandlerId
fn connect_preedit_changed<F: Fn(&Self, &str) + 'static>( &self, f: F, ) -> SignalHandlerId
Emitted when preedit text of the active IM changes.
If an input method is used, the typed text will not immediately be committed to the buffer. So if you are interested in the text, connect to this signal.
This signal is only emitted if the text at the given position is actually editable.
§preedit
the current preedit string
fn emit_preedit_changed(&self, preedit: &str)
Sourcefn connect_select_all<F: Fn(&Self, bool) + 'static>(
&self,
f: F,
) -> SignalHandlerId
fn connect_select_all<F: Fn(&Self, bool) + 'static>( &self, f: F, ) -> SignalHandlerId
Gets emitted to select or unselect the complete contents of the text view.
The ::select-all signal is a keybinding signal.
The default bindings for this signal are Ctrl+a and Ctrl+/ for selecting and Shift+Ctrl+a and Ctrl+</kbd> for unselecting.
§select
fn emit_select_all(&self, select: bool)
Sourcefn connect_set_anchor<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId
fn connect_set_anchor<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId
Gets emitted when the user initiates settings the “anchor” mark.
The ::set-anchor signal is a keybinding signal which gets emitted when the user initiates setting the “anchor” mark. The “anchor” mark gets placed at the same position as the “insert” mark.
This signal has no default bindings.
fn emit_set_anchor(&self)
Sourcefn connect_toggle_cursor_visible<F: Fn(&Self) + 'static>(
&self,
f: F,
) -> SignalHandlerId
fn connect_toggle_cursor_visible<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId
Gets emitted to toggle the cursor-visible
property.
The ::toggle-cursor-visible signal is a keybinding signal.
The default binding for this signal is F7.
fn emit_toggle_cursor_visible(&self)
Sourcefn connect_toggle_overwrite<F: Fn(&Self) + 'static>(
&self,
f: F,
) -> SignalHandlerId
fn connect_toggle_overwrite<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId
Gets emitted to toggle the overwrite mode of the text view.
The ::toggle-overwrite signal is a keybinding signal.
The default binding for this signal is Insert.
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_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
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.