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

The 'GI.GstVideo.Objects.ColorBalanceChannel.ColorBalanceChannel' object represents a parameter
for modifying the color balance implemented by an element providing the
'GI.GstVideo.Interfaces.ColorBalance.ColorBalance' interface. For example, Hue or Saturation.
-}

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

module GI.GstVideo.Objects.ColorBalanceChannel
    (

-- * Exported types
    ColorBalanceChannel(..)                 ,
    IsColorBalanceChannel                   ,
    toColorBalanceChannel                   ,
    noColorBalanceChannel                   ,


 -- * Signals
-- ** valueChanged #signal:valueChanged#

    C_ColorBalanceChannelValueChangedCallback,
    ColorBalanceChannelValueChangedCallback ,
#if ENABLE_OVERLOADING
    ColorBalanceChannelValueChangedSignalInfo,
#endif
    afterColorBalanceChannelValueChanged    ,
    genClosure_ColorBalanceChannelValueChanged,
    mk_ColorBalanceChannelValueChangedCallback,
    noColorBalanceChannelValueChangedCallback,
    onColorBalanceChannelValueChanged       ,
    wrap_ColorBalanceChannelValueChangedCallback,




    ) 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.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.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 ColorBalanceChannel = ColorBalanceChannel (ManagedPtr ColorBalanceChannel)
foreign import ccall "gst_color_balance_channel_get_type"
    c_gst_color_balance_channel_get_type :: IO GType

instance GObject ColorBalanceChannel where
    gobjectType = c_gst_color_balance_channel_get_type


-- | Type class for types which can be safely cast to `ColorBalanceChannel`, for instance with `toColorBalanceChannel`.
class (GObject o, O.IsDescendantOf ColorBalanceChannel o) => IsColorBalanceChannel o
instance (GObject o, O.IsDescendantOf ColorBalanceChannel o) => IsColorBalanceChannel o

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

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

-- | A convenience alias for `Nothing` :: `Maybe` `ColorBalanceChannel`.
noColorBalanceChannel :: Maybe ColorBalanceChannel
noColorBalanceChannel = Nothing

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

instance (info ~ ResolveColorBalanceChannelMethod t ColorBalanceChannel, O.MethodInfo info ColorBalanceChannel p) => OL.IsLabel t (ColorBalanceChannel -> 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

-- signal ColorBalanceChannel::value-changed
{- |
Fired when the value of the indicated channel has changed.
-}
type ColorBalanceChannelValueChangedCallback =
    Int32
    {- ^ /@value@/: The new value -}
    -> IO ()

-- | A convenience synonym for @`Nothing` :: `Maybe` `ColorBalanceChannelValueChangedCallback`@.
noColorBalanceChannelValueChangedCallback :: Maybe ColorBalanceChannelValueChangedCallback
noColorBalanceChannelValueChangedCallback = Nothing

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

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

-- | Wrap the callback into a `GClosure`.
genClosure_ColorBalanceChannelValueChanged :: MonadIO m => ColorBalanceChannelValueChangedCallback -> m (GClosure C_ColorBalanceChannelValueChangedCallback)
genClosure_ColorBalanceChannelValueChanged cb = liftIO $ do
    let cb' = wrap_ColorBalanceChannelValueChangedCallback cb
    mk_ColorBalanceChannelValueChangedCallback cb' >>= B.GClosure.newGClosure


-- | Wrap a `ColorBalanceChannelValueChangedCallback` into a `C_ColorBalanceChannelValueChangedCallback`.
wrap_ColorBalanceChannelValueChangedCallback ::
    ColorBalanceChannelValueChangedCallback ->
    C_ColorBalanceChannelValueChangedCallback
wrap_ColorBalanceChannelValueChangedCallback _cb _ value _ = do
    _cb  value


{- |
Connect a signal handler for the “@value-changed@” 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' colorBalanceChannel #valueChanged callback
@
-}
onColorBalanceChannelValueChanged :: (IsColorBalanceChannel a, MonadIO m) => a -> ColorBalanceChannelValueChangedCallback -> m SignalHandlerId
onColorBalanceChannelValueChanged obj cb = liftIO $ do
    let cb' = wrap_ColorBalanceChannelValueChangedCallback cb
    cb'' <- mk_ColorBalanceChannelValueChangedCallback cb'
    connectSignalFunPtr obj "value-changed" cb'' SignalConnectBefore

{- |
Connect a signal handler for the “@value-changed@” 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' colorBalanceChannel #valueChanged callback
@
-}
afterColorBalanceChannelValueChanged :: (IsColorBalanceChannel a, MonadIO m) => a -> ColorBalanceChannelValueChangedCallback -> m SignalHandlerId
afterColorBalanceChannelValueChanged obj cb = liftIO $ do
    let cb' = wrap_ColorBalanceChannelValueChangedCallback cb
    cb'' <- mk_ColorBalanceChannelValueChangedCallback cb'
    connectSignalFunPtr obj "value-changed" cb'' SignalConnectAfter


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

#if ENABLE_OVERLOADING
#endif

#if ENABLE_OVERLOADING
data ColorBalanceChannelValueChangedSignalInfo
instance SignalInfo ColorBalanceChannelValueChangedSignalInfo where
    type HaskellCallbackType ColorBalanceChannelValueChangedSignalInfo = ColorBalanceChannelValueChangedCallback
    connectSignal _ obj cb connectMode = do
        let cb' = wrap_ColorBalanceChannelValueChangedCallback cb
        cb'' <- mk_ColorBalanceChannelValueChangedCallback cb'
        connectSignalFunPtr obj "value-changed" cb'' connectMode

type instance O.SignalList ColorBalanceChannel = ColorBalanceChannelSignalList
type ColorBalanceChannelSignalList = ('[ '("notify", GObject.Object.ObjectNotifySignalInfo), '("valueChanged", ColorBalanceChannelValueChangedSignalInfo)] :: [(Symbol, *)])

#endif