#if !defined(__HADDOCK_VERSION__)
#define ENABLE_OVERLOADING
#endif
module GI.Gsk.Functions
(
rectSnapGetDirection ,
rectSnapNew ,
valueDupRenderNode ,
valueGetRenderNode ,
valueSetRenderNode ,
valueTakeRenderNode ,
) 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 Data.Word as DW
import qualified Data.Int as DI
import qualified System.Posix.Types as SPT
import qualified Foreign.C.Types as FCT
#if MIN_VERSION_base(4,18,0)
import qualified GI.Cairo.Structs.Context as Cairo.Context
import qualified GI.GLib.Structs.Bytes as GLib.Bytes
import qualified GI.Graphene.Structs.Rect as Graphene.Rect
import qualified GI.Gsk.Callbacks as Gsk.Callbacks
import {-# SOURCE #-} qualified GI.Gsk.Enums as Gsk.Enums
import {-# SOURCE #-} qualified GI.Gsk.Objects.RenderNode as Gsk.RenderNode
#else
import {-# SOURCE #-} qualified GI.Gsk.Enums as Gsk.Enums
import {-# SOURCE #-} qualified GI.Gsk.Objects.RenderNode as Gsk.RenderNode
#endif
foreign import ccall "gsk_value_take_render_node" gsk_value_take_render_node ::
Ptr GValue ->
Ptr Gsk.RenderNode.RenderNode ->
IO ()
valueTakeRenderNode ::
(B.CallStack.HasCallStack, MonadIO m, Gsk.RenderNode.IsRenderNode a) =>
GValue
-> Maybe (a)
-> m ()
valueTakeRenderNode :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsRenderNode a) =>
GValue -> Maybe a -> m ()
valueTakeRenderNode GValue
value Maybe a
node = 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
value' <- GValue -> IO (Ptr GValue)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr GValue
value
maybeNode <- case node of
Maybe a
Nothing -> Ptr RenderNode -> IO (Ptr RenderNode)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr RenderNode
forall a. Ptr a
FP.nullPtr
Just a
jNode -> do
jNode' <- a -> IO (Ptr RenderNode)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
B.ManagedPtr.disownManagedPtr a
jNode
return jNode'
gsk_value_take_render_node value' maybeNode
touchManagedPtr value
whenJust node touchManagedPtr
return ()
foreign import ccall "gsk_value_set_render_node" gsk_value_set_render_node ::
Ptr GValue ->
Ptr Gsk.RenderNode.RenderNode ->
IO ()
valueSetRenderNode ::
(B.CallStack.HasCallStack, MonadIO m, Gsk.RenderNode.IsRenderNode a) =>
GValue
-> a
-> m ()
valueSetRenderNode :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsRenderNode a) =>
GValue -> a -> m ()
valueSetRenderNode GValue
value a
node = 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
value' <- GValue -> IO (Ptr GValue)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr GValue
value
node' <- unsafeManagedPtrCastPtr node
gsk_value_set_render_node value' node'
touchManagedPtr value
touchManagedPtr node
return ()
foreign import ccall "gsk_value_get_render_node" gsk_value_get_render_node ::
Ptr GValue ->
IO (Ptr Gsk.RenderNode.RenderNode)
valueGetRenderNode ::
(B.CallStack.HasCallStack, MonadIO m) =>
GValue
-> m (Maybe Gsk.RenderNode.RenderNode)
valueGetRenderNode :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
GValue -> m (Maybe RenderNode)
valueGetRenderNode GValue
value = IO (Maybe RenderNode) -> m (Maybe RenderNode)
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (Maybe RenderNode) -> m (Maybe RenderNode))
-> IO (Maybe RenderNode) -> m (Maybe RenderNode)
forall a b. (a -> b) -> a -> b
$ do
value' <- GValue -> IO (Ptr GValue)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr GValue
value
result <- gsk_value_get_render_node value'
maybeResult <- convertIfNonNull result $ \Ptr RenderNode
result' -> do
result'' <- ((ManagedPtr RenderNode -> RenderNode)
-> Ptr RenderNode -> IO RenderNode
forall a.
(HasCallStack, BoxedPtr a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
newPtr ManagedPtr RenderNode -> RenderNode
Gsk.RenderNode.RenderNode) Ptr RenderNode
result'
return result''
touchManagedPtr value
return maybeResult
foreign import ccall "gsk_value_dup_render_node" gsk_value_dup_render_node ::
Ptr GValue ->
IO (Ptr Gsk.RenderNode.RenderNode)
valueDupRenderNode ::
(B.CallStack.HasCallStack, MonadIO m) =>
GValue
-> m (Maybe Gsk.RenderNode.RenderNode)
valueDupRenderNode :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
GValue -> m (Maybe RenderNode)
valueDupRenderNode GValue
value = IO (Maybe RenderNode) -> m (Maybe RenderNode)
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (Maybe RenderNode) -> m (Maybe RenderNode))
-> IO (Maybe RenderNode) -> m (Maybe RenderNode)
forall a b. (a -> b) -> a -> b
$ do
value' <- GValue -> IO (Ptr GValue)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr GValue
value
result <- gsk_value_dup_render_node value'
maybeResult <- convertIfNonNull result $ \Ptr RenderNode
result' -> do
result'' <- ((ManagedPtr RenderNode -> RenderNode)
-> Ptr RenderNode -> IO RenderNode
forall a.
(HasCallStack, BoxedPtr a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapPtr ManagedPtr RenderNode -> RenderNode
Gsk.RenderNode.RenderNode) Ptr RenderNode
result'
return result''
touchManagedPtr value
return maybeResult
foreign import ccall "gsk_rect_snap_new" gsk_rect_snap_new ::
CUInt ->
CUInt ->
CUInt ->
CUInt ->
IO Word32
rectSnapNew ::
(B.CallStack.HasCallStack, MonadIO m) =>
Gsk.Enums.SnapDirection
-> Gsk.Enums.SnapDirection
-> Gsk.Enums.SnapDirection
-> Gsk.Enums.SnapDirection
-> m Word32
rectSnapNew :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
SnapDirection
-> SnapDirection -> SnapDirection -> SnapDirection -> m Word32
rectSnapNew SnapDirection
top SnapDirection
right SnapDirection
bottom SnapDirection
left = IO Word32 -> m Word32
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Word32 -> m Word32) -> IO Word32 -> m Word32
forall a b. (a -> b) -> a -> b
$ do
let top' :: CUInt
top' = (Int -> CUInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> CUInt) -> (SnapDirection -> Int) -> SnapDirection -> CUInt
forall b c a. (b -> c) -> (a -> b) -> a -> c
. SnapDirection -> Int
forall a. Enum a => a -> Int
fromEnum) SnapDirection
top
let right' :: CUInt
right' = (Int -> CUInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> CUInt) -> (SnapDirection -> Int) -> SnapDirection -> CUInt
forall b c a. (b -> c) -> (a -> b) -> a -> c
. SnapDirection -> Int
forall a. Enum a => a -> Int
fromEnum) SnapDirection
right
let bottom' :: CUInt
bottom' = (Int -> CUInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> CUInt) -> (SnapDirection -> Int) -> SnapDirection -> CUInt
forall b c a. (b -> c) -> (a -> b) -> a -> c
. SnapDirection -> Int
forall a. Enum a => a -> Int
fromEnum) SnapDirection
bottom
let left' :: CUInt
left' = (Int -> CUInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> CUInt) -> (SnapDirection -> Int) -> SnapDirection -> CUInt
forall b c a. (b -> c) -> (a -> b) -> a -> c
. SnapDirection -> Int
forall a. Enum a => a -> Int
fromEnum) SnapDirection
left
result <- CUInt -> CUInt -> CUInt -> CUInt -> IO Word32
gsk_rect_snap_new CUInt
top' CUInt
right' CUInt
bottom' CUInt
left'
return result
foreign import ccall "gsk_rect_snap_get_direction" gsk_rect_snap_get_direction ::
Word32 ->
CUInt ->
IO CUInt
rectSnapGetDirection ::
(B.CallStack.HasCallStack, MonadIO m) =>
Word32
-> Gsk.Enums.Side
-> m Gsk.Enums.SnapDirection
rectSnapGetDirection :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
Word32 -> Side -> m SnapDirection
rectSnapGetDirection Word32
snap Side
side = IO SnapDirection -> m SnapDirection
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO SnapDirection -> m SnapDirection)
-> IO SnapDirection -> m SnapDirection
forall a b. (a -> b) -> a -> b
$ do
let side' :: CUInt
side' = (Int -> CUInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> CUInt) -> (Side -> Int) -> Side -> CUInt
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Side -> Int
forall a. Enum a => a -> Int
fromEnum) Side
side
result <- Word32 -> CUInt -> IO CUInt
gsk_rect_snap_get_direction Word32
snap CUInt
side'
let result' = (Int -> SnapDirection
forall a. Enum a => Int -> a
toEnum (Int -> SnapDirection) -> (CUInt -> Int) -> CUInt -> SnapDirection
forall b c a. (b -> c) -> (a -> b) -> a -> c
. CUInt -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral) CUInt
result
return result'