pub trait TextBufferExtManual:
Sealed
+ IsA<TextBuffer>
+ 'static {
// Provided methods
fn create_tag(
&self,
tag_name: Option<&str>,
properties: &[(&str, &dyn ToValue)],
) -> Option<TextTag> { ... }
fn insert_with_tags(
&self,
iter: &mut TextIter,
text: &str,
tags: &[&TextTag],
) { ... }
fn insert_with_tags_by_name(
&self,
iter: &mut TextIter,
text: &str,
tags_names: &[&str],
) { ... }
fn connect_insert_text<F: Fn(&Self, &mut TextIter, &str) + 'static>(
&self,
f: F,
) -> SignalHandlerId { ... }
fn add_commit_notify<P: Fn(&TextBuffer, TextBufferNotifyFlags, u32, u32) + 'static>(
&self,
flags: TextBufferNotifyFlags,
commit_notify: P,
) -> u32 { ... }
}
Expand description
Trait containing manually implemented methods of
TextBuffer
.
Provided Methods§
Sourcefn create_tag(
&self,
tag_name: Option<&str>,
properties: &[(&str, &dyn ToValue)],
) -> Option<TextTag>
fn create_tag( &self, tag_name: Option<&str>, properties: &[(&str, &dyn ToValue)], ) -> Option<TextTag>
§Panics
If the properties don’t exists or are not writeable. Creates a tag and adds it to the tag table for @self.
Equivalent to calling TextTag::new()
and then adding the
tag to the buffer’s tag table. The returned tag is owned by
the buffer’s tag table, so the ref count will be equal to one.
If @tag_name is None
, the tag is anonymous.
If @tag_name is non-None
, a tag called @tag_name must not already
exist in the tag table for this buffer.
The @first_property_name argument and subsequent arguments are a list of properties to set on the tag, as with g_object_set().
§tag_name
name of the new tag
§first_property_name
name of first property to set
§Returns
a new tag
Inserts @text into @self at @iter, applying the list of tags to the newly-inserted text.
The last tag specified must be None
to terminate the list.
Equivalent to calling TextBufferExt::insert()
,
then TextBufferExt::apply_tag()
on the inserted text;
this is just a convenience function.
§iter
an iterator in @self
§text
UTF-8 text
§len
length of @text, or -1
§first_tag
first tag to apply to @text
Inserts @text into @self at @iter, applying the list of tags to the newly-inserted text.
Same as insert_with_tags()
, but allows you
to pass in tag names instead of tag objects.
§iter
position in @self
§text
UTF-8 text
§len
length of @text, or -1
§first_tag_name
name of a tag to apply to @text
Sourcefn connect_insert_text<F: Fn(&Self, &mut TextIter, &str) + 'static>(
&self,
f: F,
) -> SignalHandlerId
fn connect_insert_text<F: Fn(&Self, &mut TextIter, &str) + 'static>( &self, f: F, ) -> SignalHandlerId
Emitted to insert text in a TextBuffer
.
Insertion actually occurs in the default handler.
Note that if your handler runs before the default handler it must not invalidate the @location iter (or has to revalidate it). The default signal handler revalidates it to point to the end of the inserted text.
See also: TextBufferExt::insert()
,
TextBufferExt::insert_range()
.
§location
position to insert @text in @textbuffer
§text
the UTF-8 text to be inserted
§len
length of the inserted text in bytes
Sourcefn add_commit_notify<P: Fn(&TextBuffer, TextBufferNotifyFlags, u32, u32) + 'static>(
&self,
flags: TextBufferNotifyFlags,
commit_notify: P,
) -> u32
Available on crate feature v4_16
only.
fn add_commit_notify<P: Fn(&TextBuffer, TextBufferNotifyFlags, u32, u32) + 'static>( &self, flags: TextBufferNotifyFlags, commit_notify: P, ) -> u32
v4_16
only.Adds a `callback::Gtk::TextBufferCommitNotify to be called when a change is to be made to the [type@Gtk.TextBuffer].
Functions are explicitly forbidden from making changes to the [type@Gtk.TextBuffer] from this callback. It is intended for tracking changes to the buffer only.
It may be advantageous to use callback::Gtk::TextBufferCommitNotify over connecting to the [
insert-text][struct@crate::TextBuffer#insert-text] or [
delete-range`]crate::TextBuffer signals to avoid ordering issues with
other signal handlers which may further modify the [type@Gtk.TextBuffer].
§flags
which notifications should be dispatched to @callback
§commit_notify
a `callback::Gtk::TextBufferCommitNotify to call for commit notifications
§Returns
a handler id which may be used to remove the commit notify
callback using TextBufferExt::remove_commit_notify()
.
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.