{-# LANGUAGE TypeApplications #-}
#if (MIN_VERSION_haskell_gi_overloading(1,0,0) && !defined(__HADDOCK_VERSION__))
#define ENABLE_OVERLOADING
#endif
module GI.Gtk.Structs.SymbolicColor
(
SymbolicColor(..) ,
#if defined(ENABLE_OVERLOADING)
ResolveSymbolicColorMethod ,
#endif
symbolicColorNewAlpha ,
symbolicColorNewLiteral ,
symbolicColorNewMix ,
symbolicColorNewName ,
symbolicColorNewShade ,
symbolicColorNewWin32 ,
#if defined(ENABLE_OVERLOADING)
SymbolicColorRefMethodInfo ,
#endif
symbolicColorRef ,
#if defined(ENABLE_OVERLOADING)
SymbolicColorResolveMethodInfo ,
#endif
symbolicColorResolve ,
#if defined(ENABLE_OVERLOADING)
SymbolicColorToStringMethodInfo ,
#endif
symbolicColorToString ,
#if defined(ENABLE_OVERLOADING)
SymbolicColorUnrefMethodInfo ,
#endif
symbolicColorUnref ,
) 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.Gdk.Structs.RGBA as Gdk.RGBA
import {-# SOURCE #-} qualified GI.Gtk.Objects.StyleProperties as Gtk.StyleProperties
newtype SymbolicColor = SymbolicColor (SP.ManagedPtr SymbolicColor)
deriving (SymbolicColor -> SymbolicColor -> Bool
(SymbolicColor -> SymbolicColor -> Bool)
-> (SymbolicColor -> SymbolicColor -> Bool) -> Eq SymbolicColor
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SymbolicColor -> SymbolicColor -> Bool
$c/= :: SymbolicColor -> SymbolicColor -> Bool
== :: SymbolicColor -> SymbolicColor -> Bool
$c== :: SymbolicColor -> SymbolicColor -> Bool
Eq)
instance SP.ManagedPtrNewtype SymbolicColor where
toManagedPtr :: SymbolicColor -> ManagedPtr SymbolicColor
toManagedPtr (SymbolicColor ManagedPtr SymbolicColor
p) = ManagedPtr SymbolicColor
p
foreign import ccall "gtk_symbolic_color_get_type" c_gtk_symbolic_color_get_type ::
IO GType
type instance O.ParentTypes SymbolicColor = '[]
instance O.HasParentTypes SymbolicColor
instance B.Types.TypedObject SymbolicColor where
glibType :: IO GType
glibType = IO GType
c_gtk_symbolic_color_get_type
instance B.Types.GBoxed SymbolicColor
instance B.GValue.IsGValue (Maybe SymbolicColor) where
gvalueGType_ :: IO GType
gvalueGType_ = IO GType
c_gtk_symbolic_color_get_type
gvalueSet_ :: Ptr GValue -> Maybe SymbolicColor -> IO ()
gvalueSet_ Ptr GValue
gv Maybe SymbolicColor
P.Nothing = Ptr GValue -> Ptr SymbolicColor -> IO ()
forall a. Ptr GValue -> Ptr a -> IO ()
B.GValue.set_boxed Ptr GValue
gv (Ptr SymbolicColor
forall a. Ptr a
FP.nullPtr :: FP.Ptr SymbolicColor)
gvalueSet_ Ptr GValue
gv (P.Just SymbolicColor
obj) = SymbolicColor -> (Ptr SymbolicColor -> IO ()) -> IO ()
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
B.ManagedPtr.withManagedPtr SymbolicColor
obj (Ptr GValue -> Ptr SymbolicColor -> IO ()
forall a. Ptr GValue -> Ptr a -> IO ()
B.GValue.set_boxed Ptr GValue
gv)
gvalueGet_ :: Ptr GValue -> IO (Maybe SymbolicColor)
gvalueGet_ Ptr GValue
gv = do
Ptr SymbolicColor
ptr <- Ptr GValue -> IO (Ptr SymbolicColor)
forall b. Ptr GValue -> IO (Ptr b)
B.GValue.get_boxed Ptr GValue
gv :: IO (Ptr SymbolicColor)
if Ptr SymbolicColor
ptr Ptr SymbolicColor -> Ptr SymbolicColor -> Bool
forall a. Eq a => a -> a -> Bool
/= Ptr SymbolicColor
forall a. Ptr a
FP.nullPtr
then SymbolicColor -> Maybe SymbolicColor
forall a. a -> Maybe a
P.Just (SymbolicColor -> Maybe SymbolicColor)
-> IO SymbolicColor -> IO (Maybe SymbolicColor)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (ManagedPtr SymbolicColor -> SymbolicColor)
-> Ptr SymbolicColor -> IO SymbolicColor
forall a.
(HasCallStack, GBoxed a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
B.ManagedPtr.newBoxed ManagedPtr SymbolicColor -> SymbolicColor
SymbolicColor Ptr SymbolicColor
ptr
else Maybe SymbolicColor -> IO (Maybe SymbolicColor)
forall (m :: * -> *) a. Monad m => a -> m a
return Maybe SymbolicColor
forall a. Maybe a
P.Nothing
#if defined(ENABLE_OVERLOADING)
instance O.HasAttributeList SymbolicColor
type instance O.AttributeList SymbolicColor = SymbolicColorAttributeList
type SymbolicColorAttributeList = ('[ ] :: [(Symbol, *)])
#endif
foreign import ccall "gtk_symbolic_color_new_alpha" gtk_symbolic_color_new_alpha ::
Ptr SymbolicColor ->
CDouble ->
IO (Ptr SymbolicColor)
{-# DEPRECATED symbolicColorNewAlpha ["(Since version 3.8)","t'GI.Gtk.Structs.SymbolicColor.SymbolicColor' is deprecated."] #-}
symbolicColorNewAlpha ::
(B.CallStack.HasCallStack, MonadIO m) =>
SymbolicColor
-> Double
-> m SymbolicColor
symbolicColorNewAlpha :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
SymbolicColor -> Double -> m SymbolicColor
symbolicColorNewAlpha SymbolicColor
color Double
factor = IO SymbolicColor -> m SymbolicColor
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO SymbolicColor -> m SymbolicColor)
-> IO SymbolicColor -> m SymbolicColor
forall a b. (a -> b) -> a -> b
$ do
Ptr SymbolicColor
color' <- SymbolicColor -> IO (Ptr SymbolicColor)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr SymbolicColor
color
let factor' :: CDouble
factor' = Double -> CDouble
forall a b. (Real a, Fractional b) => a -> b
realToFrac Double
factor
Ptr SymbolicColor
result <- Ptr SymbolicColor -> CDouble -> IO (Ptr SymbolicColor)
gtk_symbolic_color_new_alpha Ptr SymbolicColor
color' CDouble
factor'
Text -> Ptr SymbolicColor -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"symbolicColorNewAlpha" Ptr SymbolicColor
result
SymbolicColor
result' <- ((ManagedPtr SymbolicColor -> SymbolicColor)
-> Ptr SymbolicColor -> IO SymbolicColor
forall a.
(HasCallStack, GBoxed a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapBoxed ManagedPtr SymbolicColor -> SymbolicColor
SymbolicColor) Ptr SymbolicColor
result
SymbolicColor -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr SymbolicColor
color
SymbolicColor -> IO SymbolicColor
forall (m :: * -> *) a. Monad m => a -> m a
return SymbolicColor
result'
#if defined(ENABLE_OVERLOADING)
#endif
foreign import ccall "gtk_symbolic_color_new_literal" gtk_symbolic_color_new_literal ::
Ptr Gdk.RGBA.RGBA ->
IO (Ptr SymbolicColor)
{-# DEPRECATED symbolicColorNewLiteral ["(Since version 3.8)","t'GI.Gtk.Structs.SymbolicColor.SymbolicColor' is deprecated."] #-}
symbolicColorNewLiteral ::
(B.CallStack.HasCallStack, MonadIO m) =>
Gdk.RGBA.RGBA
-> m SymbolicColor
symbolicColorNewLiteral :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
RGBA -> m SymbolicColor
symbolicColorNewLiteral RGBA
color = IO SymbolicColor -> m SymbolicColor
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO SymbolicColor -> m SymbolicColor)
-> IO SymbolicColor -> m SymbolicColor
forall a b. (a -> b) -> a -> b
$ do
Ptr RGBA
color' <- RGBA -> IO (Ptr RGBA)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr RGBA
color
Ptr SymbolicColor
result <- Ptr RGBA -> IO (Ptr SymbolicColor)
gtk_symbolic_color_new_literal Ptr RGBA
color'
Text -> Ptr SymbolicColor -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"symbolicColorNewLiteral" Ptr SymbolicColor
result
SymbolicColor
result' <- ((ManagedPtr SymbolicColor -> SymbolicColor)
-> Ptr SymbolicColor -> IO SymbolicColor
forall a.
(HasCallStack, GBoxed a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapBoxed ManagedPtr SymbolicColor -> SymbolicColor
SymbolicColor) Ptr SymbolicColor
result
RGBA -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr RGBA
color
SymbolicColor -> IO SymbolicColor
forall (m :: * -> *) a. Monad m => a -> m a
return SymbolicColor
result'
#if defined(ENABLE_OVERLOADING)
#endif
foreign import ccall "gtk_symbolic_color_new_mix" gtk_symbolic_color_new_mix ::
Ptr SymbolicColor ->
Ptr SymbolicColor ->
CDouble ->
IO (Ptr SymbolicColor)
{-# DEPRECATED symbolicColorNewMix ["(Since version 3.8)","t'GI.Gtk.Structs.SymbolicColor.SymbolicColor' is deprecated."] #-}
symbolicColorNewMix ::
(B.CallStack.HasCallStack, MonadIO m) =>
SymbolicColor
-> SymbolicColor
-> Double
-> m SymbolicColor
symbolicColorNewMix :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
SymbolicColor -> SymbolicColor -> Double -> m SymbolicColor
symbolicColorNewMix SymbolicColor
color1 SymbolicColor
color2 Double
factor = IO SymbolicColor -> m SymbolicColor
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO SymbolicColor -> m SymbolicColor)
-> IO SymbolicColor -> m SymbolicColor
forall a b. (a -> b) -> a -> b
$ do
Ptr SymbolicColor
color1' <- SymbolicColor -> IO (Ptr SymbolicColor)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr SymbolicColor
color1
Ptr SymbolicColor
color2' <- SymbolicColor -> IO (Ptr SymbolicColor)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr SymbolicColor
color2
let factor' :: CDouble
factor' = Double -> CDouble
forall a b. (Real a, Fractional b) => a -> b
realToFrac Double
factor
Ptr SymbolicColor
result <- Ptr SymbolicColor
-> Ptr SymbolicColor -> CDouble -> IO (Ptr SymbolicColor)
gtk_symbolic_color_new_mix Ptr SymbolicColor
color1' Ptr SymbolicColor
color2' CDouble
factor'
Text -> Ptr SymbolicColor -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"symbolicColorNewMix" Ptr SymbolicColor
result
SymbolicColor
result' <- ((ManagedPtr SymbolicColor -> SymbolicColor)
-> Ptr SymbolicColor -> IO SymbolicColor
forall a.
(HasCallStack, GBoxed a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapBoxed ManagedPtr SymbolicColor -> SymbolicColor
SymbolicColor) Ptr SymbolicColor
result
SymbolicColor -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr SymbolicColor
color1
SymbolicColor -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr SymbolicColor
color2
SymbolicColor -> IO SymbolicColor
forall (m :: * -> *) a. Monad m => a -> m a
return SymbolicColor
result'
#if defined(ENABLE_OVERLOADING)
#endif
foreign import ccall "gtk_symbolic_color_new_name" gtk_symbolic_color_new_name ::
CString ->
IO (Ptr SymbolicColor)
{-# DEPRECATED symbolicColorNewName ["(Since version 3.8)","t'GI.Gtk.Structs.SymbolicColor.SymbolicColor' is deprecated."] #-}
symbolicColorNewName ::
(B.CallStack.HasCallStack, MonadIO m) =>
T.Text
-> m SymbolicColor
symbolicColorNewName :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
Text -> m SymbolicColor
symbolicColorNewName Text
name = IO SymbolicColor -> m SymbolicColor
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO SymbolicColor -> m SymbolicColor)
-> IO SymbolicColor -> m SymbolicColor
forall a b. (a -> b) -> a -> b
$ do
CString
name' <- Text -> IO CString
textToCString Text
name
Ptr SymbolicColor
result <- CString -> IO (Ptr SymbolicColor)
gtk_symbolic_color_new_name CString
name'
Text -> Ptr SymbolicColor -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"symbolicColorNewName" Ptr SymbolicColor
result
SymbolicColor
result' <- ((ManagedPtr SymbolicColor -> SymbolicColor)
-> Ptr SymbolicColor -> IO SymbolicColor
forall a.
(HasCallStack, GBoxed a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapBoxed ManagedPtr SymbolicColor -> SymbolicColor
SymbolicColor) Ptr SymbolicColor
result
CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
name'
SymbolicColor -> IO SymbolicColor
forall (m :: * -> *) a. Monad m => a -> m a
return SymbolicColor
result'
#if defined(ENABLE_OVERLOADING)
#endif
foreign import ccall "gtk_symbolic_color_new_shade" gtk_symbolic_color_new_shade ::
Ptr SymbolicColor ->
CDouble ->
IO (Ptr SymbolicColor)
{-# DEPRECATED symbolicColorNewShade ["(Since version 3.8)","t'GI.Gtk.Structs.SymbolicColor.SymbolicColor' is deprecated."] #-}
symbolicColorNewShade ::
(B.CallStack.HasCallStack, MonadIO m) =>
SymbolicColor
-> Double
-> m SymbolicColor
symbolicColorNewShade :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
SymbolicColor -> Double -> m SymbolicColor
symbolicColorNewShade SymbolicColor
color Double
factor = IO SymbolicColor -> m SymbolicColor
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO SymbolicColor -> m SymbolicColor)
-> IO SymbolicColor -> m SymbolicColor
forall a b. (a -> b) -> a -> b
$ do
Ptr SymbolicColor
color' <- SymbolicColor -> IO (Ptr SymbolicColor)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr SymbolicColor
color
let factor' :: CDouble
factor' = Double -> CDouble
forall a b. (Real a, Fractional b) => a -> b
realToFrac Double
factor
Ptr SymbolicColor
result <- Ptr SymbolicColor -> CDouble -> IO (Ptr SymbolicColor)
gtk_symbolic_color_new_shade Ptr SymbolicColor
color' CDouble
factor'
Text -> Ptr SymbolicColor -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"symbolicColorNewShade" Ptr SymbolicColor
result
SymbolicColor
result' <- ((ManagedPtr SymbolicColor -> SymbolicColor)
-> Ptr SymbolicColor -> IO SymbolicColor
forall a.
(HasCallStack, GBoxed a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapBoxed ManagedPtr SymbolicColor -> SymbolicColor
SymbolicColor) Ptr SymbolicColor
result
SymbolicColor -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr SymbolicColor
color
SymbolicColor -> IO SymbolicColor
forall (m :: * -> *) a. Monad m => a -> m a
return SymbolicColor
result'
#if defined(ENABLE_OVERLOADING)
#endif
foreign import ccall "gtk_symbolic_color_new_win32" gtk_symbolic_color_new_win32 ::
CString ->
Int32 ->
IO (Ptr SymbolicColor)
{-# DEPRECATED symbolicColorNewWin32 ["(Since version 3.8)","t'GI.Gtk.Structs.SymbolicColor.SymbolicColor' is deprecated."] #-}
symbolicColorNewWin32 ::
(B.CallStack.HasCallStack, MonadIO m) =>
T.Text
-> Int32
-> m SymbolicColor
symbolicColorNewWin32 :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
Text -> Int32 -> m SymbolicColor
symbolicColorNewWin32 Text
themeClass Int32
id = IO SymbolicColor -> m SymbolicColor
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO SymbolicColor -> m SymbolicColor)
-> IO SymbolicColor -> m SymbolicColor
forall a b. (a -> b) -> a -> b
$ do
CString
themeClass' <- Text -> IO CString
textToCString Text
themeClass
Ptr SymbolicColor
result <- CString -> Int32 -> IO (Ptr SymbolicColor)
gtk_symbolic_color_new_win32 CString
themeClass' Int32
id
Text -> Ptr SymbolicColor -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"symbolicColorNewWin32" Ptr SymbolicColor
result
SymbolicColor
result' <- ((ManagedPtr SymbolicColor -> SymbolicColor)
-> Ptr SymbolicColor -> IO SymbolicColor
forall a.
(HasCallStack, GBoxed a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapBoxed ManagedPtr SymbolicColor -> SymbolicColor
SymbolicColor) Ptr SymbolicColor
result
CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
themeClass'
SymbolicColor -> IO SymbolicColor
forall (m :: * -> *) a. Monad m => a -> m a
return SymbolicColor
result'
#if defined(ENABLE_OVERLOADING)
#endif
foreign import ccall "gtk_symbolic_color_ref" gtk_symbolic_color_ref ::
Ptr SymbolicColor ->
IO (Ptr SymbolicColor)
{-# DEPRECATED symbolicColorRef ["(Since version 3.8)","t'GI.Gtk.Structs.SymbolicColor.SymbolicColor' is deprecated."] #-}
symbolicColorRef ::
(B.CallStack.HasCallStack, MonadIO m) =>
SymbolicColor
-> m SymbolicColor
symbolicColorRef :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
SymbolicColor -> m SymbolicColor
symbolicColorRef SymbolicColor
color = IO SymbolicColor -> m SymbolicColor
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO SymbolicColor -> m SymbolicColor)
-> IO SymbolicColor -> m SymbolicColor
forall a b. (a -> b) -> a -> b
$ do
Ptr SymbolicColor
color' <- SymbolicColor -> IO (Ptr SymbolicColor)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr SymbolicColor
color
Ptr SymbolicColor
result <- Ptr SymbolicColor -> IO (Ptr SymbolicColor)
gtk_symbolic_color_ref Ptr SymbolicColor
color'
Text -> Ptr SymbolicColor -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"symbolicColorRef" Ptr SymbolicColor
result
SymbolicColor
result' <- ((ManagedPtr SymbolicColor -> SymbolicColor)
-> Ptr SymbolicColor -> IO SymbolicColor
forall a.
(HasCallStack, GBoxed a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapBoxed ManagedPtr SymbolicColor -> SymbolicColor
SymbolicColor) Ptr SymbolicColor
result
SymbolicColor -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr SymbolicColor
color
SymbolicColor -> IO SymbolicColor
forall (m :: * -> *) a. Monad m => a -> m a
return SymbolicColor
result'
#if defined(ENABLE_OVERLOADING)
data SymbolicColorRefMethodInfo
instance (signature ~ (m SymbolicColor), MonadIO m) => O.OverloadedMethod SymbolicColorRefMethodInfo SymbolicColor signature where
overloadedMethod = symbolicColorRef
instance O.OverloadedMethodInfo SymbolicColorRefMethodInfo SymbolicColor where
overloadedMethodInfo = O.MethodInfo {
O.overloadedMethodName = "GI.Gtk.Structs.SymbolicColor.symbolicColorRef",
O.overloadedMethodURL = "https://hackage.haskell.org/package/gi-gtk-3.0.37/docs/GI-Gtk-Structs-SymbolicColor.html#v:symbolicColorRef"
}
#endif
foreign import ccall "gtk_symbolic_color_resolve" gtk_symbolic_color_resolve ::
Ptr SymbolicColor ->
Ptr Gtk.StyleProperties.StyleProperties ->
Ptr Gdk.RGBA.RGBA ->
IO CInt
{-# DEPRECATED symbolicColorResolve ["(Since version 3.8)","t'GI.Gtk.Structs.SymbolicColor.SymbolicColor' is deprecated."] #-}
symbolicColorResolve ::
(B.CallStack.HasCallStack, MonadIO m, Gtk.StyleProperties.IsStyleProperties a) =>
SymbolicColor
-> Maybe (a)
-> m ((Bool, Gdk.RGBA.RGBA))
symbolicColorResolve :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsStyleProperties a) =>
SymbolicColor -> Maybe a -> m (Bool, RGBA)
symbolicColorResolve SymbolicColor
color Maybe a
props = IO (Bool, RGBA) -> m (Bool, RGBA)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (Bool, RGBA) -> m (Bool, RGBA))
-> IO (Bool, RGBA) -> m (Bool, RGBA)
forall a b. (a -> b) -> a -> b
$ do
Ptr SymbolicColor
color' <- SymbolicColor -> IO (Ptr SymbolicColor)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr SymbolicColor
color
Ptr StyleProperties
maybeProps <- case Maybe a
props of
Maybe a
Nothing -> Ptr StyleProperties -> IO (Ptr StyleProperties)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr StyleProperties
forall a. Ptr a
nullPtr
Just a
jProps -> do
Ptr StyleProperties
jProps' <- a -> IO (Ptr StyleProperties)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
jProps
Ptr StyleProperties -> IO (Ptr StyleProperties)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr StyleProperties
jProps'
Ptr RGBA
resolvedColor <- Int -> IO (Ptr RGBA)
forall a. GBoxed a => Int -> IO (Ptr a)
SP.callocBoxedBytes Int
32 :: IO (Ptr Gdk.RGBA.RGBA)
CInt
result <- Ptr SymbolicColor -> Ptr StyleProperties -> Ptr RGBA -> IO CInt
gtk_symbolic_color_resolve Ptr SymbolicColor
color' Ptr StyleProperties
maybeProps Ptr RGBA
resolvedColor
let result' :: Bool
result' = (CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
/= CInt
0) CInt
result
RGBA
resolvedColor' <- ((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
resolvedColor
SymbolicColor -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr SymbolicColor
color
Maybe a -> (a -> IO ()) -> IO ()
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe a
props a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
(Bool, RGBA) -> IO (Bool, RGBA)
forall (m :: * -> *) a. Monad m => a -> m a
return (Bool
result', RGBA
resolvedColor')
#if defined(ENABLE_OVERLOADING)
data SymbolicColorResolveMethodInfo
instance (signature ~ (Maybe (a) -> m ((Bool, Gdk.RGBA.RGBA))), MonadIO m, Gtk.StyleProperties.IsStyleProperties a) => O.OverloadedMethod SymbolicColorResolveMethodInfo SymbolicColor signature where
overloadedMethod = symbolicColorResolve
instance O.OverloadedMethodInfo SymbolicColorResolveMethodInfo SymbolicColor where
overloadedMethodInfo = O.MethodInfo {
O.overloadedMethodName = "GI.Gtk.Structs.SymbolicColor.symbolicColorResolve",
O.overloadedMethodURL = "https://hackage.haskell.org/package/gi-gtk-3.0.37/docs/GI-Gtk-Structs-SymbolicColor.html#v:symbolicColorResolve"
}
#endif
foreign import ccall "gtk_symbolic_color_to_string" gtk_symbolic_color_to_string ::
Ptr SymbolicColor ->
IO CString
{-# DEPRECATED symbolicColorToString ["(Since version 3.8)","t'GI.Gtk.Structs.SymbolicColor.SymbolicColor' is deprecated."] #-}
symbolicColorToString ::
(B.CallStack.HasCallStack, MonadIO m) =>
SymbolicColor
-> m T.Text
symbolicColorToString :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
SymbolicColor -> m Text
symbolicColorToString SymbolicColor
color = IO Text -> m Text
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Text -> m Text) -> IO Text -> m Text
forall a b. (a -> b) -> a -> b
$ do
Ptr SymbolicColor
color' <- SymbolicColor -> IO (Ptr SymbolicColor)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr SymbolicColor
color
CString
result <- Ptr SymbolicColor -> IO CString
gtk_symbolic_color_to_string Ptr SymbolicColor
color'
Text -> CString -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"symbolicColorToString" CString
result
Text
result' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
result
CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
result
SymbolicColor -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr SymbolicColor
color
Text -> IO Text
forall (m :: * -> *) a. Monad m => a -> m a
return Text
result'
#if defined(ENABLE_OVERLOADING)
data SymbolicColorToStringMethodInfo
instance (signature ~ (m T.Text), MonadIO m) => O.OverloadedMethod SymbolicColorToStringMethodInfo SymbolicColor signature where
overloadedMethod = symbolicColorToString
instance O.OverloadedMethodInfo SymbolicColorToStringMethodInfo SymbolicColor where
overloadedMethodInfo = O.MethodInfo {
O.overloadedMethodName = "GI.Gtk.Structs.SymbolicColor.symbolicColorToString",
O.overloadedMethodURL = "https://hackage.haskell.org/package/gi-gtk-3.0.37/docs/GI-Gtk-Structs-SymbolicColor.html#v:symbolicColorToString"
}
#endif
foreign import ccall "gtk_symbolic_color_unref" gtk_symbolic_color_unref ::
Ptr SymbolicColor ->
IO ()
{-# DEPRECATED symbolicColorUnref ["(Since version 3.8)","t'GI.Gtk.Structs.SymbolicColor.SymbolicColor' is deprecated."] #-}
symbolicColorUnref ::
(B.CallStack.HasCallStack, MonadIO m) =>
SymbolicColor
-> m ()
symbolicColorUnref :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
SymbolicColor -> m ()
symbolicColorUnref SymbolicColor
color = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
Ptr SymbolicColor
color' <- SymbolicColor -> IO (Ptr SymbolicColor)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr SymbolicColor
color
Ptr SymbolicColor -> IO ()
gtk_symbolic_color_unref Ptr SymbolicColor
color'
SymbolicColor -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr SymbolicColor
color
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
#if defined(ENABLE_OVERLOADING)
data SymbolicColorUnrefMethodInfo
instance (signature ~ (m ()), MonadIO m) => O.OverloadedMethod SymbolicColorUnrefMethodInfo SymbolicColor signature where
overloadedMethod = symbolicColorUnref
instance O.OverloadedMethodInfo SymbolicColorUnrefMethodInfo SymbolicColor where
overloadedMethodInfo = O.MethodInfo {
O.overloadedMethodName = "GI.Gtk.Structs.SymbolicColor.symbolicColorUnref",
O.overloadedMethodURL = "https://hackage.haskell.org/package/gi-gtk-3.0.37/docs/GI-Gtk-Structs-SymbolicColor.html#v:symbolicColorUnref"
}
#endif
#if defined(ENABLE_OVERLOADING)
type family ResolveSymbolicColorMethod (t :: Symbol) (o :: *) :: * where
ResolveSymbolicColorMethod "ref" o = SymbolicColorRefMethodInfo
ResolveSymbolicColorMethod "resolve" o = SymbolicColorResolveMethodInfo
ResolveSymbolicColorMethod "toString" o = SymbolicColorToStringMethodInfo
ResolveSymbolicColorMethod "unref" o = SymbolicColorUnrefMethodInfo
ResolveSymbolicColorMethod l o = O.MethodResolutionFailed l o
instance (info ~ ResolveSymbolicColorMethod t SymbolicColor, O.OverloadedMethod info SymbolicColor p) => OL.IsLabel t (SymbolicColor -> 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 ~ ResolveSymbolicColorMethod t SymbolicColor, O.OverloadedMethod info SymbolicColor p, R.HasField t SymbolicColor p) => R.HasField t SymbolicColor p where
getField = O.overloadedMethod @info
#endif
instance (info ~ ResolveSymbolicColorMethod t SymbolicColor, O.OverloadedMethodInfo info SymbolicColor) => OL.IsLabel t (O.MethodProxy info SymbolicColor) where
#if MIN_VERSION_base(4,10,0)
fromLabel = O.MethodProxy
#else
fromLabel _ = O.MethodProxy
#endif
#endif