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
AtkDocumentinstance.Declaration
Swift
var ptr: UnsafeMutableRawPointer! { get } -
document_ptrDefault implementationTyped pointer to the underlying
AtkDocumentinstance.Default Implementation
Return the stored, untyped pointer as a typed pointer to the
AtkDocumentinstance.Declaration
Swift
var document_ptr: UnsafeMutablePointer<AtkDocument>! { get } -
Required Initialiser for types conforming to
DocumentProtocolDeclaration
Swift
init(raw: UnsafeMutableRawPointer)
-
connect(signal:Extension methodflags: handler: ) Connect a Swift signal handler to the given, typed
DocumentSignalNamesignalDeclaration
Swift
@discardableResult @inlinable func connect(signal s: DocumentSignalName, flags f: ConnectFlags = ConnectFlags(0), handler h: @escaping SignalHandler) -> IntParameters
signalThe signal to connect
flagsThe connection flags to use
dataA pointer to user data to provide to the callback
destroyDataA
GClosureNotifyC function to destroy the data pointed to byuserDatahandlerThe 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
DocumentSignalNamesignalDeclaration
Swift
@discardableResult @inlinable func connect(signal s: DocumentSignalName, flags f: ConnectFlags = ConnectFlags(0), data userData: gpointer!, destroyData destructor: GClosureNotify? = nil, signalHandler h: @escaping GCallback) -> IntParameters
signalThe signal to connect
flagsThe connection flags to use
dataA pointer to user data to provide to the callback
destroyDataA
GClosureNotifyC function to destroy the data pointed to byuserDatasignalHandlerThe 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-completesignalDeclaration
Swift
@discardableResult @inlinable func onLoadComplete(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: DocumentRef) -> Void) -> IntParameters
flagsFlags
unownedSelfReference to instance of self
handlerThe signal handler to call Run the given callback whenever the
loadCompletesignal is emitted -
loadCompleteSignalExtension methodTyped
load-completesignal 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-stoppedsignalDeclaration
Swift
@discardableResult @inlinable func onLoadStopped(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: DocumentRef) -> Void) -> IntParameters
flagsFlags
unownedSelfReference to instance of self
handlerThe signal handler to call Run the given callback whenever the
loadStoppedsignal is emitted -
loadStoppedSignalExtension methodTyped
load-stoppedsignal 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-changedsignalDeclaration
Swift
@discardableResult @inlinable func onPageChanged(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: DocumentRef, _ pageNumber: Int) -> Void) -> IntParameters
flagsFlags
unownedSelfReference to instance of self
pageNumberthe new page number. If this value is unknown or not applicable, -1 should be provided.
handlerThe signal handler to call Run the given callback whenever the
pageChangedsignal is emitted -
pageChangedSignalExtension methodTyped
page-changedsignal 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 underlyingreloadsignalDeclaration
Swift
@discardableResult @inlinable func onReload(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: DocumentRef) -> Void) -> IntParameters
flagsFlags
unownedSelfReference to instance of self
handlerThe signal handler to call Run the given callback whenever the
reloadsignal is emitted -
reloadSignalExtension methodTyped
reloadsignal for using theconnect(signal:)methodsDeclaration
Swift
static var reloadSignal: DocumentSignalName { get }
-
getAttributeValue(attributeName:Extension method) Retrieves the value of the given
attribute_nameinsidedocument.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
gpointerthat 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_nameinsidedocument.Declaration
Swift
@inlinable func setAttributeValue(attributeName: UnsafePointer<gchar>!, attributeValue: UnsafePointer<gchar>!) -> Bool -
attributesExtension methodGets an AtkAttributeSet which describes document-wide attributes as name-value pairs.
Declaration
Swift
@inlinable var attributes: UnsafeMutablePointer<AtkAttributeSet>! { get } -
currentPageNumberExtension methodRetrieves the current page number inside
document.Declaration
Swift
@inlinable var currentPageNumber: Int { get } -
documentExtension methodGets a
gpointerthat 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 } -
documentTypeExtension 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 } -
localeExtension 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 } -
pageCountExtension methodRetrieves the total number of pages inside
document.Declaration
Swift
@inlinable var pageCount: Int { get }
View on GitHub
Install in Dash
DocumentProtocol Protocol Reference