HypertextProtocol
public protocol HypertextProtocol
An interface used for objects which implement linking between multiple resource or content locations, or multiple ‘markers’ within a single document. A Hypertext instance is associated with one or more Hyperlinks, which are associated with particular offsets within the Hypertext’s included content. While this interface is derived from Text, there is no requirement that Hypertext instances have textual content; they may implement Image as well, and Hyperlinks need not have non-zero text offsets.
The HypertextProtocol
protocol exposes the methods and properties of an underlying AtkHypertext
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 Hypertext
.
Alternatively, use HypertextRef
as a lighweight, unowned
reference if you already have an instance you just want to use.
-
Untyped pointer to the underlying
AtkHypertext
instance.Declaration
Swift
var ptr: UnsafeMutableRawPointer! { get }
-
hypertext_ptr
Default implementationTyped pointer to the underlying
AtkHypertext
instance.Default Implementation
Return the stored, untyped pointer as a typed pointer to the
AtkHypertext
instance.Declaration
Swift
var hypertext_ptr: UnsafeMutablePointer<AtkHypertext>! { get }
-
Required Initialiser for types conforming to
HypertextProtocol
Declaration
Swift
init(raw: UnsafeMutableRawPointer)
-
connect(signal:
Extension methodflags: handler: ) Connect a Swift signal handler to the given, typed
HypertextSignalName
signalDeclaration
Swift
@discardableResult @inlinable func connect(signal s: HypertextSignalName, 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
HypertextSignalName
signalDeclaration
Swift
@discardableResult @inlinable func connect(signal s: HypertextSignalName, 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)
-
onLinkSelected(flags:
Extension methodhandler: ) The “link-selected” signal is emitted by an AtkHyperText object when one of the hyperlinks associated with the object is selected.
Note
This represents the underlyinglink-selected
signalDeclaration
Swift
@discardableResult @inlinable func onLinkSelected(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: HypertextRef, _ arg1: Int) -> Void) -> Int
Parameters
flags
Flags
unownedSelf
Reference to instance of self
arg1
the index of the hyperlink which is selected
handler
The signal handler to call Run the given callback whenever the
linkSelected
signal is emitted -
linkSelectedSignal
Extension methodTyped
link-selected
signal for using theconnect(signal:)
methodsDeclaration
Swift
static var linkSelectedSignal: HypertextSignalName { get }
-
getLink(linkIndex:
Extension method) Gets the link in this hypertext document at index
link_index
Declaration
Swift
@inlinable func getLink(linkIndex: Int) -> Atk.HyperlinkRef!
-
getLinkIndex(charIndex:
Extension method) Gets the index into the array of hyperlinks that is associated with the character specified by
char_index
.Declaration
Swift
@inlinable func getLinkIndex(charIndex: Int) -> Int
-
getNLinks()
Extension methodGets the number of links within this hypertext document.
Declaration
Swift
@inlinable func getNLinks() -> Int
-
nLinks
Extension methodGets the number of links within this hypertext document.
Declaration
Swift
@inlinable var nLinks: Int { get }