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

'GI.Gtk.Interfaces.ColorChooser.ColorChooser' is an interface that is implemented by widgets
for choosing colors. Depending on the situation, colors may be
allowed to have alpha (translucency).

In GTK+, the main widgets that implement this interface are
'GI.Gtk.Objects.ColorChooserWidget.ColorChooserWidget', 'GI.Gtk.Objects.ColorChooserDialog.ColorChooserDialog' and 'GI.Gtk.Objects.ColorButton.ColorButton'.
-}

module GI.Gtk.Interfaces.ColorChooser
    ( 

-- * Exported types
    ColorChooser(..)                        ,
    noColorChooser                          ,
    IsColorChooser                          ,
    toColorChooser                          ,


 -- * Methods
-- ** addPalette #method:addPalette#
    ColorChooserAddPaletteMethodInfo        ,
    colorChooserAddPalette                  ,


-- ** getRgba #method:getRgba#
    ColorChooserGetRgbaMethodInfo           ,
    colorChooserGetRgba                     ,


-- ** getUseAlpha #method:getUseAlpha#
    ColorChooserGetUseAlphaMethodInfo       ,
    colorChooserGetUseAlpha                 ,


-- ** setRgba #method:setRgba#
    ColorChooserSetRgbaMethodInfo           ,
    colorChooserSetRgba                     ,


-- ** setUseAlpha #method:setUseAlpha#
    ColorChooserSetUseAlphaMethodInfo       ,
    colorChooserSetUseAlpha                 ,




 -- * Properties
-- ** rgba #attr:rgba#
    ColorChooserRgbaPropertyInfo            ,
    colorChooserRgba                        ,
    constructColorChooserRgba               ,
    getColorChooserRgba                     ,
    setColorChooserRgba                     ,


-- ** useAlpha #attr:useAlpha#
    ColorChooserUseAlphaPropertyInfo        ,
    colorChooserUseAlpha                    ,
    constructColorChooserUseAlpha           ,
    getColorChooserUseAlpha                 ,
    setColorChooserUseAlpha                 ,




 -- * Signals
-- ** colorActivated #signal:colorActivated#
    C_ColorChooserColorActivatedCallback    ,
    ColorChooserColorActivatedCallback      ,
    ColorChooserColorActivatedSignalInfo    ,
    afterColorChooserColorActivated         ,
    genClosure_ColorChooserColorActivated   ,
    mk_ColorChooserColorActivatedCallback   ,
    noColorChooserColorActivatedCallback    ,
    onColorChooserColorActivated            ,
    wrap_ColorChooserColorActivatedCallback ,




    ) 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.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 qualified GI.Gdk.Structs.RGBA as Gdk.RGBA
import {-# SOURCE #-} qualified GI.Gtk.Enums as Gtk.Enums

-- interface ColorChooser 
newtype ColorChooser = ColorChooser (ManagedPtr ColorChooser)
noColorChooser :: Maybe ColorChooser
noColorChooser = Nothing

type family ResolveColorChooserMethod (t :: Symbol) (o :: *) :: * where
    ResolveColorChooserMethod "addPalette" o = ColorChooserAddPaletteMethodInfo
    ResolveColorChooserMethod "bindProperty" o = GObject.Object.ObjectBindPropertyMethodInfo
    ResolveColorChooserMethod "bindPropertyFull" o = GObject.Object.ObjectBindPropertyFullMethodInfo
    ResolveColorChooserMethod "forceFloating" o = GObject.Object.ObjectForceFloatingMethodInfo
    ResolveColorChooserMethod "freezeNotify" o = GObject.Object.ObjectFreezeNotifyMethodInfo
    ResolveColorChooserMethod "isFloating" o = GObject.Object.ObjectIsFloatingMethodInfo
    ResolveColorChooserMethod "notify" o = GObject.Object.ObjectNotifyMethodInfo
    ResolveColorChooserMethod "notifyByPspec" o = GObject.Object.ObjectNotifyByPspecMethodInfo
    ResolveColorChooserMethod "ref" o = GObject.Object.ObjectRefMethodInfo
    ResolveColorChooserMethod "refSink" o = GObject.Object.ObjectRefSinkMethodInfo
    ResolveColorChooserMethod "replaceData" o = GObject.Object.ObjectReplaceDataMethodInfo
    ResolveColorChooserMethod "replaceQdata" o = GObject.Object.ObjectReplaceQdataMethodInfo
    ResolveColorChooserMethod "runDispose" o = GObject.Object.ObjectRunDisposeMethodInfo
    ResolveColorChooserMethod "stealData" o = GObject.Object.ObjectStealDataMethodInfo
    ResolveColorChooserMethod "stealQdata" o = GObject.Object.ObjectStealQdataMethodInfo
    ResolveColorChooserMethod "thawNotify" o = GObject.Object.ObjectThawNotifyMethodInfo
    ResolveColorChooserMethod "unref" o = GObject.Object.ObjectUnrefMethodInfo
    ResolveColorChooserMethod "watchClosure" o = GObject.Object.ObjectWatchClosureMethodInfo
    ResolveColorChooserMethod "getData" o = GObject.Object.ObjectGetDataMethodInfo
    ResolveColorChooserMethod "getProperty" o = GObject.Object.ObjectGetPropertyMethodInfo
    ResolveColorChooserMethod "getQdata" o = GObject.Object.ObjectGetQdataMethodInfo
    ResolveColorChooserMethod "getRgba" o = ColorChooserGetRgbaMethodInfo
    ResolveColorChooserMethod "getUseAlpha" o = ColorChooserGetUseAlphaMethodInfo
    ResolveColorChooserMethod "setData" o = GObject.Object.ObjectSetDataMethodInfo
    ResolveColorChooserMethod "setProperty" o = GObject.Object.ObjectSetPropertyMethodInfo
    ResolveColorChooserMethod "setRgba" o = ColorChooserSetRgbaMethodInfo
    ResolveColorChooserMethod "setUseAlpha" o = ColorChooserSetUseAlphaMethodInfo
    ResolveColorChooserMethod l o = O.MethodResolutionFailed l o

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

#if MIN_VERSION_base(4,9,0)
instance (info ~ ResolveColorChooserMethod t ColorChooser, O.MethodInfo info ColorChooser p) => O.IsLabel t (ColorChooser -> p) where
    fromLabel _ = O.overloadedMethod (O.MethodProxy :: O.MethodProxy info)
#endif

-- signal ColorChooser::color-activated
type ColorChooserColorActivatedCallback =
    Gdk.RGBA.RGBA ->
    IO ()

noColorChooserColorActivatedCallback :: Maybe ColorChooserColorActivatedCallback
noColorChooserColorActivatedCallback = Nothing

type C_ColorChooserColorActivatedCallback =
    Ptr () ->                               -- object
    Ptr Gdk.RGBA.RGBA ->
    Ptr () ->                               -- user_data
    IO ()

foreign import ccall "wrapper"
    mk_ColorChooserColorActivatedCallback :: C_ColorChooserColorActivatedCallback -> IO (FunPtr C_ColorChooserColorActivatedCallback)

genClosure_ColorChooserColorActivated :: ColorChooserColorActivatedCallback -> IO Closure
genClosure_ColorChooserColorActivated cb = do
    let cb' = wrap_ColorChooserColorActivatedCallback cb
    mk_ColorChooserColorActivatedCallback cb' >>= newCClosure


wrap_ColorChooserColorActivatedCallback ::
    ColorChooserColorActivatedCallback ->
    Ptr () ->
    Ptr Gdk.RGBA.RGBA ->
    Ptr () ->
    IO ()
wrap_ColorChooserColorActivatedCallback _cb _ color _ = do
    color' <- (newBoxed Gdk.RGBA.RGBA) color
    _cb  color'


onColorChooserColorActivated :: (GObject a, MonadIO m) => a -> ColorChooserColorActivatedCallback -> m SignalHandlerId
onColorChooserColorActivated obj cb = liftIO $ connectColorChooserColorActivated obj cb SignalConnectBefore
afterColorChooserColorActivated :: (GObject a, MonadIO m) => a -> ColorChooserColorActivatedCallback -> m SignalHandlerId
afterColorChooserColorActivated obj cb = connectColorChooserColorActivated obj cb SignalConnectAfter

connectColorChooserColorActivated :: (GObject a, MonadIO m) =>
                                     a -> ColorChooserColorActivatedCallback -> SignalConnectMode -> m SignalHandlerId
connectColorChooserColorActivated obj cb after = liftIO $ do
    let cb' = wrap_ColorChooserColorActivatedCallback cb
    cb'' <- mk_ColorChooserColorActivatedCallback cb'
    connectSignalFunPtr obj "color-activated" cb'' after

-- VVV Prop "rgba"
   -- Type: TInterface (Name {namespace = "Gdk", name = "RGBA"})
   -- Flags: [PropertyReadable,PropertyWritable]
   -- Nullable: (Nothing,Just False)

getColorChooserRgba :: (MonadIO m, IsColorChooser o) => o -> m (Maybe Gdk.RGBA.RGBA)
getColorChooserRgba obj = liftIO $ getObjectPropertyBoxed obj "rgba" Gdk.RGBA.RGBA

setColorChooserRgba :: (MonadIO m, IsColorChooser o) => o -> Gdk.RGBA.RGBA -> m ()
setColorChooserRgba obj val = liftIO $ setObjectPropertyBoxed obj "rgba" (Just val)

constructColorChooserRgba :: (IsColorChooser o) => Gdk.RGBA.RGBA -> IO (GValueConstruct o)
constructColorChooserRgba val = constructObjectPropertyBoxed "rgba" (Just val)

data ColorChooserRgbaPropertyInfo
instance AttrInfo ColorChooserRgbaPropertyInfo where
    type AttrAllowedOps ColorChooserRgbaPropertyInfo = '[ 'AttrSet, 'AttrConstruct, 'AttrGet]
    type AttrSetTypeConstraint ColorChooserRgbaPropertyInfo = (~) Gdk.RGBA.RGBA
    type AttrBaseTypeConstraint ColorChooserRgbaPropertyInfo = IsColorChooser
    type AttrGetType ColorChooserRgbaPropertyInfo = (Maybe Gdk.RGBA.RGBA)
    type AttrLabel ColorChooserRgbaPropertyInfo = "rgba"
    type AttrOrigin ColorChooserRgbaPropertyInfo = ColorChooser
    attrGet _ = getColorChooserRgba
    attrSet _ = setColorChooserRgba
    attrConstruct _ = constructColorChooserRgba
    attrClear _ = undefined

-- VVV Prop "use-alpha"
   -- Type: TBasicType TBoolean
   -- Flags: [PropertyReadable,PropertyWritable]
   -- Nullable: (Just False,Just False)

getColorChooserUseAlpha :: (MonadIO m, IsColorChooser o) => o -> m Bool
getColorChooserUseAlpha obj = liftIO $ getObjectPropertyBool obj "use-alpha"

setColorChooserUseAlpha :: (MonadIO m, IsColorChooser o) => o -> Bool -> m ()
setColorChooserUseAlpha obj val = liftIO $ setObjectPropertyBool obj "use-alpha" val

constructColorChooserUseAlpha :: (IsColorChooser o) => Bool -> IO (GValueConstruct o)
constructColorChooserUseAlpha val = constructObjectPropertyBool "use-alpha" val

data ColorChooserUseAlphaPropertyInfo
instance AttrInfo ColorChooserUseAlphaPropertyInfo where
    type AttrAllowedOps ColorChooserUseAlphaPropertyInfo = '[ 'AttrSet, 'AttrConstruct, 'AttrGet]
    type AttrSetTypeConstraint ColorChooserUseAlphaPropertyInfo = (~) Bool
    type AttrBaseTypeConstraint ColorChooserUseAlphaPropertyInfo = IsColorChooser
    type AttrGetType ColorChooserUseAlphaPropertyInfo = Bool
    type AttrLabel ColorChooserUseAlphaPropertyInfo = "use-alpha"
    type AttrOrigin ColorChooserUseAlphaPropertyInfo = ColorChooser
    attrGet _ = getColorChooserUseAlpha
    attrSet _ = setColorChooserUseAlpha
    attrConstruct _ = constructColorChooserUseAlpha
    attrClear _ = undefined

instance O.HasAttributeList ColorChooser
type instance O.AttributeList ColorChooser = ColorChooserAttributeList
type ColorChooserAttributeList = ('[ '("rgba", ColorChooserRgbaPropertyInfo), '("useAlpha", ColorChooserUseAlphaPropertyInfo)] :: [(Symbol, *)])

colorChooserRgba :: AttrLabelProxy "rgba"
colorChooserRgba = AttrLabelProxy

colorChooserUseAlpha :: AttrLabelProxy "useAlpha"
colorChooserUseAlpha = AttrLabelProxy

data ColorChooserColorActivatedSignalInfo
instance SignalInfo ColorChooserColorActivatedSignalInfo where
    type HaskellCallbackType ColorChooserColorActivatedSignalInfo = ColorChooserColorActivatedCallback
    connectSignal _ = connectColorChooserColorActivated

type instance O.SignalList ColorChooser = ColorChooserSignalList
type ColorChooserSignalList = ('[ '("colorActivated", ColorChooserColorActivatedSignalInfo), '("notify", GObject.Object.ObjectNotifySignalInfo)] :: [(Symbol, *)])

foreign import ccall "gtk_color_chooser_get_type"
    c_gtk_color_chooser_get_type :: IO GType

instance GObject ColorChooser where
    gobjectType _ = c_gtk_color_chooser_get_type
    

class GObject o => IsColorChooser o
#if MIN_VERSION_base(4,9,0)
instance {-# OVERLAPPABLE #-} (GObject a, O.UnknownAncestorError ColorChooser a) =>
    IsColorChooser a
#endif
instance IsColorChooser ColorChooser
instance GObject.Object.IsObject ColorChooser

toColorChooser :: IsColorChooser o => o -> IO ColorChooser
toColorChooser = unsafeCastTo ColorChooser

-- method ColorChooser::add_palette
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "chooser", argType = TInterface (Name {namespace = "Gtk", name = "ColorChooser"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GtkColorChooser", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "orientation", argType = TInterface (Name {namespace = "Gtk", name = "Orientation"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "%GTK_ORIENTATION_HORIZONTAL if the palette should\n    be displayed in rows, %GTK_ORIENTATION_VERTICAL for columns", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "colors_per_line", argType = TBasicType TInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the number of colors to show in each row/column", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "n_colors", argType = TBasicType TInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the total number of elements in @colors", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "colors", argType = TCArray False (-1) 3 (TInterface (Name {namespace = "Gdk", name = "RGBA"})), direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "the colors of the palette, or %NULL", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : [Arg {argCName = "n_colors", argType = TBasicType TInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the total number of elements in @colors", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "gtk_color_chooser_add_palette" gtk_color_chooser_add_palette :: 
    Ptr ColorChooser ->                     -- chooser : TInterface (Name {namespace = "Gtk", name = "ColorChooser"})
    CUInt ->                                -- orientation : TInterface (Name {namespace = "Gtk", name = "Orientation"})
    Int32 ->                                -- colors_per_line : TBasicType TInt
    Int32 ->                                -- n_colors : TBasicType TInt
    Ptr Gdk.RGBA.RGBA ->                    -- colors : TCArray False (-1) 3 (TInterface (Name {namespace = "Gdk", name = "RGBA"}))
    IO ()

{- |
Adds a palette to the color chooser. If /@orientation@/ is horizontal,
the colors are grouped in rows, with /@colorsPerLine@/ colors
in each row. If /@horizontal@/ is 'False', the colors are grouped
in columns instead.

The default color palette of 'GI.Gtk.Objects.ColorChooserWidget.ColorChooserWidget' has
27 colors, organized in columns of 3 colors. The default gray
palette has 9 grays in a single row.

The layout of the color chooser widget works best when the
palettes have 9-10 columns.

Calling this function for the first time has the
side effect of removing the default color and gray palettes
from the color chooser.

If /@colors@/ is 'Nothing', removes all previously added palettes.

@since 3.4
-}
colorChooserAddPalette ::
    (B.CallStack.HasCallStack, MonadIO m, IsColorChooser a) =>
    a
    {- ^ /@chooser@/: a 'GI.Gtk.Interfaces.ColorChooser.ColorChooser' -}
    -> Gtk.Enums.Orientation
    {- ^ /@orientation@/: 'GI.Gtk.Enums.OrientationHorizontal' if the palette should
    be displayed in rows, 'GI.Gtk.Enums.OrientationVertical' for columns -}
    -> Int32
    {- ^ /@colorsPerLine@/: the number of colors to show in each row\/column -}
    -> Maybe ([Gdk.RGBA.RGBA])
    {- ^ /@colors@/: the colors of the palette, or 'Nothing' -}
    -> m ()
colorChooserAddPalette chooser orientation colorsPerLine colors = liftIO $ do
    let nColors = case colors of
            Nothing -> 0
            Just jColors -> fromIntegral $ length jColors
    chooser' <- unsafeManagedPtrCastPtr chooser
    let orientation' = (fromIntegral . fromEnum) orientation
    maybeColors <- case colors of
        Nothing -> return nullPtr
        Just jColors -> do
            jColors' <- mapM unsafeManagedPtrGetPtr jColors
            jColors'' <- packBlockArray 32 jColors'
            return jColors''
    gtk_color_chooser_add_palette chooser' orientation' colorsPerLine nColors maybeColors
    touchManagedPtr chooser
    whenJust colors (mapM_ touchManagedPtr)
    freeMem maybeColors
    return ()

data ColorChooserAddPaletteMethodInfo
instance (signature ~ (Gtk.Enums.Orientation -> Int32 -> Maybe ([Gdk.RGBA.RGBA]) -> m ()), MonadIO m, IsColorChooser a) => O.MethodInfo ColorChooserAddPaletteMethodInfo a signature where
    overloadedMethod _ = colorChooserAddPalette

-- method ColorChooser::get_rgba
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "chooser", argType = TInterface (Name {namespace = "Gtk", name = "ColorChooser"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GtkColorChooser", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "color", argType = TInterface (Name {namespace = "Gdk", name = "RGBA"}), direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GdkRGBA to fill in with the current color", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = True, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "gtk_color_chooser_get_rgba" gtk_color_chooser_get_rgba :: 
    Ptr ColorChooser ->                     -- chooser : TInterface (Name {namespace = "Gtk", name = "ColorChooser"})
    Ptr Gdk.RGBA.RGBA ->                    -- color : TInterface (Name {namespace = "Gdk", name = "RGBA"})
    IO ()

{- |
Gets the currently-selected color.

@since 3.4
-}
colorChooserGetRgba ::
    (B.CallStack.HasCallStack, MonadIO m, IsColorChooser a) =>
    a
    {- ^ /@chooser@/: a 'GI.Gtk.Interfaces.ColorChooser.ColorChooser' -}
    -> m (Gdk.RGBA.RGBA)
colorChooserGetRgba chooser = liftIO $ do
    chooser' <- unsafeManagedPtrCastPtr chooser
    color <- callocBoxedBytes 32 :: IO (Ptr Gdk.RGBA.RGBA)
    gtk_color_chooser_get_rgba chooser' color
    color' <- (wrapBoxed Gdk.RGBA.RGBA) color
    touchManagedPtr chooser
    return color'

data ColorChooserGetRgbaMethodInfo
instance (signature ~ (m (Gdk.RGBA.RGBA)), MonadIO m, IsColorChooser a) => O.MethodInfo ColorChooserGetRgbaMethodInfo a signature where
    overloadedMethod _ = colorChooserGetRgba

-- method ColorChooser::get_use_alpha
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "chooser", argType = TInterface (Name {namespace = "Gtk", name = "ColorChooser"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GtkColorChooser", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "gtk_color_chooser_get_use_alpha" gtk_color_chooser_get_use_alpha :: 
    Ptr ColorChooser ->                     -- chooser : TInterface (Name {namespace = "Gtk", name = "ColorChooser"})
    IO CInt

{- |
Returns whether the color chooser shows the alpha channel.

@since 3.4
-}
colorChooserGetUseAlpha ::
    (B.CallStack.HasCallStack, MonadIO m, IsColorChooser a) =>
    a
    {- ^ /@chooser@/: a 'GI.Gtk.Interfaces.ColorChooser.ColorChooser' -}
    -> m Bool
    {- ^ __Returns:__ 'True' if the color chooser uses the alpha channel,
    'False' if not -}
colorChooserGetUseAlpha chooser = liftIO $ do
    chooser' <- unsafeManagedPtrCastPtr chooser
    result <- gtk_color_chooser_get_use_alpha chooser'
    let result' = (/= 0) result
    touchManagedPtr chooser
    return result'

data ColorChooserGetUseAlphaMethodInfo
instance (signature ~ (m Bool), MonadIO m, IsColorChooser a) => O.MethodInfo ColorChooserGetUseAlphaMethodInfo a signature where
    overloadedMethod _ = colorChooserGetUseAlpha

-- method ColorChooser::set_rgba
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "chooser", argType = TInterface (Name {namespace = "Gtk", name = "ColorChooser"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GtkColorChooser", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "color", argType = TInterface (Name {namespace = "Gdk", name = "RGBA"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the new color", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "gtk_color_chooser_set_rgba" gtk_color_chooser_set_rgba :: 
    Ptr ColorChooser ->                     -- chooser : TInterface (Name {namespace = "Gtk", name = "ColorChooser"})
    Ptr Gdk.RGBA.RGBA ->                    -- color : TInterface (Name {namespace = "Gdk", name = "RGBA"})
    IO ()

{- |
Sets the color.

@since 3.4
-}
colorChooserSetRgba ::
    (B.CallStack.HasCallStack, MonadIO m, IsColorChooser a) =>
    a
    {- ^ /@chooser@/: a 'GI.Gtk.Interfaces.ColorChooser.ColorChooser' -}
    -> Gdk.RGBA.RGBA
    {- ^ /@color@/: the new color -}
    -> m ()
colorChooserSetRgba chooser color = liftIO $ do
    chooser' <- unsafeManagedPtrCastPtr chooser
    color' <- unsafeManagedPtrGetPtr color
    gtk_color_chooser_set_rgba chooser' color'
    touchManagedPtr chooser
    touchManagedPtr color
    return ()

data ColorChooserSetRgbaMethodInfo
instance (signature ~ (Gdk.RGBA.RGBA -> m ()), MonadIO m, IsColorChooser a) => O.MethodInfo ColorChooserSetRgbaMethodInfo a signature where
    overloadedMethod _ = colorChooserSetRgba

-- method ColorChooser::set_use_alpha
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "chooser", argType = TInterface (Name {namespace = "Gtk", name = "ColorChooser"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GtkColorChooser", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "use_alpha", argType = TBasicType TBoolean, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "%TRUE if color chooser should use alpha channel, %FALSE if not", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "gtk_color_chooser_set_use_alpha" gtk_color_chooser_set_use_alpha :: 
    Ptr ColorChooser ->                     -- chooser : TInterface (Name {namespace = "Gtk", name = "ColorChooser"})
    CInt ->                                 -- use_alpha : TBasicType TBoolean
    IO ()

{- |
Sets whether or not the color chooser should use the alpha channel.

@since 3.4
-}
colorChooserSetUseAlpha ::
    (B.CallStack.HasCallStack, MonadIO m, IsColorChooser a) =>
    a
    {- ^ /@chooser@/: a 'GI.Gtk.Interfaces.ColorChooser.ColorChooser' -}
    -> Bool
    {- ^ /@useAlpha@/: 'True' if color chooser should use alpha channel, 'False' if not -}
    -> m ()
colorChooserSetUseAlpha chooser useAlpha = liftIO $ do
    chooser' <- unsafeManagedPtrCastPtr chooser
    let useAlpha' = (fromIntegral . fromEnum) useAlpha
    gtk_color_chooser_set_use_alpha chooser' useAlpha'
    touchManagedPtr chooser
    return ()

data ColorChooserSetUseAlphaMethodInfo
instance (signature ~ (Bool -> m ()), MonadIO m, IsColorChooser a) => O.MethodInfo ColorChooserSetUseAlphaMethodInfo a signature where
    overloadedMethod _ = colorChooserSetUseAlpha