Trait gtk4::prelude::TextViewExt [−][src]
pub trait TextViewExt: 'static {
Show 122 methods
fn add_child_at_anchor<P: IsA<Widget>, Q: IsA<TextChildAnchor>>(
&self,
child: &P,
anchor: &Q
);
fn add_overlay<P: IsA<Widget>>(&self, child: &P, 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) -> Option<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 move_mark_onscreen<P: IsA<TextMark>>(&self, mark: &P) -> bool;
fn move_overlay<P: IsA<Widget>>(&self, child: &P, xpos: i32, ypos: i32);
fn move_visually(&self, iter: &mut TextIter, count: i32) -> bool;
fn place_cursor_onscreen(&self) -> bool;
fn remove<P: IsA<Widget>>(&self, child: &P);
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_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_extra_menu<P: IsA<MenuModel>>(&self, model: Option<&P>);
fn set_gutter<P: IsA<Widget>>(
&self,
win: TextWindowType,
widget: Option<&P>
);
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) -> 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_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;
}
Expand description
Required methods
fn add_child_at_anchor<P: IsA<Widget>, Q: IsA<TextChildAnchor>>(
&self,
child: &P,
anchor: &Q
)
fn add_child_at_anchor<P: IsA<Widget>, Q: IsA<TextChildAnchor>>(
&self,
child: &P,
anchor: &Q
)
Adds a child widget in the text buffer, at the given anchor
.
child
a Widget
anchor
a TextChildAnchor
in the TextBuffer
for self
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
fn 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
fn 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
fn 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)
fn 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
fn 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
fn accepts_tab(&self) -> bool
fn accepts_tab(&self) -> bool
Returns whether pressing the <kbd>
Tab</kbd>
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.
fn bottom_margin(&self) -> i32
fn bottom_margin(&self) -> i32
fn 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
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
fn is_cursor_visible(&self) -> bool
fn is_cursor_visible(&self) -> bool
fn is_editable(&self) -> bool
fn is_editable(&self) -> bool
fn 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
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
fn input_hints(&self) -> InputHints
fn input_hints(&self) -> InputHints
Gets the input-hints
of the TextView
.
fn input_purpose(&self) -> InputPurpose
fn input_purpose(&self) -> InputPurpose
Gets the input-purpose
of the TextView
.
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.
fn 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
fn 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
fn 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
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
fn ltr_context(&self) -> Context
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
fn is_monospace(&self) -> bool
fn is_monospace(&self) -> bool
fn overwrites(&self) -> bool
fn overwrites(&self) -> bool
fn 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
fn 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
fn 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
fn 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
fn rtl_context(&self) -> Context
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
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()``.
fn top_margin(&self) -> i32
fn top_margin(&self) -> i32
fn 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
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
fn 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
fn place_cursor_onscreen(&self) -> bool
fn place_cursor_onscreen(&self) -> bool
fn 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).
fn 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.
fn scroll_mark_onscreen<P: IsA<TextMark>>(&self, mark: &P)
fn scroll_mark_onscreen<P: IsA<TextMark>>(&self, mark: &P)
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
fn set_accepts_tab(&self, accepts_tab: bool)
fn set_accepts_tab(&self, accepts_tab: bool)
Sets the behavior of the text widget when the <kbd>
Tab</kbd>
key is pressed.
If accepts_tab
is true
, a tab character is inserted. If accepts_tab
is false
the keyboard focus is moved to the next widget in the focus
chain.
accepts_tab
true
if pressing the Tab key should insert a tab
character, false
, if pressing the Tab key should move the
keyboard focus.
fn 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
fn set_buffer<P: IsA<TextBuffer>>(&self, buffer: Option<&P>)
fn set_buffer<P: IsA<TextBuffer>>(&self, buffer: Option<&P>)
fn 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
property::GtkSettings::gtk-keynav-use-caret
setting.
setting
whether to show the insertion cursor
fn set_editable(&self, setting: bool)
fn set_editable(&self, setting: bool)
fn set_gutter<P: IsA<Widget>>(&self, win: TextWindowType, widget: Option<&P>)
fn set_gutter<P: IsA<Widget>>(&self, win: TextWindowType, widget: Option<&P>)
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
fn 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
fn set_input_hints(&self, hints: InputHints)
fn set_input_hints(&self, hints: InputHints)
fn set_input_purpose(&self, purpose: InputPurpose)
fn set_input_purpose(&self, purpose: InputPurpose)
fn 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
fn 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
fn set_monospace(&self, monospace: bool)
fn set_monospace(&self, monospace: bool)
fn set_overwrite(&self, overwrite: bool)
fn set_overwrite(&self, overwrite: bool)
fn 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
fn 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
fn 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
fn 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
Sets the default tab stops for paragraphs in self
.
Tags in the buffer may override the default.
tabs
tabs as a pango::TabArray
fn 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
fn set_wrap_mode(&self, wrap_mode: WrapMode)
fn set_wrap_mode(&self, wrap_mode: WrapMode)
fn 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
fn 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)
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 property::Settings::gtk-im-module
property.
fn 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 property::Settings::gtk-im-module
property.
fn 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
<kbd>
Backspace</kbd>
and <kbd>
Shift</kbd>
-<kbd>
Backspace</kbd>
.
fn emit_backspace(&self)
fn 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
<kbd>
Ctrl</kbd>
-<kbd>
c</kbd>
and
<kbd>
Ctrl</kbd>
-<kbd>
Insert</kbd>
.
fn emit_copy_clipboard(&self)
fn 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
<kbd>
Ctrl</kbd>
-<kbd>
x</kbd>
and
<kbd>
Shift</kbd>
-<kbd>
Delete</kbd>
.
fn emit_cut_clipboard(&self)
fn 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 <kbd>
Delete</kbd>
for
deleting a character, <kbd>
Ctrl</kbd>
-<kbd>
Delete</kbd>
for
deleting a word and <kbd>
Ctrl</kbd>
-<kbd>
Backspace</kbd>
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)
fn connect_extend_selection<F: Fn(&Self, TextExtendSelection, &TextIter, &TextIter, &TextIter) -> Inhibit + 'static>(
&self,
f: F
) -> SignalHandlerId
fn connect_extend_selection<F: Fn(&Self, TextExtendSelection, &TextIter, &TextIter, &TextIter) -> Inhibit + '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.
fn 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)
fn 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
<kbd>
Ctrl</kbd>
-<kbd>
.</kbd>
and
<kbd>
Ctrl</kbd>
-<kbd>
;</kbd>
fn emit_insert_emoji(&self)
fn 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 <kbd>
Shift</kbd>
modifier extends the
selection, the variant without it does not.
There are too many key combinations to list them all here.
<kbd>
←</kbd>
,<kbd>
→</kbd>
,<kbd>
↑</kbd>
,<kbd>
↓</kbd>
move by individual characters/lines<kbd>
Ctrl</kbd>
-<kbd>
→</kbd>
, etc. move by words/paragraphs<kbd>
Home</kbd>
,<kbd>
End</kbd>
move to the ends of the buffer<kbd>
PgUp</kbd>
,<kbd>
PgDn</kbd>
move vertically by pages<kbd>
Ctrl</kbd>
-<kbd>
PgUp</kbd>
,<kbd>
Ctrl</kbd>
-<kbd>
PgDn</kbd>
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
)
fn 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)
fn 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
<kbd>
Ctrl</kbd>
-<kbd>
v</kbd>
and
<kbd>
Shift</kbd>
-<kbd>
Insert</kbd>
.
fn emit_paste_clipboard(&self)
fn 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)
fn 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
<kbd>
Ctrl</kbd>
-<kbd>
a</kbd>
and
<kbd>
Ctrl</kbd>
-<kbd>
/</kbd>
for selecting and
<kbd>
Shift</kbd>
-<kbd>
Ctrl</kbd>
-<kbd>
a</kbd>
and
<kbd>
Ctrl</kbd>
-<kbd>
`` for unselecting.
select
fn emit_select_all(&self, select: bool)
fn 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)
fn 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 <kbd>
F7</kbd>
.
fn emit_toggle_cursor_visible(&self)
fn 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 <kbd>
Insert</kbd>
.