{-# LANGUAGE TypeApplications #-}
#if (MIN_VERSION_haskell_gi_overloading(1,0,0) && !defined(__HADDOCK_VERSION__))
#define ENABLE_OVERLOADING
#endif
module GI.Gtk.Objects.Expression
(
Expression(..) ,
IsExpression ,
toExpression ,
#if defined(ENABLE_OVERLOADING)
ResolveExpressionMethod ,
#endif
#if defined(ENABLE_OVERLOADING)
ExpressionBindMethodInfo ,
#endif
expressionBind ,
#if defined(ENABLE_OVERLOADING)
ExpressionEvaluateMethodInfo ,
#endif
expressionEvaluate ,
#if defined(ENABLE_OVERLOADING)
ExpressionGetValueTypeMethodInfo ,
#endif
expressionGetValueType ,
#if defined(ENABLE_OVERLOADING)
ExpressionIsStaticMethodInfo ,
#endif
expressionIsStatic ,
#if defined(ENABLE_OVERLOADING)
ExpressionRefMethodInfo ,
#endif
expressionRef ,
#if defined(ENABLE_OVERLOADING)
ExpressionUnrefMethodInfo ,
#endif
expressionUnref ,
#if defined(ENABLE_OVERLOADING)
ExpressionWatchMethodInfo ,
#endif
expressionWatch ,
) 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.GLib.Callbacks as GLib.Callbacks
import qualified GI.GObject.Objects.Object as GObject.Object
import qualified GI.Gtk.Callbacks as Gtk.Callbacks
import {-# SOURCE #-} qualified GI.Gtk.Structs.ExpressionWatch as Gtk.ExpressionWatch
newtype Expression = Expression (SP.ManagedPtr Expression)
deriving (Expression -> Expression -> Bool
(Expression -> Expression -> Bool)
-> (Expression -> Expression -> Bool) -> Eq Expression
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Expression -> Expression -> Bool
$c/= :: Expression -> Expression -> Bool
== :: Expression -> Expression -> Bool
$c== :: Expression -> Expression -> Bool
Eq)
instance SP.ManagedPtrNewtype Expression where
toManagedPtr :: Expression -> ManagedPtr Expression
toManagedPtr (Expression ManagedPtr Expression
p) = ManagedPtr Expression
p
foreign import ccall "gtk_expression_get_type"
c_gtk_expression_get_type :: IO B.Types.GType
instance B.Types.TypedObject Expression where
glibType :: IO GType
glibType = IO GType
c_gtk_expression_get_type
class (SP.BoxedPtr o, SP.TypedObject o, O.IsDescendantOf Expression o) => IsExpression o
instance (SP.BoxedPtr o, SP.TypedObject o, O.IsDescendantOf Expression o) => IsExpression o
instance O.HasParentTypes Expression
type instance O.ParentTypes Expression = '[]
toExpression :: (MIO.MonadIO m, IsExpression o) => o -> m Expression
toExpression :: forall (m :: * -> *) o.
(MonadIO m, IsExpression o) =>
o -> m Expression
toExpression = IO Expression -> m Expression
forall (m :: * -> *) a. MonadIO m => IO a -> m a
MIO.liftIO (IO Expression -> m Expression)
-> (o -> IO Expression) -> o -> m Expression
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (ManagedPtr Expression -> Expression) -> o -> IO Expression
forall o o'.
(HasCallStack, ManagedPtrNewtype o, TypedObject o,
ManagedPtrNewtype o', TypedObject o') =>
(ManagedPtr o' -> o') -> o -> IO o'
B.ManagedPtr.unsafeCastTo ManagedPtr Expression -> Expression
Expression
foreign import ccall "gtk_value_get_expression" gv_get_gtk_value_get_expression ::
FP.Ptr B.GValue.GValue -> IO (FP.Ptr Expression)
foreign import ccall "gtk_value_set_expression" gv_set_gtk_value_set_expression ::
FP.Ptr B.GValue.GValue -> FP.Ptr Expression -> IO ()
instance B.GValue.IsGValue (Maybe Expression) where
gvalueGType_ :: IO GType
gvalueGType_ = IO GType
c_gtk_expression_get_type
gvalueSet_ :: Ptr GValue -> Maybe Expression -> IO ()
gvalueSet_ Ptr GValue
gv Maybe Expression
P.Nothing = Ptr GValue -> Ptr Expression -> IO ()
gv_set_gtk_value_set_expression Ptr GValue
gv (Ptr Expression
forall a. Ptr a
FP.nullPtr :: FP.Ptr Expression)
gvalueSet_ Ptr GValue
gv (P.Just Expression
obj) = Expression -> (Ptr Expression -> IO ()) -> IO ()
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
B.ManagedPtr.withManagedPtr Expression
obj (Ptr GValue -> Ptr Expression -> IO ()
gv_set_gtk_value_set_expression Ptr GValue
gv)
gvalueGet_ :: Ptr GValue -> IO (Maybe Expression)
gvalueGet_ Ptr GValue
gv = do
Ptr Expression
ptr <- Ptr GValue -> IO (Ptr Expression)
gv_get_gtk_value_get_expression Ptr GValue
gv :: IO (FP.Ptr Expression)
if Ptr Expression
ptr Ptr Expression -> Ptr Expression -> Bool
forall a. Eq a => a -> a -> Bool
/= Ptr Expression
forall a. Ptr a
FP.nullPtr
then Expression -> Maybe Expression
forall a. a -> Maybe a
P.Just (Expression -> Maybe Expression)
-> IO Expression -> IO (Maybe Expression)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (ManagedPtr Expression -> Expression)
-> Ptr Expression -> IO Expression
forall a.
(HasCallStack, BoxedPtr a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
B.ManagedPtr.newPtr ManagedPtr Expression -> Expression
Expression Ptr Expression
ptr
else Maybe Expression -> IO (Maybe Expression)
forall (m :: * -> *) a. Monad m => a -> m a
return Maybe Expression
forall a. Maybe a
P.Nothing
#if defined(ENABLE_OVERLOADING)
type family ResolveExpressionMethod (t :: Symbol) (o :: *) :: * where
ResolveExpressionMethod "bind" o = ExpressionBindMethodInfo
ResolveExpressionMethod "evaluate" o = ExpressionEvaluateMethodInfo
ResolveExpressionMethod "isStatic" o = ExpressionIsStaticMethodInfo
ResolveExpressionMethod "ref" o = ExpressionRefMethodInfo
ResolveExpressionMethod "unref" o = ExpressionUnrefMethodInfo
ResolveExpressionMethod "watch" o = ExpressionWatchMethodInfo
ResolveExpressionMethod "getValueType" o = ExpressionGetValueTypeMethodInfo
ResolveExpressionMethod l o = O.MethodResolutionFailed l o
instance (info ~ ResolveExpressionMethod t Expression, O.OverloadedMethod info Expression p) => OL.IsLabel t (Expression -> 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 ~ ResolveExpressionMethod t Expression, O.OverloadedMethod info Expression p, R.HasField t Expression p) => R.HasField t Expression p where
getField = O.overloadedMethod @info
#endif
instance (info ~ ResolveExpressionMethod t Expression, O.OverloadedMethodInfo info Expression) => OL.IsLabel t (O.MethodProxy info Expression) where
#if MIN_VERSION_base(4,10,0)
fromLabel = O.MethodProxy
#else
fromLabel _ = O.MethodProxy
#endif
#endif
foreign import ccall "gtk_expression_ref" _Expression_copy_gtk_expression_ref :: Ptr a -> IO (Ptr a)
foreign import ccall "gtk_expression_unref" _Expression_free_gtk_expression_unref :: Ptr a -> IO ()
instance BoxedPtr Expression where
boxedPtrCopy :: Expression -> IO Expression
boxedPtrCopy = \Expression
p -> Expression -> (Ptr Expression -> IO Expression) -> IO Expression
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
B.ManagedPtr.withManagedPtr Expression
p (Ptr Expression -> IO (Ptr Expression)
forall a. Ptr a -> IO (Ptr a)
_Expression_copy_gtk_expression_ref (Ptr Expression -> IO (Ptr Expression))
-> (Ptr Expression -> IO Expression)
-> Ptr Expression
-> IO Expression
forall (m :: * -> *) a b c.
Monad m =>
(a -> m b) -> (b -> m c) -> a -> m c
>=> (ManagedPtr Expression -> Expression)
-> Ptr Expression -> IO Expression
forall a.
(HasCallStack, BoxedPtr a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
B.ManagedPtr.wrapPtr ManagedPtr Expression -> Expression
Expression)
boxedPtrFree :: Expression -> IO ()
boxedPtrFree = \Expression
p -> Expression -> (Ptr Expression -> IO ()) -> IO ()
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
B.ManagedPtr.withManagedPtr Expression
p Ptr Expression -> IO ()
forall a. Ptr a -> IO ()
_Expression_free_gtk_expression_unref
foreign import ccall "gtk_expression_bind" gtk_expression_bind ::
Ptr Expression ->
Ptr GObject.Object.Object ->
CString ->
Ptr GObject.Object.Object ->
IO (Ptr Gtk.ExpressionWatch.ExpressionWatch)
expressionBind ::
(B.CallStack.HasCallStack, MonadIO m, IsExpression a, GObject.Object.IsObject b, GObject.Object.IsObject c) =>
a
-> b
-> T.Text
-> Maybe (c)
-> m Gtk.ExpressionWatch.ExpressionWatch
expressionBind :: forall (m :: * -> *) a b c.
(HasCallStack, MonadIO m, IsExpression a, IsObject b,
IsObject c) =>
a -> b -> Text -> Maybe c -> m ExpressionWatch
expressionBind a
self b
target Text
property Maybe c
this_ = IO ExpressionWatch -> m ExpressionWatch
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO ExpressionWatch -> m ExpressionWatch)
-> IO ExpressionWatch -> m ExpressionWatch
forall a b. (a -> b) -> a -> b
$ do
Ptr Expression
self' <- a -> IO (Ptr Expression)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
B.ManagedPtr.disownManagedPtr a
self
Ptr Object
target' <- b -> IO (Ptr Object)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
target
CString
property' <- Text -> IO CString
textToCString Text
property
Ptr Object
maybeThis_ <- case Maybe c
this_ of
Maybe c
Nothing -> Ptr Object -> IO (Ptr Object)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Object
forall a. Ptr a
nullPtr
Just c
jThis_ -> do
Ptr Object
jThis_' <- c -> IO (Ptr Object)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr c
jThis_
Ptr Object -> IO (Ptr Object)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Object
jThis_'
Ptr ExpressionWatch
result <- Ptr Expression
-> Ptr Object -> CString -> Ptr Object -> IO (Ptr ExpressionWatch)
gtk_expression_bind Ptr Expression
self' Ptr Object
target' CString
property' Ptr Object
maybeThis_
Text -> Ptr ExpressionWatch -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"expressionBind" Ptr ExpressionWatch
result
ExpressionWatch
result' <- ((ManagedPtr ExpressionWatch -> ExpressionWatch)
-> Ptr ExpressionWatch -> IO ExpressionWatch
forall a.
(HasCallStack, BoxedPtr a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
newPtr ManagedPtr ExpressionWatch -> ExpressionWatch
Gtk.ExpressionWatch.ExpressionWatch) Ptr ExpressionWatch
result
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
self
b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr b
target
Maybe c -> (c -> IO ()) -> IO ()
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe c
this_ c -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
property'
ExpressionWatch -> IO ExpressionWatch
forall (m :: * -> *) a. Monad m => a -> m a
return ExpressionWatch
result'
#if defined(ENABLE_OVERLOADING)
data ExpressionBindMethodInfo
instance (signature ~ (b -> T.Text -> Maybe (c) -> m Gtk.ExpressionWatch.ExpressionWatch), MonadIO m, IsExpression a, GObject.Object.IsObject b, GObject.Object.IsObject c) => O.OverloadedMethod ExpressionBindMethodInfo a signature where
overloadedMethod = expressionBind
instance O.OverloadedMethodInfo ExpressionBindMethodInfo a where
overloadedMethodInfo = O.MethodInfo {
O.overloadedMethodName = "GI.Gtk.Objects.Expression.expressionBind",
O.overloadedMethodURL = "https://hackage.haskell.org/package/gi-gtk-4.0.4/docs/GI-Gtk-Objects-Expression.html#v:expressionBind"
}
#endif
foreign import ccall "gtk_expression_evaluate" gtk_expression_evaluate ::
Ptr Expression ->
Ptr GObject.Object.Object ->
Ptr GValue ->
IO CInt
expressionEvaluate ::
(B.CallStack.HasCallStack, MonadIO m, IsExpression a, GObject.Object.IsObject b) =>
a
-> Maybe (b)
-> GValue
-> m Bool
expressionEvaluate :: forall (m :: * -> *) a b.
(HasCallStack, MonadIO m, IsExpression a, IsObject b) =>
a -> Maybe b -> GValue -> m Bool
expressionEvaluate a
self Maybe b
this_ GValue
value = IO Bool -> m Bool
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 Expression
self' <- a -> IO (Ptr Expression)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
self
Ptr Object
maybeThis_ <- case Maybe b
this_ of
Maybe b
Nothing -> Ptr Object -> IO (Ptr Object)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Object
forall a. Ptr a
nullPtr
Just b
jThis_ -> do
Ptr Object
jThis_' <- b -> IO (Ptr Object)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
jThis_
Ptr Object -> IO (Ptr Object)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Object
jThis_'
Ptr GValue
value' <- GValue -> IO (Ptr GValue)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr GValue
value
CInt
result <- Ptr Expression -> Ptr Object -> Ptr GValue -> IO CInt
gtk_expression_evaluate Ptr Expression
self' Ptr Object
maybeThis_ Ptr GValue
value'
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
self
Maybe b -> (b -> IO ()) -> IO ()
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe b
this_ b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
GValue -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr GValue
value
Bool -> IO Bool
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
result'
#if defined(ENABLE_OVERLOADING)
data ExpressionEvaluateMethodInfo
instance (signature ~ (Maybe (b) -> GValue -> m Bool), MonadIO m, IsExpression a, GObject.Object.IsObject b) => O.OverloadedMethod ExpressionEvaluateMethodInfo a signature where
overloadedMethod = expressionEvaluate
instance O.OverloadedMethodInfo ExpressionEvaluateMethodInfo a where
overloadedMethodInfo = O.MethodInfo {
O.overloadedMethodName = "GI.Gtk.Objects.Expression.expressionEvaluate",
O.overloadedMethodURL = "https://hackage.haskell.org/package/gi-gtk-4.0.4/docs/GI-Gtk-Objects-Expression.html#v:expressionEvaluate"
}
#endif
foreign import ccall "gtk_expression_get_value_type" gtk_expression_get_value_type ::
Ptr Expression ->
IO CGType
expressionGetValueType ::
(B.CallStack.HasCallStack, MonadIO m, IsExpression a) =>
a
-> m GType
expressionGetValueType :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsExpression a) =>
a -> m GType
expressionGetValueType a
self = IO GType -> m GType
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO GType -> m GType) -> IO GType -> m GType
forall a b. (a -> b) -> a -> b
$ do
Ptr Expression
self' <- a -> IO (Ptr Expression)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
self
CGType
result <- Ptr Expression -> IO CGType
gtk_expression_get_value_type Ptr Expression
self'
let result' :: GType
result' = CGType -> GType
GType CGType
result
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
self
GType -> IO GType
forall (m :: * -> *) a. Monad m => a -> m a
return GType
result'
#if defined(ENABLE_OVERLOADING)
data ExpressionGetValueTypeMethodInfo
instance (signature ~ (m GType), MonadIO m, IsExpression a) => O.OverloadedMethod ExpressionGetValueTypeMethodInfo a signature where
overloadedMethod = expressionGetValueType
instance O.OverloadedMethodInfo ExpressionGetValueTypeMethodInfo a where
overloadedMethodInfo = O.MethodInfo {
O.overloadedMethodName = "GI.Gtk.Objects.Expression.expressionGetValueType",
O.overloadedMethodURL = "https://hackage.haskell.org/package/gi-gtk-4.0.4/docs/GI-Gtk-Objects-Expression.html#v:expressionGetValueType"
}
#endif
foreign import ccall "gtk_expression_is_static" gtk_expression_is_static ::
Ptr Expression ->
IO CInt
expressionIsStatic ::
(B.CallStack.HasCallStack, MonadIO m, IsExpression a) =>
a
-> m Bool
expressionIsStatic :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsExpression a) =>
a -> m Bool
expressionIsStatic a
self = IO Bool -> m Bool
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 Expression
self' <- a -> IO (Ptr Expression)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
self
CInt
result <- Ptr Expression -> IO CInt
gtk_expression_is_static Ptr Expression
self'
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
self
Bool -> IO Bool
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
result'
#if defined(ENABLE_OVERLOADING)
data ExpressionIsStaticMethodInfo
instance (signature ~ (m Bool), MonadIO m, IsExpression a) => O.OverloadedMethod ExpressionIsStaticMethodInfo a signature where
overloadedMethod = expressionIsStatic
instance O.OverloadedMethodInfo ExpressionIsStaticMethodInfo a where
overloadedMethodInfo = O.MethodInfo {
O.overloadedMethodName = "GI.Gtk.Objects.Expression.expressionIsStatic",
O.overloadedMethodURL = "https://hackage.haskell.org/package/gi-gtk-4.0.4/docs/GI-Gtk-Objects-Expression.html#v:expressionIsStatic"
}
#endif
foreign import ccall "gtk_expression_ref" gtk_expression_ref ::
Ptr Expression ->
IO (Ptr Expression)
expressionRef ::
(B.CallStack.HasCallStack, MonadIO m, IsExpression a) =>
a
-> m Expression
expressionRef :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsExpression a) =>
a -> m Expression
expressionRef a
self = IO Expression -> m Expression
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Expression -> m Expression) -> IO Expression -> m Expression
forall a b. (a -> b) -> a -> b
$ do
Ptr Expression
self' <- a -> IO (Ptr Expression)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
self
Ptr Expression
result <- Ptr Expression -> IO (Ptr Expression)
gtk_expression_ref Ptr Expression
self'
Text -> Ptr Expression -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"expressionRef" Ptr Expression
result
Expression
result' <- ((ManagedPtr Expression -> Expression)
-> Ptr Expression -> IO Expression
forall a.
(HasCallStack, BoxedPtr a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
newPtr ManagedPtr Expression -> Expression
Expression) Ptr Expression
result
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
self
Expression -> IO Expression
forall (m :: * -> *) a. Monad m => a -> m a
return Expression
result'
#if defined(ENABLE_OVERLOADING)
data ExpressionRefMethodInfo
instance (signature ~ (m Expression), MonadIO m, IsExpression a) => O.OverloadedMethod ExpressionRefMethodInfo a signature where
overloadedMethod = expressionRef
instance O.OverloadedMethodInfo ExpressionRefMethodInfo a where
overloadedMethodInfo = O.MethodInfo {
O.overloadedMethodName = "GI.Gtk.Objects.Expression.expressionRef",
O.overloadedMethodURL = "https://hackage.haskell.org/package/gi-gtk-4.0.4/docs/GI-Gtk-Objects-Expression.html#v:expressionRef"
}
#endif
foreign import ccall "gtk_expression_unref" gtk_expression_unref ::
Ptr Expression ->
IO ()
expressionUnref ::
(B.CallStack.HasCallStack, MonadIO m, IsExpression a) =>
a
-> m ()
expressionUnref :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsExpression a) =>
a -> m ()
expressionUnref a
self = 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 Expression
self' <- a -> IO (Ptr Expression)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
self
Ptr Expression -> IO ()
gtk_expression_unref Ptr Expression
self'
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
self
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
#if defined(ENABLE_OVERLOADING)
data ExpressionUnrefMethodInfo
instance (signature ~ (m ()), MonadIO m, IsExpression a) => O.OverloadedMethod ExpressionUnrefMethodInfo a signature where
overloadedMethod = expressionUnref
instance O.OverloadedMethodInfo ExpressionUnrefMethodInfo a where
overloadedMethodInfo = O.MethodInfo {
O.overloadedMethodName = "GI.Gtk.Objects.Expression.expressionUnref",
O.overloadedMethodURL = "https://hackage.haskell.org/package/gi-gtk-4.0.4/docs/GI-Gtk-Objects-Expression.html#v:expressionUnref"
}
#endif
foreign import ccall "gtk_expression_watch" gtk_expression_watch ::
Ptr Expression ->
Ptr GObject.Object.Object ->
FunPtr Gtk.Callbacks.C_ExpressionNotify ->
Ptr () ->
FunPtr GLib.Callbacks.C_DestroyNotify ->
IO (Ptr Gtk.ExpressionWatch.ExpressionWatch)
expressionWatch ::
(B.CallStack.HasCallStack, MonadIO m, IsExpression a, GObject.Object.IsObject b) =>
a
-> Maybe (b)
-> Gtk.Callbacks.ExpressionNotify
-> m Gtk.ExpressionWatch.ExpressionWatch
expressionWatch :: forall (m :: * -> *) a b.
(HasCallStack, MonadIO m, IsExpression a, IsObject b) =>
a -> Maybe b -> IO () -> m ExpressionWatch
expressionWatch a
self Maybe b
this_ IO ()
notify = IO ExpressionWatch -> m ExpressionWatch
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO ExpressionWatch -> m ExpressionWatch)
-> IO ExpressionWatch -> m ExpressionWatch
forall a b. (a -> b) -> a -> b
$ do
Ptr Expression
self' <- a -> IO (Ptr Expression)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
self
Ptr Object
maybeThis_ <- case Maybe b
this_ of
Maybe b
Nothing -> Ptr Object -> IO (Ptr Object)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Object
forall a. Ptr a
nullPtr
Just b
jThis_ -> do
Ptr Object
jThis_' <- b -> IO (Ptr Object)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
jThis_
Ptr Object -> IO (Ptr Object)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Object
jThis_'
FunPtr C_ExpressionNotify
notify' <- C_ExpressionNotify -> IO (FunPtr C_ExpressionNotify)
Gtk.Callbacks.mk_ExpressionNotify (Maybe (Ptr (FunPtr C_ExpressionNotify))
-> C_ExpressionNotify -> C_ExpressionNotify
Gtk.Callbacks.wrap_ExpressionNotify Maybe (Ptr (FunPtr C_ExpressionNotify))
forall a. Maybe a
Nothing (IO () -> C_ExpressionNotify
Gtk.Callbacks.drop_closures_ExpressionNotify IO ()
notify))
let userData :: Ptr ()
userData = FunPtr C_ExpressionNotify -> Ptr ()
forall a b. FunPtr a -> Ptr b
castFunPtrToPtr FunPtr C_ExpressionNotify
notify'
let userDestroy :: FunPtr (Ptr a -> IO ())
userDestroy = FunPtr (Ptr a -> IO ())
forall a. FunPtr (Ptr a -> IO ())
SP.safeFreeFunPtrPtr
Ptr ExpressionWatch
result <- Ptr Expression
-> Ptr Object
-> FunPtr C_ExpressionNotify
-> Ptr ()
-> FunPtr C_ExpressionNotify
-> IO (Ptr ExpressionWatch)
gtk_expression_watch Ptr Expression
self' Ptr Object
maybeThis_ FunPtr C_ExpressionNotify
notify' Ptr ()
userData FunPtr C_ExpressionNotify
forall a. FunPtr (Ptr a -> IO ())
userDestroy
Text -> Ptr ExpressionWatch -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"expressionWatch" Ptr ExpressionWatch
result
ExpressionWatch
result' <- ((ManagedPtr ExpressionWatch -> ExpressionWatch)
-> Ptr ExpressionWatch -> IO ExpressionWatch
forall a.
(HasCallStack, BoxedPtr a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
newPtr ManagedPtr ExpressionWatch -> ExpressionWatch
Gtk.ExpressionWatch.ExpressionWatch) Ptr ExpressionWatch
result
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
self
Maybe b -> (b -> IO ()) -> IO ()
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe b
this_ b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
ExpressionWatch -> IO ExpressionWatch
forall (m :: * -> *) a. Monad m => a -> m a
return ExpressionWatch
result'
#if defined(ENABLE_OVERLOADING)
data ExpressionWatchMethodInfo
instance (signature ~ (Maybe (b) -> Gtk.Callbacks.ExpressionNotify -> m Gtk.ExpressionWatch.ExpressionWatch), MonadIO m, IsExpression a, GObject.Object.IsObject b) => O.OverloadedMethod ExpressionWatchMethodInfo a signature where
overloadedMethod = expressionWatch
instance O.OverloadedMethodInfo ExpressionWatchMethodInfo a where
overloadedMethodInfo = O.MethodInfo {
O.overloadedMethodName = "GI.Gtk.Objects.Expression.expressionWatch",
O.overloadedMethodURL = "https://hackage.haskell.org/package/gi-gtk-4.0.4/docs/GI-Gtk-Objects-Expression.html#v:expressionWatch"
}
#endif