TextTagTableProtocol
public protocol TextTagTableProtocol : ObjectProtocol, BuildableProtocol
The collection of tags in a GtkTextBuffer
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.
GtkTextTagTables as GtkBuildable
The GtkTextTagTable
implementation of the GtkBuildable
interface
supports adding tags by specifying “tag” as the “type” attribute
of a <child> element.
An example of a UI definition fragment specifying tags:
<object class="GtkTextTagTable">
<child type="tag">
<object class="GtkTextTag"/>
</child>
</object>
The TextTagTableProtocol
protocol exposes the methods and properties of an underlying GtkTextTagTable
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 TextTagTable
.
Alternatively, use TextTagTableRef
as a lighweight, unowned
reference if you already have an instance you just want to use.
-
Untyped pointer to the underlying
GtkTextTagTable
instance.Declaration
Swift
var ptr: UnsafeMutableRawPointer! { get }
-
text_tag_table_ptr
Default implementationTyped pointer to the underlying
GtkTextTagTable
instance.Default Implementation
Return the stored, untyped pointer as a typed pointer to the
GtkTextTagTable
instance.Declaration
Swift
var text_tag_table_ptr: UnsafeMutablePointer<GtkTextTagTable>! { get }
-
Required Initialiser for types conforming to
TextTagTableProtocol
Declaration
Swift
init(raw: UnsafeMutableRawPointer)
-
connect(signal:
Extension methodflags: handler: ) Connect a Swift signal handler to the given, typed
TextTagTableSignalName
signalDeclaration
Swift
@discardableResult @inlinable func connect(signal s: TextTagTableSignalName, flags f: ConnectFlags = ConnectFlags(0), handler h: @escaping SignalHandler) -> Int
Parameters
signal
The signal to connect
flags
The connection flags to use
data
A pointer to user data to provide to the callback
destroyData
A
GClosureNotify
C function to destroy the data pointed to byuserData
handler
The Swift signal handler (function or callback) to invoke on the given signal
Return Value
The signal handler ID (always greater than 0 for successful connections)
-
connect(signal:
Extension methodflags: data: destroyData: signalHandler: ) Connect a C signal handler to the given, typed
TextTagTableSignalName
signalDeclaration
Swift
@discardableResult @inlinable func connect(signal s: TextTagTableSignalName, flags f: ConnectFlags = ConnectFlags(0), data userData: gpointer!, destroyData destructor: GClosureNotify? = nil, signalHandler h: @escaping GCallback) -> Int
Parameters
signal
The signal to connect
flags
The connection flags to use
data
A pointer to user data to provide to the callback
destroyData
A
GClosureNotify
C function to destroy the data pointed to byuserData
signalHandler
The C function to be called on the given signal
Return Value
The signal handler ID (always greater than 0 for successful connections)
-
onTagAdded(flags:
Extension methodhandler: ) Emitted every time a new tag is added in the
GtkTextTagTable
.Note
This represents the underlyingtag-added
signalDeclaration
Swift
@discardableResult @inlinable func onTagAdded(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: TextTagTableRef, _ tag: TextTagRef) -> Void) -> Int
Parameters
flags
Flags
unownedSelf
Reference to instance of self
tag
the added tag.
handler
The signal handler to call Run the given callback whenever the
tagAdded
signal is emitted -
tagAddedSignal
Extension methodTyped
tag-added
signal for using theconnect(signal:)
methodsDeclaration
Swift
static var tagAddedSignal: TextTagTableSignalName { get }
-
onTagChanged(flags:
Extension methodhandler: ) Emitted every time a tag in the
GtkTextTagTable
changes.Note
This represents the underlyingtag-changed
signalDeclaration
Swift
@discardableResult @inlinable func onTagChanged(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: TextTagTableRef, _ tag: TextTagRef, _ sizeChanged: Bool) -> Void) -> Int
Parameters
flags
Flags
unownedSelf
Reference to instance of self
tag
the changed tag.
sizeChanged
whether the change affects the
GtkTextView
layout.handler
The signal handler to call Run the given callback whenever the
tagChanged
signal is emitted -
tagChangedSignal
Extension methodTyped
tag-changed
signal for using theconnect(signal:)
methodsDeclaration
Swift
static var tagChangedSignal: TextTagTableSignalName { get }
-
onTagRemoved(flags:
Extension methodhandler: ) Emitted every time a tag is removed from the
GtkTextTagTable
.The
tag
is still valid by the time the signal is emitted, but it is not associated with a tag table any more.Note
This represents the underlyingtag-removed
signalDeclaration
Swift
@discardableResult @inlinable func onTagRemoved(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: TextTagTableRef, _ tag: TextTagRef) -> Void) -> Int
Parameters
flags
Flags
unownedSelf
Reference to instance of self
tag
the removed tag.
handler
The signal handler to call Run the given callback whenever the
tagRemoved
signal is emitted -
tagRemovedSignal
Extension methodTyped
tag-removed
signal for using theconnect(signal:)
methodsDeclaration
Swift
static var tagRemovedSignal: TextTagTableSignalName { get }
-
add(tag:
Extension method) Add a tag to the table.
The tag is assigned the highest priority in the table.
tag
must not be in a tag table already, and may not have the same name as an already-added tag.Declaration
Swift
@inlinable func add<TextTagT>(tag: TextTagT) -> Bool where TextTagT : TextTagProtocol
-
foreach(func:
Extension methoddata: ) Calls
func
on each tag intable
, with user datadata
.Note that the table may not be modified while iterating over it (you can’t add/remove tags).
Declaration
Swift
@inlinable func foreach(func: @escaping GtkTextTagTableForeach, data: gpointer! = nil)
-
getSize()
Extension methodReturns the size of the table (number of tags)
Declaration
Swift
@inlinable func getSize() -> Int
-
lookup(name:
Extension method) Look up a named tag.
Declaration
Swift
@inlinable func lookup(name: UnsafePointer<CChar>!) -> TextTagRef!
-
remove(tag:
Extension method) Remove a tag from the table.
If a
GtkTextBuffer
hastable
as its tag table, the tag is removed from the buffer. The table’s reference to the tag is removed, so the tag will end up destroyed if you don’t have a reference to it.Declaration
Swift
@inlinable func remove<TextTagT>(tag: TextTagT) where TextTagT : TextTagProtocol
-
size
Extension methodReturns the size of the table (number of tags)
Declaration
Swift
@inlinable var size: Int { get }