{-# LANGUAGE TypeApplications #-}
#if (MIN_VERSION_haskell_gi_overloading(1,0,0) && !defined(__HADDOCK_VERSION__))
#define ENABLE_OVERLOADING
#endif
module GI.Gsk.Objects.TextureNode
(
TextureNode(..) ,
IsTextureNode ,
toTextureNode ,
#if defined(ENABLE_OVERLOADING)
ResolveTextureNodeMethod ,
#endif
#if defined(ENABLE_OVERLOADING)
TextureNodeGetTextureMethodInfo ,
#endif
textureNodeGetTexture ,
textureNodeNew ,
) 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.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 GI.Gdk.Objects.Texture as Gdk.Texture
import qualified GI.Graphene.Structs.Rect as Graphene.Rect
import {-# SOURCE #-} qualified GI.Gsk.Objects.RenderNode as Gsk.RenderNode
newtype TextureNode = TextureNode (SP.ManagedPtr TextureNode)
deriving (TextureNode -> TextureNode -> Bool
(TextureNode -> TextureNode -> Bool)
-> (TextureNode -> TextureNode -> Bool) -> Eq TextureNode
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: TextureNode -> TextureNode -> Bool
$c/= :: TextureNode -> TextureNode -> Bool
== :: TextureNode -> TextureNode -> Bool
$c== :: TextureNode -> TextureNode -> Bool
Eq)
instance SP.ManagedPtrNewtype TextureNode where
toManagedPtr :: TextureNode -> ManagedPtr TextureNode
toManagedPtr (TextureNode ManagedPtr TextureNode
p) = ManagedPtr TextureNode
p
foreign import ccall "gsk_texture_node_get_type"
c_gsk_texture_node_get_type :: IO B.Types.GType
instance B.Types.TypedObject TextureNode where
glibType :: IO GType
glibType = IO GType
c_gsk_texture_node_get_type
class (SP.BoxedPtr o, SP.TypedObject o, O.IsDescendantOf TextureNode o) => IsTextureNode o
instance (SP.BoxedPtr o, SP.TypedObject o, O.IsDescendantOf TextureNode o) => IsTextureNode o
instance O.HasParentTypes TextureNode
type instance O.ParentTypes TextureNode = '[Gsk.RenderNode.RenderNode]
toTextureNode :: (MonadIO m, IsTextureNode o) => o -> m TextureNode
toTextureNode :: o -> m TextureNode
toTextureNode = IO TextureNode -> m TextureNode
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO TextureNode -> m TextureNode)
-> (o -> IO TextureNode) -> o -> m TextureNode
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (ManagedPtr TextureNode -> TextureNode) -> o -> IO TextureNode
forall o o'.
(HasCallStack, ManagedPtrNewtype o, TypedObject o,
ManagedPtrNewtype o', TypedObject o') =>
(ManagedPtr o' -> o') -> o -> IO o'
unsafeCastTo ManagedPtr TextureNode -> TextureNode
TextureNode
#if defined(ENABLE_OVERLOADING)
type family ResolveTextureNodeMethod (t :: Symbol) (o :: *) :: * where
ResolveTextureNodeMethod "draw" o = Gsk.RenderNode.RenderNodeDrawMethodInfo
ResolveTextureNodeMethod "ref" o = Gsk.RenderNode.RenderNodeRefMethodInfo
ResolveTextureNodeMethod "serialize" o = Gsk.RenderNode.RenderNodeSerializeMethodInfo
ResolveTextureNodeMethod "unref" o = Gsk.RenderNode.RenderNodeUnrefMethodInfo
ResolveTextureNodeMethod "writeToFile" o = Gsk.RenderNode.RenderNodeWriteToFileMethodInfo
ResolveTextureNodeMethod "getBounds" o = Gsk.RenderNode.RenderNodeGetBoundsMethodInfo
ResolveTextureNodeMethod "getNodeType" o = Gsk.RenderNode.RenderNodeGetNodeTypeMethodInfo
ResolveTextureNodeMethod "getTexture" o = TextureNodeGetTextureMethodInfo
ResolveTextureNodeMethod l o = O.MethodResolutionFailed l o
instance (info ~ ResolveTextureNodeMethod t TextureNode, O.MethodInfo info TextureNode p) => OL.IsLabel t (TextureNode -> p) where
#if MIN_VERSION_base(4,10,0)
fromLabel = O.overloadedMethod @info
#else
fromLabel _ = O.overloadedMethod @info
#endif
#endif
instance BoxedPtr TextureNode where
boxedPtrCopy :: TextureNode -> IO TextureNode
boxedPtrCopy = TextureNode -> IO TextureNode
forall (m :: * -> *) a. Monad m => a -> m a
return
boxedPtrFree :: TextureNode -> IO ()
boxedPtrFree = \TextureNode
_x -> () -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
foreign import ccall "gsk_texture_node_new" gsk_texture_node_new ::
Ptr Gdk.Texture.Texture ->
Ptr Graphene.Rect.Rect ->
IO (Ptr TextureNode)
textureNodeNew ::
(B.CallStack.HasCallStack, MonadIO m, Gdk.Texture.IsTexture a) =>
a
-> Graphene.Rect.Rect
-> m TextureNode
textureNodeNew :: a -> Rect -> m TextureNode
textureNodeNew a
texture Rect
bounds = IO TextureNode -> m TextureNode
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO TextureNode -> m TextureNode)
-> IO TextureNode -> m TextureNode
forall a b. (a -> b) -> a -> b
$ do
Ptr Texture
texture' <- a -> IO (Ptr Texture)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
texture
Ptr Rect
bounds' <- Rect -> IO (Ptr Rect)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Rect
bounds
Ptr TextureNode
result <- Ptr Texture -> Ptr Rect -> IO (Ptr TextureNode)
gsk_texture_node_new Ptr Texture
texture' Ptr Rect
bounds'
Text -> Ptr TextureNode -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"textureNodeNew" Ptr TextureNode
result
TextureNode
result' <- ((ManagedPtr TextureNode -> TextureNode)
-> Ptr TextureNode -> IO TextureNode
forall a.
(HasCallStack, BoxedPtr a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapPtr ManagedPtr TextureNode -> TextureNode
TextureNode) Ptr TextureNode
result
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
texture
Rect -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Rect
bounds
TextureNode -> IO TextureNode
forall (m :: * -> *) a. Monad m => a -> m a
return TextureNode
result'
#if defined(ENABLE_OVERLOADING)
#endif
foreign import ccall "gsk_texture_node_get_texture" gsk_texture_node_get_texture ::
Ptr TextureNode ->
IO (Ptr Gdk.Texture.Texture)
textureNodeGetTexture ::
(B.CallStack.HasCallStack, MonadIO m, IsTextureNode a) =>
a
-> m Gdk.Texture.Texture
textureNodeGetTexture :: a -> m Texture
textureNodeGetTexture a
node = IO Texture -> m Texture
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Texture -> m Texture) -> IO Texture -> m Texture
forall a b. (a -> b) -> a -> b
$ do
Ptr TextureNode
node' <- a -> IO (Ptr TextureNode)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
node
Ptr Texture
result <- Ptr TextureNode -> IO (Ptr Texture)
gsk_texture_node_get_texture Ptr TextureNode
node'
Text -> Ptr Texture -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"textureNodeGetTexture" Ptr Texture
result
Texture
result' <- ((ManagedPtr Texture -> Texture) -> Ptr Texture -> IO Texture
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
newObject ManagedPtr Texture -> Texture
Gdk.Texture.Texture) Ptr Texture
result
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
node
Texture -> IO Texture
forall (m :: * -> *) a. Monad m => a -> m a
return Texture
result'
#if defined(ENABLE_OVERLOADING)
data TextureNodeGetTextureMethodInfo
instance (signature ~ (m Gdk.Texture.Texture), MonadIO m, IsTextureNode a) => O.MethodInfo TextureNodeGetTextureMethodInfo a signature where
overloadedMethod = textureNodeGetTexture
#endif