{- |
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.GdkPixbuf.Objects.PixbufAnimationIter
    ( 

-- * Exported types
    PixbufAnimationIter(..)                 ,
    PixbufAnimationIterK                    ,
    toPixbufAnimationIter                   ,
    noPixbufAnimationIter                   ,


 -- * Methods
-- ** pixbufAnimationIterAdvance
    pixbufAnimationIterAdvance              ,


-- ** pixbufAnimationIterGetDelayTime
    pixbufAnimationIterGetDelayTime         ,


-- ** pixbufAnimationIterGetPixbuf
    pixbufAnimationIterGetPixbuf            ,


-- ** pixbufAnimationIterOnCurrentlyLoadingFrame
    pixbufAnimationIterOnCurrentlyLoadingFrame,




    ) 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.GdkPixbuf.Types
import GI.GdkPixbuf.Callbacks
import qualified GI.GLib as GLib
import qualified GI.GObject as GObject

newtype PixbufAnimationIter = PixbufAnimationIter (ForeignPtr PixbufAnimationIter)
foreign import ccall "gdk_pixbuf_animation_iter_get_type"
    c_gdk_pixbuf_animation_iter_get_type :: IO GType

type instance ParentTypes PixbufAnimationIter = PixbufAnimationIterParentTypes
type PixbufAnimationIterParentTypes = '[GObject.Object]

instance GObject PixbufAnimationIter where
    gobjectIsInitiallyUnowned _ = False
    gobjectType _ = c_gdk_pixbuf_animation_iter_get_type
    

class GObject o => PixbufAnimationIterK o
instance (GObject o, IsDescendantOf PixbufAnimationIter o) => PixbufAnimationIterK o

toPixbufAnimationIter :: PixbufAnimationIterK o => o -> IO PixbufAnimationIter
toPixbufAnimationIter = unsafeCastTo PixbufAnimationIter

noPixbufAnimationIter :: Maybe PixbufAnimationIter
noPixbufAnimationIter = Nothing

type instance AttributeList PixbufAnimationIter = PixbufAnimationIterAttributeList
type PixbufAnimationIterAttributeList = ('[ ] :: [(Symbol, *)])

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

-- method PixbufAnimationIter::advance
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "GdkPixbuf" "PixbufAnimationIter", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "current_time", argType = TInterface "GLib" "TimeVal", direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "GdkPixbuf" "PixbufAnimationIter", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "current_time", argType = TInterface "GLib" "TimeVal", direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TBoolean
-- throws : False
-- Skip return : False

foreign import ccall "gdk_pixbuf_animation_iter_advance" gdk_pixbuf_animation_iter_advance :: 
    Ptr PixbufAnimationIter ->              -- _obj : TInterface "GdkPixbuf" "PixbufAnimationIter"
    Ptr GLib.TimeVal ->                     -- current_time : TInterface "GLib" "TimeVal"
    IO CInt


pixbufAnimationIterAdvance ::
    (MonadIO m, PixbufAnimationIterK a) =>
    a ->                                    -- _obj
    Maybe (GLib.TimeVal) ->                 -- current_time
    m Bool
pixbufAnimationIterAdvance _obj current_time = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    maybeCurrent_time <- case current_time of
        Nothing -> return nullPtr
        Just jCurrent_time -> do
            let jCurrent_time' = unsafeManagedPtrGetPtr jCurrent_time
            return jCurrent_time'
    result <- gdk_pixbuf_animation_iter_advance _obj' maybeCurrent_time
    let result' = (/= 0) result
    touchManagedPtr _obj
    whenJust current_time touchManagedPtr
    return result'

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

foreign import ccall "gdk_pixbuf_animation_iter_get_delay_time" gdk_pixbuf_animation_iter_get_delay_time :: 
    Ptr PixbufAnimationIter ->              -- _obj : TInterface "GdkPixbuf" "PixbufAnimationIter"
    IO Int32


pixbufAnimationIterGetDelayTime ::
    (MonadIO m, PixbufAnimationIterK a) =>
    a ->                                    -- _obj
    m Int32
pixbufAnimationIterGetDelayTime _obj = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    result <- gdk_pixbuf_animation_iter_get_delay_time _obj'
    touchManagedPtr _obj
    return result

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

foreign import ccall "gdk_pixbuf_animation_iter_get_pixbuf" gdk_pixbuf_animation_iter_get_pixbuf :: 
    Ptr PixbufAnimationIter ->              -- _obj : TInterface "GdkPixbuf" "PixbufAnimationIter"
    IO (Ptr Pixbuf)


pixbufAnimationIterGetPixbuf ::
    (MonadIO m, PixbufAnimationIterK a) =>
    a ->                                    -- _obj
    m Pixbuf
pixbufAnimationIterGetPixbuf _obj = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    result <- gdk_pixbuf_animation_iter_get_pixbuf _obj'
    checkUnexpectedReturnNULL "gdk_pixbuf_animation_iter_get_pixbuf" result
    result' <- (newObject Pixbuf) result
    touchManagedPtr _obj
    return result'

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

foreign import ccall "gdk_pixbuf_animation_iter_on_currently_loading_frame" gdk_pixbuf_animation_iter_on_currently_loading_frame :: 
    Ptr PixbufAnimationIter ->              -- _obj : TInterface "GdkPixbuf" "PixbufAnimationIter"
    IO CInt


pixbufAnimationIterOnCurrentlyLoadingFrame ::
    (MonadIO m, PixbufAnimationIterK a) =>
    a ->                                    -- _obj
    m Bool
pixbufAnimationIterOnCurrentlyLoadingFrame _obj = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    result <- gdk_pixbuf_animation_iter_on_currently_loading_frame _obj'
    let result' = (/= 0) result
    touchManagedPtr _obj
    return result'