{-# 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
-- ** Overloaded methods #method:Overloaded methods#

#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.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 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

-- | Convert 'Engine' to and from 'Data.GI.Base.GValue.GValue' with 'Data.GI.Base.GValue.toGValue' and 'Data.GI.Base.GValue.fromGValue'.
instance B.GValue.IsGValue Engine where
    toGValue :: Engine -> IO GValue
toGValue Engine
o = do
        GType
gtype <- IO GType
c_pango_engine_get_type
        Engine -> (Ptr Engine -> IO GValue) -> IO GValue
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
B.ManagedPtr.withManagedPtr Engine
o (GType -> (GValue -> Ptr Engine -> IO ()) -> Ptr Engine -> IO GValue
forall a. GType -> (GValue -> a -> IO ()) -> a -> IO GValue
B.GValue.buildGValue GType
gtype GValue -> Ptr Engine -> IO ()
forall a. GObject a => GValue -> Ptr a -> IO ()
B.GValue.set_object)
        
    fromGValue :: GValue -> IO Engine
fromGValue GValue
gv = do
        Ptr Engine
ptr <- GValue -> IO (Ptr Engine)
forall b. GObject b => GValue -> IO (Ptr b)
B.GValue.get_object GValue
gv :: IO (Ptr Engine)
        (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
        
    

-- | 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 :: (MonadIO m, IsEngine o) => o -> m Engine
toEngine :: o -> m Engine
toEngine = IO Engine -> m Engine
forall (m :: * -> *) a. MonadIO m => IO a -> m a
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'
unsafeCastTo ManagedPtr Engine -> Engine
Engine

#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.MethodInfo 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

#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