Skip to main content

TextBuffer

Struct TextBuffer 

Source
pub struct TextBuffer { /* private fields */ }
Expand description

You may wish to begin by reading the text widget conceptual overview which gives an overview of all the objects and data types related to the text widget and how they work together.

§Properties

§copy-target-list

The list of targets this buffer supports for clipboard copying and as DND source.

Readable

§cursor-position

The position of the insert mark (as offset from the beginning of the buffer). It is useful for getting notified when the cursor moves.

Readable

§has-selection

Whether the buffer has some text currently selected.

Readable

§paste-target-list

The list of targets this buffer supports for clipboard pasting and as DND destination.

Readable

§tag-table

Readable | Writable | Construct Only

§text

The text content of the buffer. Without child widgets and images, see TextBufferExt::text() for more information.

Readable | Writable

§Signals

§apply-tag

The ::apply-tag signal is emitted to apply a tag to a range of text in a TextBuffer. Applying actually occurs in the default handler.

Note that if your handler runs before the default handler it must not invalidate the start and end iters (or has to revalidate them).

See also: TextBufferExt::apply_tag(), gtk_text_buffer_insert_with_tags(), TextBufferExt::insert_range().

§begin-user-action

The ::begin-user-action signal is emitted at the beginning of a single user-visible operation on a TextBuffer.

See also: TextBufferExt::begin_user_action(), TextBufferExt::insert_interactive(), TextBufferExt::insert_range_interactive(), TextBufferExt::delete_interactive(), TextBufferExt::backspace(), TextBufferExt::delete_selection().

§changed

The ::changed signal is emitted when the content of a TextBuffer has changed.

§delete-range

The ::delete-range signal is emitted to delete a range from a TextBuffer.

Note that if your handler runs before the default handler it must not invalidate the start and end iters (or has to revalidate them). The default signal handler revalidates the start and end iters to both point to the location where text was deleted. Handlers which run after the default handler (see g_signal_connect_after()) do not have access to the deleted text.

See also: TextBufferExt::delete().

§end-user-action

The ::end-user-action signal is emitted at the end of a single user-visible operation on the TextBuffer.

See also: TextBufferExt::end_user_action(), TextBufferExt::insert_interactive(), TextBufferExt::insert_range_interactive(), TextBufferExt::delete_interactive(), TextBufferExt::backspace(), TextBufferExt::delete_selection(), TextBufferExt::backspace().

§insert-child-anchor

The ::insert-child-anchor signal is emitted to insert a TextChildAnchor 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 be placed after the inserted anchor.

See also: TextBufferExt::insert_child_anchor().

§insert-pixbuf

The ::insert-pixbuf signal is emitted to insert a gdk_pixbuf::Pixbuf 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 be placed after the inserted pixbuf.

See also: TextBufferExt::insert_pixbuf().

§insert-text

The ::insert-text signal is 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().

§mark-deleted

The ::mark-deleted signal is emitted as notification after a TextMark is deleted.

See also: TextBufferExt::delete_mark().

§mark-set

The ::mark-set signal is emitted as notification after a TextMark is set.

See also: TextBufferExt::create_mark(), TextBufferExt::move_mark().

§modified-changed

The ::modified-changed signal is emitted when the modified bit of a TextBuffer flips.

See also: TextBufferExt::set_modified().

§paste-done

The paste-done signal is emitted after paste operation has been completed. This is useful to properly scroll the view to the end of the pasted text. See TextBufferExt::paste_clipboard() for more details.

§remove-tag

The ::remove-tag signal is emitted to remove all occurrences of tag from a range of text in a TextBuffer. Removal actually occurs in the default handler.

Note that if your handler runs before the default handler it must not invalidate the start and end iters (or has to revalidate them).

See also: TextBufferExt::remove_tag().

§Implements

TextBufferExt, [trait@glib::ObjectExt], TextBufferExtManual

GLib type: GObject with reference counted clone semantics.

Implementations§

Source§

impl TextBuffer

Source

pub const NONE: Option<&'static TextBuffer> = None

Source

pub fn new(table: Option<&impl IsA<TextTagTable>>) -> TextBuffer

Creates a new text buffer.

§table

a tag table, or None to create a new one

§Returns

a new text buffer

Source

pub fn builder() -> TextBufferBuilder

Creates a new builder-pattern struct instance to construct TextBuffer objects.

This method returns an instance of TextBufferBuilder which can be used to create TextBuffer objects.

Trait Implementations§

Source§

impl Clone for TextBuffer

Source§

fn clone(&self) -> Self

Makes a clone of this shared reference.

This increments the strong reference count of the object. Dropping the object will decrement it again.

1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for TextBuffer

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for TextBuffer

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Eq for TextBuffer

Source§

impl HasParamSpec for TextBuffer

Source§

type ParamSpec = ParamSpecObject

Source§

type SetValue = TextBuffer

Preferred value to be used as setter for the associated ParamSpec.
Source§

type BuilderFn = fn(&str) -> ParamSpecObjectBuilder<'_, TextBuffer>

Source§

fn param_spec_builder() -> Self::BuilderFn

Source§

impl Hash for TextBuffer

Source§

fn hash<H>(&self, state: &mut H)
where H: Hasher,

Hashes the memory address of this object.

1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl Ord for TextBuffer

Source§

fn cmp(&self, other: &Self) -> Ordering

Comparison for two GObjects.

Compares the memory addresses of the provided objects.

1.21.0 (const: unstable) · Source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 (const: unstable) · Source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 (const: unstable) · Source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
Source§

impl ParentClassIs for TextBuffer

Source§

impl<OT: ObjectType> PartialEq<OT> for TextBuffer

Source§

fn eq(&self, other: &OT) -> bool

Equality for two GObjects.

Two GObjects are equal if their memory addresses are equal.

1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl<OT: ObjectType> PartialOrd<OT> for TextBuffer

Source§

fn partial_cmp(&self, other: &OT) -> Option<Ordering>

Partial comparison for two GObjects.

Compares the memory addresses of the provided objects.

1.0.0 (const: unstable) · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 (const: unstable) · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 (const: unstable) · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 (const: unstable) · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl StaticType for TextBuffer

Source§

fn static_type() -> Type

Returns the type identifier of Self.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> Cast for T
where T: ObjectType,

Source§

fn upcast<T>(self) -> T
where T: ObjectType, Self: IsA<T>,

Upcasts an object to a superclass or interface T. Read more
Source§

fn upcast_ref<T>(&self) -> &T
where T: ObjectType, Self: IsA<T>,

Upcasts an object to a reference of its superclass or interface T. Read more
Source§

fn downcast<T>(self) -> Result<T, Self>
where T: ObjectType, Self: MayDowncastTo<T>,

Tries to downcast to a subclass or interface implementor T. Read more
Source§

fn downcast_ref<T>(&self) -> Option<&T>
where T: ObjectType, Self: MayDowncastTo<T>,

Tries to downcast to a reference of its subclass or interface implementor T. Read more
Source§

fn dynamic_cast<T>(self) -> Result<T, Self>
where T: ObjectType,

Tries to cast to an object of type T. This handles upcasting, downcasting and casting between interface and interface implementors. All checks are performed at runtime, while upcast will do many checks at compile-time already. downcast will perform the same checks at runtime as dynamic_cast, but will also ensure some amount of compile-time safety. Read more
Source§

fn dynamic_cast_ref<T>(&self) -> Option<&T>
where T: ObjectType,

Tries to cast to reference to an object of type T. This handles upcasting, downcasting and casting between interface and interface implementors. All checks are performed at runtime, while downcast and upcast will do many checks at compile-time already. Read more
Source§

unsafe fn unsafe_cast<T>(self) -> T
where T: ObjectType,

Casts to T unconditionally. Read more
Source§

unsafe fn unsafe_cast_ref<T>(&self) -> &T
where T: ObjectType,

Casts to &T unconditionally. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> FromGlibContainerAsVec<<T as GlibPtrDefault>::GlibType, *const GList> for T

Source§

unsafe fn from_glib_none_num_as_vec(ptr: *const GList, num: usize) -> Vec<T>

Source§

unsafe fn from_glib_container_num_as_vec(_: *const GList, _: usize) -> Vec<T>

Source§

unsafe fn from_glib_full_num_as_vec(_: *const GList, _: usize) -> Vec<T>

Source§

impl<T> FromGlibContainerAsVec<<T as GlibPtrDefault>::GlibType, *const GPtrArray> for T

Source§

unsafe fn from_glib_none_num_as_vec(ptr: *const GPtrArray, num: usize) -> Vec<T>

Source§

unsafe fn from_glib_container_num_as_vec( _: *const GPtrArray, _: usize, ) -> Vec<T>

Source§

unsafe fn from_glib_full_num_as_vec(_: *const GPtrArray, _: usize) -> Vec<T>

Source§

impl<T> FromGlibContainerAsVec<<T as GlibPtrDefault>::GlibType, *const GSList> for T

Source§

unsafe fn from_glib_none_num_as_vec(ptr: *const GSList, num: usize) -> Vec<T>

Source§

unsafe fn from_glib_container_num_as_vec(_: *const GSList, _: usize) -> Vec<T>

Source§

unsafe fn from_glib_full_num_as_vec(_: *const GSList, _: usize) -> Vec<T>

Source§

impl<T> FromGlibContainerAsVec<<T as GlibPtrDefault>::GlibType, *mut GList> for T

Source§

unsafe fn from_glib_none_num_as_vec(ptr: *mut GList, num: usize) -> Vec<T>

Source§

unsafe fn from_glib_container_num_as_vec(ptr: *mut GList, num: usize) -> Vec<T>

Source§

unsafe fn from_glib_full_num_as_vec(ptr: *mut GList, num: usize) -> Vec<T>

Source§

impl<T> FromGlibContainerAsVec<<T as GlibPtrDefault>::GlibType, *mut GPtrArray> for T

Source§

unsafe fn from_glib_none_num_as_vec(ptr: *mut GPtrArray, num: usize) -> Vec<T>

Source§

unsafe fn from_glib_container_num_as_vec( ptr: *mut GPtrArray, num: usize, ) -> Vec<T>

Source§

unsafe fn from_glib_full_num_as_vec(ptr: *mut GPtrArray, num: usize) -> Vec<T>

Source§

impl<T> FromGlibContainerAsVec<<T as GlibPtrDefault>::GlibType, *mut GSList> for T

Source§

unsafe fn from_glib_none_num_as_vec(ptr: *mut GSList, num: usize) -> Vec<T>

Source§

unsafe fn from_glib_container_num_as_vec(ptr: *mut GSList, num: usize) -> Vec<T>

Source§

unsafe fn from_glib_full_num_as_vec(ptr: *mut GSList, num: usize) -> Vec<T>

Source§

impl<T> FromGlibPtrArrayContainerAsVec<<T as GlibPtrDefault>::GlibType, *const GList> for T

Source§

unsafe fn from_glib_none_as_vec(ptr: *const GList) -> Vec<T>

Source§

unsafe fn from_glib_container_as_vec(_: *const GList) -> Vec<T>

Source§

unsafe fn from_glib_full_as_vec(_: *const GList) -> Vec<T>

Source§

impl<T> FromGlibPtrArrayContainerAsVec<<T as GlibPtrDefault>::GlibType, *const GPtrArray> for T

Source§

unsafe fn from_glib_none_as_vec(ptr: *const GPtrArray) -> Vec<T>

Source§

unsafe fn from_glib_container_as_vec(_: *const GPtrArray) -> Vec<T>

Source§

unsafe fn from_glib_full_as_vec(_: *const GPtrArray) -> Vec<T>

Source§

impl<T> FromGlibPtrArrayContainerAsVec<<T as GlibPtrDefault>::GlibType, *const GSList> for T

Source§

unsafe fn from_glib_none_as_vec(ptr: *const GSList) -> Vec<T>

Source§

unsafe fn from_glib_container_as_vec(_: *const GSList) -> Vec<T>

Source§

unsafe fn from_glib_full_as_vec(_: *const GSList) -> Vec<T>

Source§

impl<T> FromGlibPtrArrayContainerAsVec<<T as GlibPtrDefault>::GlibType, *mut GList> for T

Source§

unsafe fn from_glib_none_as_vec(ptr: *mut GList) -> Vec<T>

Source§

unsafe fn from_glib_container_as_vec(ptr: *mut GList) -> Vec<T>

Source§

unsafe fn from_glib_full_as_vec(ptr: *mut GList) -> Vec<T>

Source§

impl<T> FromGlibPtrArrayContainerAsVec<<T as GlibPtrDefault>::GlibType, *mut GPtrArray> for T

Source§

unsafe fn from_glib_none_as_vec(ptr: *mut GPtrArray) -> Vec<T>

Source§

unsafe fn from_glib_container_as_vec(ptr: *mut GPtrArray) -> Vec<T>

Source§

unsafe fn from_glib_full_as_vec(ptr: *mut GPtrArray) -> Vec<T>

Source§

impl<T> FromGlibPtrArrayContainerAsVec<<T as GlibPtrDefault>::GlibType, *mut GSList> for T

Source§

unsafe fn from_glib_none_as_vec(ptr: *mut GSList) -> Vec<T>

Source§

unsafe fn from_glib_container_as_vec(ptr: *mut GSList) -> Vec<T>

Source§

unsafe fn from_glib_full_as_vec(ptr: *mut GSList) -> Vec<T>

Source§

impl<'a, T, C, E> FromValueOptional<'a> for T
where T: FromValue<'a, Checker = C>, C: ValueTypeChecker<Error = ValueTypeMismatchOrNoneError<E>>, E: Error + Send + 'static,

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoClosureReturnValue for T
where T: Into<Value>,

Source§

impl<U> IsSubclassableExt for U

Source§

impl<Super, Sub> MayDowncastTo<Sub> for Super
where Super: IsA<Super>, Sub: IsA<Super>,

Source§

impl<T> ObjectExt for T
where T: ObjectType,

Source§

fn is<U>(&self) -> bool
where U: StaticType,

Returns true if the object is an instance of (can be cast to) T.
Source§

fn type_(&self) -> Type

Returns the type of the object.
Source§

fn object_class(&self) -> &Class<Object>

Returns the ObjectClass of the object. Read more
Source§

fn class(&self) -> &Class<T>
where T: IsClass,

Returns the class of the object.
Source§

fn class_of<U>(&self) -> Option<&Class<U>>
where U: IsClass,

Returns the class of the object in the given type T. Read more
Source§

fn interface<U>(&self) -> Option<InterfaceRef<'_, U>>
where U: IsInterface,

Returns the interface T of the object. Read more
Source§

fn set_property(&self, property_name: &str, value: impl Into<Value>)

Sets the property property_name of the object to value value. Read more
Source§

fn set_property_from_value(&self, property_name: &str, value: &Value)

Sets the property property_name of the object to value value. Read more
Source§

fn set_properties(&self, property_values: &[(&str, &dyn ToValue)])

Sets multiple properties of the object at once. Read more
Source§

fn set_properties_from_value(&self, property_values: &[(&str, Value)])

Sets multiple properties of the object at once. Read more
Source§

fn property<V>(&self, property_name: &str) -> V
where V: for<'b> FromValue<'b> + 'static,

Gets the property property_name of the object and cast it to the type V. Read more
Source§

fn property_value(&self, property_name: &str) -> Value

Gets the property property_name of the object. Read more
Source§

fn has_property(&self, property_name: &str) -> bool

Check if the object has a property property_name.
Source§

fn has_property_with_type(&self, property_name: &str, type_: Type) -> bool

Check if the object has a property property_name of the given type_.
Source§

fn property_type(&self, property_name: &str) -> Option<Type>

Get the type of the property property_name of this object. Read more
Source§

fn find_property(&self, property_name: &str) -> Option<ParamSpec>

Get the ParamSpec of the property property_name of this object.
Source§

fn list_properties(&self) -> PtrSlice<ParamSpec>

Return all ParamSpec of the properties of this object.
Source§

fn freeze_notify(&self) -> PropertyNotificationFreezeGuard

Freeze all property notifications until the return guard object is dropped. Read more
Source§

unsafe fn set_qdata<QD>(&self, key: Quark, value: QD)
where QD: 'static,

Set arbitrary data on this object with the given key. Read more
Source§

unsafe fn qdata<QD>(&self, key: Quark) -> Option<NonNull<QD>>
where QD: 'static,

Return previously set arbitrary data of this object with the given key. Read more
Source§

unsafe fn steal_qdata<QD>(&self, key: Quark) -> Option<QD>
where QD: 'static,

Retrieve previously set arbitrary data of this object with the given key. Read more
Source§

unsafe fn set_data<QD>(&self, key: &str, value: QD)
where QD: 'static,

Set arbitrary data on this object with the given key. Read more
Source§

unsafe fn data<QD>(&self, key: &str) -> Option<NonNull<QD>>
where QD: 'static,

Return previously set arbitrary data of this object with the given key. Read more
Source§

unsafe fn steal_data<QD>(&self, key: &str) -> Option<QD>
where QD: 'static,

Retrieve previously set arbitrary data of this object with the given key. Read more
Source§

fn block_signal(&self, handler_id: &SignalHandlerId)

Block a given signal handler. Read more
Source§

fn unblock_signal(&self, handler_id: &SignalHandlerId)

Unblock a given signal handler.
Source§

fn stop_signal_emission(&self, signal_id: SignalId, detail: Option<Quark>)

Stop emission of the currently emitted signal.
Source§

fn stop_signal_emission_by_name(&self, signal_name: &str)

Stop emission of the currently emitted signal by the (possibly detailed) signal name.
Source§

fn connect<F>( &self, signal_name: &str, after: bool, callback: F, ) -> SignalHandlerId
where F: Fn(&[Value]) -> Option<Value> + Send + Sync + 'static,

Connect to the signal signal_name on this object. Read more
Source§

fn connect_id<F>( &self, signal_id: SignalId, details: Option<Quark>, after: bool, callback: F, ) -> SignalHandlerId
where F: Fn(&[Value]) -> Option<Value> + Send + Sync + 'static,

Connect to the signal signal_id on this object. Read more
Source§

fn connect_local<F>( &self, signal_name: &str, after: bool, callback: F, ) -> SignalHandlerId
where F: Fn(&[Value]) -> Option<Value> + 'static,

Connect to the signal signal_name on this object. Read more
Source§

fn connect_local_id<F>( &self, signal_id: SignalId, details: Option<Quark>, after: bool, callback: F, ) -> SignalHandlerId
where F: Fn(&[Value]) -> Option<Value> + 'static,

Connect to the signal signal_id on this object. Read more
Source§

unsafe fn connect_unsafe<F>( &self, signal_name: &str, after: bool, callback: F, ) -> SignalHandlerId
where F: Fn(&[Value]) -> Option<Value>,

Connect to the signal signal_name on this object. Read more
Source§

unsafe fn connect_unsafe_id<F>( &self, signal_id: SignalId, details: Option<Quark>, after: bool, callback: F, ) -> SignalHandlerId
where F: Fn(&[Value]) -> Option<Value>,

Connect to the signal signal_id on this object. Read more
Source§

fn connect_closure( &self, signal_name: &str, after: bool, closure: RustClosure, ) -> SignalHandlerId

Connect a closure to the signal signal_name on this object. Read more
Source§

fn connect_closure_id( &self, signal_id: SignalId, details: Option<Quark>, after: bool, closure: RustClosure, ) -> SignalHandlerId

Connect a closure to the signal signal_id on this object. Read more
Source§

fn watch_closure(&self, closure: &impl AsRef<Closure>)

Limits the lifetime of closure to the lifetime of the object. When the object’s reference count drops to zero, the closure will be invalidated. An invalidated closure will ignore any calls to invoke_with_values, or invoke when using Rust closures.
Source§

fn emit<R>(&self, signal_id: SignalId, args: &[&dyn ToValue]) -> R

Emit signal by signal id. Read more
Source§

fn emit_with_values(&self, signal_id: SignalId, args: &[Value]) -> Option<Value>

Same as Self::emit but takes Value for the arguments.
Source§

fn emit_by_name<R>(&self, signal_name: &str, args: &[&dyn ToValue]) -> R

Emit signal by its name. Read more
Source§

fn emit_by_name_with_values( &self, signal_name: &str, args: &[Value], ) -> Option<Value>

Emit signal by its name. Read more
Source§

fn emit_by_name_with_details<R>( &self, signal_name: &str, details: Quark, args: &[&dyn ToValue], ) -> R

Emit signal by its name with details. Read more
Source§

fn emit_by_name_with_details_and_values( &self, signal_name: &str, details: Quark, args: &[Value], ) -> Option<Value>

Emit signal by its name with details. Read more
Source§

fn emit_with_details<R>( &self, signal_id: SignalId, details: Quark, args: &[&dyn ToValue], ) -> R

Emit signal by signal id with details. Read more
Source§

fn emit_with_details_and_values( &self, signal_id: SignalId, details: Quark, args: &[Value], ) -> Option<Value>

Emit signal by signal id with details. Read more
Source§

fn disconnect(&self, handler_id: SignalHandlerId)

Disconnect a previously connected signal handler.
Source§

fn connect_notify<F>(&self, name: Option<&str>, f: F) -> SignalHandlerId
where F: Fn(&T, &ParamSpec) + Send + Sync + 'static,

Connect to the notify signal of the object. Read more
Source§

fn connect_notify_local<F>(&self, name: Option<&str>, f: F) -> SignalHandlerId
where F: Fn(&T, &ParamSpec) + 'static,

Connect to the notify signal of the object. Read more
Source§

unsafe fn connect_notify_unsafe<F>( &self, name: Option<&str>, f: F, ) -> SignalHandlerId
where F: Fn(&T, &ParamSpec),

Connect to the notify signal of the object. Read more
Source§

fn notify(&self, property_name: &str)

Notify that the given property has changed its value. Read more
Source§

fn notify_by_pspec(&self, pspec: &ParamSpec)

Notify that the given property has changed its value. Read more
Source§

fn downgrade(&self) -> WeakRef<T>

Downgrade this object to a weak reference.
Source§

fn add_weak_ref_notify<F>(&self, f: F) -> WeakRefNotify<T>
where F: FnOnce() + Send + 'static,

Add a callback to be notified when the Object is disposed.
Source§

fn add_weak_ref_notify_local<F>(&self, f: F) -> WeakRefNotify<T>
where F: FnOnce() + 'static,

Add a callback to be notified when the Object is disposed. Read more
Source§

fn bind_property<'a, 'f, 't, O>( &'a self, source_property: &'a str, target: &'a O, target_property: &'a str, ) -> BindingBuilder<'a, 'f, 't>
where O: ObjectType,

Bind property source_property on this object to the target_property on the target object. Read more
Source§

fn ref_count(&self) -> u32

Returns the strong reference count of this object.
Source§

unsafe fn run_dispose(&self)

Runs the dispose mechanism of the object. Read more
Source§

impl<T> Property for T
where T: HasParamSpec,

Source§

type Value = T

Source§

impl<T> PropertyGet for T
where T: HasParamSpec,

Source§

type Value = T

Source§

fn get<R, F>(&self, f: F) -> R
where F: Fn(&<T as PropertyGet>::Value) -> R,

Source§

impl<T> StaticTypeExt for T
where T: StaticType,

Source§

fn ensure_type()

Ensures that the type has been registered with the type system.
Source§

impl<O> TextBufferExt for O
where O: IsA<TextBuffer>,

Source§

fn add_mark(&self, mark: &impl IsA<TextMark>, where_: &TextIter)

Adds the mark at position where_. The mark must not be added to another buffer, and if its name is not None then there must not be another mark in the buffer with the same name. Read more
Source§

fn add_selection_clipboard(&self, clipboard: &Clipboard)

Adds clipboard to the list of clipboards in which the selection contents of self are available. In most cases, clipboard will be the Clipboard of type GDK_SELECTION_PRIMARY for a view of self. Read more
Source§

fn apply_tag(&self, tag: &impl IsA<TextTag>, start: &TextIter, end: &TextIter)

Emits the “apply-tag” signal on self. The default handler for the signal applies tag to the given range. start and end do not have to be in order. Read more
Source§

fn apply_tag_by_name(&self, name: &str, start: &TextIter, end: &TextIter)

Calls TextTagTableExt::lookup() on the buffer’s tag table to get a TextTag, then calls apply_tag(). Read more
Source§

fn backspace( &self, iter: &mut TextIter, interactive: bool, default_editable: bool, ) -> bool

Performs the appropriate action as if the user hit the delete key with the cursor at the position specified by iter. In the normal case a single character will be deleted, but when combining accents are involved, more than one character can be deleted, and when precomposed character and accent combinations are involved, less than one character will be deleted. Read more
Source§

fn begin_user_action(&self)

Called to indicate that the buffer operations between here and a call to end_user_action() are part of a single user-visible operation. The operations between begin_user_action() and end_user_action() can then be grouped when creating an undo stack. TextBuffer maintains a count of calls to begin_user_action() that have not been closed with a call to end_user_action(), and emits the “begin-user-action” and “end-user-action” signals only for the outermost pair of calls. This allows you to build user actions from other user actions. Read more
Source§

fn copy_clipboard(&self, clipboard: &Clipboard)

Copies the currently-selected text to a clipboard. Read more
Source§

fn create_child_anchor(&self, iter: &mut TextIter) -> Option<TextChildAnchor>

This is a convenience function which simply creates a child anchor with TextChildAnchor::new() and inserts it into the buffer with insert_child_anchor(). The new anchor is owned by the buffer; no reference count is returned to the caller of create_child_anchor(). Read more
Source§

fn create_mark( &self, mark_name: Option<&str>, where_: &TextIter, left_gravity: bool, ) -> Option<TextMark>

Creates a mark at position where_. If mark_name is None, the mark is anonymous; otherwise, the mark can be retrieved by name using mark(). If a mark has left gravity, and text is inserted at the mark’s current location, the mark will be moved to the left of the newly-inserted text. If the mark has right gravity (left_gravity = false), the mark will end up on the right of newly-inserted text. The standard left-to-right cursor is a mark with right gravity (when you type, the cursor stays on the right side of the text you’re typing). Read more
Source§

fn cut_clipboard(&self, clipboard: &Clipboard, default_editable: bool)

Copies the currently-selected text to a clipboard, then deletes said text if it’s editable. Read more
Source§

fn delete(&self, start: &mut TextIter, end: &mut TextIter)

Deletes text between start and end. The order of start and end is not actually relevant; delete() will reorder them. This function actually emits the “delete-range” signal, and the default handler of that signal deletes the text. Because the buffer is modified, all outstanding iterators become invalid after calling this function; however, the start and end will be re-initialized to point to the location where text was deleted. Read more
Source§

fn delete_interactive( &self, start_iter: &mut TextIter, end_iter: &mut TextIter, default_editable: bool, ) -> bool

Deletes all editable text in the given range. Calls delete() for each editable sub-range of [start,end). start and end are revalidated to point to the location of the last deleted range, or left untouched if no text was deleted. Read more
Source§

fn delete_mark(&self, mark: &impl IsA<TextMark>)

Deletes mark, so that it’s no longer located anywhere in the buffer. Removes the reference the buffer holds to the mark, so if you haven’t called g_object_ref() on the mark, it will be freed. Even if the mark isn’t freed, most operations on mark become invalid, until it gets added to a buffer again with add_mark(). Use TextMarkExt::is_deleted() to find out if a mark has been removed from its buffer. The mark-deleted signal will be emitted as notification after the mark is deleted. Read more
Source§

fn delete_mark_by_name(&self, name: &str)

Deletes the mark named name; the mark must exist. See delete_mark() for details. Read more
Source§

fn delete_selection(&self, interactive: bool, default_editable: bool) -> bool

Deletes the range between the “insert” and “selection_bound” marks, that is, the currently-selected text. If interactive is true, the editability of the selection will be considered (users can’t delete uneditable text). Read more
Source§

fn deserialize( &self, content_buffer: &impl IsA<TextBuffer>, format: &Atom, iter: &mut TextIter, data: &[u8], ) -> Result<(), Error>

This function deserializes rich text in format format and inserts it at iter. Read more
Source§

fn deserialize_get_can_create_tags(&self, format: &Atom) -> bool

This functions returns the value set with deserialize_set_can_create_tags() Read more
Source§

fn deserialize_set_can_create_tags(&self, format: &Atom, can_create_tags: bool)

Use this function to allow a rich text deserialization function to create new tags in the receiving buffer. Note that using this function is almost always a bad idea, because the rich text functions you register should know how to map the rich text format they handler to your text buffers set of tags. Read more
Source§

fn end_user_action(&self)

Should be paired with a call to begin_user_action(). See that function for a full explanation.
Source§

fn bounds(&self) -> (TextIter, TextIter)

Retrieves the first and last iterators in the buffer, i.e. the entire buffer lies within the range [start,end). Read more
Source§

fn char_count(&self) -> i32

Gets the number of characters in the buffer; note that characters and bytes are not the same, you can’t e.g. expect the contents of the buffer in string form to be this many bytes long. The character count is cached, so this function is very fast. Read more
Source§

fn copy_target_list(&self) -> Option<TargetList>

This function returns the list of targets this text buffer can provide for copying and as DND source. The targets in the list are added with info values from the GtkTextBufferTargetInfo enum, using TargetList::add_rich_text_targets() and TargetList::add_text_targets(). Read more
Source§

fn deserialize_formats(&self) -> Vec<Atom>

This function returns the rich text deserialize formats registered with self using gtk_text_buffer_register_deserialize_format() or register_deserialize_tagset() Read more
Source§

fn end_iter(&self) -> TextIter

Initializes iter with the “end iterator,” one past the last valid character in the text buffer. If dereferenced with TextIter::char(), the end iterator has a character value of 0. The entire buffer lies in the range from the first position in the buffer (call start_iter() to get character position 0) to the end iterator. Read more
Source§

fn has_selection(&self) -> bool

Indicates whether the buffer has some text currently selected. Read more
Source§

fn get_insert(&self) -> Option<TextMark>

Returns the mark that represents the cursor (insertion point). Equivalent to calling mark() to get the mark named “insert”, but very slightly more efficient, and involves less typing. Read more
Source§

fn iter_at_child_anchor(&self, anchor: &impl IsA<TextChildAnchor>) -> TextIter

Obtains the location of anchor within self. Read more
Source§

fn iter_at_line(&self, line_number: i32) -> TextIter

Initializes iter to the start of the given line. If line_number is greater than the number of lines in the self, the end iterator is returned. Read more
Source§

fn iter_at_line_index(&self, line_number: i32, byte_index: i32) -> TextIter

Obtains an iterator pointing to byte_index within the given line. byte_index must be the start of a UTF-8 character. Note bytes, not characters; UTF-8 may encode one character as multiple bytes. Read more
Source§

fn iter_at_line_offset(&self, line_number: i32, char_offset: i32) -> TextIter

Obtains an iterator pointing to char_offset within the given line. Note characters, not bytes; UTF-8 may encode one character as multiple bytes. Read more
Source§

fn iter_at_mark(&self, mark: &impl IsA<TextMark>) -> TextIter

Initializes iter with the current position of mark. Read more
Source§

fn iter_at_offset(&self, char_offset: i32) -> TextIter

Initializes iter to a position char_offset chars from the start of the entire buffer. If char_offset is -1 or greater than the number of characters in the buffer, iter is initialized to the end iterator, the iterator one past the last valid character in the buffer. Read more
Source§

fn line_count(&self) -> i32

Obtains the number of lines in the buffer. This value is cached, so the function is very fast. Read more
Source§

fn mark(&self, name: &str) -> Option<TextMark>

Returns the mark named name in buffer self, or None if no such mark exists in the buffer. Read more
Source§

fn is_modified(&self) -> bool

Indicates whether the buffer has been modified since the last call to set_modified() set the modification flag to false. Used for example to enable a “save” function in a text editor. Read more
Source§

fn paste_target_list(&self) -> Option<TargetList>

This function returns the list of targets this text buffer supports for pasting and as DND destination. The targets in the list are added with info values from the GtkTextBufferTargetInfo enum, using TargetList::add_rich_text_targets() and TargetList::add_text_targets(). Read more
Source§

fn selection_bound(&self) -> Option<TextMark>

Returns the mark that represents the selection bound. Equivalent to calling mark() to get the mark named “selection_bound”, but very slightly more efficient, and involves less typing. Read more
Source§

fn selection_bounds(&self) -> Option<(TextIter, TextIter)>

Returns true if some text is selected; places the bounds of the selection in start and end (if the selection has length 0, then start and end are filled in with the same value). start and end will be in ascending order. If start and end are NULL, then they are not filled in, but the return value still indicates whether text is selected. Read more
Source§

fn serialize_formats(&self) -> Vec<Atom>

This function returns the rich text serialize formats registered with self using gtk_text_buffer_register_serialize_format() or register_serialize_tagset() Read more
Source§

fn slice( &self, start: &TextIter, end: &TextIter, include_hidden_chars: bool, ) -> Option<GString>

Returns the text in the range [start,end). Excludes undisplayed text (text marked with tags that set the invisibility attribute) if include_hidden_chars is false. The returned string includes a 0xFFFC character whenever the buffer contains embedded images, so byte and character indexes into the returned string do correspond to byte and character indexes into the buffer. Contrast with text(). Note that 0xFFFC can occur in normal text as well, so it is not a reliable indicator that a pixbuf or widget is in the buffer. Read more
Source§

fn start_iter(&self) -> TextIter

Initialized iter with the first position in the text buffer. This is the same as using iter_at_offset() to get the iter at character offset 0. Read more
Source§

fn tag_table(&self) -> Option<TextTagTable>

Get the TextTagTable associated with this buffer. Read more
Source§

fn text( &self, start: &TextIter, end: &TextIter, include_hidden_chars: bool, ) -> Option<GString>

Returns the text in the range [start,end). Excludes undisplayed text (text marked with tags that set the invisibility attribute) if include_hidden_chars is false. Does not include characters representing embedded images, so byte and character indexes into the returned string do not correspond to byte and character indexes into the buffer. Contrast with slice(). Read more
Source§

fn insert(&self, iter: &mut TextIter, text: &str)

Inserts len bytes of text at position iter. If len is -1, text must be nul-terminated and will be inserted in its entirety. Emits the “insert-text” signal; insertion actually occurs in the default handler for the signal. iter is invalidated when insertion occurs (because the buffer contents change), but the default signal handler revalidates it to point to the end of the inserted text. Read more
Source§

fn insert_at_cursor(&self, text: &str)

Simply calls insert(), using the current cursor position as the insertion point. Read more
Source§

fn insert_child_anchor( &self, iter: &mut TextIter, anchor: &impl IsA<TextChildAnchor>, )

Inserts a child widget anchor into the text buffer at iter. The anchor will be counted as one character in character counts, and when obtaining the buffer contents as a string, will be represented by the Unicode “object replacement character” 0xFFFC. Note that the “slice” variants for obtaining portions of the buffer as a string include this character for child anchors, but the “text” variants do not. E.g. see slice() and text(). Consider create_child_anchor() as a more convenient alternative to this function. The buffer will add a reference to the anchor, so you can unref it after insertion. Read more
Source§

fn insert_interactive( &self, iter: &mut TextIter, text: &str, default_editable: bool, ) -> bool

Like insert(), but the insertion will not occur if iter is at a non-editable location in the buffer. Usually you want to prevent insertions at ineditable locations if the insertion results from a user action (is interactive). Read more
Source§

fn insert_interactive_at_cursor( &self, text: &str, default_editable: bool, ) -> bool

Calls insert_interactive() at the cursor position. Read more
Source§

fn insert_markup(&self, iter: &mut TextIter, markup: &str)

Inserts the text in markup at position iter. markup will be inserted in its entirety and must be nul-terminated and valid UTF-8. Emits the insert-text signal, possibly multiple times; insertion actually occurs in the default handler for the signal. iter will point to the end of the inserted text on return. Read more
Source§

fn insert_pixbuf(&self, iter: &mut TextIter, pixbuf: &Pixbuf)

Inserts an image into the text buffer at iter. The image will be counted as one character in character counts, and when obtaining the buffer contents as a string, will be represented by the Unicode “object replacement character” 0xFFFC. Note that the “slice” variants for obtaining portions of the buffer as a string include this character for pixbufs, but the “text” variants do not. e.g. see slice() and text(). Read more
Source§

fn insert_range(&self, iter: &mut TextIter, start: &TextIter, end: &TextIter)

Copies text, tags, and pixbufs between start and end (the order of start and end doesn’t matter) and inserts the copy at iter. Used instead of simply getting/inserting text because it preserves images and tags. If start and end are in a different buffer from self, the two buffers must share the same tag table. Read more
Source§

fn insert_range_interactive( &self, iter: &mut TextIter, start: &TextIter, end: &TextIter, default_editable: bool, ) -> bool

Same as insert_range(), but does nothing if the insertion point isn’t editable. The default_editable parameter indicates whether the text is editable at iter if no tags enclosing iter affect editability. Typically the result of TextViewExt::is_editable() is appropriate here. Read more
Source§

fn move_mark(&self, mark: &impl IsA<TextMark>, where_: &TextIter)

Moves mark to the new location where_. Emits the mark-set signal as notification of the move. Read more
Source§

fn move_mark_by_name(&self, name: &str, where_: &TextIter)

Moves the mark named name (which must exist) to location where_. See move_mark() for details. Read more
Source§

fn paste_clipboard( &self, clipboard: &Clipboard, override_location: Option<&TextIter>, default_editable: bool, )

Pastes the contents of a clipboard. If override_location is None, the pasted text will be inserted at the cursor position, or the buffer selection will be replaced if the selection is non-empty. Read more
Source§

fn place_cursor(&self, where_: &TextIter)

This function moves the “insert” and “selection_bound” marks simultaneously. If you move them to the same place in two steps with move_mark(), you will temporarily select a region in between their old and new locations, which can be pretty inefficient since the temporarily-selected region will force stuff to be recalculated. This function moves them as a unit, which can be optimized. Read more
Source§

fn register_deserialize_tagset(&self, tagset_name: Option<&str>) -> Atom

This function registers GTK+’s internal rich text serialization format with the passed self. See register_serialize_tagset() for details. Read more
Source§

fn register_serialize_tagset(&self, tagset_name: Option<&str>) -> Atom

This function registers GTK+’s internal rich text serialization format with the passed self. The internal format does not comply to any standard rich text format and only works between TextBuffer instances. It is capable of serializing all of a text buffer’s tags and embedded pixbufs. Read more
Source§

fn remove_all_tags(&self, start: &TextIter, end: &TextIter)

Removes all tags in the range between start and end. Be careful with this function; it could remove tags added in code unrelated to the code you’re currently writing. That is, using this function is probably a bad idea if you have two or more unrelated code sections that add tags. Read more
Source§

fn remove_selection_clipboard(&self, clipboard: &Clipboard)

Source§

fn remove_tag(&self, tag: &impl IsA<TextTag>, start: &TextIter, end: &TextIter)

Emits the “remove-tag” signal. The default handler for the signal removes all occurrences of tag from the given range. start and end don’t have to be in order. Read more
Source§

fn remove_tag_by_name(&self, name: &str, start: &TextIter, end: &TextIter)

Calls TextTagTableExt::lookup() on the buffer’s tag table to get a TextTag, then calls remove_tag(). Read more
Source§

fn select_range(&self, ins: &TextIter, bound: &TextIter)

This function moves the “insert” and “selection_bound” marks simultaneously. If you move them in two steps with move_mark(), you will temporarily select a region in between their old and new locations, which can be pretty inefficient since the temporarily-selected region will force stuff to be recalculated. This function moves them as a unit, which can be optimized. Read more
Source§

fn serialize( &self, content_buffer: &impl IsA<TextBuffer>, format: &Atom, start: &TextIter, end: &TextIter, ) -> Vec<u8>

This function serializes the portion of text between start and end in the rich text format represented by format. Read more
Source§

fn set_modified(&self, setting: bool)

Used to keep track of whether the buffer has been modified since the last time it was saved. Whenever the buffer is saved to disk, call gtk_text_buffer_set_modified (self, FALSE). When the buffer is modified, it will automatically toggled on the modified bit again. When the modified bit flips, the buffer emits the modified-changed signal. Read more
Source§

fn set_text(&self, text: &str)

Deletes current contents of self, and inserts text instead. If len is -1, text must be nul-terminated. text must be valid UTF-8. Read more
Source§

fn unregister_deserialize_format(&self, format: &Atom)

This function unregisters a rich text format that was previously registered using gtk_text_buffer_register_deserialize_format() or register_deserialize_tagset(). Read more
Source§

fn unregister_serialize_format(&self, format: &Atom)

This function unregisters a rich text format that was previously registered using gtk_text_buffer_register_serialize_format() or register_serialize_tagset() Read more
Source§

fn cursor_position(&self) -> i32

The position of the insert mark (as offset from the beginning of the buffer). It is useful for getting notified when the cursor moves.
Source§

fn connect_begin_user_action<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId

The ::begin-user-action signal is emitted at the beginning of a single user-visible operation on a TextBuffer. Read more
Source§

fn connect_changed<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId

The ::changed signal is emitted when the content of a TextBuffer has changed.
Source§

fn connect_end_user_action<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId

The ::end-user-action signal is emitted at the end of a single user-visible operation on the TextBuffer. Read more
Source§

fn connect_mark_deleted<F: Fn(&Self, &TextMark) + 'static>( &self, f: F, ) -> SignalHandlerId

The ::mark-deleted signal is emitted as notification after a TextMark is deleted. Read more
Source§

fn connect_mark_set<F: Fn(&Self, &TextIter, &TextMark) + 'static>( &self, f: F, ) -> SignalHandlerId

The ::mark-set signal is emitted as notification after a TextMark is set. Read more
Source§

fn connect_modified_changed<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId

The ::modified-changed signal is emitted when the modified bit of a TextBuffer flips. Read more
Source§

fn connect_paste_done<F: Fn(&Self, &Clipboard) + 'static>( &self, f: F, ) -> SignalHandlerId

The paste-done signal is emitted after paste operation has been completed. This is useful to properly scroll the view to the end of the pasted text. See paste_clipboard() for more details. Read more
Source§

fn connect_copy_target_list_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId

Source§

fn connect_cursor_position_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId

Source§

fn connect_has_selection_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId

Source§

fn connect_paste_target_list_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId

Source§

fn connect_text_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId

Source§

impl<O> TextBufferExtManual for O
where O: IsA<TextBuffer>,

Source§

fn connect_apply_tag<F: Fn(&Self, &TextTag, &mut TextIter, &mut TextIter) + 'static>( &self, f: F, ) -> SignalHandlerId

The ::apply-tag signal is emitted to apply a tag to a range of text in a TextBuffer. Applying actually occurs in the default handler. Read more
Source§

fn connect_delete_range<F: Fn(&Self, &mut TextIter, &mut TextIter) + 'static>( &self, f: F, ) -> SignalHandlerId

The ::delete-range signal is emitted to delete a range from a TextBuffer. Read more
Source§

fn connect_insert_child_anchor<F: Fn(&Self, &mut TextIter, &TextChildAnchor) + 'static>( &self, f: F, ) -> SignalHandlerId

The ::insert-child-anchor signal is emitted to insert a TextChildAnchor in a TextBuffer. Insertion actually occurs in the default handler. Read more
Source§

fn connect_insert_pixbuf<F: Fn(&Self, &mut TextIter, &Pixbuf) + 'static>( &self, f: F, ) -> SignalHandlerId

The ::insert-pixbuf signal is emitted to insert a gdk_pixbuf::Pixbuf in a TextBuffer. Insertion actually occurs in the default handler. Read more
Source§

fn connect_insert_text<F: Fn(&Self, &mut TextIter, &str) + 'static>( &self, f: F, ) -> SignalHandlerId

The ::insert-text signal is emitted to insert text in a TextBuffer. Insertion actually occurs in the default handler. Read more
Source§

fn connect_remove_tag<F: Fn(&Self, &TextTag, &mut TextIter, &mut TextIter) + 'static>( &self, f: F, ) -> SignalHandlerId

The ::remove-tag signal is emitted to remove all occurrences of tag from a range of text in a TextBuffer. Removal actually occurs in the default handler. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> TransparentType for T

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T> TryFromClosureReturnValue for T
where T: for<'a> FromValue<'a> + StaticType + 'static,

Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.