TextMarkProtocol
public protocol TextMarkProtocol : ObjectProtocol
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.
A GtkTextMark
is like a bookmark in a text buffer; it preserves a position in
the text. You can convert the mark to an iterator using
gtk_text_buffer_get_iter_at_mark()
. Unlike iterators, marks remain valid across
buffer mutations, because their behavior is defined when text is inserted or
deleted. When text containing a mark is deleted, the mark remains in the
position originally occupied by the deleted text. When text is inserted at a
mark, a mark with “left gravity” will be moved to the
beginning of the newly-inserted text, and a mark with “right
gravity” will be moved to the end.
Note that “left” and “right” here refer to logical direction (left is the toward the start of the buffer); in some languages such as Hebrew the logically-leftmost text is not actually on the left when displayed.
Marks are reference counted, but the reference count only controls the validity
of the memory; marks can be deleted from the buffer at any time with
gtk_text_buffer_delete_mark()
. Once deleted from the buffer, a mark is
essentially useless.
Marks optionally have names; these can be convenient to avoid passing the
GtkTextMark
object around.
Marks are typically created using the gtk_text_buffer_create_mark()
function.
The TextMarkProtocol
protocol exposes the methods and properties of an underlying GtkTextMark
instance.
The default implementation of these can be found in the protocol extension below.
For a concrete class that implements these methods and properties, see TextMark
.
Alternatively, use TextMarkRef
as a lighweight, unowned
reference if you already have an instance you just want to use.
-
Untyped pointer to the underlying
GtkTextMark
instance.Declaration
Swift
var ptr: UnsafeMutableRawPointer! { get }
-
text_mark_ptr
Default implementationTyped pointer to the underlying
GtkTextMark
instance.Default Implementation
Return the stored, untyped pointer as a typed pointer to the
GtkTextMark
instance.Declaration
Swift
var text_mark_ptr: UnsafeMutablePointer<GtkTextMark>! { get }
-
Required Initialiser for types conforming to
TextMarkProtocol
Declaration
Swift
init(raw: UnsafeMutableRawPointer)
-
bind(property:
Extension methodto: _: flags: transformFrom: transformTo: ) Bind a
TextMarkPropertyName
source property to a given target object.Declaration
Swift
@discardableResult @inlinable func bind<Q, T>(property source_property: TextMarkPropertyName, to target: T, _ target_property: Q, flags f: BindingFlags = .default, transformFrom transform_from: @escaping GLibObject.ValueTransformer = { $0.transform(destValue: $1) }, transformTo transform_to: @escaping GLibObject.ValueTransformer = { $0.transform(destValue: $1) }) -> BindingRef! where Q : PropertyNameProtocol, T : ObjectProtocol
Parameters
source_property
the source property to bind
target
the target object to bind to
target_property
the target property to bind to
flags
the flags to pass to the
Binding
transform_from
ValueTransformer
to use for forward transformationtransform_to
ValueTransformer
to use for backwards transformationReturn Value
binding reference or
nil
in case of an error -
get(property:
Extension method) Get the value of a TextMark property
Declaration
Swift
@inlinable func get(property: TextMarkPropertyName) -> GLibObject.Value
Parameters
property
the property to get the value for
Return Value
the value of the named property
-
set(property:
Extension methodvalue: ) Set the value of a TextMark property. Note that this will only have an effect on properties that are writable and not construct-only!
Declaration
Swift
@inlinable func set(property: TextMarkPropertyName, value v: GLibObject.Value)
Parameters
property
the property to get the value for
Return Value
the value of the named property
-
getBuffer()
Extension methodGets the buffer this mark is located inside, or
nil
if the mark is deleted.Declaration
Swift
@inlinable func getBuffer() -> TextBufferRef!
-
getDeleted()
Extension methodReturns
true
if the mark has been removed from its buffer withgtk_text_buffer_delete_mark()
. Seegtk_text_buffer_add_mark()
for a way to add it to a buffer again.Declaration
Swift
@inlinable func getDeleted() -> Bool
-
getLeftGravity()
Extension methodDetermines whether the mark has left gravity.
Declaration
Swift
@inlinable func getLeftGravity() -> Bool
-
getName()
Extension methodReturns the mark name; returns NULL for anonymous marks.
Declaration
Swift
@inlinable func getName() -> String!
-
getVisible()
Extension methodReturns
true
if the mark is visible (i.e. a cursor is displayed for it).Declaration
Swift
@inlinable func getVisible() -> Bool
-
setVisible(setting:
Extension method) Sets the visibility of
mark
; the insertion point is normally visible, i.e. you can see it as a vertical bar. Also, the text widget uses a visible mark to indicate where a drop will occur when dragging-and-dropping text. Most other marks are not visible. Marks are not visible by default.Declaration
Swift
@inlinable func setVisible(setting: Bool)
-
buffer
Extension methodGets the buffer this mark is located inside, or
nil
if the mark is deleted.Declaration
Swift
@inlinable var buffer: TextBufferRef! { get }
-
deleted
Extension methodReturns
true
if the mark has been removed from its buffer withgtk_text_buffer_delete_mark()
. Seegtk_text_buffer_add_mark()
for a way to add it to a buffer again.Declaration
Swift
@inlinable var deleted: Bool { get }
-
leftGravity
Extension methodDetermines whether the mark has left gravity.
Declaration
Swift
@inlinable var leftGravity: Bool { get }
-
name
Extension methodThe name of the mark or
nil
if the mark is anonymous.Declaration
Swift
@inlinable var name: String! { get }
-
visible
Extension methodReturns
true
if the mark is visible (i.e. a cursor is displayed for it).Declaration
Swift
@inlinable var visible: Bool { get nonmutating set }
-
parentInstance
Extension methodUndocumented
Declaration
Swift
@inlinable var parentInstance: GObject { get }