{-# LANGUAGE TypeApplications #-}


-- | Copyright  : Will Thompson and Iñaki García Etxebarria
-- License    : LGPL-2.1
-- Maintainer : Iñaki García Etxebarria
-- 
-- The t'GI.Clutter.Objects.TextNode.TextNode' structure is an opaque
-- type whose members cannot be directly accessed.
-- 
-- /Since: 1.10/

#if (MIN_VERSION_haskell_gi_overloading(1,0,0) && !defined(__HADDOCK_VERSION__))
#define ENABLE_OVERLOADING
#endif

module GI.Clutter.Objects.ClipNode
    ( 

-- * Exported types
    ClipNode(..)                            ,
    IsClipNode                              ,
    toClipNode                              ,


 -- * Methods
-- | 
-- 
--  === __Click to display all available methods, including inherited ones__
-- ==== Methods
-- [addChild]("GI.Clutter.Objects.PaintNode#g:method:addChild"), [addRectangle]("GI.Clutter.Objects.PaintNode#g:method:addRectangle"), [addTextureRectangle]("GI.Clutter.Objects.PaintNode#g:method:addTextureRectangle"), [ref]("GI.Clutter.Objects.PaintNode#g:method:ref"), [unref]("GI.Clutter.Objects.PaintNode#g:method:unref").
-- 
-- ==== Getters
-- /None/.
-- 
-- ==== Setters
-- [setName]("GI.Clutter.Objects.PaintNode#g:method:setName").

#if defined(ENABLE_OVERLOADING)
    ResolveClipNodeMethod                   ,
#endif

-- ** new #method:new#

    clipNodeNew                             ,




    ) 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 {-# SOURCE #-} qualified GI.Clutter.Objects.PaintNode as Clutter.PaintNode

-- | Memory-managed wrapper type.
newtype ClipNode = ClipNode (SP.ManagedPtr ClipNode)
    deriving (ClipNode -> ClipNode -> Bool
(ClipNode -> ClipNode -> Bool)
-> (ClipNode -> ClipNode -> Bool) -> Eq ClipNode
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: ClipNode -> ClipNode -> Bool
== :: ClipNode -> ClipNode -> Bool
$c/= :: ClipNode -> ClipNode -> Bool
/= :: ClipNode -> ClipNode -> Bool
Eq)

instance SP.ManagedPtrNewtype ClipNode where
    toManagedPtr :: ClipNode -> ManagedPtr ClipNode
toManagedPtr (ClipNode ManagedPtr ClipNode
p) = ManagedPtr ClipNode
p

foreign import ccall "clutter_clip_node_get_type"
    c_clutter_clip_node_get_type :: IO B.Types.GType

instance B.Types.TypedObject ClipNode where
    glibType :: IO GType
glibType = IO GType
c_clutter_clip_node_get_type

-- | Type class for types which can be safely cast to `ClipNode`, for instance with `toClipNode`.
class (SP.BoxedPtr o, SP.TypedObject o, O.IsDescendantOf ClipNode o) => IsClipNode o
instance (SP.BoxedPtr o, SP.TypedObject o, O.IsDescendantOf ClipNode o) => IsClipNode o

instance O.HasParentTypes ClipNode
type instance O.ParentTypes ClipNode = '[Clutter.PaintNode.PaintNode]

-- | Cast to `ClipNode`, for types for which this is known to be safe. For general casts, use `Data.GI.Base.ManagedPtr.castTo`.
toClipNode :: (MIO.MonadIO m, IsClipNode o) => o -> m ClipNode
toClipNode :: forall (m :: * -> *) o.
(MonadIO m, IsClipNode o) =>
o -> m ClipNode
toClipNode = IO ClipNode -> m ClipNode
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
MIO.liftIO (IO ClipNode -> m ClipNode)
-> (o -> IO ClipNode) -> o -> m ClipNode
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (ManagedPtr ClipNode -> ClipNode) -> o -> IO ClipNode
forall o o'.
(HasCallStack, ManagedPtrNewtype o, TypedObject o,
 ManagedPtrNewtype o', TypedObject o') =>
(ManagedPtr o' -> o') -> o -> IO o'
B.ManagedPtr.unsafeCastTo ManagedPtr ClipNode -> ClipNode
ClipNode

--- XXX Missing getter and/or setter, so no GValue instance could be generated.
#if defined(ENABLE_OVERLOADING)
type family ResolveClipNodeMethod (t :: Symbol) (o :: DK.Type) :: DK.Type where
    ResolveClipNodeMethod "addChild" o = Clutter.PaintNode.PaintNodeAddChildMethodInfo
    ResolveClipNodeMethod "addRectangle" o = Clutter.PaintNode.PaintNodeAddRectangleMethodInfo
    ResolveClipNodeMethod "addTextureRectangle" o = Clutter.PaintNode.PaintNodeAddTextureRectangleMethodInfo
    ResolveClipNodeMethod "ref" o = Clutter.PaintNode.PaintNodeRefMethodInfo
    ResolveClipNodeMethod "unref" o = Clutter.PaintNode.PaintNodeUnrefMethodInfo
    ResolveClipNodeMethod "setName" o = Clutter.PaintNode.PaintNodeSetNameMethodInfo
    ResolveClipNodeMethod l o = O.MethodResolutionFailed l o

instance (info ~ ResolveClipNodeMethod t ClipNode, O.OverloadedMethod info ClipNode p) => OL.IsLabel t (ClipNode -> 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 ~ ResolveClipNodeMethod t ClipNode, O.OverloadedMethod info ClipNode p, R.HasField t ClipNode p) => R.HasField t ClipNode p where
    getField = O.overloadedMethod @info

#endif

instance (info ~ ResolveClipNodeMethod t ClipNode, O.OverloadedMethodInfo info ClipNode) => OL.IsLabel t (O.MethodProxy info ClipNode) where
#if MIN_VERSION_base(4,10,0)
    fromLabel = O.MethodProxy
#else
    fromLabel _ = O.MethodProxy
#endif

#endif

-- XXX Wrapping a foreign struct/union with no known destructor or size, leak?
instance BoxedPtr ClipNode where
    boxedPtrCopy :: ClipNode -> IO ClipNode
boxedPtrCopy = ClipNode -> IO ClipNode
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return
    boxedPtrFree :: ClipNode -> IO ()
boxedPtrFree = \ClipNode
_x -> () -> IO ()
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return ()


-- method ClipNode::new
-- method type : Constructor
-- Args: []
-- Lengths: []
-- returnType: Just
--               (TInterface Name { namespace = "Clutter" , name = "PaintNode" })
-- throws : False
-- Skip return : False

foreign import ccall "clutter_clip_node_new" clutter_clip_node_new :: 
    IO (Ptr Clutter.PaintNode.PaintNode)

-- | Creates a new t'GI.Clutter.Objects.PaintNode.PaintNode' that will clip its child
-- nodes to the 2D regions added to it.
-- 
-- /Since: 1.10/
clipNodeNew ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    m Clutter.PaintNode.PaintNode
    -- ^ __Returns:__ the newly created t'GI.Clutter.Objects.PaintNode.PaintNode'.
    --   Use 'GI.Clutter.Objects.PaintNode.paintNodeUnref' when done.
clipNodeNew :: forall (m :: * -> *). (HasCallStack, MonadIO m) => m PaintNode
clipNodeNew  = IO PaintNode -> m PaintNode
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO PaintNode -> m PaintNode) -> IO PaintNode -> m PaintNode
forall a b. (a -> b) -> a -> b
$ do
    Ptr PaintNode
result <- IO (Ptr PaintNode)
clutter_clip_node_new
    Text -> Ptr PaintNode -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"clipNodeNew" Ptr PaintNode
result
    PaintNode
result' <- ((ManagedPtr PaintNode -> PaintNode)
-> Ptr PaintNode -> IO PaintNode
forall a.
(HasCallStack, BoxedPtr a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapPtr ManagedPtr PaintNode -> PaintNode
Clutter.PaintNode.PaintNode) Ptr PaintNode
result
    PaintNode -> IO PaintNode
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return PaintNode
result'

#if defined(ENABLE_OVERLOADING)
#endif