{-# LANGUAGE TypeApplications #-}


-- | Copyright  : Will Thompson, Iñaki García Etxebarria and Jonas Platte
-- License    : LGPL-2.1
-- Maintainer : Iñaki García Etxebarria
-- 
-- 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.

#if (MIN_VERSION_haskell_gi_overloading(1,0,0) && !defined(__HADDOCK_VERSION__))
#define ENABLE_OVERLOADING
#endif

module GI.Atk.Interfaces.Document
    ( 

-- * Exported types
    Document(..)                            ,
    noDocument                              ,
    IsDocument                              ,
    toDocument                              ,


 -- * Methods
-- ** Overloaded methods #method:Overloaded methods#

#if defined(ENABLE_OVERLOADING)
    ResolveDocumentMethod                   ,
#endif


-- ** getAttributeValue #method:getAttributeValue#

#if defined(ENABLE_OVERLOADING)
    DocumentGetAttributeValueMethodInfo     ,
#endif
    documentGetAttributeValue               ,


-- ** getAttributes #method:getAttributes#

#if defined(ENABLE_OVERLOADING)
    DocumentGetAttributesMethodInfo         ,
#endif
    documentGetAttributes                   ,


-- ** getCurrentPageNumber #method:getCurrentPageNumber#

#if defined(ENABLE_OVERLOADING)
    DocumentGetCurrentPageNumberMethodInfo  ,
#endif
    documentGetCurrentPageNumber            ,


-- ** getDocument #method:getDocument#

#if defined(ENABLE_OVERLOADING)
    DocumentGetDocumentMethodInfo           ,
#endif
    documentGetDocument                     ,


-- ** getDocumentType #method:getDocumentType#

#if defined(ENABLE_OVERLOADING)
    DocumentGetDocumentTypeMethodInfo       ,
#endif
    documentGetDocumentType                 ,


-- ** getLocale #method:getLocale#

#if defined(ENABLE_OVERLOADING)
    DocumentGetLocaleMethodInfo             ,
#endif
    documentGetLocale                       ,


-- ** getPageCount #method:getPageCount#

#if defined(ENABLE_OVERLOADING)
    DocumentGetPageCountMethodInfo          ,
#endif
    documentGetPageCount                    ,


-- ** setAttributeValue #method:setAttributeValue#

#if defined(ENABLE_OVERLOADING)
    DocumentSetAttributeValueMethodInfo     ,
#endif
    documentSetAttributeValue               ,




 -- * Signals
-- ** loadComplete #signal:loadComplete#

    C_DocumentLoadCompleteCallback          ,
    DocumentLoadCompleteCallback            ,
#if defined(ENABLE_OVERLOADING)
    DocumentLoadCompleteSignalInfo          ,
#endif
    afterDocumentLoadComplete               ,
    genClosure_DocumentLoadComplete         ,
    mk_DocumentLoadCompleteCallback         ,
    noDocumentLoadCompleteCallback          ,
    onDocumentLoadComplete                  ,
    wrap_DocumentLoadCompleteCallback       ,


-- ** loadStopped #signal:loadStopped#

    C_DocumentLoadStoppedCallback           ,
    DocumentLoadStoppedCallback             ,
#if defined(ENABLE_OVERLOADING)
    DocumentLoadStoppedSignalInfo           ,
#endif
    afterDocumentLoadStopped                ,
    genClosure_DocumentLoadStopped          ,
    mk_DocumentLoadStoppedCallback          ,
    noDocumentLoadStoppedCallback           ,
    onDocumentLoadStopped                   ,
    wrap_DocumentLoadStoppedCallback        ,


-- ** pageChanged #signal:pageChanged#

    C_DocumentPageChangedCallback           ,
    DocumentPageChangedCallback             ,
#if defined(ENABLE_OVERLOADING)
    DocumentPageChangedSignalInfo           ,
#endif
    afterDocumentPageChanged                ,
    genClosure_DocumentPageChanged          ,
    mk_DocumentPageChangedCallback          ,
    noDocumentPageChangedCallback           ,
    onDocumentPageChanged                   ,
    wrap_DocumentPageChangedCallback        ,


-- ** reload #signal:reload#

    C_DocumentReloadCallback                ,
    DocumentReloadCallback                  ,
#if defined(ENABLE_OVERLOADING)
    DocumentReloadSignalInfo                ,
#endif
    afterDocumentReload                     ,
    genClosure_DocumentReload               ,
    mk_DocumentReloadCallback               ,
    noDocumentReloadCallback                ,
    onDocumentReload                        ,
    wrap_DocumentReloadCallback             ,




    ) where

import Data.GI.Base.ShortPrelude
import qualified Data.GI.Base.ShortPrelude as SP
import qualified Data.GI.Base.Overloading as O
import qualified Prelude as P

import qualified Data.GI.Base.Attributes as GI.Attributes
import qualified Data.GI.Base.ManagedPtr as B.ManagedPtr
import qualified Data.GI.Base.GClosure as B.GClosure
import qualified Data.GI.Base.GError as B.GError
import qualified Data.GI.Base.GVariant as B.GVariant
import qualified Data.GI.Base.GValue as B.GValue
import qualified Data.GI.Base.GParamSpec as B.GParamSpec
import qualified Data.GI.Base.CallStack as B.CallStack
import qualified Data.GI.Base.Properties as B.Properties
import qualified Data.GI.Base.Signals as B.Signals
import qualified Data.Text as T
import qualified Data.ByteString.Char8 as B
import qualified Data.Map as Map
import qualified Foreign.Ptr as FP
import qualified GHC.OverloadedLabels as OL

import qualified GI.GObject.Objects.Object as GObject.Object

-- interface Document 
-- | Memory-managed wrapper type.
newtype Document = Document (ManagedPtr Document)
    deriving (Document -> Document -> Bool
(Document -> Document -> Bool)
-> (Document -> Document -> Bool) -> Eq Document
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Document -> Document -> Bool
$c/= :: Document -> Document -> Bool
== :: Document -> Document -> Bool
$c== :: Document -> Document -> Bool
Eq)
-- | A convenience alias for `Nothing` :: `Maybe` `Document`.
noDocument :: Maybe Document
noDocument :: Maybe Document
noDocument = Maybe Document
forall a. Maybe a
Nothing

-- signal Document::load-complete
-- | 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.)
type DocumentLoadCompleteCallback =
    IO ()

-- | A convenience synonym for @`Nothing` :: `Maybe` `DocumentLoadCompleteCallback`@.
noDocumentLoadCompleteCallback :: Maybe DocumentLoadCompleteCallback
noDocumentLoadCompleteCallback :: Maybe DocumentLoadCompleteCallback
noDocumentLoadCompleteCallback = Maybe DocumentLoadCompleteCallback
forall a. Maybe a
Nothing

-- | Type for the callback on the (unwrapped) C side.
type C_DocumentLoadCompleteCallback =
    Ptr () ->                               -- object
    Ptr () ->                               -- user_data
    IO ()

-- | Generate a function pointer callable from C code, from a `C_DocumentLoadCompleteCallback`.
foreign import ccall "wrapper"
    mk_DocumentLoadCompleteCallback :: C_DocumentLoadCompleteCallback -> IO (FunPtr C_DocumentLoadCompleteCallback)

-- | Wrap the callback into a `GClosure`.
genClosure_DocumentLoadComplete :: MonadIO m => DocumentLoadCompleteCallback -> m (GClosure C_DocumentLoadCompleteCallback)
genClosure_DocumentLoadComplete :: DocumentLoadCompleteCallback
-> m (GClosure C_DocumentLoadCompleteCallback)
genClosure_DocumentLoadComplete cb :: DocumentLoadCompleteCallback
cb = IO (GClosure C_DocumentLoadCompleteCallback)
-> m (GClosure C_DocumentLoadCompleteCallback)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (GClosure C_DocumentLoadCompleteCallback)
 -> m (GClosure C_DocumentLoadCompleteCallback))
-> IO (GClosure C_DocumentLoadCompleteCallback)
-> m (GClosure C_DocumentLoadCompleteCallback)
forall a b. (a -> b) -> a -> b
$ do
    let cb' :: C_DocumentLoadCompleteCallback
cb' = DocumentLoadCompleteCallback -> C_DocumentLoadCompleteCallback
wrap_DocumentLoadCompleteCallback DocumentLoadCompleteCallback
cb
    C_DocumentLoadCompleteCallback
-> IO (FunPtr C_DocumentLoadCompleteCallback)
mk_DocumentLoadCompleteCallback C_DocumentLoadCompleteCallback
cb' IO (FunPtr C_DocumentLoadCompleteCallback)
-> (FunPtr C_DocumentLoadCompleteCallback
    -> IO (GClosure C_DocumentLoadCompleteCallback))
-> IO (GClosure C_DocumentLoadCompleteCallback)
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= FunPtr C_DocumentLoadCompleteCallback
-> IO (GClosure C_DocumentLoadCompleteCallback)
forall (m :: * -> *) a. MonadIO m => FunPtr a -> m (GClosure a)
B.GClosure.newGClosure


-- | Wrap a `DocumentLoadCompleteCallback` into a `C_DocumentLoadCompleteCallback`.
wrap_DocumentLoadCompleteCallback ::
    DocumentLoadCompleteCallback ->
    C_DocumentLoadCompleteCallback
wrap_DocumentLoadCompleteCallback :: DocumentLoadCompleteCallback -> C_DocumentLoadCompleteCallback
wrap_DocumentLoadCompleteCallback _cb :: DocumentLoadCompleteCallback
_cb _ _ = do
    DocumentLoadCompleteCallback
_cb 


-- | Connect a signal handler for the [loadComplete](#signal:loadComplete) signal, to be run before the default handler.
-- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
-- 
-- @
-- 'Data.GI.Base.Signals.on' document #loadComplete callback
-- @
-- 
-- 
onDocumentLoadComplete :: (IsDocument a, MonadIO m) => a -> DocumentLoadCompleteCallback -> m SignalHandlerId
onDocumentLoadComplete :: a -> DocumentLoadCompleteCallback -> m SignalHandlerId
onDocumentLoadComplete obj :: a
obj cb :: DocumentLoadCompleteCallback
cb = IO SignalHandlerId -> m SignalHandlerId
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO SignalHandlerId -> m SignalHandlerId)
-> IO SignalHandlerId -> m SignalHandlerId
forall a b. (a -> b) -> a -> b
$ do
    let cb' :: C_DocumentLoadCompleteCallback
cb' = DocumentLoadCompleteCallback -> C_DocumentLoadCompleteCallback
wrap_DocumentLoadCompleteCallback DocumentLoadCompleteCallback
cb
    FunPtr C_DocumentLoadCompleteCallback
cb'' <- C_DocumentLoadCompleteCallback
-> IO (FunPtr C_DocumentLoadCompleteCallback)
mk_DocumentLoadCompleteCallback C_DocumentLoadCompleteCallback
cb'
    a
-> Text
-> FunPtr C_DocumentLoadCompleteCallback
-> SignalConnectMode
-> Maybe Text
-> IO SignalHandlerId
forall o a.
GObject o =>
o
-> Text
-> FunPtr a
-> SignalConnectMode
-> Maybe Text
-> IO SignalHandlerId
connectSignalFunPtr a
obj "load-complete" FunPtr C_DocumentLoadCompleteCallback
cb'' SignalConnectMode
SignalConnectBefore Maybe Text
forall a. Maybe a
Nothing

-- | Connect a signal handler for the [loadComplete](#signal:loadComplete) signal, to be run after the default handler.
-- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
-- 
-- @
-- 'Data.GI.Base.Signals.after' document #loadComplete callback
-- @
-- 
-- 
afterDocumentLoadComplete :: (IsDocument a, MonadIO m) => a -> DocumentLoadCompleteCallback -> m SignalHandlerId
afterDocumentLoadComplete :: a -> DocumentLoadCompleteCallback -> m SignalHandlerId
afterDocumentLoadComplete obj :: a
obj cb :: DocumentLoadCompleteCallback
cb = IO SignalHandlerId -> m SignalHandlerId
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO SignalHandlerId -> m SignalHandlerId)
-> IO SignalHandlerId -> m SignalHandlerId
forall a b. (a -> b) -> a -> b
$ do
    let cb' :: C_DocumentLoadCompleteCallback
cb' = DocumentLoadCompleteCallback -> C_DocumentLoadCompleteCallback
wrap_DocumentLoadCompleteCallback DocumentLoadCompleteCallback
cb
    FunPtr C_DocumentLoadCompleteCallback
cb'' <- C_DocumentLoadCompleteCallback
-> IO (FunPtr C_DocumentLoadCompleteCallback)
mk_DocumentLoadCompleteCallback C_DocumentLoadCompleteCallback
cb'
    a
-> Text
-> FunPtr C_DocumentLoadCompleteCallback
-> SignalConnectMode
-> Maybe Text
-> IO SignalHandlerId
forall o a.
GObject o =>
o
-> Text
-> FunPtr a
-> SignalConnectMode
-> Maybe Text
-> IO SignalHandlerId
connectSignalFunPtr a
obj "load-complete" FunPtr C_DocumentLoadCompleteCallback
cb'' SignalConnectMode
SignalConnectAfter Maybe Text
forall a. Maybe a
Nothing


#if defined(ENABLE_OVERLOADING)
data DocumentLoadCompleteSignalInfo
instance SignalInfo DocumentLoadCompleteSignalInfo where
    type HaskellCallbackType DocumentLoadCompleteSignalInfo = DocumentLoadCompleteCallback
    connectSignal obj cb connectMode detail = do
        let cb' = wrap_DocumentLoadCompleteCallback cb
        cb'' <- mk_DocumentLoadCompleteCallback cb'
        connectSignalFunPtr obj "load-complete" cb'' connectMode detail

#endif

-- signal Document::load-stopped
-- | 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.
type DocumentLoadStoppedCallback =
    IO ()

-- | A convenience synonym for @`Nothing` :: `Maybe` `DocumentLoadStoppedCallback`@.
noDocumentLoadStoppedCallback :: Maybe DocumentLoadStoppedCallback
noDocumentLoadStoppedCallback :: Maybe DocumentLoadCompleteCallback
noDocumentLoadStoppedCallback = Maybe DocumentLoadCompleteCallback
forall a. Maybe a
Nothing

-- | Type for the callback on the (unwrapped) C side.
type C_DocumentLoadStoppedCallback =
    Ptr () ->                               -- object
    Ptr () ->                               -- user_data
    IO ()

-- | Generate a function pointer callable from C code, from a `C_DocumentLoadStoppedCallback`.
foreign import ccall "wrapper"
    mk_DocumentLoadStoppedCallback :: C_DocumentLoadStoppedCallback -> IO (FunPtr C_DocumentLoadStoppedCallback)

-- | Wrap the callback into a `GClosure`.
genClosure_DocumentLoadStopped :: MonadIO m => DocumentLoadStoppedCallback -> m (GClosure C_DocumentLoadStoppedCallback)
genClosure_DocumentLoadStopped :: DocumentLoadCompleteCallback
-> m (GClosure C_DocumentLoadCompleteCallback)
genClosure_DocumentLoadStopped cb :: DocumentLoadCompleteCallback
cb = IO (GClosure C_DocumentLoadCompleteCallback)
-> m (GClosure C_DocumentLoadCompleteCallback)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (GClosure C_DocumentLoadCompleteCallback)
 -> m (GClosure C_DocumentLoadCompleteCallback))
-> IO (GClosure C_DocumentLoadCompleteCallback)
-> m (GClosure C_DocumentLoadCompleteCallback)
forall a b. (a -> b) -> a -> b
$ do
    let cb' :: C_DocumentLoadCompleteCallback
cb' = DocumentLoadCompleteCallback -> C_DocumentLoadCompleteCallback
wrap_DocumentLoadStoppedCallback DocumentLoadCompleteCallback
cb
    C_DocumentLoadCompleteCallback
-> IO (FunPtr C_DocumentLoadCompleteCallback)
mk_DocumentLoadStoppedCallback C_DocumentLoadCompleteCallback
cb' IO (FunPtr C_DocumentLoadCompleteCallback)
-> (FunPtr C_DocumentLoadCompleteCallback
    -> IO (GClosure C_DocumentLoadCompleteCallback))
-> IO (GClosure C_DocumentLoadCompleteCallback)
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= FunPtr C_DocumentLoadCompleteCallback
-> IO (GClosure C_DocumentLoadCompleteCallback)
forall (m :: * -> *) a. MonadIO m => FunPtr a -> m (GClosure a)
B.GClosure.newGClosure


-- | Wrap a `DocumentLoadStoppedCallback` into a `C_DocumentLoadStoppedCallback`.
wrap_DocumentLoadStoppedCallback ::
    DocumentLoadStoppedCallback ->
    C_DocumentLoadStoppedCallback
wrap_DocumentLoadStoppedCallback :: DocumentLoadCompleteCallback -> C_DocumentLoadCompleteCallback
wrap_DocumentLoadStoppedCallback _cb :: DocumentLoadCompleteCallback
_cb _ _ = do
    DocumentLoadCompleteCallback
_cb 


-- | Connect a signal handler for the [loadStopped](#signal:loadStopped) signal, to be run before the default handler.
-- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
-- 
-- @
-- 'Data.GI.Base.Signals.on' document #loadStopped callback
-- @
-- 
-- 
onDocumentLoadStopped :: (IsDocument a, MonadIO m) => a -> DocumentLoadStoppedCallback -> m SignalHandlerId
onDocumentLoadStopped :: a -> DocumentLoadCompleteCallback -> m SignalHandlerId
onDocumentLoadStopped obj :: a
obj cb :: DocumentLoadCompleteCallback
cb = IO SignalHandlerId -> m SignalHandlerId
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO SignalHandlerId -> m SignalHandlerId)
-> IO SignalHandlerId -> m SignalHandlerId
forall a b. (a -> b) -> a -> b
$ do
    let cb' :: C_DocumentLoadCompleteCallback
cb' = DocumentLoadCompleteCallback -> C_DocumentLoadCompleteCallback
wrap_DocumentLoadStoppedCallback DocumentLoadCompleteCallback
cb
    FunPtr C_DocumentLoadCompleteCallback
cb'' <- C_DocumentLoadCompleteCallback
-> IO (FunPtr C_DocumentLoadCompleteCallback)
mk_DocumentLoadStoppedCallback C_DocumentLoadCompleteCallback
cb'
    a
-> Text
-> FunPtr C_DocumentLoadCompleteCallback
-> SignalConnectMode
-> Maybe Text
-> IO SignalHandlerId
forall o a.
GObject o =>
o
-> Text
-> FunPtr a
-> SignalConnectMode
-> Maybe Text
-> IO SignalHandlerId
connectSignalFunPtr a
obj "load-stopped" FunPtr C_DocumentLoadCompleteCallback
cb'' SignalConnectMode
SignalConnectBefore Maybe Text
forall a. Maybe a
Nothing

-- | Connect a signal handler for the [loadStopped](#signal:loadStopped) signal, to be run after the default handler.
-- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
-- 
-- @
-- 'Data.GI.Base.Signals.after' document #loadStopped callback
-- @
-- 
-- 
afterDocumentLoadStopped :: (IsDocument a, MonadIO m) => a -> DocumentLoadStoppedCallback -> m SignalHandlerId
afterDocumentLoadStopped :: a -> DocumentLoadCompleteCallback -> m SignalHandlerId
afterDocumentLoadStopped obj :: a
obj cb :: DocumentLoadCompleteCallback
cb = IO SignalHandlerId -> m SignalHandlerId
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO SignalHandlerId -> m SignalHandlerId)
-> IO SignalHandlerId -> m SignalHandlerId
forall a b. (a -> b) -> a -> b
$ do
    let cb' :: C_DocumentLoadCompleteCallback
cb' = DocumentLoadCompleteCallback -> C_DocumentLoadCompleteCallback
wrap_DocumentLoadStoppedCallback DocumentLoadCompleteCallback
cb
    FunPtr C_DocumentLoadCompleteCallback
cb'' <- C_DocumentLoadCompleteCallback
-> IO (FunPtr C_DocumentLoadCompleteCallback)
mk_DocumentLoadStoppedCallback C_DocumentLoadCompleteCallback
cb'
    a
-> Text
-> FunPtr C_DocumentLoadCompleteCallback
-> SignalConnectMode
-> Maybe Text
-> IO SignalHandlerId
forall o a.
GObject o =>
o
-> Text
-> FunPtr a
-> SignalConnectMode
-> Maybe Text
-> IO SignalHandlerId
connectSignalFunPtr a
obj "load-stopped" FunPtr C_DocumentLoadCompleteCallback
cb'' SignalConnectMode
SignalConnectAfter Maybe Text
forall a. Maybe a
Nothing


#if defined(ENABLE_OVERLOADING)
data DocumentLoadStoppedSignalInfo
instance SignalInfo DocumentLoadStoppedSignalInfo where
    type HaskellCallbackType DocumentLoadStoppedSignalInfo = DocumentLoadStoppedCallback
    connectSignal obj cb connectMode detail = do
        let cb' = wrap_DocumentLoadStoppedCallback cb
        cb'' <- mk_DocumentLoadStoppedCallback cb'
        connectSignalFunPtr obj "load-stopped" cb'' connectMode detail

#endif

-- signal Document::page-changed
-- | The \'page-changed\' signal is emitted when the current page of
-- a document changes, e.g. pressing page up\/down in a document
-- viewer.
-- 
-- /Since: 2.12/
type DocumentPageChangedCallback =
    Int32
    -- ^ /@pageNumber@/: the new page number. If this value is unknown
    -- or not applicable, -1 should be provided.
    -> IO ()

-- | A convenience synonym for @`Nothing` :: `Maybe` `DocumentPageChangedCallback`@.
noDocumentPageChangedCallback :: Maybe DocumentPageChangedCallback
noDocumentPageChangedCallback :: Maybe DocumentPageChangedCallback
noDocumentPageChangedCallback = Maybe DocumentPageChangedCallback
forall a. Maybe a
Nothing

-- | Type for the callback on the (unwrapped) C side.
type C_DocumentPageChangedCallback =
    Ptr () ->                               -- object
    Int32 ->
    Ptr () ->                               -- user_data
    IO ()

-- | Generate a function pointer callable from C code, from a `C_DocumentPageChangedCallback`.
foreign import ccall "wrapper"
    mk_DocumentPageChangedCallback :: C_DocumentPageChangedCallback -> IO (FunPtr C_DocumentPageChangedCallback)

-- | Wrap the callback into a `GClosure`.
genClosure_DocumentPageChanged :: MonadIO m => DocumentPageChangedCallback -> m (GClosure C_DocumentPageChangedCallback)
genClosure_DocumentPageChanged :: DocumentPageChangedCallback
-> m (GClosure C_DocumentPageChangedCallback)
genClosure_DocumentPageChanged cb :: DocumentPageChangedCallback
cb = IO (GClosure C_DocumentPageChangedCallback)
-> m (GClosure C_DocumentPageChangedCallback)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (GClosure C_DocumentPageChangedCallback)
 -> m (GClosure C_DocumentPageChangedCallback))
-> IO (GClosure C_DocumentPageChangedCallback)
-> m (GClosure C_DocumentPageChangedCallback)
forall a b. (a -> b) -> a -> b
$ do
    let cb' :: C_DocumentPageChangedCallback
cb' = DocumentPageChangedCallback -> C_DocumentPageChangedCallback
wrap_DocumentPageChangedCallback DocumentPageChangedCallback
cb
    C_DocumentPageChangedCallback
-> IO (FunPtr C_DocumentPageChangedCallback)
mk_DocumentPageChangedCallback C_DocumentPageChangedCallback
cb' IO (FunPtr C_DocumentPageChangedCallback)
-> (FunPtr C_DocumentPageChangedCallback
    -> IO (GClosure C_DocumentPageChangedCallback))
-> IO (GClosure C_DocumentPageChangedCallback)
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= FunPtr C_DocumentPageChangedCallback
-> IO (GClosure C_DocumentPageChangedCallback)
forall (m :: * -> *) a. MonadIO m => FunPtr a -> m (GClosure a)
B.GClosure.newGClosure


-- | Wrap a `DocumentPageChangedCallback` into a `C_DocumentPageChangedCallback`.
wrap_DocumentPageChangedCallback ::
    DocumentPageChangedCallback ->
    C_DocumentPageChangedCallback
wrap_DocumentPageChangedCallback :: DocumentPageChangedCallback -> C_DocumentPageChangedCallback
wrap_DocumentPageChangedCallback _cb :: DocumentPageChangedCallback
_cb _ pageNumber :: Int32
pageNumber _ = do
    DocumentPageChangedCallback
_cb  Int32
pageNumber


-- | Connect a signal handler for the [pageChanged](#signal:pageChanged) signal, to be run before the default handler.
-- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
-- 
-- @
-- 'Data.GI.Base.Signals.on' document #pageChanged callback
-- @
-- 
-- 
onDocumentPageChanged :: (IsDocument a, MonadIO m) => a -> DocumentPageChangedCallback -> m SignalHandlerId
onDocumentPageChanged :: a -> DocumentPageChangedCallback -> m SignalHandlerId
onDocumentPageChanged obj :: a
obj cb :: DocumentPageChangedCallback
cb = IO SignalHandlerId -> m SignalHandlerId
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO SignalHandlerId -> m SignalHandlerId)
-> IO SignalHandlerId -> m SignalHandlerId
forall a b. (a -> b) -> a -> b
$ do
    let cb' :: C_DocumentPageChangedCallback
cb' = DocumentPageChangedCallback -> C_DocumentPageChangedCallback
wrap_DocumentPageChangedCallback DocumentPageChangedCallback
cb
    FunPtr C_DocumentPageChangedCallback
cb'' <- C_DocumentPageChangedCallback
-> IO (FunPtr C_DocumentPageChangedCallback)
mk_DocumentPageChangedCallback C_DocumentPageChangedCallback
cb'
    a
-> Text
-> FunPtr C_DocumentPageChangedCallback
-> SignalConnectMode
-> Maybe Text
-> IO SignalHandlerId
forall o a.
GObject o =>
o
-> Text
-> FunPtr a
-> SignalConnectMode
-> Maybe Text
-> IO SignalHandlerId
connectSignalFunPtr a
obj "page-changed" FunPtr C_DocumentPageChangedCallback
cb'' SignalConnectMode
SignalConnectBefore Maybe Text
forall a. Maybe a
Nothing

-- | Connect a signal handler for the [pageChanged](#signal:pageChanged) signal, to be run after the default handler.
-- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
-- 
-- @
-- 'Data.GI.Base.Signals.after' document #pageChanged callback
-- @
-- 
-- 
afterDocumentPageChanged :: (IsDocument a, MonadIO m) => a -> DocumentPageChangedCallback -> m SignalHandlerId
afterDocumentPageChanged :: a -> DocumentPageChangedCallback -> m SignalHandlerId
afterDocumentPageChanged obj :: a
obj cb :: DocumentPageChangedCallback
cb = IO SignalHandlerId -> m SignalHandlerId
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO SignalHandlerId -> m SignalHandlerId)
-> IO SignalHandlerId -> m SignalHandlerId
forall a b. (a -> b) -> a -> b
$ do
    let cb' :: C_DocumentPageChangedCallback
cb' = DocumentPageChangedCallback -> C_DocumentPageChangedCallback
wrap_DocumentPageChangedCallback DocumentPageChangedCallback
cb
    FunPtr C_DocumentPageChangedCallback
cb'' <- C_DocumentPageChangedCallback
-> IO (FunPtr C_DocumentPageChangedCallback)
mk_DocumentPageChangedCallback C_DocumentPageChangedCallback
cb'
    a
-> Text
-> FunPtr C_DocumentPageChangedCallback
-> SignalConnectMode
-> Maybe Text
-> IO SignalHandlerId
forall o a.
GObject o =>
o
-> Text
-> FunPtr a
-> SignalConnectMode
-> Maybe Text
-> IO SignalHandlerId
connectSignalFunPtr a
obj "page-changed" FunPtr C_DocumentPageChangedCallback
cb'' SignalConnectMode
SignalConnectAfter Maybe Text
forall a. Maybe a
Nothing


#if defined(ENABLE_OVERLOADING)
data DocumentPageChangedSignalInfo
instance SignalInfo DocumentPageChangedSignalInfo where
    type HaskellCallbackType DocumentPageChangedSignalInfo = DocumentPageChangedCallback
    connectSignal obj cb connectMode detail = do
        let cb' = wrap_DocumentPageChangedCallback cb
        cb'' <- mk_DocumentPageChangedCallback cb'
        connectSignalFunPtr obj "page-changed" cb'' connectMode detail

#endif

-- signal Document::reload
-- | 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.
type DocumentReloadCallback =
    IO ()

-- | A convenience synonym for @`Nothing` :: `Maybe` `DocumentReloadCallback`@.
noDocumentReloadCallback :: Maybe DocumentReloadCallback
noDocumentReloadCallback :: Maybe DocumentLoadCompleteCallback
noDocumentReloadCallback = Maybe DocumentLoadCompleteCallback
forall a. Maybe a
Nothing

-- | Type for the callback on the (unwrapped) C side.
type C_DocumentReloadCallback =
    Ptr () ->                               -- object
    Ptr () ->                               -- user_data
    IO ()

-- | Generate a function pointer callable from C code, from a `C_DocumentReloadCallback`.
foreign import ccall "wrapper"
    mk_DocumentReloadCallback :: C_DocumentReloadCallback -> IO (FunPtr C_DocumentReloadCallback)

-- | Wrap the callback into a `GClosure`.
genClosure_DocumentReload :: MonadIO m => DocumentReloadCallback -> m (GClosure C_DocumentReloadCallback)
genClosure_DocumentReload :: DocumentLoadCompleteCallback
-> m (GClosure C_DocumentLoadCompleteCallback)
genClosure_DocumentReload cb :: DocumentLoadCompleteCallback
cb = IO (GClosure C_DocumentLoadCompleteCallback)
-> m (GClosure C_DocumentLoadCompleteCallback)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (GClosure C_DocumentLoadCompleteCallback)
 -> m (GClosure C_DocumentLoadCompleteCallback))
-> IO (GClosure C_DocumentLoadCompleteCallback)
-> m (GClosure C_DocumentLoadCompleteCallback)
forall a b. (a -> b) -> a -> b
$ do
    let cb' :: C_DocumentLoadCompleteCallback
cb' = DocumentLoadCompleteCallback -> C_DocumentLoadCompleteCallback
wrap_DocumentReloadCallback DocumentLoadCompleteCallback
cb
    C_DocumentLoadCompleteCallback
-> IO (FunPtr C_DocumentLoadCompleteCallback)
mk_DocumentReloadCallback C_DocumentLoadCompleteCallback
cb' IO (FunPtr C_DocumentLoadCompleteCallback)
-> (FunPtr C_DocumentLoadCompleteCallback
    -> IO (GClosure C_DocumentLoadCompleteCallback))
-> IO (GClosure C_DocumentLoadCompleteCallback)
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= FunPtr C_DocumentLoadCompleteCallback
-> IO (GClosure C_DocumentLoadCompleteCallback)
forall (m :: * -> *) a. MonadIO m => FunPtr a -> m (GClosure a)
B.GClosure.newGClosure


-- | Wrap a `DocumentReloadCallback` into a `C_DocumentReloadCallback`.
wrap_DocumentReloadCallback ::
    DocumentReloadCallback ->
    C_DocumentReloadCallback
wrap_DocumentReloadCallback :: DocumentLoadCompleteCallback -> C_DocumentLoadCompleteCallback
wrap_DocumentReloadCallback _cb :: DocumentLoadCompleteCallback
_cb _ _ = do
    DocumentLoadCompleteCallback
_cb 


-- | Connect a signal handler for the [reload](#signal:reload) signal, to be run before the default handler.
-- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
-- 
-- @
-- 'Data.GI.Base.Signals.on' document #reload callback
-- @
-- 
-- 
onDocumentReload :: (IsDocument a, MonadIO m) => a -> DocumentReloadCallback -> m SignalHandlerId
onDocumentReload :: a -> DocumentLoadCompleteCallback -> m SignalHandlerId
onDocumentReload obj :: a
obj cb :: DocumentLoadCompleteCallback
cb = IO SignalHandlerId -> m SignalHandlerId
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO SignalHandlerId -> m SignalHandlerId)
-> IO SignalHandlerId -> m SignalHandlerId
forall a b. (a -> b) -> a -> b
$ do
    let cb' :: C_DocumentLoadCompleteCallback
cb' = DocumentLoadCompleteCallback -> C_DocumentLoadCompleteCallback
wrap_DocumentReloadCallback DocumentLoadCompleteCallback
cb
    FunPtr C_DocumentLoadCompleteCallback
cb'' <- C_DocumentLoadCompleteCallback
-> IO (FunPtr C_DocumentLoadCompleteCallback)
mk_DocumentReloadCallback C_DocumentLoadCompleteCallback
cb'
    a
-> Text
-> FunPtr C_DocumentLoadCompleteCallback
-> SignalConnectMode
-> Maybe Text
-> IO SignalHandlerId
forall o a.
GObject o =>
o
-> Text
-> FunPtr a
-> SignalConnectMode
-> Maybe Text
-> IO SignalHandlerId
connectSignalFunPtr a
obj "reload" FunPtr C_DocumentLoadCompleteCallback
cb'' SignalConnectMode
SignalConnectBefore Maybe Text
forall a. Maybe a
Nothing

-- | Connect a signal handler for the [reload](#signal:reload) signal, to be run after the default handler.
-- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
-- 
-- @
-- 'Data.GI.Base.Signals.after' document #reload callback
-- @
-- 
-- 
afterDocumentReload :: (IsDocument a, MonadIO m) => a -> DocumentReloadCallback -> m SignalHandlerId
afterDocumentReload :: a -> DocumentLoadCompleteCallback -> m SignalHandlerId
afterDocumentReload obj :: a
obj cb :: DocumentLoadCompleteCallback
cb = IO SignalHandlerId -> m SignalHandlerId
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO SignalHandlerId -> m SignalHandlerId)
-> IO SignalHandlerId -> m SignalHandlerId
forall a b. (a -> b) -> a -> b
$ do
    let cb' :: C_DocumentLoadCompleteCallback
cb' = DocumentLoadCompleteCallback -> C_DocumentLoadCompleteCallback
wrap_DocumentReloadCallback DocumentLoadCompleteCallback
cb
    FunPtr C_DocumentLoadCompleteCallback
cb'' <- C_DocumentLoadCompleteCallback
-> IO (FunPtr C_DocumentLoadCompleteCallback)
mk_DocumentReloadCallback C_DocumentLoadCompleteCallback
cb'
    a
-> Text
-> FunPtr C_DocumentLoadCompleteCallback
-> SignalConnectMode
-> Maybe Text
-> IO SignalHandlerId
forall o a.
GObject o =>
o
-> Text
-> FunPtr a
-> SignalConnectMode
-> Maybe Text
-> IO SignalHandlerId
connectSignalFunPtr a
obj "reload" FunPtr C_DocumentLoadCompleteCallback
cb'' SignalConnectMode
SignalConnectAfter Maybe Text
forall a. Maybe a
Nothing


#if defined(ENABLE_OVERLOADING)
data DocumentReloadSignalInfo
instance SignalInfo DocumentReloadSignalInfo where
    type HaskellCallbackType DocumentReloadSignalInfo = DocumentReloadCallback
    connectSignal obj cb connectMode detail = do
        let cb' = wrap_DocumentReloadCallback cb
        cb'' <- mk_DocumentReloadCallback cb'
        connectSignalFunPtr obj "reload" cb'' connectMode detail

#endif

#if defined(ENABLE_OVERLOADING)
type instance O.SignalList Document = DocumentSignalList
type DocumentSignalList = ('[ '("loadComplete", DocumentLoadCompleteSignalInfo), '("loadStopped", DocumentLoadStoppedSignalInfo), '("notify", GObject.Object.ObjectNotifySignalInfo), '("pageChanged", DocumentPageChangedSignalInfo), '("reload", DocumentReloadSignalInfo)] :: [(Symbol, *)])

#endif

foreign import ccall "atk_document_get_type"
    c_atk_document_get_type :: IO GType

instance GObject Document where
    gobjectType :: IO GType
gobjectType = IO GType
c_atk_document_get_type
    

-- | Convert 'Document' to and from 'Data.GI.Base.GValue.GValue' with 'Data.GI.Base.GValue.toGValue' and 'Data.GI.Base.GValue.fromGValue'.
instance B.GValue.IsGValue Document where
    toGValue :: Document -> IO GValue
toGValue o :: Document
o = do
        GType
gtype <- IO GType
c_atk_document_get_type
        Document -> (Ptr Document -> IO GValue) -> IO GValue
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
B.ManagedPtr.withManagedPtr Document
o (GType
-> (GValue -> Ptr Document -> DocumentLoadCompleteCallback)
-> Ptr Document
-> IO GValue
forall a.
GType
-> (GValue -> a -> DocumentLoadCompleteCallback) -> a -> IO GValue
B.GValue.buildGValue GType
gtype GValue -> Ptr Document -> DocumentLoadCompleteCallback
forall a.
GObject a =>
GValue -> Ptr a -> DocumentLoadCompleteCallback
B.GValue.set_object)
        
    fromGValue :: GValue -> IO Document
fromGValue gv :: GValue
gv = do
        Ptr Document
ptr <- GValue -> IO (Ptr Document)
forall b. GObject b => GValue -> IO (Ptr b)
B.GValue.get_object GValue
gv :: IO (Ptr Document)
        (ManagedPtr Document -> Document) -> Ptr Document -> IO Document
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
B.ManagedPtr.newObject ManagedPtr Document -> Document
Document Ptr Document
ptr
        
    

-- | Type class for types which can be safely cast to `Document`, for instance with `toDocument`.
class (GObject o, O.IsDescendantOf Document o) => IsDocument o
instance (GObject o, O.IsDescendantOf Document o) => IsDocument o

instance O.HasParentTypes Document
type instance O.ParentTypes Document = '[GObject.Object.Object]

-- | Cast to `Document`, for types for which this is known to be safe. For general casts, use `Data.GI.Base.ManagedPtr.castTo`.
toDocument :: (MonadIO m, IsDocument o) => o -> m Document
toDocument :: o -> m Document
toDocument = IO Document -> m Document
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Document -> m Document)
-> (o -> IO Document) -> o -> m Document
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (ManagedPtr Document -> Document) -> o -> IO Document
forall o o'.
(HasCallStack, GObject o, GObject o') =>
(ManagedPtr o' -> o') -> o -> IO o'
unsafeCastTo ManagedPtr Document -> Document
Document

#if defined(ENABLE_OVERLOADING)
instance O.HasAttributeList Document
type instance O.AttributeList Document = DocumentAttributeList
type DocumentAttributeList = ('[ ] :: [(Symbol, *)])
#endif

#if defined(ENABLE_OVERLOADING)
#endif

#if defined(ENABLE_OVERLOADING)
type family ResolveDocumentMethod (t :: Symbol) (o :: *) :: * where
    ResolveDocumentMethod "bindProperty" o = GObject.Object.ObjectBindPropertyMethodInfo
    ResolveDocumentMethod "bindPropertyFull" o = GObject.Object.ObjectBindPropertyFullMethodInfo
    ResolveDocumentMethod "forceFloating" o = GObject.Object.ObjectForceFloatingMethodInfo
    ResolveDocumentMethod "freezeNotify" o = GObject.Object.ObjectFreezeNotifyMethodInfo
    ResolveDocumentMethod "getv" o = GObject.Object.ObjectGetvMethodInfo
    ResolveDocumentMethod "isFloating" o = GObject.Object.ObjectIsFloatingMethodInfo
    ResolveDocumentMethod "notify" o = GObject.Object.ObjectNotifyMethodInfo
    ResolveDocumentMethod "notifyByPspec" o = GObject.Object.ObjectNotifyByPspecMethodInfo
    ResolveDocumentMethod "ref" o = GObject.Object.ObjectRefMethodInfo
    ResolveDocumentMethod "refSink" o = GObject.Object.ObjectRefSinkMethodInfo
    ResolveDocumentMethod "runDispose" o = GObject.Object.ObjectRunDisposeMethodInfo
    ResolveDocumentMethod "stealData" o = GObject.Object.ObjectStealDataMethodInfo
    ResolveDocumentMethod "stealQdata" o = GObject.Object.ObjectStealQdataMethodInfo
    ResolveDocumentMethod "thawNotify" o = GObject.Object.ObjectThawNotifyMethodInfo
    ResolveDocumentMethod "unref" o = GObject.Object.ObjectUnrefMethodInfo
    ResolveDocumentMethod "watchClosure" o = GObject.Object.ObjectWatchClosureMethodInfo
    ResolveDocumentMethod "getAttributeValue" o = DocumentGetAttributeValueMethodInfo
    ResolveDocumentMethod "getAttributes" o = DocumentGetAttributesMethodInfo
    ResolveDocumentMethod "getCurrentPageNumber" o = DocumentGetCurrentPageNumberMethodInfo
    ResolveDocumentMethod "getData" o = GObject.Object.ObjectGetDataMethodInfo
    ResolveDocumentMethod "getDocument" o = DocumentGetDocumentMethodInfo
    ResolveDocumentMethod "getDocumentType" o = DocumentGetDocumentTypeMethodInfo
    ResolveDocumentMethod "getLocale" o = DocumentGetLocaleMethodInfo
    ResolveDocumentMethod "getPageCount" o = DocumentGetPageCountMethodInfo
    ResolveDocumentMethod "getProperty" o = GObject.Object.ObjectGetPropertyMethodInfo
    ResolveDocumentMethod "getQdata" o = GObject.Object.ObjectGetQdataMethodInfo
    ResolveDocumentMethod "setAttributeValue" o = DocumentSetAttributeValueMethodInfo
    ResolveDocumentMethod "setData" o = GObject.Object.ObjectSetDataMethodInfo
    ResolveDocumentMethod "setDataFull" o = GObject.Object.ObjectSetDataFullMethodInfo
    ResolveDocumentMethod "setProperty" o = GObject.Object.ObjectSetPropertyMethodInfo
    ResolveDocumentMethod l o = O.MethodResolutionFailed l o

instance (info ~ ResolveDocumentMethod t Document, O.MethodInfo info Document p) => OL.IsLabel t (Document -> p) where
#if MIN_VERSION_base(4,10,0)
    fromLabel = O.overloadedMethod @info
#else
    fromLabel _ = O.overloadedMethod @info
#endif

#endif

-- method Document::get_attribute_value
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "document"
--           , argType =
--               TInterface Name { namespace = "Atk" , name = "Document" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "a #GObject instance that implements AtkDocumentIface"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "attribute_name"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just
--                       "a character string representing the name of the attribute\n           whose value is being queried."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TUTF8)
-- throws : False
-- Skip return : False

foreign import ccall "atk_document_get_attribute_value" atk_document_get_attribute_value :: 
    Ptr Document ->                         -- document : TInterface (Name {namespace = "Atk", name = "Document"})
    CString ->                              -- attribute_name : TBasicType TUTF8
    IO CString

-- | /No description available in the introspection data./
-- 
-- /Since: 1.12/
documentGetAttributeValue ::
    (B.CallStack.HasCallStack, MonadIO m, IsDocument a) =>
    a
    -- ^ /@document@/: a t'GI.GObject.Objects.Object.Object' instance that implements AtkDocumentIface
    -> T.Text
    -- ^ /@attributeName@/: a character string representing the name of the attribute
    --            whose value is being queried.
    -> m (Maybe T.Text)
    -- ^ __Returns:__ a string value associated with the named
    --    attribute for this document, or NULL if a value for
    --    @/attribute_name/@ has not been specified for this document.
documentGetAttributeValue :: a -> Text -> m (Maybe Text)
documentGetAttributeValue document :: a
document attributeName :: Text
attributeName = IO (Maybe Text) -> m (Maybe Text)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (Maybe Text) -> m (Maybe Text))
-> IO (Maybe Text) -> m (Maybe Text)
forall a b. (a -> b) -> a -> b
$ do
    Ptr Document
document' <- a -> IO (Ptr Document)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
document
    CString
attributeName' <- Text -> IO CString
textToCString Text
attributeName
    CString
result <- Ptr Document -> CString -> IO CString
atk_document_get_attribute_value Ptr Document
document' CString
attributeName'
    Maybe Text
maybeResult <- CString -> (CString -> IO Text) -> IO (Maybe Text)
forall a b. Ptr a -> (Ptr a -> IO b) -> IO (Maybe b)
convertIfNonNull CString
result ((CString -> IO Text) -> IO (Maybe Text))
-> (CString -> IO Text) -> IO (Maybe Text)
forall a b. (a -> b) -> a -> b
$ \result' :: CString
result' -> do
        Text
result'' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
result'
        Text -> IO Text
forall (m :: * -> *) a. Monad m => a -> m a
return Text
result''
    a -> DocumentLoadCompleteCallback
forall a. ManagedPtrNewtype a => a -> DocumentLoadCompleteCallback
touchManagedPtr a
document
    CString -> DocumentLoadCompleteCallback
forall a. Ptr a -> DocumentLoadCompleteCallback
freeMem CString
attributeName'
    Maybe Text -> IO (Maybe Text)
forall (m :: * -> *) a. Monad m => a -> m a
return Maybe Text
maybeResult

#if defined(ENABLE_OVERLOADING)
data DocumentGetAttributeValueMethodInfo
instance (signature ~ (T.Text -> m (Maybe T.Text)), MonadIO m, IsDocument a) => O.MethodInfo DocumentGetAttributeValueMethodInfo a signature where
    overloadedMethod = documentGetAttributeValue

#endif

-- method Document::get_attributes
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "document"
--           , argType =
--               TInterface Name { namespace = "Atk" , name = "Document" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "a #GObject instance that implements AtkDocumentIface"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TGSList (TBasicType TPtr))
-- throws : False
-- Skip return : False

foreign import ccall "atk_document_get_attributes" atk_document_get_attributes :: 
    Ptr Document ->                         -- document : TInterface (Name {namespace = "Atk", name = "Document"})
    IO (Ptr (GSList (Ptr ())))

-- | Gets an AtkAttributeSet which describes document-wide
--          attributes as name-value pairs.
-- 
-- /Since: 1.12/
documentGetAttributes ::
    (B.CallStack.HasCallStack, MonadIO m, IsDocument a) =>
    a
    -- ^ /@document@/: a t'GI.GObject.Objects.Object.Object' instance that implements AtkDocumentIface
    -> m ([Ptr ()])
    -- ^ __Returns:__ An AtkAttributeSet containing the explicitly
    --          set name-value-pair attributes associated with this document
    --          as a whole.
documentGetAttributes :: a -> m [Ptr ()]
documentGetAttributes document :: a
document = IO [Ptr ()] -> m [Ptr ()]
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO [Ptr ()] -> m [Ptr ()]) -> IO [Ptr ()] -> m [Ptr ()]
forall a b. (a -> b) -> a -> b
$ do
    Ptr Document
document' <- a -> IO (Ptr Document)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
document
    Ptr (GSList (Ptr ()))
result <- Ptr Document -> IO (Ptr (GSList (Ptr ())))
atk_document_get_attributes Ptr Document
document'
    [Ptr ()]
result' <- Ptr (GSList (Ptr ())) -> IO [Ptr ()]
forall a. Ptr (GSList (Ptr a)) -> IO [Ptr a]
unpackGSList Ptr (GSList (Ptr ()))
result
    a -> DocumentLoadCompleteCallback
forall a. ManagedPtrNewtype a => a -> DocumentLoadCompleteCallback
touchManagedPtr a
document
    [Ptr ()] -> IO [Ptr ()]
forall (m :: * -> *) a. Monad m => a -> m a
return [Ptr ()]
result'

#if defined(ENABLE_OVERLOADING)
data DocumentGetAttributesMethodInfo
instance (signature ~ (m ([Ptr ()])), MonadIO m, IsDocument a) => O.MethodInfo DocumentGetAttributesMethodInfo a signature where
    overloadedMethod = documentGetAttributes

#endif

-- method Document::get_current_page_number
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "document"
--           , argType =
--               TInterface Name { namespace = "Atk" , name = "Document" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the #AtkDocument" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TInt)
-- throws : False
-- Skip return : False

foreign import ccall "atk_document_get_current_page_number" atk_document_get_current_page_number :: 
    Ptr Document ->                         -- document : TInterface (Name {namespace = "Atk", name = "Document"})
    IO Int32

-- | /No description available in the introspection data./
-- 
-- /Since: 2.12/
documentGetCurrentPageNumber ::
    (B.CallStack.HasCallStack, MonadIO m, IsDocument a) =>
    a
    -- ^ /@document@/: the t'GI.Atk.Interfaces.Document.Document'
    -> m Int32
    -- ^ __Returns:__ current page number inside /@document@/. -1 if not
    -- implemented, not know by the implementor or irrelevant.
documentGetCurrentPageNumber :: a -> m Int32
documentGetCurrentPageNumber document :: a
document = IO Int32 -> m Int32
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Int32 -> m Int32) -> IO Int32 -> m Int32
forall a b. (a -> b) -> a -> b
$ do
    Ptr Document
document' <- a -> IO (Ptr Document)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
document
    Int32
result <- Ptr Document -> IO Int32
atk_document_get_current_page_number Ptr Document
document'
    a -> DocumentLoadCompleteCallback
forall a. ManagedPtrNewtype a => a -> DocumentLoadCompleteCallback
touchManagedPtr a
document
    Int32 -> IO Int32
forall (m :: * -> *) a. Monad m => a -> m a
return Int32
result

#if defined(ENABLE_OVERLOADING)
data DocumentGetCurrentPageNumberMethodInfo
instance (signature ~ (m Int32), MonadIO m, IsDocument a) => O.MethodInfo DocumentGetCurrentPageNumberMethodInfo a signature where
    overloadedMethod = documentGetCurrentPageNumber

#endif

-- method Document::get_document
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "document"
--           , argType =
--               TInterface Name { namespace = "Atk" , name = "Document" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "a #GObject instance that implements AtkDocumentIface"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TPtr)
-- throws : False
-- Skip return : False

foreign import ccall "atk_document_get_document" atk_document_get_document :: 
    Ptr Document ->                         -- document : TInterface (Name {namespace = "Atk", name = "Document"})
    IO (Ptr ())

{-# DEPRECATED documentGetDocument ["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."] #-}
-- | 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.
documentGetDocument ::
    (B.CallStack.HasCallStack, MonadIO m, IsDocument a) =>
    a
    -- ^ /@document@/: a t'GI.GObject.Objects.Object.Object' instance that implements AtkDocumentIface
    -> m (Ptr ())
    -- ^ __Returns:__ a @/gpointer/@ that points to an instance of the DOM.
documentGetDocument :: a -> m (Ptr ())
documentGetDocument document :: a
document = IO (Ptr ()) -> m (Ptr ())
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (Ptr ()) -> m (Ptr ())) -> IO (Ptr ()) -> m (Ptr ())
forall a b. (a -> b) -> a -> b
$ do
    Ptr Document
document' <- a -> IO (Ptr Document)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
document
    Ptr ()
result <- Ptr Document -> IO (Ptr ())
atk_document_get_document Ptr Document
document'
    a -> DocumentLoadCompleteCallback
forall a. ManagedPtrNewtype a => a -> DocumentLoadCompleteCallback
touchManagedPtr a
document
    Ptr () -> IO (Ptr ())
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr ()
result

#if defined(ENABLE_OVERLOADING)
data DocumentGetDocumentMethodInfo
instance (signature ~ (m (Ptr ())), MonadIO m, IsDocument a) => O.MethodInfo DocumentGetDocumentMethodInfo a signature where
    overloadedMethod = documentGetDocument

#endif

-- method Document::get_document_type
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "document"
--           , argType =
--               TInterface Name { namespace = "Atk" , name = "Document" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "a #GObject instance that implements AtkDocumentIface"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TUTF8)
-- throws : False
-- Skip return : False

foreign import ccall "atk_document_get_document_type" atk_document_get_document_type :: 
    Ptr Document ->                         -- document : TInterface (Name {namespace = "Atk", name = "Document"})
    IO CString

{-# DEPRECATED documentGetDocumentType ["Since 2.12. Please use 'GI.Atk.Interfaces.Document.documentGetAttributes' to","ask for the document type if it applies."] #-}
-- | Gets a string indicating the document type.
documentGetDocumentType ::
    (B.CallStack.HasCallStack, MonadIO m, IsDocument a) =>
    a
    -- ^ /@document@/: a t'GI.GObject.Objects.Object.Object' instance that implements AtkDocumentIface
    -> m T.Text
    -- ^ __Returns:__ a string indicating the document type
documentGetDocumentType :: a -> m Text
documentGetDocumentType document :: a
document = IO Text -> m Text
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Text -> m Text) -> IO Text -> m Text
forall a b. (a -> b) -> a -> b
$ do
    Ptr Document
document' <- a -> IO (Ptr Document)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
document
    CString
result <- Ptr Document -> IO CString
atk_document_get_document_type Ptr Document
document'
    Text -> CString -> DocumentLoadCompleteCallback
forall a.
HasCallStack =>
Text -> Ptr a -> DocumentLoadCompleteCallback
checkUnexpectedReturnNULL "documentGetDocumentType" CString
result
    Text
result' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
result
    a -> DocumentLoadCompleteCallback
forall a. ManagedPtrNewtype a => a -> DocumentLoadCompleteCallback
touchManagedPtr a
document
    Text -> IO Text
forall (m :: * -> *) a. Monad m => a -> m a
return Text
result'

#if defined(ENABLE_OVERLOADING)
data DocumentGetDocumentTypeMethodInfo
instance (signature ~ (m T.Text), MonadIO m, IsDocument a) => O.MethodInfo DocumentGetDocumentTypeMethodInfo a signature where
    overloadedMethod = documentGetDocumentType

#endif

-- method Document::get_locale
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "document"
--           , argType =
--               TInterface Name { namespace = "Atk" , name = "Document" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "a #GObject instance that implements AtkDocumentIface"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TUTF8)
-- throws : False
-- Skip return : False

foreign import ccall "atk_document_get_locale" atk_document_get_locale :: 
    Ptr Document ->                         -- document : TInterface (Name {namespace = "Atk", name = "Document"})
    IO CString

{-# DEPRECATED documentGetLocale ["(Since version 2.7.90)","Please use 'GI.Atk.Objects.Object.objectGetObjectLocale' instead."] #-}
-- | 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.
documentGetLocale ::
    (B.CallStack.HasCallStack, MonadIO m, IsDocument a) =>
    a
    -- ^ /@document@/: a t'GI.GObject.Objects.Object.Object' instance that implements AtkDocumentIface
    -> m T.Text
    -- ^ __Returns:__ a UTF-8 string indicating the POSIX-style LC_MESSAGES
    --          locale of the document content as a whole, or NULL if
    --          the document content does not specify a locale.
documentGetLocale :: a -> m Text
documentGetLocale document :: a
document = IO Text -> m Text
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Text -> m Text) -> IO Text -> m Text
forall a b. (a -> b) -> a -> b
$ do
    Ptr Document
document' <- a -> IO (Ptr Document)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
document
    CString
result <- Ptr Document -> IO CString
atk_document_get_locale Ptr Document
document'
    Text -> CString -> DocumentLoadCompleteCallback
forall a.
HasCallStack =>
Text -> Ptr a -> DocumentLoadCompleteCallback
checkUnexpectedReturnNULL "documentGetLocale" CString
result
    Text
result' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
result
    a -> DocumentLoadCompleteCallback
forall a. ManagedPtrNewtype a => a -> DocumentLoadCompleteCallback
touchManagedPtr a
document
    Text -> IO Text
forall (m :: * -> *) a. Monad m => a -> m a
return Text
result'

#if defined(ENABLE_OVERLOADING)
data DocumentGetLocaleMethodInfo
instance (signature ~ (m T.Text), MonadIO m, IsDocument a) => O.MethodInfo DocumentGetLocaleMethodInfo a signature where
    overloadedMethod = documentGetLocale

#endif

-- method Document::get_page_count
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "document"
--           , argType =
--               TInterface Name { namespace = "Atk" , name = "Document" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the #AtkDocument" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TInt)
-- throws : False
-- Skip return : False

foreign import ccall "atk_document_get_page_count" atk_document_get_page_count :: 
    Ptr Document ->                         -- document : TInterface (Name {namespace = "Atk", name = "Document"})
    IO Int32

-- | /No description available in the introspection data./
-- 
-- /Since: 2.12/
documentGetPageCount ::
    (B.CallStack.HasCallStack, MonadIO m, IsDocument a) =>
    a
    -- ^ /@document@/: the t'GI.Atk.Interfaces.Document.Document'
    -> m Int32
    -- ^ __Returns:__ total page count of /@document@/. -1 if not implemented, not
    -- know by the implementor or irrelevant.
documentGetPageCount :: a -> m Int32
documentGetPageCount document :: a
document = IO Int32 -> m Int32
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Int32 -> m Int32) -> IO Int32 -> m Int32
forall a b. (a -> b) -> a -> b
$ do
    Ptr Document
document' <- a -> IO (Ptr Document)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
document
    Int32
result <- Ptr Document -> IO Int32
atk_document_get_page_count Ptr Document
document'
    a -> DocumentLoadCompleteCallback
forall a. ManagedPtrNewtype a => a -> DocumentLoadCompleteCallback
touchManagedPtr a
document
    Int32 -> IO Int32
forall (m :: * -> *) a. Monad m => a -> m a
return Int32
result

#if defined(ENABLE_OVERLOADING)
data DocumentGetPageCountMethodInfo
instance (signature ~ (m Int32), MonadIO m, IsDocument a) => O.MethodInfo DocumentGetPageCountMethodInfo a signature where
    overloadedMethod = documentGetPageCount

#endif

-- method Document::set_attribute_value
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "document"
--           , argType =
--               TInterface Name { namespace = "Atk" , name = "Document" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "a #GObject instance that implements AtkDocumentIface"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "attribute_name"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just
--                       "a character string representing the name of the attribute\n           whose value is being set."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "attribute_value"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "a string value to be associated with #attribute_name."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "atk_document_set_attribute_value" atk_document_set_attribute_value :: 
    Ptr Document ->                         -- document : TInterface (Name {namespace = "Atk", name = "Document"})
    CString ->                              -- attribute_name : TBasicType TUTF8
    CString ->                              -- attribute_value : TBasicType TUTF8
    IO CInt

-- | /No description available in the introspection data./
-- 
-- /Since: 1.12/
documentSetAttributeValue ::
    (B.CallStack.HasCallStack, MonadIO m, IsDocument a) =>
    a
    -- ^ /@document@/: a t'GI.GObject.Objects.Object.Object' instance that implements AtkDocumentIface
    -> T.Text
    -- ^ /@attributeName@/: a character string representing the name of the attribute
    --            whose value is being set.
    -> T.Text
    -- ^ /@attributeValue@/: a string value to be associated with @/attribute_name/@.
    -> m Bool
    -- ^ __Returns:__ TRUE if @/value/@ is successfully associated with @/attribute_name/@
    --          for this document, FALSE otherwise (e.g. if the document does not
    --          allow the attribute to be modified).
documentSetAttributeValue :: a -> Text -> Text -> m Bool
documentSetAttributeValue document :: a
document attributeName :: Text
attributeName attributeValue :: Text
attributeValue = IO Bool -> m Bool
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Bool -> m Bool) -> IO Bool -> m Bool
forall a b. (a -> b) -> a -> b
$ do
    Ptr Document
document' <- a -> IO (Ptr Document)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
document
    CString
attributeName' <- Text -> IO CString
textToCString Text
attributeName
    CString
attributeValue' <- Text -> IO CString
textToCString Text
attributeValue
    CInt
result <- Ptr Document -> CString -> CString -> IO CInt
atk_document_set_attribute_value Ptr Document
document' CString
attributeName' CString
attributeValue'
    let result' :: Bool
result' = (CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
/= 0) CInt
result
    a -> DocumentLoadCompleteCallback
forall a. ManagedPtrNewtype a => a -> DocumentLoadCompleteCallback
touchManagedPtr a
document
    CString -> DocumentLoadCompleteCallback
forall a. Ptr a -> DocumentLoadCompleteCallback
freeMem CString
attributeName'
    CString -> DocumentLoadCompleteCallback
forall a. Ptr a -> DocumentLoadCompleteCallback
freeMem CString
attributeValue'
    Bool -> IO Bool
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
result'

#if defined(ENABLE_OVERLOADING)
data DocumentSetAttributeValueMethodInfo
instance (signature ~ (T.Text -> T.Text -> m Bool), MonadIO m, IsDocument a) => O.MethodInfo DocumentSetAttributeValueMethodInfo a signature where
    overloadedMethod = documentSetAttributeValue

#endif