{- |
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.Fontset
    ( 

-- * Exported types
    Fontset(..)                             ,
    FontsetK                                ,
    toFontset                               ,
    noFontset                               ,


 -- * Methods
-- ** fontsetForeach
    fontsetForeach                          ,


-- ** fontsetGetFont
    fontsetGetFont                          ,


-- ** fontsetGetMetrics
    fontsetGetMetrics                       ,




    ) 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 Fontset = Fontset (ForeignPtr Fontset)
foreign import ccall "pango_fontset_get_type"
    c_pango_fontset_get_type :: IO GType

type instance ParentTypes Fontset = FontsetParentTypes
type FontsetParentTypes = '[GObject.Object]

instance GObject Fontset where
    gobjectIsInitiallyUnowned _ = False
    gobjectType _ = c_pango_fontset_get_type
    

class GObject o => FontsetK o
instance (GObject o, IsDescendantOf Fontset o) => FontsetK o

toFontset :: FontsetK o => o -> IO Fontset
toFontset = unsafeCastTo Fontset

noFontset :: Maybe Fontset
noFontset = Nothing

type instance AttributeList Fontset = FontsetAttributeList
type FontsetAttributeList = ('[ ] :: [(Symbol, *)])

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

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

foreign import ccall "pango_fontset_foreach" pango_fontset_foreach :: 
    Ptr Fontset ->                          -- _obj : TInterface "Pango" "Fontset"
    FunPtr FontsetForeachFuncC ->           -- func : TInterface "Pango" "FontsetForeachFunc"
    Ptr () ->                               -- data : TBasicType TVoid
    IO ()


fontsetForeach ::
    (MonadIO m, FontsetK a) =>
    a ->                                    -- _obj
    FontsetForeachFunc ->                   -- func
    m ()
fontsetForeach _obj func = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    func' <- mkFontsetForeachFunc (fontsetForeachFuncWrapper Nothing func)
    let data_ = nullPtr
    pango_fontset_foreach _obj' func' data_
    safeFreeFunPtr $ castFunPtrToPtr func'
    touchManagedPtr _obj
    return ()

-- method Fontset::get_font
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Pango" "Fontset", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "wc", argType = TBasicType TUInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Pango" "Fontset", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "wc", argType = TBasicType TUInt32, 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_fontset_get_font" pango_fontset_get_font :: 
    Ptr Fontset ->                          -- _obj : TInterface "Pango" "Fontset"
    Word32 ->                               -- wc : TBasicType TUInt32
    IO (Ptr Font)


fontsetGetFont ::
    (MonadIO m, FontsetK a) =>
    a ->                                    -- _obj
    Word32 ->                               -- wc
    m Font
fontsetGetFont _obj wc = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    result <- pango_fontset_get_font _obj' wc
    checkUnexpectedReturnNULL "pango_fontset_get_font" result
    result' <- (wrapObject Font) result
    touchManagedPtr _obj
    return result'

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

foreign import ccall "pango_fontset_get_metrics" pango_fontset_get_metrics :: 
    Ptr Fontset ->                          -- _obj : TInterface "Pango" "Fontset"
    IO (Ptr FontMetrics)


fontsetGetMetrics ::
    (MonadIO m, FontsetK a) =>
    a ->                                    -- _obj
    m FontMetrics
fontsetGetMetrics _obj = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    result <- pango_fontset_get_metrics _obj'
    checkUnexpectedReturnNULL "pango_fontset_get_metrics" result
    result' <- (wrapBoxed FontMetrics) result
    touchManagedPtr _obj
    return result'