{-# LANGUAGE TypeApplications #-}


-- | Copyright  : Will Thompson, Iñaki García Etxebarria and Jonas Platte
-- License    : LGPL-2.1
-- Maintainer : Iñaki García Etxebarria
-- 
-- /No description available in the introspection data./

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

module GI.Atk.Structs.Implementor
    ( 

-- * Exported types
    Implementor(..)                         ,


 -- * Methods
-- ** Overloaded methods #method:Overloaded methods#

#if defined(ENABLE_OVERLOADING)
    ResolveImplementorMethod                ,
#endif


-- ** refAccessible #method:refAccessible#

#if defined(ENABLE_OVERLOADING)
    ImplementorRefAccessibleMethodInfo      ,
#endif
    implementorRefAccessible                ,




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

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

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

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


#if defined(ENABLE_OVERLOADING)
instance O.HasAttributeList Implementor
type instance O.AttributeList Implementor = ImplementorAttributeList
type ImplementorAttributeList = ('[ ] :: [(Symbol, *)])
#endif

-- method Implementor::ref_accessible
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "implementor"
--           , argType =
--               TInterface Name { namespace = "Atk" , name = "Implementor" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just
--                       "The #GObject instance which should implement #AtkImplementorIface\nif a non-null return value is required."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TInterface Name { namespace = "Atk" , name = "Object" })
-- throws : False
-- Skip return : False

foreign import ccall "atk_implementor_ref_accessible" atk_implementor_ref_accessible :: 
    Ptr Implementor ->                      -- implementor : TInterface (Name {namespace = "Atk", name = "Implementor"})
    IO (Ptr Atk.Object.Object)

-- | Gets a reference to an object\'s t'GI.Atk.Objects.Object.Object' implementation, if
-- the object implements @/AtkObjectIface/@
implementorRefAccessible ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Implementor
    -- ^ /@implementor@/: The t'GI.GObject.Objects.Object.Object' instance which should implement t'GI.Atk.Interfaces.ImplementorIface.ImplementorIface'
    -- if a non-null return value is required.
    -> m Atk.Object.Object
    -- ^ __Returns:__ a reference to an object\'s t'GI.Atk.Objects.Object.Object'
    -- implementation
implementorRefAccessible :: Implementor -> m Object
implementorRefAccessible Implementor
implementor = IO Object -> m Object
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Object -> m Object) -> IO Object -> m Object
forall a b. (a -> b) -> a -> b
$ do
    Ptr Implementor
implementor' <- Implementor -> IO (Ptr Implementor)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Implementor
implementor
    Ptr Object
result <- Ptr Implementor -> IO (Ptr Object)
atk_implementor_ref_accessible Ptr Implementor
implementor'
    Text -> Ptr Object -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"implementorRefAccessible" Ptr Object
result
    Object
result' <- ((ManagedPtr Object -> Object) -> Ptr Object -> IO Object
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
wrapObject ManagedPtr Object -> Object
Atk.Object.Object) Ptr Object
result
    Implementor -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Implementor
implementor
    Object -> IO Object
forall (m :: * -> *) a. Monad m => a -> m a
return Object
result'

#if defined(ENABLE_OVERLOADING)
data ImplementorRefAccessibleMethodInfo
instance (signature ~ (m Atk.Object.Object), MonadIO m) => O.MethodInfo ImplementorRefAccessibleMethodInfo Implementor signature where
    overloadedMethod = implementorRefAccessible

#endif

#if defined(ENABLE_OVERLOADING)
type family ResolveImplementorMethod (t :: Symbol) (o :: *) :: * where
    ResolveImplementorMethod "refAccessible" o = ImplementorRefAccessibleMethodInfo
    ResolveImplementorMethod l o = O.MethodResolutionFailed l o

instance (info ~ ResolveImplementorMethod t Implementor, O.MethodInfo info Implementor p) => OL.IsLabel t (Implementor -> p) where
#if MIN_VERSION_base(4,10,0)
    fromLabel = O.overloadedMethod @info
#else
    fromLabel _ = O.overloadedMethod @info
#endif

#endif