{-# LANGUAGE TypeApplications #-}


-- | Copyright  : Will Thompson, Iñaki García Etxebarria and Jonas Platte
-- License    : LGPL-2.1
-- Maintainer : Iñaki García Etxebarria
-- 
-- t'GI.Pango.Objects.Engine.Engine' is the base class for all types of language and
-- script specific engines. It has no functionality by itself.

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

module GI.Pango.Objects.Engine
    ( 

-- * Exported types
    Engine(..)                              ,
    IsEngine                                ,
    toEngine                                ,


 -- * Methods
-- | 
-- 
--  === __Click to display all available methods, including inherited ones__
-- ==== Methods
-- [bindProperty]("GI.GObject.Objects.Object#g:method:bindProperty"), [bindPropertyFull]("GI.GObject.Objects.Object#g:method:bindPropertyFull"), [forceFloating]("GI.GObject.Objects.Object#g:method:forceFloating"), [freezeNotify]("GI.GObject.Objects.Object#g:method:freezeNotify"), [getv]("GI.GObject.Objects.Object#g:method:getv"), [isFloating]("GI.GObject.Objects.Object#g:method:isFloating"), [notify]("GI.GObject.Objects.Object#g:method:notify"), [notifyByPspec]("GI.GObject.Objects.Object#g:method:notifyByPspec"), [ref]("GI.GObject.Objects.Object#g:method:ref"), [refSink]("GI.GObject.Objects.Object#g:method:refSink"), [runDispose]("GI.GObject.Objects.Object#g:method:runDispose"), [stealData]("GI.GObject.Objects.Object#g:method:stealData"), [stealQdata]("GI.GObject.Objects.Object#g:method:stealQdata"), [thawNotify]("GI.GObject.Objects.Object#g:method:thawNotify"), [unref]("GI.GObject.Objects.Object#g:method:unref"), [watchClosure]("GI.GObject.Objects.Object#g:method:watchClosure").
-- 
-- ==== Getters
-- [getData]("GI.GObject.Objects.Object#g:method:getData"), [getProperty]("GI.GObject.Objects.Object#g:method:getProperty"), [getQdata]("GI.GObject.Objects.Object#g:method:getQdata").
-- 
-- ==== Setters
-- [setData]("GI.GObject.Objects.Object#g:method:setData"), [setDataFull]("GI.GObject.Objects.Object#g:method:setDataFull"), [setProperty]("GI.GObject.Objects.Object#g:method:setProperty").

#if defined(ENABLE_OVERLOADING)
    ResolveEngineMethod                     ,
#endif



    ) 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.BasicTypes as B.Types
import qualified Data.GI.Base.ManagedPtr as B.ManagedPtr
import qualified Data.GI.Base.GArray as B.GArray
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.GI.Base.Signals as B.Signals
import qualified Control.Monad.IO.Class as MIO
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 GHC.Records as R

import qualified GI.GObject.Objects.Object as GObject.Object

-- | Memory-managed wrapper type.
newtype Engine = Engine (SP.ManagedPtr Engine)
    deriving (Engine -> Engine -> Bool
(Engine -> Engine -> Bool)
-> (Engine -> Engine -> Bool) -> Eq Engine
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Engine -> Engine -> Bool
$c/= :: Engine -> Engine -> Bool
== :: Engine -> Engine -> Bool
$c== :: Engine -> Engine -> Bool
Eq)

instance SP.ManagedPtrNewtype Engine where
    toManagedPtr :: Engine -> ManagedPtr Engine
toManagedPtr (Engine ManagedPtr Engine
p) = ManagedPtr Engine
p

foreign import ccall "pango_engine_get_type"
    c_pango_engine_get_type :: IO B.Types.GType

instance B.Types.TypedObject Engine where
    glibType :: IO GType
glibType = IO GType
c_pango_engine_get_type

instance B.Types.GObject Engine

-- | Type class for types which can be safely cast to `Engine`, for instance with `toEngine`.
class (SP.GObject o, O.IsDescendantOf Engine o) => IsEngine o
instance (SP.GObject o, O.IsDescendantOf Engine o) => IsEngine o

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

-- | Cast to `Engine`, for types for which this is known to be safe. For general casts, use `Data.GI.Base.ManagedPtr.castTo`.
toEngine :: (MIO.MonadIO m, IsEngine o) => o -> m Engine
toEngine :: forall (m :: * -> *) o. (MonadIO m, IsEngine o) => o -> m Engine
toEngine = IO Engine -> m Engine
forall (m :: * -> *) a. MonadIO m => IO a -> m a
MIO.liftIO (IO Engine -> m Engine) -> (o -> IO Engine) -> o -> m Engine
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (ManagedPtr Engine -> Engine) -> o -> IO Engine
forall o o'.
(HasCallStack, ManagedPtrNewtype o, TypedObject o,
 ManagedPtrNewtype o', TypedObject o') =>
(ManagedPtr o' -> o') -> o -> IO o'
B.ManagedPtr.unsafeCastTo ManagedPtr Engine -> Engine
Engine

-- | Convert 'Engine' to and from 'Data.GI.Base.GValue.GValue'. See 'Data.GI.Base.GValue.toGValue' and 'Data.GI.Base.GValue.fromGValue'.
instance B.GValue.IsGValue (Maybe Engine) where
    gvalueGType_ :: IO GType
gvalueGType_ = IO GType
c_pango_engine_get_type
    gvalueSet_ :: Ptr GValue -> Maybe Engine -> IO ()
gvalueSet_ Ptr GValue
gv Maybe Engine
P.Nothing = Ptr GValue -> Ptr Engine -> IO ()
forall a. GObject a => Ptr GValue -> Ptr a -> IO ()
B.GValue.set_object Ptr GValue
gv (Ptr Engine
forall a. Ptr a
FP.nullPtr :: FP.Ptr Engine)
    gvalueSet_ Ptr GValue
gv (P.Just Engine
obj) = Engine -> (Ptr Engine -> IO ()) -> IO ()
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
B.ManagedPtr.withManagedPtr Engine
obj (Ptr GValue -> Ptr Engine -> IO ()
forall a. GObject a => Ptr GValue -> Ptr a -> IO ()
B.GValue.set_object Ptr GValue
gv)
    gvalueGet_ :: Ptr GValue -> IO (Maybe Engine)
gvalueGet_ Ptr GValue
gv = do
        Ptr Engine
ptr <- Ptr GValue -> IO (Ptr Engine)
forall a. GObject a => Ptr GValue -> IO (Ptr a)
B.GValue.get_object Ptr GValue
gv :: IO (FP.Ptr Engine)
        if Ptr Engine
ptr Ptr Engine -> Ptr Engine -> Bool
forall a. Eq a => a -> a -> Bool
/= Ptr Engine
forall a. Ptr a
FP.nullPtr
        then Engine -> Maybe Engine
forall a. a -> Maybe a
P.Just (Engine -> Maybe Engine) -> IO Engine -> IO (Maybe Engine)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (ManagedPtr Engine -> Engine) -> Ptr Engine -> IO Engine
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
B.ManagedPtr.newObject ManagedPtr Engine -> Engine
Engine Ptr Engine
ptr
        else Maybe Engine -> IO (Maybe Engine)
forall (m :: * -> *) a. Monad m => a -> m a
return Maybe Engine
forall a. Maybe a
P.Nothing
        
    

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

instance (info ~ ResolveEngineMethod t Engine, O.OverloadedMethod info Engine p) => OL.IsLabel t (Engine -> p) where
#if MIN_VERSION_base(4,10,0)
    fromLabel = O.overloadedMethod @info
#else
    fromLabel _ = O.overloadedMethod @info
#endif

#if MIN_VERSION_base(4,13,0)
instance (info ~ ResolveEngineMethod t Engine, O.OverloadedMethod info Engine p, R.HasField t Engine p) => R.HasField t Engine p where
    getField = O.overloadedMethod @info

#endif

instance (info ~ ResolveEngineMethod t Engine, O.OverloadedMethodInfo info Engine) => OL.IsLabel t (O.MethodProxy info Engine) where
#if MIN_VERSION_base(4,10,0)
    fromLabel = O.MethodProxy
#else
    fromLabel _ = O.MethodProxy
#endif

#endif

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

#if defined(ENABLE_OVERLOADING)
#endif

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

#endif