{- |
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.Poppler.Objects.Movie
    ( 

-- * Exported types
    Movie(..)                               ,
    MovieK                                  ,
    toMovie                                 ,
    noMovie                                 ,


 -- * Methods
-- ** movieGetFilename
    movieGetFilename                        ,


-- ** movieNeedPoster
    movieNeedPoster                         ,


-- ** movieShowControls
    movieShowControls                       ,




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

newtype Movie = Movie (ForeignPtr Movie)
foreign import ccall "poppler_movie_get_type"
    c_poppler_movie_get_type :: IO GType

type instance ParentTypes Movie = MovieParentTypes
type MovieParentTypes = '[GObject.Object]

instance GObject Movie where
    gobjectIsInitiallyUnowned _ = False
    gobjectType _ = c_poppler_movie_get_type
    

class GObject o => MovieK o
instance (GObject o, IsDescendantOf Movie o) => MovieK o

toMovie :: MovieK o => o -> IO Movie
toMovie = unsafeCastTo Movie

noMovie :: Maybe Movie
noMovie = Nothing

type instance AttributeList Movie = MovieAttributeList
type MovieAttributeList = ('[ ] :: [(Symbol, *)])

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

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

foreign import ccall "poppler_movie_get_filename" poppler_movie_get_filename :: 
    Ptr Movie ->                            -- _obj : TInterface "Poppler" "Movie"
    IO CString


movieGetFilename ::
    (MonadIO m, MovieK a) =>
    a ->                                    -- _obj
    m T.Text
movieGetFilename _obj = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    result <- poppler_movie_get_filename _obj'
    checkUnexpectedReturnNULL "poppler_movie_get_filename" result
    result' <- cstringToText result
    touchManagedPtr _obj
    return result'

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

foreign import ccall "poppler_movie_need_poster" poppler_movie_need_poster :: 
    Ptr Movie ->                            -- _obj : TInterface "Poppler" "Movie"
    IO CInt


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

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

foreign import ccall "poppler_movie_show_controls" poppler_movie_show_controls :: 
    Ptr Movie ->                            -- _obj : TInterface "Poppler" "Movie"
    IO CInt


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