{- |
Copyright  : Will Thompson, Iñaki García Etxebarria and Jonas Platte
License    : LGPL-2.1
Maintainer : Iñaki García Etxebarria (inaki@blueleaf.cc)

/No description available in the introspection data./
-}

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

module GI.Poppler.Objects.Movie
    (

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


 -- * Methods
-- ** getFilename #method:getFilename#

#if ENABLE_OVERLOADING
    MovieGetFilenameMethodInfo              ,
#endif
    movieGetFilename                        ,


-- ** getPlayMode #method:getPlayMode#

#if ENABLE_OVERLOADING
    MovieGetPlayModeMethodInfo              ,
#endif
    movieGetPlayMode                        ,


-- ** needPoster #method:needPoster#

#if ENABLE_OVERLOADING
    MovieNeedPosterMethodInfo               ,
#endif
    movieNeedPoster                         ,


-- ** showControls #method:showControls#

#if ENABLE_OVERLOADING
    MovieShowControlsMethodInfo             ,
#endif
    movieShowControls                       ,




    ) 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.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
import {-# SOURCE #-} qualified GI.Poppler.Enums as Poppler.Enums

-- | Memory-managed wrapper type.
newtype Movie = Movie (ManagedPtr Movie)
foreign import ccall "poppler_movie_get_type"
    c_poppler_movie_get_type :: IO GType

instance GObject Movie where
    gobjectType = c_poppler_movie_get_type


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

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

-- | Cast to `Movie`, for types for which this is known to be safe. For general casts, use `Data.GI.Base.ManagedPtr.castTo`.
toMovie :: (MonadIO m, IsMovie o) => o -> m Movie
toMovie = liftIO . unsafeCastTo Movie

-- | A convenience alias for `Nothing` :: `Maybe` `Movie`.
noMovie :: Maybe Movie
noMovie = Nothing

#if ENABLE_OVERLOADING
type family ResolveMovieMethod (t :: Symbol) (o :: *) :: * where
    ResolveMovieMethod "bindProperty" o = GObject.Object.ObjectBindPropertyMethodInfo
    ResolveMovieMethod "bindPropertyFull" o = GObject.Object.ObjectBindPropertyFullMethodInfo
    ResolveMovieMethod "forceFloating" o = GObject.Object.ObjectForceFloatingMethodInfo
    ResolveMovieMethod "freezeNotify" o = GObject.Object.ObjectFreezeNotifyMethodInfo
    ResolveMovieMethod "getv" o = GObject.Object.ObjectGetvMethodInfo
    ResolveMovieMethod "isFloating" o = GObject.Object.ObjectIsFloatingMethodInfo
    ResolveMovieMethod "needPoster" o = MovieNeedPosterMethodInfo
    ResolveMovieMethod "notify" o = GObject.Object.ObjectNotifyMethodInfo
    ResolveMovieMethod "notifyByPspec" o = GObject.Object.ObjectNotifyByPspecMethodInfo
    ResolveMovieMethod "ref" o = GObject.Object.ObjectRefMethodInfo
    ResolveMovieMethod "refSink" o = GObject.Object.ObjectRefSinkMethodInfo
    ResolveMovieMethod "runDispose" o = GObject.Object.ObjectRunDisposeMethodInfo
    ResolveMovieMethod "showControls" o = MovieShowControlsMethodInfo
    ResolveMovieMethod "stealData" o = GObject.Object.ObjectStealDataMethodInfo
    ResolveMovieMethod "stealQdata" o = GObject.Object.ObjectStealQdataMethodInfo
    ResolveMovieMethod "thawNotify" o = GObject.Object.ObjectThawNotifyMethodInfo
    ResolveMovieMethod "unref" o = GObject.Object.ObjectUnrefMethodInfo
    ResolveMovieMethod "watchClosure" o = GObject.Object.ObjectWatchClosureMethodInfo
    ResolveMovieMethod "getData" o = GObject.Object.ObjectGetDataMethodInfo
    ResolveMovieMethod "getFilename" o = MovieGetFilenameMethodInfo
    ResolveMovieMethod "getPlayMode" o = MovieGetPlayModeMethodInfo
    ResolveMovieMethod "getProperty" o = GObject.Object.ObjectGetPropertyMethodInfo
    ResolveMovieMethod "getQdata" o = GObject.Object.ObjectGetQdataMethodInfo
    ResolveMovieMethod "setData" o = GObject.Object.ObjectSetDataMethodInfo
    ResolveMovieMethod "setDataFull" o = GObject.Object.ObjectSetDataFullMethodInfo
    ResolveMovieMethod "setProperty" o = GObject.Object.ObjectSetPropertyMethodInfo
    ResolveMovieMethod l o = O.MethodResolutionFailed l o

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

#endif

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

#if ENABLE_OVERLOADING
#endif

#if ENABLE_OVERLOADING
type instance O.SignalList Movie = MovieSignalList
type MovieSignalList = ('[ '("notify", GObject.Object.ObjectNotifySignalInfo)] :: [(Symbol, *)])

#endif

-- method Movie::get_filename
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "poppler_movie", argType = TInterface (Name {namespace = "Poppler", name = "Movie"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #PopplerMovie", 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 "poppler_movie_get_filename" poppler_movie_get_filename ::
    Ptr Movie ->                            -- poppler_movie : TInterface (Name {namespace = "Poppler", name = "Movie"})
    IO CString

{- |
Returns the local filename identifying a self-describing movie file

/Since: 0.14/
-}
movieGetFilename ::
    (B.CallStack.HasCallStack, MonadIO m, IsMovie a) =>
    a
    {- ^ /@popplerMovie@/: a 'GI.Poppler.Objects.Movie.Movie' -}
    -> m T.Text
    {- ^ __Returns:__ a local filename, return value is owned by 'GI.Poppler.Objects.Movie.Movie' and
              should not be freed -}
movieGetFilename popplerMovie = liftIO $ do
    popplerMovie' <- unsafeManagedPtrCastPtr popplerMovie
    result <- poppler_movie_get_filename popplerMovie'
    checkUnexpectedReturnNULL "movieGetFilename" result
    result' <- cstringToText result
    touchManagedPtr popplerMovie
    return result'

#if ENABLE_OVERLOADING
data MovieGetFilenameMethodInfo
instance (signature ~ (m T.Text), MonadIO m, IsMovie a) => O.MethodInfo MovieGetFilenameMethodInfo a signature where
    overloadedMethod _ = movieGetFilename

#endif

-- method Movie::get_play_mode
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "poppler_movie", argType = TInterface (Name {namespace = "Poppler", name = "Movie"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #PopplerMovie", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Poppler", name = "MoviePlayMode"}))
-- throws : False
-- Skip return : False

foreign import ccall "poppler_movie_get_play_mode" poppler_movie_get_play_mode ::
    Ptr Movie ->                            -- poppler_movie : TInterface (Name {namespace = "Poppler", name = "Movie"})
    IO CUInt

{- |
Returns the play mode of /@popplerMovie@/.

/Since: 0.54/
-}
movieGetPlayMode ::
    (B.CallStack.HasCallStack, MonadIO m, IsMovie a) =>
    a
    {- ^ /@popplerMovie@/: a 'GI.Poppler.Objects.Movie.Movie' -}
    -> m Poppler.Enums.MoviePlayMode
    {- ^ __Returns:__ a 'GI.Poppler.Enums.MoviePlayMode'. -}
movieGetPlayMode popplerMovie = liftIO $ do
    popplerMovie' <- unsafeManagedPtrCastPtr popplerMovie
    result <- poppler_movie_get_play_mode popplerMovie'
    let result' = (toEnum . fromIntegral) result
    touchManagedPtr popplerMovie
    return result'

#if ENABLE_OVERLOADING
data MovieGetPlayModeMethodInfo
instance (signature ~ (m Poppler.Enums.MoviePlayMode), MonadIO m, IsMovie a) => O.MethodInfo MovieGetPlayModeMethodInfo a signature where
    overloadedMethod _ = movieGetPlayMode

#endif

-- method Movie::need_poster
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "poppler_movie", argType = TInterface (Name {namespace = "Poppler", name = "Movie"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #PopplerMovie", 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 "poppler_movie_need_poster" poppler_movie_need_poster ::
    Ptr Movie ->                            -- poppler_movie : TInterface (Name {namespace = "Poppler", name = "Movie"})
    IO CInt

{- |
Returns whether a poster image representing the Movie
shall be displayed. The poster image must be retrieved
from the movie file.

/Since: 0.14/
-}
movieNeedPoster ::
    (B.CallStack.HasCallStack, MonadIO m, IsMovie a) =>
    a
    {- ^ /@popplerMovie@/: a 'GI.Poppler.Objects.Movie.Movie' -}
    -> m Bool
    {- ^ __Returns:__ 'True' if move needs a poster image, 'False' otherwise -}
movieNeedPoster popplerMovie = liftIO $ do
    popplerMovie' <- unsafeManagedPtrCastPtr popplerMovie
    result <- poppler_movie_need_poster popplerMovie'
    let result' = (/= 0) result
    touchManagedPtr popplerMovie
    return result'

#if ENABLE_OVERLOADING
data MovieNeedPosterMethodInfo
instance (signature ~ (m Bool), MonadIO m, IsMovie a) => O.MethodInfo MovieNeedPosterMethodInfo a signature where
    overloadedMethod _ = movieNeedPoster

#endif

-- method Movie::show_controls
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "poppler_movie", argType = TInterface (Name {namespace = "Poppler", name = "Movie"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #PopplerMovie", 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 "poppler_movie_show_controls" poppler_movie_show_controls ::
    Ptr Movie ->                            -- poppler_movie : TInterface (Name {namespace = "Poppler", name = "Movie"})
    IO CInt

{- |
Returns whether to display a movie controller bar while playing the movie

/Since: 0.14/
-}
movieShowControls ::
    (B.CallStack.HasCallStack, MonadIO m, IsMovie a) =>
    a
    {- ^ /@popplerMovie@/: a 'GI.Poppler.Objects.Movie.Movie' -}
    -> m Bool
    {- ^ __Returns:__ 'True' if controller bar should be displayed, 'False' otherwise -}
movieShowControls popplerMovie = liftIO $ do
    popplerMovie' <- unsafeManagedPtrCastPtr popplerMovie
    result <- poppler_movie_show_controls popplerMovie'
    let result' = (/= 0) result
    touchManagedPtr popplerMovie
    return result'

#if ENABLE_OVERLOADING
data MovieShowControlsMethodInfo
instance (signature ~ (m Bool), MonadIO m, IsMovie a) => O.MethodInfo MovieShowControlsMethodInfo a signature where
    overloadedMethod _ = movieShowControls

#endif