{- |
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.EngineLang.EngineLang' class is implemented by engines that
customize the rendering-system independent part of the
Pango pipeline for a particular script or language. For
instance, a custom 'GI.Pango.Objects.EngineLang.EngineLang' could be provided for
Thai to implement the dictionary-based word boundary
lookups needed for that language.
-}

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

module GI.Pango.Objects.EngineLang
    (

-- * Exported types
    EngineLang(..)                          ,
    IsEngineLang                            ,
    toEngineLang                            ,
    noEngineLang                            ,


    ) 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 EngineLang = EngineLang (ManagedPtr EngineLang)
foreign import ccall "pango_engine_lang_get_type"
    c_pango_engine_lang_get_type :: IO GType

instance GObject EngineLang where
    gobjectType _ = c_pango_engine_lang_get_type


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

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

-- | A convenience alias for `Nothing` :: `Maybe` `EngineLang`.
noEngineLang :: Maybe EngineLang
noEngineLang = Nothing

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

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

#if MIN_VERSION_base(4,9,0)
instance (info ~ ResolveEngineLangMethod t EngineLang, O.MethodInfo info EngineLang p) => O.IsLabel t (EngineLang -> 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 EngineLang
type instance O.AttributeList EngineLang = EngineLangAttributeList
type EngineLangAttributeList = ('[ ] :: [(Symbol, *)])
#endif

#if ENABLE_OVERLOADING
#endif

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

#endif