{-# LINE 1 "Data/GI/Base/GParamSpec.hsc" #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TypeApplications #-}
module Data.GI.Base.GParamSpec
(
wrapGParamSpecPtr
, newGParamSpecFromPtr
, unrefGParamSpec
, disownGParamSpec
, PropertyInfo(..)
, gParamSpecValue
, CStringPropertyInfo(..)
, gParamSpecCString
, CIntPropertyInfo(..)
, gParamSpecCInt
, GParamFlag(..)
, PropGetSetter(..)
, getGParamSpecGetterSetter
) where
import Foreign.C (CInt(..), CString)
import Foreign.Ptr (Ptr, FunPtr, castPtr, nullPtr)
import Foreign.StablePtr (newStablePtr, deRefStablePtr,
castStablePtrToPtr, castPtrToStablePtr)
import Control.Monad (void)
import Data.Coerce (coerce)
import Data.Maybe (fromMaybe)
import Data.Text (Text)
import Data.GI.Base.ManagedPtr (newManagedPtr', withManagedPtr,
disownManagedPtr,
newObject, withTransient)
import Data.GI.Base.BasicConversions (gflagsToWord, withTextCString)
import Data.GI.Base.BasicTypes (GObject, GParamSpec(..),
GType(..), IsGFlag, ManagedPtr)
import Data.GI.Base.GQuark (GQuark(..), gQuarkFromString)
import Data.GI.Base.GType (gtypeStablePtr)
import qualified Data.GI.Base.GValue as GV
import Data.GI.Base.GValue (GValue(..), IsGValue(..), take_stablePtr)
foreign import ccall "g_param_spec_ref_sink" g_param_spec_ref_sink ::
Ptr GParamSpec -> IO (Ptr GParamSpec)
foreign import ccall "g_param_spec_ref" g_param_spec_ref ::
Ptr GParamSpec -> IO (Ptr GParamSpec)
foreign import ccall "g_param_spec_unref" g_param_spec_unref ::
Ptr GParamSpec -> IO ()
foreign import ccall "&g_param_spec_unref" ptr_to_g_param_spec_unref ::
FunPtr (Ptr GParamSpec -> IO ())
wrapGParamSpecPtr :: Ptr GParamSpec -> IO GParamSpec
wrapGParamSpecPtr :: Ptr GParamSpec -> IO GParamSpec
wrapGParamSpecPtr Ptr GParamSpec
ptr = do
forall (f :: * -> *) a. Functor f => f a -> f ()
void forall a b. (a -> b) -> a -> b
$ Ptr GParamSpec -> IO (Ptr GParamSpec)
g_param_spec_ref_sink Ptr GParamSpec
ptr
ManagedPtr GParamSpec
fPtr <- forall a.
HasCallStack =>
FinalizerPtr a -> Ptr a -> IO (ManagedPtr a)
newManagedPtr' FunPtr (Ptr GParamSpec -> IO ())
ptr_to_g_param_spec_unref Ptr GParamSpec
ptr
forall (m :: * -> *) a. Monad m => a -> m a
return forall a b. (a -> b) -> a -> b
$! ManagedPtr GParamSpec -> GParamSpec
GParamSpec ManagedPtr GParamSpec
fPtr
newGParamSpecFromPtr :: Ptr GParamSpec -> IO GParamSpec
newGParamSpecFromPtr :: Ptr GParamSpec -> IO GParamSpec
newGParamSpecFromPtr Ptr GParamSpec
ptr = do
ManagedPtr GParamSpec
fPtr <- Ptr GParamSpec -> IO (Ptr GParamSpec)
g_param_spec_ref Ptr GParamSpec
ptr forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= forall a.
HasCallStack =>
FinalizerPtr a -> Ptr a -> IO (ManagedPtr a)
newManagedPtr' FunPtr (Ptr GParamSpec -> IO ())
ptr_to_g_param_spec_unref
forall (m :: * -> *) a. Monad m => a -> m a
return forall a b. (a -> b) -> a -> b
$! ManagedPtr GParamSpec -> GParamSpec
GParamSpec ManagedPtr GParamSpec
fPtr
unrefGParamSpec :: GParamSpec -> IO ()
unrefGParamSpec :: GParamSpec -> IO ()
unrefGParamSpec GParamSpec
ps = forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
withManagedPtr GParamSpec
ps Ptr GParamSpec -> IO ()
g_param_spec_unref
disownGParamSpec :: GParamSpec -> IO (Ptr GParamSpec)
disownGParamSpec :: GParamSpec -> IO (Ptr GParamSpec)
disownGParamSpec = forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
disownManagedPtr
data GParamFlag = GParamReadable
| GParamWritable
| GParamConstruct
| GParamConstructOnly
| GParamExplicitNotify
| AnotherGParamFlag Int
deriving (Int -> GParamFlag -> ShowS
[GParamFlag] -> ShowS
GParamFlag -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GParamFlag] -> ShowS
$cshowList :: [GParamFlag] -> ShowS
show :: GParamFlag -> String
$cshow :: GParamFlag -> String
showsPrec :: Int -> GParamFlag -> ShowS
$cshowsPrec :: Int -> GParamFlag -> ShowS
Show, GParamFlag -> GParamFlag -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GParamFlag -> GParamFlag -> Bool
$c/= :: GParamFlag -> GParamFlag -> Bool
== :: GParamFlag -> GParamFlag -> Bool
$c== :: GParamFlag -> GParamFlag -> Bool
Eq)
instance Enum GParamFlag where
fromEnum :: GParamFlag -> Int
fromEnum GParamFlag
GParamReadable = Int
1
{-# LINE 106 "Data/GI/Base/GParamSpec.hsc" #-}
fromEnum GParamWritable = 2
{-# LINE 107 "Data/GI/Base/GParamSpec.hsc" #-}
fromEnum GParamConstruct = 4
{-# LINE 108 "Data/GI/Base/GParamSpec.hsc" #-}
fromEnum GParamConstructOnly = 8
{-# LINE 109 "Data/GI/Base/GParamSpec.hsc" #-}
fromEnum GParamExplicitNotify = 1073741824
{-# LINE 110 "Data/GI/Base/GParamSpec.hsc" #-}
fromEnum (AnotherGParamFlag k) = k
toEnum :: Int -> GParamFlag
toEnum (Int
1) = GParamFlag
GParamReadable
{-# LINE 113 "Data/GI/Base/GParamSpec.hsc" #-}
toEnum (2) = GParamWritable
{-# LINE 114 "Data/GI/Base/GParamSpec.hsc" #-}
toEnum (4) = GParamConstruct
{-# LINE 115 "Data/GI/Base/GParamSpec.hsc" #-}
toEnum (8) = GParamConstructOnly
{-# LINE 116 "Data/GI/Base/GParamSpec.hsc" #-}
toEnum (1073741824) = GParamExplicitNotify
{-# LINE 117 "Data/GI/Base/GParamSpec.hsc" #-}
toEnum k = AnotherGParamFlag k
instance Ord GParamFlag where
compare :: GParamFlag -> GParamFlag -> Ordering
compare GParamFlag
a GParamFlag
b = forall a. Ord a => a -> a -> Ordering
compare (forall a. Enum a => a -> Int
fromEnum GParamFlag
a) (forall a. Enum a => a -> Int
fromEnum GParamFlag
b)
instance IsGFlag GParamFlag
defaultFlags :: Num a => a
defaultFlags :: forall a. Num a => a
defaultFlags = forall b a. (Num b, IsGFlag a) => [a] -> b
gflagsToWord [GParamFlag
GParamReadable, GParamFlag
GParamWritable,
GParamFlag
GParamExplicitNotify]
data PropGetSetter o = PropGetSetter
{ forall o. PropGetSetter o -> Ptr o -> Ptr GValue -> IO ()
propGetter :: Ptr o -> Ptr GValue -> IO ()
, forall o. PropGetSetter o -> Ptr o -> Ptr GValue -> IO ()
propSetter :: Ptr o -> Ptr GValue -> IO ()
}
pspecQuark :: IO (GQuark (PropGetSetter o))
pspecQuark :: forall o. IO (GQuark (PropGetSetter o))
pspecQuark = forall a. Text -> IO (GQuark a)
gQuarkFromString Text
"haskell-gi-get-set"
newtype GObjectConstructor = GObjectConstructor (ManagedPtr GObjectConstructor)
objectFromPtr :: forall a o. GObject o => Ptr a -> IO o
objectFromPtr :: forall a o. GObject o => Ptr a -> IO o
objectFromPtr Ptr a
objPtr = forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
newObject @o @o (coerce :: forall a b. Coercible a b => a -> b
coerce @_ @(ManagedPtr o -> o) ManagedPtr GObjectConstructor -> GObjectConstructor
GObjectConstructor) (forall a b. Ptr a -> Ptr b
castPtr Ptr a
objPtr)
wrapGetSet :: forall o a. (GObject o, IsGValue a) =>
(o -> IO a)
-> (o -> a -> IO ())
-> (Ptr GValue -> a -> IO ())
-> PropGetSetter o
wrapGetSet :: forall o a.
(GObject o, IsGValue a) =>
(o -> IO a)
-> (o -> a -> IO ())
-> (Ptr GValue -> a -> IO ())
-> PropGetSetter o
wrapGetSet o -> IO a
getter o -> a -> IO ()
setter Ptr GValue -> a -> IO ()
gvalueSetter = PropGetSetter {
$sel:propGetter:PropGetSetter :: Ptr o -> Ptr GValue -> IO ()
propGetter = \Ptr o
objPtr Ptr GValue
destPtr -> do
a
value <- forall a o. GObject o => Ptr a -> IO o
objectFromPtr Ptr o
objPtr forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= o -> IO a
getter
Ptr GValue -> a -> IO ()
gvalueSetter Ptr GValue
destPtr a
value
, $sel:propSetter:PropGetSetter :: Ptr o -> Ptr GValue -> IO ()
propSetter = \Ptr o
objPtr Ptr GValue
newGValuePtr ->
forall a b.
(HasCallStack, ManagedPtrNewtype a) =>
Ptr a -> (a -> IO b) -> IO b
withTransient Ptr GValue
newGValuePtr forall a b. (a -> b) -> a -> b
$ \GValue
newGValue -> do
o
obj <- forall a o. GObject o => Ptr a -> IO o
objectFromPtr Ptr o
objPtr
a
value <- forall a (m :: * -> *). (IsGValue a, MonadIO m) => GValue -> m a
GV.fromGValue GValue
newGValue
o -> a -> IO ()
setter o
obj a
value
}
data PropertyInfo o a = PropertyInfo
{ forall o a. PropertyInfo o a -> Text
name :: Text
, forall o a. PropertyInfo o a -> Text
nick :: Text
, forall o a. PropertyInfo o a -> Text
blurb :: Text
, forall o a. PropertyInfo o a -> o -> a -> IO ()
setter :: o -> a -> IO ()
, forall o a. PropertyInfo o a -> o -> IO a
getter :: o -> IO a
, forall o a. PropertyInfo o a -> Maybe [GParamFlag]
flags :: Maybe [GParamFlag]
}
foreign import ccall g_param_spec_boxed ::
CString -> CString -> CString -> GType -> CInt -> IO (Ptr GParamSpec)
gParamSpecValue :: forall o a. GObject o => PropertyInfo o a -> IO GParamSpec
gParamSpecValue :: forall o a. GObject o => PropertyInfo o a -> IO GParamSpec
gParamSpecValue (PropertyInfo {Maybe [GParamFlag]
Text
o -> IO a
o -> a -> IO ()
flags :: Maybe [GParamFlag]
getter :: o -> IO a
setter :: o -> a -> IO ()
blurb :: Text
nick :: Text
name :: Text
$sel:flags:PropertyInfo :: forall o a. PropertyInfo o a -> Maybe [GParamFlag]
$sel:getter:PropertyInfo :: forall o a. PropertyInfo o a -> o -> IO a
$sel:setter:PropertyInfo :: forall o a. PropertyInfo o a -> o -> a -> IO ()
$sel:blurb:PropertyInfo :: forall o a. PropertyInfo o a -> Text
$sel:nick:PropertyInfo :: forall o a. PropertyInfo o a -> Text
$sel:name:PropertyInfo :: forall o a. PropertyInfo o a -> Text
..}) =
forall a. Text -> (CString -> IO a) -> IO a
withTextCString Text
name forall a b. (a -> b) -> a -> b
$ \CString
cname ->
forall a. Text -> (CString -> IO a) -> IO a
withTextCString Text
nick forall a b. (a -> b) -> a -> b
$ \CString
cnick ->
forall a. Text -> (CString -> IO a) -> IO a
withTextCString Text
blurb forall a b. (a -> b) -> a -> b
$ \CString
cblurb -> do
Ptr GParamSpec
pspecPtr <- CString
-> CString -> CString -> GType -> CInt -> IO (Ptr GParamSpec)
g_param_spec_boxed CString
cname CString
cnick CString
cblurb
GType
gtypeStablePtr
(forall b a. b -> (a -> b) -> Maybe a -> b
maybe forall a. Num a => a
defaultFlags forall b a. (Num b, IsGFlag a) => [a] -> b
gflagsToWord Maybe [GParamFlag]
flags)
GQuark (PropGetSetter o)
quark <- forall o. IO (GQuark (PropGetSetter o))
pspecQuark @o
forall a. Ptr GParamSpec -> GQuark a -> a -> IO ()
gParamSpecSetQData Ptr GParamSpec
pspecPtr GQuark (PropGetSetter o)
quark
(PropGetSetter { $sel:propGetter:PropGetSetter :: Ptr o -> Ptr GValue -> IO ()
propGetter = Ptr o -> Ptr GValue -> IO ()
getter', $sel:propSetter:PropGetSetter :: Ptr o -> Ptr GValue -> IO ()
propSetter = Ptr o -> Ptr GValue -> IO ()
setter'})
Ptr GParamSpec -> IO GParamSpec
wrapGParamSpecPtr Ptr GParamSpec
pspecPtr
where
getter' :: Ptr o -> Ptr GValue -> IO ()
getter' :: Ptr o -> Ptr GValue -> IO ()
getter' Ptr o
objPtr Ptr GValue
destPtr = do
StablePtr a
stablePtr <- forall a o. GObject o => Ptr a -> IO o
objectFromPtr Ptr o
objPtr forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= o -> IO a
getter forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= forall a. a -> IO (StablePtr a)
newStablePtr
forall a. Ptr GValue -> StablePtr a -> IO ()
take_stablePtr Ptr GValue
destPtr StablePtr a
stablePtr
setter' :: Ptr o -> (Ptr GValue) -> IO ()
setter' :: Ptr o -> Ptr GValue -> IO ()
setter' Ptr o
objPtr Ptr GValue
gvPtr = forall a b.
(HasCallStack, ManagedPtrNewtype a) =>
Ptr a -> (a -> IO b) -> IO b
withTransient Ptr GValue
gvPtr forall a b. (a -> b) -> a -> b
$ \GValue
gv -> do
o
obj <- forall a o. GObject o => Ptr a -> IO o
objectFromPtr Ptr o
objPtr
a
val <- forall a (m :: * -> *). (IsGValue a, MonadIO m) => GValue -> m a
GV.fromGValue GValue
gv forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= forall a. StablePtr a -> IO a
deRefStablePtr
o -> a -> IO ()
setter o
obj a
val
data CIntPropertyInfo o = CIntPropertyInfo
{ forall o. CIntPropertyInfo o -> Text
name :: Text
, forall o. CIntPropertyInfo o -> Text
nick :: Text
, forall o. CIntPropertyInfo o -> Text
blurb :: Text
, forall o. CIntPropertyInfo o -> CInt
defaultValue :: CInt
, forall o. CIntPropertyInfo o -> o -> CInt -> IO ()
setter :: o -> CInt -> IO ()
, forall o. CIntPropertyInfo o -> o -> IO CInt
getter :: o -> IO CInt
, forall o. CIntPropertyInfo o -> Maybe [GParamFlag]
flags :: Maybe [GParamFlag]
, forall o. CIntPropertyInfo o -> Maybe CInt
minValue :: Maybe CInt
, forall o. CIntPropertyInfo o -> Maybe CInt
maxValue :: Maybe CInt
}
foreign import ccall g_param_spec_int ::
CString -> CString -> CString -> CInt -> CInt -> CInt -> CInt
-> IO (Ptr GParamSpec)
gParamSpecCInt :: GObject o => CIntPropertyInfo o -> IO GParamSpec
gParamSpecCInt :: forall o. GObject o => CIntPropertyInfo o -> IO GParamSpec
gParamSpecCInt (CIntPropertyInfo {Maybe [GParamFlag]
Maybe CInt
CInt
Text
o -> IO CInt
o -> CInt -> IO ()
maxValue :: Maybe CInt
minValue :: Maybe CInt
flags :: Maybe [GParamFlag]
getter :: o -> IO CInt
setter :: o -> CInt -> IO ()
defaultValue :: CInt
blurb :: Text
nick :: Text
name :: Text
$sel:maxValue:CIntPropertyInfo :: forall o. CIntPropertyInfo o -> Maybe CInt
$sel:minValue:CIntPropertyInfo :: forall o. CIntPropertyInfo o -> Maybe CInt
$sel:flags:CIntPropertyInfo :: forall o. CIntPropertyInfo o -> Maybe [GParamFlag]
$sel:getter:CIntPropertyInfo :: forall o. CIntPropertyInfo o -> o -> IO CInt
$sel:setter:CIntPropertyInfo :: forall o. CIntPropertyInfo o -> o -> CInt -> IO ()
$sel:defaultValue:CIntPropertyInfo :: forall o. CIntPropertyInfo o -> CInt
$sel:blurb:CIntPropertyInfo :: forall o. CIntPropertyInfo o -> Text
$sel:nick:CIntPropertyInfo :: forall o. CIntPropertyInfo o -> Text
$sel:name:CIntPropertyInfo :: forall o. CIntPropertyInfo o -> Text
..}) =
forall a. Text -> (CString -> IO a) -> IO a
withTextCString Text
name forall a b. (a -> b) -> a -> b
$ \CString
cname ->
forall a. Text -> (CString -> IO a) -> IO a
withTextCString Text
nick forall a b. (a -> b) -> a -> b
$ \CString
cnick ->
forall a. Text -> (CString -> IO a) -> IO a
withTextCString Text
blurb forall a b. (a -> b) -> a -> b
$ \CString
cblurb -> do
Ptr GParamSpec
pspecPtr <- CString
-> CString
-> CString
-> CInt
-> CInt
-> CInt
-> CInt
-> IO (Ptr GParamSpec)
g_param_spec_int CString
cname CString
cnick CString
cblurb
(forall a. a -> Maybe a -> a
fromMaybe forall a. Bounded a => a
minBound Maybe CInt
minValue)
(forall a. a -> Maybe a -> a
fromMaybe forall a. Bounded a => a
maxBound Maybe CInt
maxValue)
CInt
defaultValue
(forall b a. b -> (a -> b) -> Maybe a -> b
maybe forall a. Num a => a
defaultFlags forall b a. (Num b, IsGFlag a) => [a] -> b
gflagsToWord Maybe [GParamFlag]
flags)
GQuark (PropGetSetter o)
quark <- forall o. IO (GQuark (PropGetSetter o))
pspecQuark
forall a. Ptr GParamSpec -> GQuark a -> a -> IO ()
gParamSpecSetQData Ptr GParamSpec
pspecPtr GQuark (PropGetSetter o)
quark (forall o a.
(GObject o, IsGValue a) =>
(o -> IO a)
-> (o -> a -> IO ())
-> (Ptr GValue -> a -> IO ())
-> PropGetSetter o
wrapGetSet o -> IO CInt
getter o -> CInt -> IO ()
setter forall a. IsGValue a => Ptr GValue -> a -> IO ()
gvalueSet_)
Ptr GParamSpec -> IO GParamSpec
wrapGParamSpecPtr Ptr GParamSpec
pspecPtr
data CStringPropertyInfo o = CStringPropertyInfo
{ forall o. CStringPropertyInfo o -> Text
name :: Text
, forall o. CStringPropertyInfo o -> Text
nick :: Text
, forall o. CStringPropertyInfo o -> Text
blurb :: Text
, forall o. CStringPropertyInfo o -> Maybe Text
defaultValue :: Maybe Text
, forall o. CStringPropertyInfo o -> Maybe [GParamFlag]
flags :: Maybe [GParamFlag]
, forall o. CStringPropertyInfo o -> o -> Maybe Text -> IO ()
setter :: o -> Maybe Text -> IO ()
, forall o. CStringPropertyInfo o -> o -> IO (Maybe Text)
getter :: o -> IO (Maybe Text)
}
foreign import ccall g_param_spec_string ::
CString -> CString -> CString -> CString -> CInt -> IO (Ptr GParamSpec)
gParamSpecCString :: GObject o => CStringPropertyInfo o -> IO GParamSpec
gParamSpecCString :: forall o. GObject o => CStringPropertyInfo o -> IO GParamSpec
gParamSpecCString (CStringPropertyInfo {Maybe [GParamFlag]
Maybe Text
Text
o -> IO (Maybe Text)
o -> Maybe Text -> IO ()
getter :: o -> IO (Maybe Text)
setter :: o -> Maybe Text -> IO ()
flags :: Maybe [GParamFlag]
defaultValue :: Maybe Text
blurb :: Text
nick :: Text
name :: Text
$sel:getter:CStringPropertyInfo :: forall o. CStringPropertyInfo o -> o -> IO (Maybe Text)
$sel:setter:CStringPropertyInfo :: forall o. CStringPropertyInfo o -> o -> Maybe Text -> IO ()
$sel:flags:CStringPropertyInfo :: forall o. CStringPropertyInfo o -> Maybe [GParamFlag]
$sel:defaultValue:CStringPropertyInfo :: forall o. CStringPropertyInfo o -> Maybe Text
$sel:blurb:CStringPropertyInfo :: forall o. CStringPropertyInfo o -> Text
$sel:nick:CStringPropertyInfo :: forall o. CStringPropertyInfo o -> Text
$sel:name:CStringPropertyInfo :: forall o. CStringPropertyInfo o -> Text
..}) =
forall a. Text -> (CString -> IO a) -> IO a
withTextCString Text
name forall a b. (a -> b) -> a -> b
$ \CString
cname ->
forall a. Text -> (CString -> IO a) -> IO a
withTextCString Text
nick forall a b. (a -> b) -> a -> b
$ \CString
cnick ->
forall a. Text -> (CString -> IO a) -> IO a
withTextCString Text
blurb forall a b. (a -> b) -> a -> b
$ \CString
cblurb -> do
Ptr GParamSpec
pspecPtr <- case Maybe Text
defaultValue of
Maybe Text
Nothing -> CString
-> CString -> CString -> CString -> CInt -> IO (Ptr GParamSpec)
g_param_spec_string CString
cname CString
cnick CString
cblurb forall a. Ptr a
nullPtr
(forall b a. b -> (a -> b) -> Maybe a -> b
maybe forall a. Num a => a
defaultFlags forall b a. (Num b, IsGFlag a) => [a] -> b
gflagsToWord Maybe [GParamFlag]
flags)
Just Text
value ->
forall a. Text -> (CString -> IO a) -> IO a
withTextCString Text
value forall a b. (a -> b) -> a -> b
$ \CString
cdefault ->
CString
-> CString -> CString -> CString -> CInt -> IO (Ptr GParamSpec)
g_param_spec_string CString
cname CString
cnick CString
cblurb CString
cdefault
(forall b a. b -> (a -> b) -> Maybe a -> b
maybe forall a. Num a => a
defaultFlags forall b a. (Num b, IsGFlag a) => [a] -> b
gflagsToWord Maybe [GParamFlag]
flags)
GQuark (PropGetSetter o)
quark <- forall o. IO (GQuark (PropGetSetter o))
pspecQuark
forall a. Ptr GParamSpec -> GQuark a -> a -> IO ()
gParamSpecSetQData Ptr GParamSpec
pspecPtr GQuark (PropGetSetter o)
quark (forall o a.
(GObject o, IsGValue a) =>
(o -> IO a)
-> (o -> a -> IO ())
-> (Ptr GValue -> a -> IO ())
-> PropGetSetter o
wrapGetSet o -> IO (Maybe Text)
getter o -> Maybe Text -> IO ()
setter forall a. IsGValue a => Ptr GValue -> a -> IO ()
gvalueSet_)
Ptr GParamSpec -> IO GParamSpec
wrapGParamSpecPtr Ptr GParamSpec
pspecPtr
foreign import ccall g_param_spec_set_qdata_full ::
Ptr GParamSpec -> GQuark a -> Ptr b -> FunPtr (Ptr c -> IO ()) -> IO ()
foreign import ccall "&hs_free_stable_ptr" ptr_to_hs_free_stable_ptr ::
FunPtr (Ptr a -> IO ())
gParamSpecSetQData :: Ptr GParamSpec -> GQuark a -> a -> IO ()
gParamSpecSetQData :: forall a. Ptr GParamSpec -> GQuark a -> a -> IO ()
gParamSpecSetQData Ptr GParamSpec
pspecPtr GQuark a
quark a
d = do
StablePtr a
ptr <- forall a. a -> IO (StablePtr a)
newStablePtr a
d
forall a b c.
Ptr GParamSpec
-> GQuark a -> Ptr b -> FunPtr (Ptr c -> IO ()) -> IO ()
g_param_spec_set_qdata_full Ptr GParamSpec
pspecPtr GQuark a
quark
(forall a. StablePtr a -> Ptr ()
castStablePtrToPtr StablePtr a
ptr)
forall a. FunPtr (Ptr a -> IO ())
ptr_to_hs_free_stable_ptr
foreign import ccall g_param_spec_get_qdata ::
Ptr GParamSpec -> GQuark a -> IO (Ptr b)
gParamSpecGetQData :: Ptr GParamSpec -> GQuark a -> IO (Maybe a)
gParamSpecGetQData :: forall a. Ptr GParamSpec -> GQuark a -> IO (Maybe a)
gParamSpecGetQData Ptr GParamSpec
pspecPtr GQuark a
quark = do
Ptr ()
ptr <- forall a b. Ptr GParamSpec -> GQuark a -> IO (Ptr b)
g_param_spec_get_qdata Ptr GParamSpec
pspecPtr GQuark a
quark
if Ptr ()
ptr forall a. Eq a => a -> a -> Bool
/= forall a. Ptr a
nullPtr
then forall a. a -> Maybe a
Just forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall a. StablePtr a -> IO a
deRefStablePtr (forall a. Ptr () -> StablePtr a
castPtrToStablePtr Ptr ()
ptr)
else forall (m :: * -> *) a. Monad m => a -> m a
return forall a. Maybe a
Nothing
getGParamSpecGetterSetter :: forall o. Ptr GParamSpec ->
IO (Maybe (PropGetSetter o))
getGParamSpecGetterSetter :: forall o. Ptr GParamSpec -> IO (Maybe (PropGetSetter o))
getGParamSpecGetterSetter Ptr GParamSpec
pspecPtr = do
GQuark (PropGetSetter o)
quark <- forall o. IO (GQuark (PropGetSetter o))
pspecQuark @o
forall a. Ptr GParamSpec -> GQuark a -> IO (Maybe a)
gParamSpecGetQData Ptr GParamSpec
pspecPtr GQuark (PropGetSetter o)
quark