Trait gtk4::prelude::TextBufferExtManual
source · 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 { ... }
}
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