{- |
Copyright  : Will Thompson, Iñaki García Etxebarria and Jonas Platte
License    : LGPL-2.1
Maintainer : Iñaki García Etxebarria (garetxe@gmail.com)
-}

module GI.Pango.Objects.Context
    ( 

-- * Exported types
    Context(..)                             ,
    ContextK                                ,
    toContext                               ,
    noContext                               ,


 -- * Methods
-- ** contextChanged
    contextChanged                          ,


-- ** contextGetBaseDir
    contextGetBaseDir                       ,


-- ** contextGetBaseGravity
    contextGetBaseGravity                   ,


-- ** contextGetFontDescription
    contextGetFontDescription               ,


-- ** contextGetFontMap
    contextGetFontMap                       ,


-- ** contextGetGravity
    contextGetGravity                       ,


-- ** contextGetGravityHint
    contextGetGravityHint                   ,


-- ** contextGetLanguage
    contextGetLanguage                      ,


-- ** contextGetMatrix
    contextGetMatrix                        ,


-- ** contextGetMetrics
    contextGetMetrics                       ,


-- ** contextGetSerial
    contextGetSerial                        ,


-- ** contextListFamilies
    contextListFamilies                     ,


-- ** contextLoadFont
    contextLoadFont                         ,


-- ** contextLoadFontset
    contextLoadFontset                      ,


-- ** contextNew
    contextNew                              ,


-- ** contextSetBaseDir
    contextSetBaseDir                       ,


-- ** contextSetBaseGravity
    contextSetBaseGravity                   ,


-- ** contextSetFontDescription
    contextSetFontDescription               ,


-- ** contextSetFontMap
    contextSetFontMap                       ,


-- ** contextSetGravityHint
    contextSetGravityHint                   ,


-- ** contextSetLanguage
    contextSetLanguage                      ,


-- ** contextSetMatrix
    contextSetMatrix                        ,




    ) where

import Prelude ()
import Data.GI.Base.ShortPrelude

import qualified Data.Text as T
import qualified Data.ByteString.Char8 as B
import qualified Data.Map as Map

import GI.Pango.Types
import GI.Pango.Callbacks
import qualified GI.GObject as GObject

newtype Context = Context (ForeignPtr Context)
foreign import ccall "pango_context_get_type"
    c_pango_context_get_type :: IO GType

type instance ParentTypes Context = ContextParentTypes
type ContextParentTypes = '[GObject.Object]

instance GObject Context where
    gobjectIsInitiallyUnowned _ = False
    gobjectType _ = c_pango_context_get_type
    

class GObject o => ContextK o
instance (GObject o, IsDescendantOf Context o) => ContextK o

toContext :: ContextK o => o -> IO Context
toContext = unsafeCastTo Context

noContext :: Maybe Context
noContext = Nothing

type instance AttributeList Context = ContextAttributeList
type ContextAttributeList = ('[ ] :: [(Symbol, *)])

type instance SignalList Context = ContextSignalList
type ContextSignalList = ('[ '("notify", GObject.ObjectNotifySignalInfo), '("notify::[property]", GObjectNotifySignalInfo)] :: [(Symbol, *)])

-- method Context::new
-- method type : Constructor
-- Args : []
-- Lengths : []
-- hInArgs : []
-- returnType : TInterface "Pango" "Context"
-- throws : False
-- Skip return : False

foreign import ccall "pango_context_new" pango_context_new :: 
    IO (Ptr Context)


contextNew ::
    (MonadIO m) =>
    m Context
contextNew  = liftIO $ do
    result <- pango_context_new
    checkUnexpectedReturnNULL "pango_context_new" result
    result' <- (wrapObject Context) result
    return result'

-- method Context::changed
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Pango" "Context", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Pango" "Context", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False

foreign import ccall "pango_context_changed" pango_context_changed :: 
    Ptr Context ->                          -- _obj : TInterface "Pango" "Context"
    IO ()


contextChanged ::
    (MonadIO m, ContextK a) =>
    a ->                                    -- _obj
    m ()
contextChanged _obj = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    pango_context_changed _obj'
    touchManagedPtr _obj
    return ()

-- method Context::get_base_dir
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Pango" "Context", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Pango" "Context", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TInterface "Pango" "Direction"
-- throws : False
-- Skip return : False

foreign import ccall "pango_context_get_base_dir" pango_context_get_base_dir :: 
    Ptr Context ->                          -- _obj : TInterface "Pango" "Context"
    IO CUInt


contextGetBaseDir ::
    (MonadIO m, ContextK a) =>
    a ->                                    -- _obj
    m Direction
contextGetBaseDir _obj = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    result <- pango_context_get_base_dir _obj'
    let result' = (toEnum . fromIntegral) result
    touchManagedPtr _obj
    return result'

-- method Context::get_base_gravity
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Pango" "Context", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Pango" "Context", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TInterface "Pango" "Gravity"
-- throws : False
-- Skip return : False

foreign import ccall "pango_context_get_base_gravity" pango_context_get_base_gravity :: 
    Ptr Context ->                          -- _obj : TInterface "Pango" "Context"
    IO CUInt


contextGetBaseGravity ::
    (MonadIO m, ContextK a) =>
    a ->                                    -- _obj
    m Gravity
contextGetBaseGravity _obj = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    result <- pango_context_get_base_gravity _obj'
    let result' = (toEnum . fromIntegral) result
    touchManagedPtr _obj
    return result'

-- method Context::get_font_description
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Pango" "Context", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Pango" "Context", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TInterface "Pango" "FontDescription"
-- throws : False
-- Skip return : False

foreign import ccall "pango_context_get_font_description" pango_context_get_font_description :: 
    Ptr Context ->                          -- _obj : TInterface "Pango" "Context"
    IO (Ptr FontDescription)


contextGetFontDescription ::
    (MonadIO m, ContextK a) =>
    a ->                                    -- _obj
    m FontDescription
contextGetFontDescription _obj = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    result <- pango_context_get_font_description _obj'
    checkUnexpectedReturnNULL "pango_context_get_font_description" result
    result' <- (newBoxed FontDescription) result
    touchManagedPtr _obj
    return result'

-- method Context::get_font_map
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Pango" "Context", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Pango" "Context", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TInterface "Pango" "FontMap"
-- throws : False
-- Skip return : False

foreign import ccall "pango_context_get_font_map" pango_context_get_font_map :: 
    Ptr Context ->                          -- _obj : TInterface "Pango" "Context"
    IO (Ptr FontMap)


contextGetFontMap ::
    (MonadIO m, ContextK a) =>
    a ->                                    -- _obj
    m FontMap
contextGetFontMap _obj = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    result <- pango_context_get_font_map _obj'
    checkUnexpectedReturnNULL "pango_context_get_font_map" result
    result' <- (newObject FontMap) result
    touchManagedPtr _obj
    return result'

-- method Context::get_gravity
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Pango" "Context", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Pango" "Context", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TInterface "Pango" "Gravity"
-- throws : False
-- Skip return : False

foreign import ccall "pango_context_get_gravity" pango_context_get_gravity :: 
    Ptr Context ->                          -- _obj : TInterface "Pango" "Context"
    IO CUInt


contextGetGravity ::
    (MonadIO m, ContextK a) =>
    a ->                                    -- _obj
    m Gravity
contextGetGravity _obj = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    result <- pango_context_get_gravity _obj'
    let result' = (toEnum . fromIntegral) result
    touchManagedPtr _obj
    return result'

-- method Context::get_gravity_hint
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Pango" "Context", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Pango" "Context", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TInterface "Pango" "GravityHint"
-- throws : False
-- Skip return : False

foreign import ccall "pango_context_get_gravity_hint" pango_context_get_gravity_hint :: 
    Ptr Context ->                          -- _obj : TInterface "Pango" "Context"
    IO CUInt


contextGetGravityHint ::
    (MonadIO m, ContextK a) =>
    a ->                                    -- _obj
    m GravityHint
contextGetGravityHint _obj = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    result <- pango_context_get_gravity_hint _obj'
    let result' = (toEnum . fromIntegral) result
    touchManagedPtr _obj
    return result'

-- method Context::get_language
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Pango" "Context", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Pango" "Context", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TInterface "Pango" "Language"
-- throws : False
-- Skip return : False

foreign import ccall "pango_context_get_language" pango_context_get_language :: 
    Ptr Context ->                          -- _obj : TInterface "Pango" "Context"
    IO (Ptr Language)


contextGetLanguage ::
    (MonadIO m, ContextK a) =>
    a ->                                    -- _obj
    m Language
contextGetLanguage _obj = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    result <- pango_context_get_language _obj'
    checkUnexpectedReturnNULL "pango_context_get_language" result
    result' <- (wrapBoxed Language) result
    touchManagedPtr _obj
    return result'

-- method Context::get_matrix
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Pango" "Context", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Pango" "Context", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TInterface "Pango" "Matrix"
-- throws : False
-- Skip return : False

foreign import ccall "pango_context_get_matrix" pango_context_get_matrix :: 
    Ptr Context ->                          -- _obj : TInterface "Pango" "Context"
    IO (Ptr Matrix)


contextGetMatrix ::
    (MonadIO m, ContextK a) =>
    a ->                                    -- _obj
    m Matrix
contextGetMatrix _obj = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    result <- pango_context_get_matrix _obj'
    checkUnexpectedReturnNULL "pango_context_get_matrix" result
    result' <- (newBoxed Matrix) result
    touchManagedPtr _obj
    return result'

-- method Context::get_metrics
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Pango" "Context", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "desc", argType = TInterface "Pango" "FontDescription", direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "language", argType = TInterface "Pango" "Language", direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Pango" "Context", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "desc", argType = TInterface "Pango" "FontDescription", direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "language", argType = TInterface "Pango" "Language", direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TInterface "Pango" "FontMetrics"
-- throws : False
-- Skip return : False

foreign import ccall "pango_context_get_metrics" pango_context_get_metrics :: 
    Ptr Context ->                          -- _obj : TInterface "Pango" "Context"
    Ptr FontDescription ->                  -- desc : TInterface "Pango" "FontDescription"
    Ptr Language ->                         -- language : TInterface "Pango" "Language"
    IO (Ptr FontMetrics)


contextGetMetrics ::
    (MonadIO m, ContextK a) =>
    a ->                                    -- _obj
    Maybe (FontDescription) ->              -- desc
    Maybe (Language) ->                     -- language
    m FontMetrics
contextGetMetrics _obj desc language = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    maybeDesc <- case desc of
        Nothing -> return nullPtr
        Just jDesc -> do
            let jDesc' = unsafeManagedPtrGetPtr jDesc
            return jDesc'
    maybeLanguage <- case language of
        Nothing -> return nullPtr
        Just jLanguage -> do
            let jLanguage' = unsafeManagedPtrGetPtr jLanguage
            return jLanguage'
    result <- pango_context_get_metrics _obj' maybeDesc maybeLanguage
    checkUnexpectedReturnNULL "pango_context_get_metrics" result
    result' <- (wrapBoxed FontMetrics) result
    touchManagedPtr _obj
    whenJust desc touchManagedPtr
    whenJust language touchManagedPtr
    return result'

-- method Context::get_serial
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Pango" "Context", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Pango" "Context", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TUInt32
-- throws : False
-- Skip return : False

foreign import ccall "pango_context_get_serial" pango_context_get_serial :: 
    Ptr Context ->                          -- _obj : TInterface "Pango" "Context"
    IO Word32


contextGetSerial ::
    (MonadIO m, ContextK a) =>
    a ->                                    -- _obj
    m Word32
contextGetSerial _obj = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    result <- pango_context_get_serial _obj'
    touchManagedPtr _obj
    return result

-- method Context::list_families
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Pango" "Context", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "families", argType = TCArray False (-1) 2 (TInterface "Pango" "FontFamily"), direction = DirectionOut, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferContainer},Arg {argName = "n_families", argType = TBasicType TInt32, direction = DirectionOut, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferEverything}]
-- Lengths : [Arg {argName = "n_families", argType = TBasicType TInt32, direction = DirectionOut, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferEverything}]
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Pango" "Context", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False

foreign import ccall "pango_context_list_families" pango_context_list_families :: 
    Ptr Context ->                          -- _obj : TInterface "Pango" "Context"
    Ptr (Ptr (Ptr FontFamily)) ->           -- families : TCArray False (-1) 2 (TInterface "Pango" "FontFamily")
    Ptr Int32 ->                            -- n_families : TBasicType TInt32
    IO ()


contextListFamilies ::
    (MonadIO m, ContextK a) =>
    a ->                                    -- _obj
    m ([FontFamily])
contextListFamilies _obj = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    families <- allocMem :: IO (Ptr (Ptr (Ptr FontFamily)))
    n_families <- allocMem :: IO (Ptr Int32)
    pango_context_list_families _obj' families n_families
    n_families' <- peek n_families
    families' <- peek families
    families'' <- (unpackPtrArrayWithLength n_families') families'
    families''' <- mapM (newObject FontFamily) families''
    freeMem families'
    touchManagedPtr _obj
    freeMem families
    freeMem n_families
    return families'''

-- method Context::load_font
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Pango" "Context", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "desc", argType = TInterface "Pango" "FontDescription", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Pango" "Context", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "desc", argType = TInterface "Pango" "FontDescription", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TInterface "Pango" "Font"
-- throws : False
-- Skip return : False

foreign import ccall "pango_context_load_font" pango_context_load_font :: 
    Ptr Context ->                          -- _obj : TInterface "Pango" "Context"
    Ptr FontDescription ->                  -- desc : TInterface "Pango" "FontDescription"
    IO (Ptr Font)


contextLoadFont ::
    (MonadIO m, ContextK a) =>
    a ->                                    -- _obj
    FontDescription ->                      -- desc
    m Font
contextLoadFont _obj desc = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    let desc' = unsafeManagedPtrGetPtr desc
    result <- pango_context_load_font _obj' desc'
    checkUnexpectedReturnNULL "pango_context_load_font" result
    result' <- (wrapObject Font) result
    touchManagedPtr _obj
    touchManagedPtr desc
    return result'

-- method Context::load_fontset
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Pango" "Context", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "desc", argType = TInterface "Pango" "FontDescription", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "language", argType = TInterface "Pango" "Language", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Pango" "Context", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "desc", argType = TInterface "Pango" "FontDescription", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "language", argType = TInterface "Pango" "Language", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TInterface "Pango" "Fontset"
-- throws : False
-- Skip return : False

foreign import ccall "pango_context_load_fontset" pango_context_load_fontset :: 
    Ptr Context ->                          -- _obj : TInterface "Pango" "Context"
    Ptr FontDescription ->                  -- desc : TInterface "Pango" "FontDescription"
    Ptr Language ->                         -- language : TInterface "Pango" "Language"
    IO (Ptr Fontset)


contextLoadFontset ::
    (MonadIO m, ContextK a) =>
    a ->                                    -- _obj
    FontDescription ->                      -- desc
    Language ->                             -- language
    m Fontset
contextLoadFontset _obj desc language = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    let desc' = unsafeManagedPtrGetPtr desc
    let language' = unsafeManagedPtrGetPtr language
    result <- pango_context_load_fontset _obj' desc' language'
    checkUnexpectedReturnNULL "pango_context_load_fontset" result
    result' <- (wrapObject Fontset) result
    touchManagedPtr _obj
    touchManagedPtr desc
    touchManagedPtr language
    return result'

-- method Context::set_base_dir
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Pango" "Context", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "direction", argType = TInterface "Pango" "Direction", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Pango" "Context", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "direction", argType = TInterface "Pango" "Direction", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False

foreign import ccall "pango_context_set_base_dir" pango_context_set_base_dir :: 
    Ptr Context ->                          -- _obj : TInterface "Pango" "Context"
    CUInt ->                                -- direction : TInterface "Pango" "Direction"
    IO ()


contextSetBaseDir ::
    (MonadIO m, ContextK a) =>
    a ->                                    -- _obj
    Direction ->                            -- direction
    m ()
contextSetBaseDir _obj direction = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    let direction' = (fromIntegral . fromEnum) direction
    pango_context_set_base_dir _obj' direction'
    touchManagedPtr _obj
    return ()

-- method Context::set_base_gravity
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Pango" "Context", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "gravity", argType = TInterface "Pango" "Gravity", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Pango" "Context", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "gravity", argType = TInterface "Pango" "Gravity", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False

foreign import ccall "pango_context_set_base_gravity" pango_context_set_base_gravity :: 
    Ptr Context ->                          -- _obj : TInterface "Pango" "Context"
    CUInt ->                                -- gravity : TInterface "Pango" "Gravity"
    IO ()


contextSetBaseGravity ::
    (MonadIO m, ContextK a) =>
    a ->                                    -- _obj
    Gravity ->                              -- gravity
    m ()
contextSetBaseGravity _obj gravity = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    let gravity' = (fromIntegral . fromEnum) gravity
    pango_context_set_base_gravity _obj' gravity'
    touchManagedPtr _obj
    return ()

-- method Context::set_font_description
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Pango" "Context", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "desc", argType = TInterface "Pango" "FontDescription", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Pango" "Context", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "desc", argType = TInterface "Pango" "FontDescription", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False

foreign import ccall "pango_context_set_font_description" pango_context_set_font_description :: 
    Ptr Context ->                          -- _obj : TInterface "Pango" "Context"
    Ptr FontDescription ->                  -- desc : TInterface "Pango" "FontDescription"
    IO ()


contextSetFontDescription ::
    (MonadIO m, ContextK a) =>
    a ->                                    -- _obj
    FontDescription ->                      -- desc
    m ()
contextSetFontDescription _obj desc = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    let desc' = unsafeManagedPtrGetPtr desc
    pango_context_set_font_description _obj' desc'
    touchManagedPtr _obj
    touchManagedPtr desc
    return ()

-- method Context::set_font_map
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Pango" "Context", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "font_map", argType = TInterface "Pango" "FontMap", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Pango" "Context", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "font_map", argType = TInterface "Pango" "FontMap", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False

foreign import ccall "pango_context_set_font_map" pango_context_set_font_map :: 
    Ptr Context ->                          -- _obj : TInterface "Pango" "Context"
    Ptr FontMap ->                          -- font_map : TInterface "Pango" "FontMap"
    IO ()


contextSetFontMap ::
    (MonadIO m, ContextK a, FontMapK b) =>
    a ->                                    -- _obj
    b ->                                    -- font_map
    m ()
contextSetFontMap _obj font_map = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    let font_map' = unsafeManagedPtrCastPtr font_map
    pango_context_set_font_map _obj' font_map'
    touchManagedPtr _obj
    touchManagedPtr font_map
    return ()

-- method Context::set_gravity_hint
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Pango" "Context", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "hint", argType = TInterface "Pango" "GravityHint", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Pango" "Context", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "hint", argType = TInterface "Pango" "GravityHint", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False

foreign import ccall "pango_context_set_gravity_hint" pango_context_set_gravity_hint :: 
    Ptr Context ->                          -- _obj : TInterface "Pango" "Context"
    CUInt ->                                -- hint : TInterface "Pango" "GravityHint"
    IO ()


contextSetGravityHint ::
    (MonadIO m, ContextK a) =>
    a ->                                    -- _obj
    GravityHint ->                          -- hint
    m ()
contextSetGravityHint _obj hint = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    let hint' = (fromIntegral . fromEnum) hint
    pango_context_set_gravity_hint _obj' hint'
    touchManagedPtr _obj
    return ()

-- method Context::set_language
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Pango" "Context", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "language", argType = TInterface "Pango" "Language", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Pango" "Context", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "language", argType = TInterface "Pango" "Language", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False

foreign import ccall "pango_context_set_language" pango_context_set_language :: 
    Ptr Context ->                          -- _obj : TInterface "Pango" "Context"
    Ptr Language ->                         -- language : TInterface "Pango" "Language"
    IO ()


contextSetLanguage ::
    (MonadIO m, ContextK a) =>
    a ->                                    -- _obj
    Language ->                             -- language
    m ()
contextSetLanguage _obj language = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    let language' = unsafeManagedPtrGetPtr language
    pango_context_set_language _obj' language'
    touchManagedPtr _obj
    touchManagedPtr language
    return ()

-- method Context::set_matrix
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Pango" "Context", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "matrix", argType = TInterface "Pango" "Matrix", direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Pango" "Context", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "matrix", argType = TInterface "Pango" "Matrix", direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False

foreign import ccall "pango_context_set_matrix" pango_context_set_matrix :: 
    Ptr Context ->                          -- _obj : TInterface "Pango" "Context"
    Ptr Matrix ->                           -- matrix : TInterface "Pango" "Matrix"
    IO ()


contextSetMatrix ::
    (MonadIO m, ContextK a) =>
    a ->                                    -- _obj
    Maybe (Matrix) ->                       -- matrix
    m ()
contextSetMatrix _obj matrix = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    maybeMatrix <- case matrix of
        Nothing -> return nullPtr
        Just jMatrix -> do
            let jMatrix' = unsafeManagedPtrGetPtr jMatrix
            return jMatrix'
    pango_context_set_matrix _obj' maybeMatrix
    touchManagedPtr _obj
    whenJust matrix touchManagedPtr
    return ()