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

The 'GI.Pango.Objects.EngineShape.EngineShape' class is implemented by engines that
customize the rendering-system dependent part of the
Pango pipeline for a particular script or language.
A 'GI.Pango.Objects.EngineShape.EngineShape' implementation is then specific to both
a particular rendering system or group of rendering systems
and to a particular script. For instance, there is one
'GI.Pango.Objects.EngineShape.EngineShape' implementation to handle shaping Arabic
for Fontconfig-based backends.
-}

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

module GI.Pango.Objects.EngineShape
    (

-- * Exported types
    EngineShape(..)                         ,
    IsEngineShape                           ,
    toEngineShape                           ,
    noEngineShape                           ,


    ) 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.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.Text as T
import qualified Data.ByteString.Char8 as B
import qualified Data.Map as Map
import qualified Foreign.Ptr as FP

import qualified GI.GObject.Objects.Object as GObject.Object
import {-# SOURCE #-} qualified GI.Pango.Objects.Engine as Pango.Engine

-- | Memory-managed wrapper type.
newtype EngineShape = EngineShape (ManagedPtr EngineShape)
foreign import ccall "pango_engine_shape_get_type"
    c_pango_engine_shape_get_type :: IO GType

instance GObject EngineShape where
    gobjectType _ = c_pango_engine_shape_get_type


-- | Type class for types which can be safely cast to `EngineShape`, for instance with `toEngineShape`.
class GObject o => IsEngineShape o
#if MIN_VERSION_base(4,9,0)
instance {-# OVERLAPPABLE #-} (GObject a, O.UnknownAncestorError EngineShape a) =>
    IsEngineShape a
#endif
instance IsEngineShape EngineShape
instance Pango.Engine.IsEngine EngineShape
instance GObject.Object.IsObject EngineShape

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

-- | A convenience alias for `Nothing` :: `Maybe` `EngineShape`.
noEngineShape :: Maybe EngineShape
noEngineShape = Nothing

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

instance (info ~ ResolveEngineShapeMethod t EngineShape, O.MethodInfo info EngineShape p) => O.IsLabelProxy t (EngineShape -> p) where
    fromLabelProxy _ = O.overloadedMethod (O.MethodProxy :: O.MethodProxy info)

#if MIN_VERSION_base(4,9,0)
instance (info ~ ResolveEngineShapeMethod t EngineShape, O.MethodInfo info EngineShape p) => O.IsLabel t (EngineShape -> 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

#endif

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

#if ENABLE_OVERLOADING
#endif

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

#endif