{-# LANGUAGE ImplicitParams, RankNTypes, TypeApplications #-}
#if (MIN_VERSION_haskell_gi_overloading(1,0,0) && !defined(__HADDOCK_VERSION__))
#define ENABLE_OVERLOADING
#endif
module GI.Gtk.Interfaces.ColorChooser
(
ColorChooser(..) ,
IsColorChooser ,
toColorChooser ,
#if defined(ENABLE_OVERLOADING)
ResolveColorChooserMethod ,
#endif
#if defined(ENABLE_OVERLOADING)
ColorChooserAddPaletteMethodInfo ,
#endif
colorChooserAddPalette ,
#if defined(ENABLE_OVERLOADING)
ColorChooserGetRgbaMethodInfo ,
#endif
colorChooserGetRgba ,
#if defined(ENABLE_OVERLOADING)
ColorChooserGetUseAlphaMethodInfo ,
#endif
colorChooserGetUseAlpha ,
#if defined(ENABLE_OVERLOADING)
ColorChooserSetRgbaMethodInfo ,
#endif
colorChooserSetRgba ,
#if defined(ENABLE_OVERLOADING)
ColorChooserSetUseAlphaMethodInfo ,
#endif
colorChooserSetUseAlpha ,
#if defined(ENABLE_OVERLOADING)
ColorChooserRgbaPropertyInfo ,
#endif
#if defined(ENABLE_OVERLOADING)
colorChooserRgba ,
#endif
constructColorChooserRgba ,
getColorChooserRgba ,
setColorChooserRgba ,
#if defined(ENABLE_OVERLOADING)
ColorChooserUseAlphaPropertyInfo ,
#endif
#if defined(ENABLE_OVERLOADING)
colorChooserUseAlpha ,
#endif
constructColorChooserUseAlpha ,
getColorChooserUseAlpha ,
setColorChooserUseAlpha ,
ColorChooserColorActivatedCallback ,
#if defined(ENABLE_OVERLOADING)
ColorChooserColorActivatedSignalInfo ,
#endif
afterColorChooserColorActivated ,
onColorChooserColorActivated ,
) 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.GHashTable as B.GHT
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.Coerce as Coerce
import qualified Data.Text as T
import qualified Data.Kind as DK
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
import qualified GI.Gdk.Structs.RGBA as Gdk.RGBA
import {-# SOURCE #-} qualified GI.Gtk.Enums as Gtk.Enums
newtype ColorChooser = ColorChooser (SP.ManagedPtr ColorChooser)
deriving (ColorChooser -> ColorChooser -> Bool
(ColorChooser -> ColorChooser -> Bool)
-> (ColorChooser -> ColorChooser -> Bool) -> Eq ColorChooser
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: ColorChooser -> ColorChooser -> Bool
== :: ColorChooser -> ColorChooser -> Bool
$c/= :: ColorChooser -> ColorChooser -> Bool
/= :: ColorChooser -> ColorChooser -> Bool
Eq)
instance SP.ManagedPtrNewtype ColorChooser where
toManagedPtr :: ColorChooser -> ManagedPtr ColorChooser
toManagedPtr (ColorChooser ManagedPtr ColorChooser
p) = ManagedPtr ColorChooser
p
foreign import ccall "gtk_color_chooser_get_type"
c_gtk_color_chooser_get_type :: IO B.Types.GType
instance B.Types.TypedObject ColorChooser where
glibType :: IO GType
glibType = IO GType
c_gtk_color_chooser_get_type
instance B.Types.GObject ColorChooser
class (SP.GObject o, O.IsDescendantOf ColorChooser o) => IsColorChooser o
instance (SP.GObject o, O.IsDescendantOf ColorChooser o) => IsColorChooser o
instance O.HasParentTypes ColorChooser
type instance O.ParentTypes ColorChooser = '[GObject.Object.Object]
toColorChooser :: (MIO.MonadIO m, IsColorChooser o) => o -> m ColorChooser
toColorChooser :: forall (m :: * -> *) o.
(MonadIO m, IsColorChooser o) =>
o -> m ColorChooser
toColorChooser = IO ColorChooser -> m ColorChooser
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
MIO.liftIO (IO ColorChooser -> m ColorChooser)
-> (o -> IO ColorChooser) -> o -> m ColorChooser
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (ManagedPtr ColorChooser -> ColorChooser) -> o -> IO ColorChooser
forall o o'.
(HasCallStack, ManagedPtrNewtype o, TypedObject o,
ManagedPtrNewtype o', TypedObject o') =>
(ManagedPtr o' -> o') -> o -> IO o'
B.ManagedPtr.unsafeCastTo ManagedPtr ColorChooser -> ColorChooser
ColorChooser
instance B.GValue.IsGValue (Maybe ColorChooser) where
gvalueGType_ :: IO GType
gvalueGType_ = IO GType
c_gtk_color_chooser_get_type
gvalueSet_ :: Ptr GValue -> Maybe ColorChooser -> IO ()
gvalueSet_ Ptr GValue
gv Maybe ColorChooser
P.Nothing = Ptr GValue -> Ptr ColorChooser -> IO ()
forall a. GObject a => Ptr GValue -> Ptr a -> IO ()
B.GValue.set_object Ptr GValue
gv (Ptr ColorChooser
forall a. Ptr a
FP.nullPtr :: FP.Ptr ColorChooser)
gvalueSet_ Ptr GValue
gv (P.Just ColorChooser
obj) = ColorChooser -> (Ptr ColorChooser -> IO ()) -> IO ()
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
B.ManagedPtr.withManagedPtr ColorChooser
obj (Ptr GValue -> Ptr ColorChooser -> IO ()
forall a. GObject a => Ptr GValue -> Ptr a -> IO ()
B.GValue.set_object Ptr GValue
gv)
gvalueGet_ :: Ptr GValue -> IO (Maybe ColorChooser)
gvalueGet_ Ptr GValue
gv = do
Ptr ColorChooser
ptr <- Ptr GValue -> IO (Ptr ColorChooser)
forall a. GObject a => Ptr GValue -> IO (Ptr a)
B.GValue.get_object Ptr GValue
gv :: IO (FP.Ptr ColorChooser)
if Ptr ColorChooser
ptr Ptr ColorChooser -> Ptr ColorChooser -> Bool
forall a. Eq a => a -> a -> Bool
/= Ptr ColorChooser
forall a. Ptr a
FP.nullPtr
then ColorChooser -> Maybe ColorChooser
forall a. a -> Maybe a
P.Just (ColorChooser -> Maybe ColorChooser)
-> IO ColorChooser -> IO (Maybe ColorChooser)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (ManagedPtr ColorChooser -> ColorChooser)
-> Ptr ColorChooser -> IO ColorChooser
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
B.ManagedPtr.newObject ManagedPtr ColorChooser -> ColorChooser
ColorChooser Ptr ColorChooser
ptr
else Maybe ColorChooser -> IO (Maybe ColorChooser)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Maybe ColorChooser
forall a. Maybe a
P.Nothing
getColorChooserRgba :: (MonadIO m, IsColorChooser o) => o -> m (Maybe Gdk.RGBA.RGBA)
getColorChooserRgba :: forall (m :: * -> *) o.
(MonadIO m, IsColorChooser o) =>
o -> m (Maybe RGBA)
getColorChooserRgba o
obj = IO (Maybe RGBA) -> m (Maybe RGBA)
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
MIO.liftIO (IO (Maybe RGBA) -> m (Maybe RGBA))
-> IO (Maybe RGBA) -> m (Maybe RGBA)
forall a b. (a -> b) -> a -> b
$ o -> String -> (ManagedPtr RGBA -> RGBA) -> IO (Maybe RGBA)
forall a b.
(GObject a, GBoxed b) =>
a -> String -> (ManagedPtr b -> b) -> IO (Maybe b)
B.Properties.getObjectPropertyBoxed o
obj String
"rgba" ManagedPtr RGBA -> RGBA
Gdk.RGBA.RGBA
setColorChooserRgba :: (MonadIO m, IsColorChooser o) => o -> Gdk.RGBA.RGBA -> m ()
setColorChooserRgba :: forall (m :: * -> *) o.
(MonadIO m, IsColorChooser o) =>
o -> RGBA -> m ()
setColorChooserRgba o
obj RGBA
val = IO () -> m ()
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
MIO.liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
o -> String -> Maybe RGBA -> IO ()
forall a b.
(GObject a, GBoxed b) =>
a -> String -> Maybe b -> IO ()
B.Properties.setObjectPropertyBoxed o
obj String
"rgba" (RGBA -> Maybe RGBA
forall a. a -> Maybe a
Just RGBA
val)
constructColorChooserRgba :: (IsColorChooser o, MIO.MonadIO m) => Gdk.RGBA.RGBA -> m (GValueConstruct o)
constructColorChooserRgba :: forall o (m :: * -> *).
(IsColorChooser o, MonadIO m) =>
RGBA -> m (GValueConstruct o)
constructColorChooserRgba RGBA
val = IO (GValueConstruct o) -> m (GValueConstruct o)
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
MIO.liftIO (IO (GValueConstruct o) -> m (GValueConstruct o))
-> IO (GValueConstruct o) -> m (GValueConstruct o)
forall a b. (a -> b) -> a -> b
$ do
IO (GValueConstruct o) -> IO (GValueConstruct o)
forall a. IO a -> IO a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
MIO.liftIO (IO (GValueConstruct o) -> IO (GValueConstruct o))
-> IO (GValueConstruct o) -> IO (GValueConstruct o)
forall a b. (a -> b) -> a -> b
$ String -> Maybe RGBA -> IO (GValueConstruct o)
forall a o. GBoxed a => String -> Maybe a -> IO (GValueConstruct o)
B.Properties.constructObjectPropertyBoxed String
"rgba" (RGBA -> Maybe RGBA
forall a. a -> Maybe a
P.Just RGBA
val)
#if defined(ENABLE_OVERLOADING)
data ColorChooserRgbaPropertyInfo
instance AttrInfo ColorChooserRgbaPropertyInfo where
type AttrAllowedOps ColorChooserRgbaPropertyInfo = '[ 'AttrSet, 'AttrConstruct, 'AttrGet]
type AttrBaseTypeConstraint ColorChooserRgbaPropertyInfo = IsColorChooser
type AttrSetTypeConstraint ColorChooserRgbaPropertyInfo = (~) Gdk.RGBA.RGBA
type AttrTransferTypeConstraint ColorChooserRgbaPropertyInfo = (~) Gdk.RGBA.RGBA
type AttrTransferType ColorChooserRgbaPropertyInfo = Gdk.RGBA.RGBA
type AttrGetType ColorChooserRgbaPropertyInfo = (Maybe Gdk.RGBA.RGBA)
type AttrLabel ColorChooserRgbaPropertyInfo = "rgba"
type AttrOrigin ColorChooserRgbaPropertyInfo = ColorChooser
attrGet = getColorChooserRgba
attrSet = setColorChooserRgba
attrTransfer _ v = do
return v
attrConstruct = constructColorChooserRgba
attrClear = undefined
dbgAttrInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Gtk.Interfaces.ColorChooser.rgba"
, O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gtk-3.0.41/docs/GI-Gtk-Interfaces-ColorChooser.html#g:attr:rgba"
})
#endif
getColorChooserUseAlpha :: (MonadIO m, IsColorChooser o) => o -> m Bool
getColorChooserUseAlpha :: forall (m :: * -> *) o.
(MonadIO m, IsColorChooser o) =>
o -> m Bool
getColorChooserUseAlpha o
obj = IO Bool -> m Bool
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
MIO.liftIO (IO Bool -> m Bool) -> IO Bool -> m Bool
forall a b. (a -> b) -> a -> b
$ o -> String -> IO Bool
forall a. GObject a => a -> String -> IO Bool
B.Properties.getObjectPropertyBool o
obj String
"use-alpha"
setColorChooserUseAlpha :: (MonadIO m, IsColorChooser o) => o -> Bool -> m ()
setColorChooserUseAlpha :: forall (m :: * -> *) o.
(MonadIO m, IsColorChooser o) =>
o -> Bool -> m ()
setColorChooserUseAlpha o
obj Bool
val = IO () -> m ()
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
MIO.liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
o -> String -> Bool -> IO ()
forall a. GObject a => a -> String -> Bool -> IO ()
B.Properties.setObjectPropertyBool o
obj String
"use-alpha" Bool
val
constructColorChooserUseAlpha :: (IsColorChooser o, MIO.MonadIO m) => Bool -> m (GValueConstruct o)
constructColorChooserUseAlpha :: forall o (m :: * -> *).
(IsColorChooser o, MonadIO m) =>
Bool -> m (GValueConstruct o)
constructColorChooserUseAlpha Bool
val = IO (GValueConstruct o) -> m (GValueConstruct o)
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
MIO.liftIO (IO (GValueConstruct o) -> m (GValueConstruct o))
-> IO (GValueConstruct o) -> m (GValueConstruct o)
forall a b. (a -> b) -> a -> b
$ do
IO (GValueConstruct o) -> IO (GValueConstruct o)
forall a. IO a -> IO a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
MIO.liftIO (IO (GValueConstruct o) -> IO (GValueConstruct o))
-> IO (GValueConstruct o) -> IO (GValueConstruct o)
forall a b. (a -> b) -> a -> b
$ String -> Bool -> IO (GValueConstruct o)
forall o. String -> Bool -> IO (GValueConstruct o)
B.Properties.constructObjectPropertyBool String
"use-alpha" Bool
val
#if defined(ENABLE_OVERLOADING)
data ColorChooserUseAlphaPropertyInfo
instance AttrInfo ColorChooserUseAlphaPropertyInfo where
type AttrAllowedOps ColorChooserUseAlphaPropertyInfo = '[ 'AttrSet, 'AttrConstruct, 'AttrGet]
type AttrBaseTypeConstraint ColorChooserUseAlphaPropertyInfo = IsColorChooser
type AttrSetTypeConstraint ColorChooserUseAlphaPropertyInfo = (~) Bool
type AttrTransferTypeConstraint ColorChooserUseAlphaPropertyInfo = (~) Bool
type AttrTransferType ColorChooserUseAlphaPropertyInfo = Bool
type AttrGetType ColorChooserUseAlphaPropertyInfo = Bool
type AttrLabel ColorChooserUseAlphaPropertyInfo = "use-alpha"
type AttrOrigin ColorChooserUseAlphaPropertyInfo = ColorChooser
attrGet = getColorChooserUseAlpha
attrSet = setColorChooserUseAlpha
attrTransfer _ v = do
return v
attrConstruct = constructColorChooserUseAlpha
attrClear = undefined
dbgAttrInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Gtk.Interfaces.ColorChooser.useAlpha"
, O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gtk-3.0.41/docs/GI-Gtk-Interfaces-ColorChooser.html#g:attr:useAlpha"
})
#endif
#if defined(ENABLE_OVERLOADING)
instance O.HasAttributeList ColorChooser
type instance O.AttributeList ColorChooser = ColorChooserAttributeList
type ColorChooserAttributeList = ('[ '("rgba", ColorChooserRgbaPropertyInfo), '("useAlpha", ColorChooserUseAlphaPropertyInfo)] :: [(Symbol, DK.Type)])
#endif
#if defined(ENABLE_OVERLOADING)
colorChooserRgba :: AttrLabelProxy "rgba"
colorChooserRgba = AttrLabelProxy
colorChooserUseAlpha :: AttrLabelProxy "useAlpha"
colorChooserUseAlpha = AttrLabelProxy
#endif
#if defined(ENABLE_OVERLOADING)
type family ResolveColorChooserMethod (t :: Symbol) (o :: DK.Type) :: DK.Type 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 "getv" o = GObject.Object.ObjectGetvMethodInfo
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 "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 "setDataFull" o = GObject.Object.ObjectSetDataFullMethodInfo
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.OverloadedMethod info ColorChooser p) => OL.IsLabel t (ColorChooser -> 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 ~ ResolveColorChooserMethod t ColorChooser, O.OverloadedMethod info ColorChooser p, R.HasField t ColorChooser p) => R.HasField t ColorChooser p where
getField = O.overloadedMethod @info
#endif
instance (info ~ ResolveColorChooserMethod t ColorChooser, O.OverloadedMethodInfo info ColorChooser) => OL.IsLabel t (O.MethodProxy info ColorChooser) where
#if MIN_VERSION_base(4,10,0)
fromLabel = O.MethodProxy
#else
fromLabel _ = O.MethodProxy
#endif
#endif
foreign import ccall "gtk_color_chooser_add_palette" gtk_color_chooser_add_palette ::
Ptr ColorChooser ->
CUInt ->
Int32 ->
Int32 ->
Ptr Gdk.RGBA.RGBA ->
IO ()
colorChooserAddPalette ::
(B.CallStack.HasCallStack, MonadIO m, IsColorChooser a) =>
a
-> Gtk.Enums.Orientation
-> Int32
-> Maybe ([Gdk.RGBA.RGBA])
-> m ()
colorChooserAddPalette :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsColorChooser a) =>
a -> Orientation -> Int32 -> Maybe [RGBA] -> m ()
colorChooserAddPalette a
chooser Orientation
orientation Int32
colorsPerLine Maybe [RGBA]
colors = IO () -> m ()
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
let nColors :: Int32
nColors = case Maybe [RGBA]
colors of
Maybe [RGBA]
Nothing -> Int32
0
Just [RGBA]
jColors -> Int -> Int32
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> Int32) -> Int -> Int32
forall a b. (a -> b) -> a -> b
$ [RGBA] -> Int
forall a. [a] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
P.length [RGBA]
jColors
Ptr ColorChooser
chooser' <- a -> IO (Ptr ColorChooser)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
chooser
let orientation' :: CUInt
orientation' = (Int -> CUInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> CUInt) -> (Orientation -> Int) -> Orientation -> CUInt
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Orientation -> Int
forall a. Enum a => a -> Int
fromEnum) Orientation
orientation
Ptr RGBA
maybeColors <- case Maybe [RGBA]
colors of
Maybe [RGBA]
Nothing -> Ptr RGBA -> IO (Ptr RGBA)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr RGBA
forall a. Ptr a
nullPtr
Just [RGBA]
jColors -> do
[Ptr RGBA]
jColors' <- (RGBA -> IO (Ptr RGBA)) -> [RGBA] -> IO [Ptr RGBA]
forall (t :: * -> *) (m :: * -> *) a b.
(Traversable t, Monad m) =>
(a -> m b) -> t a -> m (t b)
forall (m :: * -> *) a b. Monad m => (a -> m b) -> [a] -> m [b]
mapM RGBA -> IO (Ptr RGBA)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr [RGBA]
jColors
Ptr RGBA
jColors'' <- Int -> [Ptr RGBA] -> IO (Ptr RGBA)
forall a. Int -> [Ptr a] -> IO (Ptr a)
packBlockArray Int
32 [Ptr RGBA]
jColors'
Ptr RGBA -> IO (Ptr RGBA)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr RGBA
jColors''
Ptr ColorChooser -> CUInt -> Int32 -> Int32 -> Ptr RGBA -> IO ()
gtk_color_chooser_add_palette Ptr ColorChooser
chooser' CUInt
orientation' Int32
colorsPerLine Int32
nColors Ptr RGBA
maybeColors
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
chooser
Maybe [RGBA] -> ([RGBA] -> IO ()) -> IO ()
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe [RGBA]
colors ((RGBA -> IO ()) -> [RGBA] -> IO ()
forall (t :: * -> *) (m :: * -> *) a b.
(Foldable t, Monad m) =>
(a -> m b) -> t a -> m ()
mapM_ RGBA -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr)
Ptr RGBA -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr RGBA
maybeColors
() -> IO ()
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return ()
#if defined(ENABLE_OVERLOADING)
data ColorChooserAddPaletteMethodInfo
instance (signature ~ (Gtk.Enums.Orientation -> Int32 -> Maybe ([Gdk.RGBA.RGBA]) -> m ()), MonadIO m, IsColorChooser a) => O.OverloadedMethod ColorChooserAddPaletteMethodInfo a signature where
overloadedMethod = colorChooserAddPalette
instance O.OverloadedMethodInfo ColorChooserAddPaletteMethodInfo a where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Gtk.Interfaces.ColorChooser.colorChooserAddPalette",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gtk-3.0.41/docs/GI-Gtk-Interfaces-ColorChooser.html#v:colorChooserAddPalette"
})
#endif
foreign import ccall "gtk_color_chooser_get_rgba" gtk_color_chooser_get_rgba ::
Ptr ColorChooser ->
Ptr Gdk.RGBA.RGBA ->
IO ()
colorChooserGetRgba ::
(B.CallStack.HasCallStack, MonadIO m, IsColorChooser a) =>
a
-> m (Gdk.RGBA.RGBA)
colorChooserGetRgba :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsColorChooser a) =>
a -> m RGBA
colorChooserGetRgba a
chooser = IO RGBA -> m RGBA
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO RGBA -> m RGBA) -> IO RGBA -> m RGBA
forall a b. (a -> b) -> a -> b
$ do
Ptr ColorChooser
chooser' <- a -> IO (Ptr ColorChooser)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
chooser
Ptr RGBA
color <- Int -> IO (Ptr RGBA)
forall a. GBoxed a => Int -> IO (Ptr a)
SP.callocBoxedBytes Int
32 :: IO (Ptr Gdk.RGBA.RGBA)
Ptr ColorChooser -> Ptr RGBA -> IO ()
gtk_color_chooser_get_rgba Ptr ColorChooser
chooser' Ptr RGBA
color
RGBA
color' <- ((ManagedPtr RGBA -> RGBA) -> Ptr RGBA -> IO RGBA
forall a.
(HasCallStack, GBoxed a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapBoxed ManagedPtr RGBA -> RGBA
Gdk.RGBA.RGBA) Ptr RGBA
color
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
chooser
RGBA -> IO RGBA
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return RGBA
color'
#if defined(ENABLE_OVERLOADING)
data ColorChooserGetRgbaMethodInfo
instance (signature ~ (m (Gdk.RGBA.RGBA)), MonadIO m, IsColorChooser a) => O.OverloadedMethod ColorChooserGetRgbaMethodInfo a signature where
overloadedMethod = colorChooserGetRgba
instance O.OverloadedMethodInfo ColorChooserGetRgbaMethodInfo a where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Gtk.Interfaces.ColorChooser.colorChooserGetRgba",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gtk-3.0.41/docs/GI-Gtk-Interfaces-ColorChooser.html#v:colorChooserGetRgba"
})
#endif
foreign import ccall "gtk_color_chooser_get_use_alpha" gtk_color_chooser_get_use_alpha ::
Ptr ColorChooser ->
IO CInt
colorChooserGetUseAlpha ::
(B.CallStack.HasCallStack, MonadIO m, IsColorChooser a) =>
a
-> m Bool
colorChooserGetUseAlpha :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsColorChooser a) =>
a -> m Bool
colorChooserGetUseAlpha a
chooser = IO Bool -> m Bool
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Bool -> m Bool) -> IO Bool -> m Bool
forall a b. (a -> b) -> a -> b
$ do
Ptr ColorChooser
chooser' <- a -> IO (Ptr ColorChooser)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
chooser
CInt
result <- Ptr ColorChooser -> IO CInt
gtk_color_chooser_get_use_alpha Ptr ColorChooser
chooser'
let result' :: Bool
result' = (CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
/= CInt
0) CInt
result
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
chooser
Bool -> IO Bool
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
result'
#if defined(ENABLE_OVERLOADING)
data ColorChooserGetUseAlphaMethodInfo
instance (signature ~ (m Bool), MonadIO m, IsColorChooser a) => O.OverloadedMethod ColorChooserGetUseAlphaMethodInfo a signature where
overloadedMethod = colorChooserGetUseAlpha
instance O.OverloadedMethodInfo ColorChooserGetUseAlphaMethodInfo a where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Gtk.Interfaces.ColorChooser.colorChooserGetUseAlpha",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gtk-3.0.41/docs/GI-Gtk-Interfaces-ColorChooser.html#v:colorChooserGetUseAlpha"
})
#endif
foreign import ccall "gtk_color_chooser_set_rgba" gtk_color_chooser_set_rgba ::
Ptr ColorChooser ->
Ptr Gdk.RGBA.RGBA ->
IO ()
colorChooserSetRgba ::
(B.CallStack.HasCallStack, MonadIO m, IsColorChooser a) =>
a
-> Gdk.RGBA.RGBA
-> m ()
colorChooserSetRgba :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsColorChooser a) =>
a -> RGBA -> m ()
colorChooserSetRgba a
chooser RGBA
color = IO () -> m ()
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
Ptr ColorChooser
chooser' <- a -> IO (Ptr ColorChooser)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
chooser
Ptr RGBA
color' <- RGBA -> IO (Ptr RGBA)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr RGBA
color
Ptr ColorChooser -> Ptr RGBA -> IO ()
gtk_color_chooser_set_rgba Ptr ColorChooser
chooser' Ptr RGBA
color'
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
chooser
RGBA -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr RGBA
color
() -> IO ()
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return ()
#if defined(ENABLE_OVERLOADING)
data ColorChooserSetRgbaMethodInfo
instance (signature ~ (Gdk.RGBA.RGBA -> m ()), MonadIO m, IsColorChooser a) => O.OverloadedMethod ColorChooserSetRgbaMethodInfo a signature where
overloadedMethod = colorChooserSetRgba
instance O.OverloadedMethodInfo ColorChooserSetRgbaMethodInfo a where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Gtk.Interfaces.ColorChooser.colorChooserSetRgba",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gtk-3.0.41/docs/GI-Gtk-Interfaces-ColorChooser.html#v:colorChooserSetRgba"
})
#endif
foreign import ccall "gtk_color_chooser_set_use_alpha" gtk_color_chooser_set_use_alpha ::
Ptr ColorChooser ->
CInt ->
IO ()
colorChooserSetUseAlpha ::
(B.CallStack.HasCallStack, MonadIO m, IsColorChooser a) =>
a
-> Bool
-> m ()
colorChooserSetUseAlpha :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsColorChooser a) =>
a -> Bool -> m ()
colorChooserSetUseAlpha a
chooser Bool
useAlpha = IO () -> m ()
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
Ptr ColorChooser
chooser' <- a -> IO (Ptr ColorChooser)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
chooser
let useAlpha' :: CInt
useAlpha' = (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
P.fromIntegral (Int -> CInt) -> (Bool -> Int) -> Bool -> CInt
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Bool -> Int
forall a. Enum a => a -> Int
P.fromEnum) Bool
useAlpha
Ptr ColorChooser -> CInt -> IO ()
gtk_color_chooser_set_use_alpha Ptr ColorChooser
chooser' CInt
useAlpha'
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
chooser
() -> IO ()
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return ()
#if defined(ENABLE_OVERLOADING)
data ColorChooserSetUseAlphaMethodInfo
instance (signature ~ (Bool -> m ()), MonadIO m, IsColorChooser a) => O.OverloadedMethod ColorChooserSetUseAlphaMethodInfo a signature where
overloadedMethod = colorChooserSetUseAlpha
instance O.OverloadedMethodInfo ColorChooserSetUseAlphaMethodInfo a where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Gtk.Interfaces.ColorChooser.colorChooserSetUseAlpha",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gtk-3.0.41/docs/GI-Gtk-Interfaces-ColorChooser.html#v:colorChooserSetUseAlpha"
})
#endif
type ColorChooserColorActivatedCallback =
Gdk.RGBA.RGBA
-> IO ()
type C_ColorChooserColorActivatedCallback =
Ptr ColorChooser ->
Ptr Gdk.RGBA.RGBA ->
Ptr () ->
IO ()
foreign import ccall "wrapper"
mk_ColorChooserColorActivatedCallback :: C_ColorChooserColorActivatedCallback -> IO (FunPtr C_ColorChooserColorActivatedCallback)
wrap_ColorChooserColorActivatedCallback ::
GObject a => (a -> ColorChooserColorActivatedCallback) ->
C_ColorChooserColorActivatedCallback
wrap_ColorChooserColorActivatedCallback :: forall a.
GObject a =>
(a -> RGBA -> IO ()) -> C_ColorChooserColorActivatedCallback
wrap_ColorChooserColorActivatedCallback a -> RGBA -> IO ()
gi'cb Ptr ColorChooser
gi'selfPtr Ptr RGBA
color Ptr ()
_ = do
Ptr RGBA -> (RGBA -> IO ()) -> IO ()
forall a b.
(HasCallStack, ManagedPtrNewtype a) =>
Ptr a -> (a -> IO b) -> IO b
B.ManagedPtr.withTransient Ptr RGBA
color ((RGBA -> IO ()) -> IO ()) -> (RGBA -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \RGBA
color' -> do
Ptr ColorChooser -> (ColorChooser -> IO ()) -> IO ()
forall a b.
(HasCallStack, ManagedPtrNewtype a) =>
Ptr a -> (a -> IO b) -> IO b
B.ManagedPtr.withTransient Ptr ColorChooser
gi'selfPtr ((ColorChooser -> IO ()) -> IO ())
-> (ColorChooser -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \ColorChooser
gi'self -> a -> RGBA -> IO ()
gi'cb (ColorChooser -> a
forall a b. Coercible a b => a -> b
Coerce.coerce ColorChooser
gi'self) RGBA
color'
onColorChooserColorActivated :: (IsColorChooser a, MonadIO m) => a -> ((?self :: a) => ColorChooserColorActivatedCallback) -> m SignalHandlerId
onColorChooserColorActivated :: forall a (m :: * -> *).
(IsColorChooser a, MonadIO m) =>
a -> ((?self::a) => RGBA -> IO ()) -> m SignalHandlerId
onColorChooserColorActivated a
obj (?self::a) => RGBA -> IO ()
cb = IO SignalHandlerId -> m SignalHandlerId
forall a. IO a -> m a
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 wrapped :: a -> RGBA -> IO ()
wrapped a
self = let ?self = a
?self::a
self in (?self::a) => RGBA -> IO ()
RGBA -> IO ()
cb
let wrapped' :: C_ColorChooserColorActivatedCallback
wrapped' = (a -> RGBA -> IO ()) -> C_ColorChooserColorActivatedCallback
forall a.
GObject a =>
(a -> RGBA -> IO ()) -> C_ColorChooserColorActivatedCallback
wrap_ColorChooserColorActivatedCallback a -> RGBA -> IO ()
wrapped
FunPtr C_ColorChooserColorActivatedCallback
wrapped'' <- C_ColorChooserColorActivatedCallback
-> IO (FunPtr C_ColorChooserColorActivatedCallback)
mk_ColorChooserColorActivatedCallback C_ColorChooserColorActivatedCallback
wrapped'
a
-> Text
-> FunPtr C_ColorChooserColorActivatedCallback
-> SignalConnectMode
-> Maybe Text
-> IO SignalHandlerId
forall o a.
GObject o =>
o
-> Text
-> FunPtr a
-> SignalConnectMode
-> Maybe Text
-> IO SignalHandlerId
connectSignalFunPtr a
obj Text
"color-activated" FunPtr C_ColorChooserColorActivatedCallback
wrapped'' SignalConnectMode
SignalConnectBefore Maybe Text
forall a. Maybe a
Nothing
afterColorChooserColorActivated :: (IsColorChooser a, MonadIO m) => a -> ((?self :: a) => ColorChooserColorActivatedCallback) -> m SignalHandlerId
afterColorChooserColorActivated :: forall a (m :: * -> *).
(IsColorChooser a, MonadIO m) =>
a -> ((?self::a) => RGBA -> IO ()) -> m SignalHandlerId
afterColorChooserColorActivated a
obj (?self::a) => RGBA -> IO ()
cb = IO SignalHandlerId -> m SignalHandlerId
forall a. IO a -> m a
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 wrapped :: a -> RGBA -> IO ()
wrapped a
self = let ?self = a
?self::a
self in (?self::a) => RGBA -> IO ()
RGBA -> IO ()
cb
let wrapped' :: C_ColorChooserColorActivatedCallback
wrapped' = (a -> RGBA -> IO ()) -> C_ColorChooserColorActivatedCallback
forall a.
GObject a =>
(a -> RGBA -> IO ()) -> C_ColorChooserColorActivatedCallback
wrap_ColorChooserColorActivatedCallback a -> RGBA -> IO ()
wrapped
FunPtr C_ColorChooserColorActivatedCallback
wrapped'' <- C_ColorChooserColorActivatedCallback
-> IO (FunPtr C_ColorChooserColorActivatedCallback)
mk_ColorChooserColorActivatedCallback C_ColorChooserColorActivatedCallback
wrapped'
a
-> Text
-> FunPtr C_ColorChooserColorActivatedCallback
-> SignalConnectMode
-> Maybe Text
-> IO SignalHandlerId
forall o a.
GObject o =>
o
-> Text
-> FunPtr a
-> SignalConnectMode
-> Maybe Text
-> IO SignalHandlerId
connectSignalFunPtr a
obj Text
"color-activated" FunPtr C_ColorChooserColorActivatedCallback
wrapped'' SignalConnectMode
SignalConnectAfter Maybe Text
forall a. Maybe a
Nothing
#if defined(ENABLE_OVERLOADING)
data ColorChooserColorActivatedSignalInfo
instance SignalInfo ColorChooserColorActivatedSignalInfo where
type HaskellCallbackType ColorChooserColorActivatedSignalInfo = ColorChooserColorActivatedCallback
connectSignal obj cb connectMode detail = do
let cb' = wrap_ColorChooserColorActivatedCallback cb
cb'' <- mk_ColorChooserColorActivatedCallback cb'
connectSignalFunPtr obj "color-activated" cb'' connectMode detail
dbgSignalInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Gtk.Interfaces.ColorChooser::color-activated"
, O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gtk-3.0.41/docs/GI-Gtk-Interfaces-ColorChooser.html#g:signal:colorActivated"})
#endif
#if defined(ENABLE_OVERLOADING)
type instance O.SignalList ColorChooser = ColorChooserSignalList
type ColorChooserSignalList = ('[ '("colorActivated", ColorChooserColorActivatedSignalInfo), '("notify", GObject.Object.ObjectNotifySignalInfo)] :: [(Symbol, DK.Type)])
#endif