TextMarkRef
public struct TextMarkRef : TextMarkProtocol, GWeakCapturing
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 TextMarkRef
type acts as a lightweight Swift reference to an underlying GtkTextMark
instance.
It exposes methods that can operate on this data type through TextMarkProtocol
conformance.
Use TextMarkRef
only as an unowned
reference to an existing GtkTextMark
instance.
-
Untyped pointer to the underlying `GtkTextMark` instance.
For type-safe access, use the generated, typed pointer
text_mark_ptr
property instead.Declaration
Swift
public let ptr: UnsafeMutableRawPointer!
-
Designated initialiser from the underlying
C
data typeDeclaration
Swift
@inlinable init(_ p: UnsafeMutablePointer<GtkTextMark>)
-
Designated initialiser from a constant pointer to the underlying
C
data typeDeclaration
Swift
@inlinable init(_ p: UnsafePointer<GtkTextMark>)
-
Conditional initialiser from an optional pointer to the underlying
C
data typeDeclaration
Swift
@inlinable init!(_ maybePointer: UnsafeMutablePointer<GtkTextMark>?)
-
Conditional initialiser from an optional, non-mutable pointer to the underlying
C
data typeDeclaration
Swift
@inlinable init!(_ maybePointer: UnsafePointer<GtkTextMark>?)
-
Conditional initialiser from an optional
gpointer
Declaration
Swift
@inlinable init!(gpointer g: gpointer?)
-
Conditional initialiser from an optional, non-mutable
gconstpointer
Declaration
Swift
@inlinable init!(gconstpointer g: gconstpointer?)
-
Reference intialiser for a related type that implements
TextMarkProtocol
Declaration
Swift
@inlinable init<T>(_ other: T) where T : TextMarkProtocol
-
This factory is syntactic sugar for setting weak pointers wrapped in
GWeak<T>
Declaration
Swift
@inlinable static func unowned<T>(_ other: T) -> TextMarkRef where T : TextMarkProtocol
-
Unsafe typed initialiser. Do not use unless you know the underlying data type the pointer points to conforms to
TextMarkProtocol
.Declaration
Swift
@inlinable init<T>(cPointer: UnsafeMutablePointer<T>)
-
Unsafe typed initialiser. Do not use unless you know the underlying data type the pointer points to conforms to
TextMarkProtocol
.Declaration
Swift
@inlinable init<T>(constPointer: UnsafePointer<T>)
-
Unsafe untyped initialiser. Do not use unless you know the underlying data type the pointer points to conforms to
TextMarkProtocol
.Declaration
Swift
@inlinable init(mutating raw: UnsafeRawPointer)
-
Unsafe untyped initialiser. Do not use unless you know the underlying data type the pointer points to conforms to
TextMarkProtocol
.Declaration
Swift
@inlinable init(raw: UnsafeMutableRawPointer)
-
Unsafe untyped initialiser. Do not use unless you know the underlying data type the pointer points to conforms to
TextMarkProtocol
.Declaration
Swift
@inlinable init(opaquePointer: OpaquePointer)
-
Creates a text mark. Add it to a buffer using `gtk_text_buffer_add_mark()`.
If
name
isnil
, the mark is anonymous; otherwise, the mark can be retrieved by name usinggtk_text_buffer_get_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).Declaration
Swift
@inlinable init(name: UnsafePointer<gchar>? = nil, leftGravity: Bool)