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.

  • ptr

    Untyped pointer to the underlying AtkDocument instance.

    Declaration

    Swift

    var ptr: UnsafeMutableRawPointer! { get }
  • document_ptr Default implementation

    Typed 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)

Document signals

  • Connect a Swift signal handler to the given, typed DocumentSignalName signal

    Declaration

    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 by userData

    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 a C signal handler to the given, typed DocumentSignalName signal

    Declaration

    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 by userData

    signalHandler

    The C function to be called on the given signal

    Return Value

    The signal handler ID (always greater than 0 for successful connections)

  • 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 underlying load-complete signal

    Declaration

    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 method

    Typed load-complete signal for using the connect(signal:) methods

    Declaration

    Swift

    static var loadCompleteSignal: DocumentSignalName { get }
  • 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 underlying load-stopped signal

    Declaration

    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 method

    Typed load-stopped signal for using the connect(signal:) methods

    Declaration

    Swift

    static var loadStoppedSignal: DocumentSignalName { get }
  • 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 underlying page-changed signal

    Declaration

    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 method

    Typed page-changed signal for using the connect(signal:) methods

    Declaration

    Swift

    static var pageChangedSignal: DocumentSignalName { get }
  • onReload(flags:handler:) Extension method

    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 underlying reload signal

    Declaration

    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 method

    Typed reload signal for using the connect(signal:) methods

    Declaration

    Swift

    static var reloadSignal: DocumentSignalName { get }

Document Interface: DocumentProtocol extension (methods and fields)

  • Retrieves the value of the given attribute_name inside document.

    Declaration

    Swift

    @inlinable
    func getAttributeValue(attributeName: UnsafePointer<gchar>!) -> String!
  • getAttributes() Extension method

    Gets an AtkAttributeSet which describes document-wide attributes as name-value pairs.

    Declaration

    Swift

    @inlinable
    func getAttributes() -> UnsafeMutablePointer<AtkAttributeSet>!
  • getCurrentPageNumber() Extension method

    Retrieves the current page number inside document.

    Declaration

    Swift

    @inlinable
    func getCurrentPageNumber() -> Int
  • getDocument() Extension method

    Gets 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 method

    Gets 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 method

    Gets 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 method

    Retrieves the total number of pages inside document.

    Declaration

    Swift

    @inlinable
    func getPageCount() -> Int
  • Sets the value for the given attribute_name inside document.

    Declaration

    Swift

    @inlinable
    func setAttributeValue(attributeName: UnsafePointer<gchar>!, attributeValue: UnsafePointer<gchar>!) -> Bool
  • attributes Extension method

    Gets an AtkAttributeSet which describes document-wide attributes as name-value pairs.

    Declaration

    Swift

    @inlinable
    var attributes: UnsafeMutablePointer<AtkAttributeSet>! { get }
  • currentPageNumber Extension method

    Retrieves the current page number inside document.

    Declaration

    Swift

    @inlinable
    var currentPageNumber: Int { get }
  • document Extension method

    Gets 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 method

    Gets 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 method

    Gets 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 method

    Retrieves the total number of pages inside document.

    Declaration

    Swift

    @inlinable
    var pageCount: Int { get }