{-# LANGUAGE TypeApplications #-}


-- | Copyright  : Will Thompson, Iñaki García Etxebarria and Jonas Platte
-- License    : LGPL-2.1
-- Maintainer : Iñaki García Etxebarria
-- 
-- GtkStyleProvider is an interface used to provide style information to a t'GI.Gtk.Objects.StyleContext.StyleContext'.
-- See 'GI.Gtk.Objects.StyleContext.styleContextAddProvider' and 'GI.Gtk.Objects.StyleContext.styleContextAddProviderForDisplay'.

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

module GI.Gtk.Interfaces.StyleProvider
    ( 

-- * Exported types
    StyleProvider(..)                       ,
    IsStyleProvider                         ,
    toStyleProvider                         ,


 -- * 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)
    ResolveStyleProviderMethod              ,
#endif



 -- * Signals


-- ** gtkPrivateChanged #signal:gtkPrivateChanged#

    C_StyleProviderGtkPrivateChangedCallback,
    StyleProviderGtkPrivateChangedCallback  ,
#if defined(ENABLE_OVERLOADING)
    StyleProviderGtkPrivateChangedSignalInfo,
#endif
    afterStyleProviderGtkPrivateChanged     ,
    genClosure_StyleProviderGtkPrivateChanged,
    mk_StyleProviderGtkPrivateChangedCallback,
    noStyleProviderGtkPrivateChangedCallback,
    onStyleProviderGtkPrivateChanged        ,
    wrap_StyleProviderGtkPrivateChangedCallback,




    ) 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

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

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

foreign import ccall "gtk_style_provider_get_type"
    c_gtk_style_provider_get_type :: IO B.Types.GType

instance B.Types.TypedObject StyleProvider where
    glibType :: IO GType
glibType = IO GType
c_gtk_style_provider_get_type

instance B.Types.GObject StyleProvider

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

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

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

-- | Convert 'StyleProvider' 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 StyleProvider) where
    gvalueGType_ :: IO GType
gvalueGType_ = IO GType
c_gtk_style_provider_get_type
    gvalueSet_ :: Ptr GValue -> Maybe StyleProvider -> IO ()
gvalueSet_ Ptr GValue
gv Maybe StyleProvider
P.Nothing = Ptr GValue -> Ptr StyleProvider -> IO ()
forall a. GObject a => Ptr GValue -> Ptr a -> IO ()
B.GValue.set_object Ptr GValue
gv (Ptr StyleProvider
forall a. Ptr a
FP.nullPtr :: FP.Ptr StyleProvider)
    gvalueSet_ Ptr GValue
gv (P.Just StyleProvider
obj) = StyleProvider -> (Ptr StyleProvider -> IO ()) -> IO ()
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
B.ManagedPtr.withManagedPtr StyleProvider
obj (Ptr GValue -> Ptr StyleProvider -> IO ()
forall a. GObject a => Ptr GValue -> Ptr a -> IO ()
B.GValue.set_object Ptr GValue
gv)
    gvalueGet_ :: Ptr GValue -> IO (Maybe StyleProvider)
gvalueGet_ Ptr GValue
gv = do
        Ptr StyleProvider
ptr <- Ptr GValue -> IO (Ptr StyleProvider)
forall a. GObject a => Ptr GValue -> IO (Ptr a)
B.GValue.get_object Ptr GValue
gv :: IO (FP.Ptr StyleProvider)
        if Ptr StyleProvider
ptr Ptr StyleProvider -> Ptr StyleProvider -> Bool
forall a. Eq a => a -> a -> Bool
/= Ptr StyleProvider
forall a. Ptr a
FP.nullPtr
        then StyleProvider -> Maybe StyleProvider
forall a. a -> Maybe a
P.Just (StyleProvider -> Maybe StyleProvider)
-> IO StyleProvider -> IO (Maybe StyleProvider)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (ManagedPtr StyleProvider -> StyleProvider)
-> Ptr StyleProvider -> IO StyleProvider
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
B.ManagedPtr.newObject ManagedPtr StyleProvider -> StyleProvider
StyleProvider Ptr StyleProvider
ptr
        else Maybe StyleProvider -> IO (Maybe StyleProvider)
forall (m :: * -> *) a. Monad m => a -> m a
return Maybe StyleProvider
forall a. Maybe a
P.Nothing
        
    

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

#if defined(ENABLE_OVERLOADING)
#endif

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

instance (info ~ ResolveStyleProviderMethod t StyleProvider, O.OverloadedMethod info StyleProvider p) => OL.IsLabel t (StyleProvider -> 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 ~ ResolveStyleProviderMethod t StyleProvider, O.OverloadedMethod info StyleProvider p, R.HasField t StyleProvider p) => R.HasField t StyleProvider p where
    getField = O.overloadedMethod @info

#endif

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

#endif

-- signal StyleProvider::gtk-private-changed
-- | /No description available in the introspection data./
type StyleProviderGtkPrivateChangedCallback =
    IO ()

-- | A convenience synonym for @`Nothing` :: `Maybe` `StyleProviderGtkPrivateChangedCallback`@.
noStyleProviderGtkPrivateChangedCallback :: Maybe StyleProviderGtkPrivateChangedCallback
noStyleProviderGtkPrivateChangedCallback :: Maybe (IO ())
noStyleProviderGtkPrivateChangedCallback = Maybe (IO ())
forall a. Maybe a
Nothing

-- | Type for the callback on the (unwrapped) C side.
type C_StyleProviderGtkPrivateChangedCallback =
    Ptr () ->                               -- object
    Ptr () ->                               -- user_data
    IO ()

-- | Generate a function pointer callable from C code, from a `C_StyleProviderGtkPrivateChangedCallback`.
foreign import ccall "wrapper"
    mk_StyleProviderGtkPrivateChangedCallback :: C_StyleProviderGtkPrivateChangedCallback -> IO (FunPtr C_StyleProviderGtkPrivateChangedCallback)

-- | Wrap the callback into a `GClosure`.
genClosure_StyleProviderGtkPrivateChanged :: MonadIO m => StyleProviderGtkPrivateChangedCallback -> m (GClosure C_StyleProviderGtkPrivateChangedCallback)
genClosure_StyleProviderGtkPrivateChanged :: forall (m :: * -> *).
MonadIO m =>
IO () -> m (GClosure C_StyleProviderGtkPrivateChangedCallback)
genClosure_StyleProviderGtkPrivateChanged IO ()
cb = IO (GClosure C_StyleProviderGtkPrivateChangedCallback)
-> m (GClosure C_StyleProviderGtkPrivateChangedCallback)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (GClosure C_StyleProviderGtkPrivateChangedCallback)
 -> m (GClosure C_StyleProviderGtkPrivateChangedCallback))
-> IO (GClosure C_StyleProviderGtkPrivateChangedCallback)
-> m (GClosure C_StyleProviderGtkPrivateChangedCallback)
forall a b. (a -> b) -> a -> b
$ do
    let cb' :: C_StyleProviderGtkPrivateChangedCallback
cb' = IO () -> C_StyleProviderGtkPrivateChangedCallback
wrap_StyleProviderGtkPrivateChangedCallback IO ()
cb
    C_StyleProviderGtkPrivateChangedCallback
-> IO (FunPtr C_StyleProviderGtkPrivateChangedCallback)
mk_StyleProviderGtkPrivateChangedCallback C_StyleProviderGtkPrivateChangedCallback
cb' IO (FunPtr C_StyleProviderGtkPrivateChangedCallback)
-> (FunPtr C_StyleProviderGtkPrivateChangedCallback
    -> IO (GClosure C_StyleProviderGtkPrivateChangedCallback))
-> IO (GClosure C_StyleProviderGtkPrivateChangedCallback)
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= FunPtr C_StyleProviderGtkPrivateChangedCallback
-> IO (GClosure C_StyleProviderGtkPrivateChangedCallback)
forall (m :: * -> *) a. MonadIO m => FunPtr a -> m (GClosure a)
B.GClosure.newGClosure


-- | Wrap a `StyleProviderGtkPrivateChangedCallback` into a `C_StyleProviderGtkPrivateChangedCallback`.
wrap_StyleProviderGtkPrivateChangedCallback ::
    StyleProviderGtkPrivateChangedCallback ->
    C_StyleProviderGtkPrivateChangedCallback
wrap_StyleProviderGtkPrivateChangedCallback :: IO () -> C_StyleProviderGtkPrivateChangedCallback
wrap_StyleProviderGtkPrivateChangedCallback IO ()
_cb Ptr ()
_ Ptr ()
_ = do
    IO ()
_cb 


-- | Connect a signal handler for the [gtkPrivateChanged](#signal:gtkPrivateChanged) signal, to be run before the default handler.
-- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
-- 
-- @
-- 'Data.GI.Base.Signals.on' styleProvider #gtkPrivateChanged callback
-- @
-- 
-- 
onStyleProviderGtkPrivateChanged :: (IsStyleProvider a, MonadIO m) => a -> StyleProviderGtkPrivateChangedCallback -> m SignalHandlerId
onStyleProviderGtkPrivateChanged :: forall a (m :: * -> *).
(IsStyleProvider a, MonadIO m) =>
a -> IO () -> m SignalHandlerId
onStyleProviderGtkPrivateChanged a
obj IO ()
cb = IO SignalHandlerId -> m SignalHandlerId
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO SignalHandlerId -> m SignalHandlerId)
-> IO SignalHandlerId -> m SignalHandlerId
forall a b. (a -> b) -> a -> b
$ do
    let cb' :: C_StyleProviderGtkPrivateChangedCallback
cb' = IO () -> C_StyleProviderGtkPrivateChangedCallback
wrap_StyleProviderGtkPrivateChangedCallback IO ()
cb
    FunPtr C_StyleProviderGtkPrivateChangedCallback
cb'' <- C_StyleProviderGtkPrivateChangedCallback
-> IO (FunPtr C_StyleProviderGtkPrivateChangedCallback)
mk_StyleProviderGtkPrivateChangedCallback C_StyleProviderGtkPrivateChangedCallback
cb'
    a
-> Text
-> FunPtr C_StyleProviderGtkPrivateChangedCallback
-> SignalConnectMode
-> Maybe Text
-> IO SignalHandlerId
forall o a.
GObject o =>
o
-> Text
-> FunPtr a
-> SignalConnectMode
-> Maybe Text
-> IO SignalHandlerId
connectSignalFunPtr a
obj Text
"gtk-private-changed" FunPtr C_StyleProviderGtkPrivateChangedCallback
cb'' SignalConnectMode
SignalConnectBefore Maybe Text
forall a. Maybe a
Nothing

-- | Connect a signal handler for the [gtkPrivateChanged](#signal:gtkPrivateChanged) signal, to be run after the default handler.
-- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
-- 
-- @
-- 'Data.GI.Base.Signals.after' styleProvider #gtkPrivateChanged callback
-- @
-- 
-- 
afterStyleProviderGtkPrivateChanged :: (IsStyleProvider a, MonadIO m) => a -> StyleProviderGtkPrivateChangedCallback -> m SignalHandlerId
afterStyleProviderGtkPrivateChanged :: forall a (m :: * -> *).
(IsStyleProvider a, MonadIO m) =>
a -> IO () -> m SignalHandlerId
afterStyleProviderGtkPrivateChanged a
obj IO ()
cb = IO SignalHandlerId -> m SignalHandlerId
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO SignalHandlerId -> m SignalHandlerId)
-> IO SignalHandlerId -> m SignalHandlerId
forall a b. (a -> b) -> a -> b
$ do
    let cb' :: C_StyleProviderGtkPrivateChangedCallback
cb' = IO () -> C_StyleProviderGtkPrivateChangedCallback
wrap_StyleProviderGtkPrivateChangedCallback IO ()
cb
    FunPtr C_StyleProviderGtkPrivateChangedCallback
cb'' <- C_StyleProviderGtkPrivateChangedCallback
-> IO (FunPtr C_StyleProviderGtkPrivateChangedCallback)
mk_StyleProviderGtkPrivateChangedCallback C_StyleProviderGtkPrivateChangedCallback
cb'
    a
-> Text
-> FunPtr C_StyleProviderGtkPrivateChangedCallback
-> SignalConnectMode
-> Maybe Text
-> IO SignalHandlerId
forall o a.
GObject o =>
o
-> Text
-> FunPtr a
-> SignalConnectMode
-> Maybe Text
-> IO SignalHandlerId
connectSignalFunPtr a
obj Text
"gtk-private-changed" FunPtr C_StyleProviderGtkPrivateChangedCallback
cb'' SignalConnectMode
SignalConnectAfter Maybe Text
forall a. Maybe a
Nothing


#if defined(ENABLE_OVERLOADING)
data StyleProviderGtkPrivateChangedSignalInfo
instance SignalInfo StyleProviderGtkPrivateChangedSignalInfo where
    type HaskellCallbackType StyleProviderGtkPrivateChangedSignalInfo = StyleProviderGtkPrivateChangedCallback
    connectSignal obj cb connectMode detail = do
        let cb' = wrap_StyleProviderGtkPrivateChangedCallback cb
        cb'' <- mk_StyleProviderGtkPrivateChangedCallback cb'
        connectSignalFunPtr obj "gtk-private-changed" cb'' connectMode detail

#endif

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

#endif