DocumentProtocol
public protocol DocumentProtocol
The AtkDocument interface should be supported by any object whose content is a representation or view of a document. The AtkDocument interface should appear on the toplevel container for the document content; however AtkDocument instances may be nested (i.e. an AtkDocument may be a descendant of another AtkDocument) in those cases where one document contains “embedded content” which can reasonably be considered a document in its own right.
The DocumentProtocol
protocol exposes the methods and properties of an underlying AtkDocument
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 Document
.
Alternatively, use DocumentRef
as a lighweight, unowned
reference if you already have an instance you just want to use.
-
Untyped pointer to the underlying
AtkDocument
instance.Declaration
Swift
var ptr: UnsafeMutableRawPointer! { get }
-
document_ptr
Default implementationTyped pointer to the underlying
AtkDocument
instance.Default Implementation
Return the stored, untyped pointer as a typed pointer to the
AtkDocument
instance.Declaration
Swift
var document_ptr: UnsafeMutablePointer<AtkDocument>! { get }
-
Required Initialiser for types conforming to
DocumentProtocol
Declaration
Swift
init(raw: UnsafeMutableRawPointer)
-
connect(signal:
Extension methodflags: handler: ) Connect a Swift signal handler to the given, typed
DocumentSignalName
signalDeclaration
Swift
@discardableResult @inlinable func connect(signal s: DocumentSignalName, 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
DocumentSignalName
signalDeclaration
Swift
@discardableResult @inlinable func connect(signal s: DocumentSignalName, 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)
-
onLoadComplete(flags:
Extension methodhandler: ) The ‘load-complete’ signal is emitted when a pending load of a static document has completed. This signal is to be expected by ATK clients if and when AtkDocument implementors expose ATK_STATE_BUSY. If the state of an AtkObject which implements AtkDocument does not include ATK_STATE_BUSY, it should be safe for clients to assume that the AtkDocument’s static contents are fully loaded into the container. (Dynamic document contents should be exposed via other signals.)
Note
This represents the underlyingload-complete
signalDeclaration
Swift
@discardableResult @inlinable func onLoadComplete(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: DocumentRef) -> Void) -> Int
Parameters
flags
Flags
unownedSelf
Reference to instance of self
handler
The signal handler to call Run the given callback whenever the
loadComplete
signal is emitted -
loadCompleteSignal
Extension methodTyped
load-complete
signal for using theconnect(signal:)
methodsDeclaration
Swift
static var loadCompleteSignal: DocumentSignalName { get }
-
onLoadStopped(flags:
Extension methodhandler: ) The ‘load-stopped’ signal is emitted when a pending load of document contents is cancelled, paused, or otherwise interrupted by the user or application logic. It should not however be emitted while waiting for a resource (for instance while blocking on a file or network read) unless a user-significant timeout has occurred.
Note
This represents the underlyingload-stopped
signalDeclaration
Swift
@discardableResult @inlinable func onLoadStopped(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: DocumentRef) -> Void) -> Int
Parameters
flags
Flags
unownedSelf
Reference to instance of self
handler
The signal handler to call Run the given callback whenever the
loadStopped
signal is emitted -
loadStoppedSignal
Extension methodTyped
load-stopped
signal for using theconnect(signal:)
methodsDeclaration
Swift
static var loadStoppedSignal: DocumentSignalName { get }
-
onPageChanged(flags:
Extension methodhandler: ) The ‘page-changed’ signal is emitted when the current page of a document changes, e.g. pressing page up/down in a document viewer.
Note
This represents the underlyingpage-changed
signalDeclaration
Swift
@discardableResult @inlinable func onPageChanged(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: DocumentRef, _ pageNumber: Int) -> Void) -> Int
Parameters
flags
Flags
unownedSelf
Reference to instance of self
pageNumber
the new page number. If this value is unknown or not applicable, -1 should be provided.
handler
The signal handler to call Run the given callback whenever the
pageChanged
signal is emitted -
pageChangedSignal
Extension methodTyped
page-changed
signal for using theconnect(signal:)
methodsDeclaration
Swift
static var pageChangedSignal: DocumentSignalName { get }
-
onReload(flags:
Extension methodhandler: ) The ‘reload’ signal is emitted when the contents of a document is refreshed from its source. Once ‘reload’ has been emitted, a matching ‘load-complete’ or ‘load-stopped’ signal should follow, which clients may await before interrogating ATK for the latest document content.
Note
This represents the underlyingreload
signalDeclaration
Swift
@discardableResult @inlinable func onReload(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: DocumentRef) -> Void) -> Int
Parameters
flags
Flags
unownedSelf
Reference to instance of self
handler
The signal handler to call Run the given callback whenever the
reload
signal is emitted -
reloadSignal
Extension methodTyped
reload
signal for using theconnect(signal:)
methodsDeclaration
Swift
static var reloadSignal: DocumentSignalName { get }
-
getAttributeValue(attributeName:
Extension method) Retrieves the value of the given
attribute_name
insidedocument
.Declaration
Swift
@inlinable func getAttributeValue(attributeName: UnsafePointer<gchar>!) -> String!
-
getAttributes()
Extension methodGets an AtkAttributeSet which describes document-wide attributes as name-value pairs.
Declaration
Swift
@inlinable func getAttributes() -> UnsafeMutablePointer<AtkAttributeSet>!
-
getCurrentPageNumber()
Extension methodRetrieves the current page number inside
document
.Declaration
Swift
@inlinable func getCurrentPageNumber() -> Int
-
getDocument()
Extension methodGets a
gpointer
that points to an instance of the DOM. It is up to the caller to check atk_document_get_type to determine how to cast this pointer.get_document is deprecated: Since 2.12. @document is already a representation of the document. Use it directly, or one of its children, as an instance of the DOM.
Declaration
Swift
@available(*, deprecated) @inlinable func getDocument() -> gpointer?
-
getDocumentType()
Extension methodGets a string indicating the document type.
get_document_type is deprecated: Since 2.12. Please use atk_document_get_attributes() to ask for the document type if it applies.
Declaration
Swift
@available(*, deprecated) @inlinable func getDocumentType() -> String!
-
getLocale()
Extension methodGets a UTF-8 string indicating the POSIX-style LC_MESSAGES locale of the content of this document instance. Individual text substrings or images within this document may have a different locale, see atk_text_get_attributes and atk_image_get_image_locale.
get_locale is deprecated: Please use atk_object_get_object_locale() instead.
Declaration
Swift
@available(*, deprecated) @inlinable func getLocale() -> String!
-
getPageCount()
Extension methodRetrieves the total number of pages inside
document
.Declaration
Swift
@inlinable func getPageCount() -> Int
-
setAttributeValue(attributeName:
Extension methodattributeValue: ) Sets the value for the given
attribute_name
insidedocument
.Declaration
Swift
@inlinable func setAttributeValue(attributeName: UnsafePointer<gchar>!, attributeValue: UnsafePointer<gchar>!) -> Bool
-
attributes
Extension methodGets an AtkAttributeSet which describes document-wide attributes as name-value pairs.
Declaration
Swift
@inlinable var attributes: UnsafeMutablePointer<AtkAttributeSet>! { get }
-
currentPageNumber
Extension methodRetrieves the current page number inside
document
.Declaration
Swift
@inlinable var currentPageNumber: Int { get }
-
document
Extension methodGets a
gpointer
that points to an instance of the DOM. It is up to the caller to check atk_document_get_type to determine how to cast this pointer.get_document is deprecated: Since 2.12. @document is already a representation of the document. Use it directly, or one of its children, as an instance of the DOM.
Declaration
Swift
@inlinable var document: gpointer? { get }
-
documentType
Extension methodGets a string indicating the document type.
get_document_type is deprecated: Since 2.12. Please use atk_document_get_attributes() to ask for the document type if it applies.
Declaration
Swift
@inlinable var documentType: String! { get }
-
locale
Extension methodGets a UTF-8 string indicating the POSIX-style LC_MESSAGES locale of the content of this document instance. Individual text substrings or images within this document may have a different locale, see atk_text_get_attributes and atk_image_get_image_locale.
get_locale is deprecated: Please use atk_object_get_object_locale() instead.
Declaration
Swift
@inlinable var locale: String! { get }
-
pageCount
Extension methodRetrieves the total number of pages inside
document
.Declaration
Swift
@inlinable var pageCount: Int { get }