    {-# 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 !defined(__HADDOCK_VERSION__)
    #define ENABLE_OVERLOADING
    #endif

    module GI.GdkX11.Objects.X11Visual
        (

    -- * Exported types
        X11Visual(..)                           ,
        IsX11Visual                             ,
        toX11Visual                             ,

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

    #if defined(ENABLE_OVERLOADING)
        ResolveX11VisualMethod                  ,
    #endif

    -- ** getXvisual #method:getXvisual#

    #if defined(ENABLE_OVERLOADING)
        X11VisualGetXvisualMethodInfo           ,
    #endif
        x11VisualGetXvisual                     ,

        ) 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 GI.GObject.Objects.Object as GObject.Object
    import qualified GI.Gdk.Objects.Visual as Gdk.Visual
    import qualified GI.Xlib.Structs.Visual as Xlib.Visual

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

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

    foreign import ccall "gdk_x11_visual_get_type"
        c_gdk_x11_visual_get_type :: IO B.Types.GType

    instance B.Types.TypedObject X11Visual where
        glibType :: IO GType
    glibType = IO GType
    c_gdk_x11_visual_get_type

    instance B.Types.GObject X11Visual

    -- | Convert 'X11Visual' to and from 'Data.GI.Base.GValue.GValue' with 'Data.GI.Base.GValue.toGValue' and 'Data.GI.Base.GValue.fromGValue'.
    instance B.GValue.IsGValue X11Visual where
        toGValue :: X11Visual -> IO GValue
    toGValue o :: X11Visual
    o = do
            GType
    gtype <- IO GType
    c_gdk_x11_visual_get_type
            X11Visual -> (Ptr X11Visual -> IO GValue) -> IO GValue
    forall a c.
    (HasCallStack, ManagedPtrNewtype a) =>
    a -> (Ptr a -> IO c) -> IO c
    B.ManagedPtr.withManagedPtr X11Visual
    o (GType
    -> (GValue -> Ptr X11Visual -> IO ()) -> Ptr X11Visual -> IO GValue
    forall a. GType -> (GValue -> a -> IO ()) -> a -> IO GValue
    B.GValue.buildGValue GType
    gtype GValue -> Ptr X11Visual -> IO ()
    forall a. GObject a => GValue -> Ptr a -> IO ()
    B.GValue.set_object)

        fromGValue :: GValue -> IO X11Visual
    fromGValue gv :: GValue
    gv = do
            Ptr X11Visual
    ptr <- GValue -> IO (Ptr X11Visual)
    forall b. GObject b => GValue -> IO (Ptr b)
    B.GValue.get_object GValue
    gv :: IO (Ptr X11Visual)
            (ManagedPtr X11Visual -> X11Visual)
    -> Ptr X11Visual -> IO X11Visual
    forall a b.
    (HasCallStack, GObject a, GObject b) =>
    (ManagedPtr a -> a) -> Ptr b -> IO a
    B.ManagedPtr.newObject ManagedPtr X11Visual -> X11Visual
    X11Visual Ptr X11Visual
    ptr

    -- | Type class for types which can be safely cast to `X11Visual`, for instance with `toX11Visual`.
    class (SP.GObject o, O.IsDescendantOf X11Visual o) => IsX11Visual o
    instance (SP.GObject o, O.IsDescendantOf X11Visual o) => IsX11Visual o

    instance O.HasParentTypes X11Visual
    type instance O.ParentTypes X11Visual = '[Gdk.Visual.Visual, GObject.Object.Object]

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

    #if defined(ENABLE_OVERLOADING)
    type family ResolveX11VisualMethod (t :: Symbol) (o :: *) :: * where
        ResolveX11VisualMethod "bindProperty" o = GObject.Object.ObjectBindPropertyMethodInfo
        ResolveX11VisualMethod "bindPropertyFull" o = GObject.Object.ObjectBindPropertyFullMethodInfo
        ResolveX11VisualMethod "forceFloating" o = GObject.Object.ObjectForceFloatingMethodInfo
        ResolveX11VisualMethod "freezeNotify" o = GObject.Object.ObjectFreezeNotifyMethodInfo
        ResolveX11VisualMethod "getv" o = GObject.Object.ObjectGetvMethodInfo
        ResolveX11VisualMethod "isFloating" o = GObject.Object.ObjectIsFloatingMethodInfo
        ResolveX11VisualMethod "notify" o = GObject.Object.ObjectNotifyMethodInfo
        ResolveX11VisualMethod "notifyByPspec" o = GObject.Object.ObjectNotifyByPspecMethodInfo
        ResolveX11VisualMethod "ref" o = GObject.Object.ObjectRefMethodInfo
        ResolveX11VisualMethod "refSink" o = GObject.Object.ObjectRefSinkMethodInfo
        ResolveX11VisualMethod "runDispose" o = GObject.Object.ObjectRunDisposeMethodInfo
        ResolveX11VisualMethod "stealData" o = GObject.Object.ObjectStealDataMethodInfo
        ResolveX11VisualMethod "stealQdata" o = GObject.Object.ObjectStealQdataMethodInfo
        ResolveX11VisualMethod "thawNotify" o = GObject.Object.ObjectThawNotifyMethodInfo
        ResolveX11VisualMethod "unref" o = GObject.Object.ObjectUnrefMethodInfo
        ResolveX11VisualMethod "watchClosure" o = GObject.Object.ObjectWatchClosureMethodInfo
        ResolveX11VisualMethod "getBitsPerRgb" o = Gdk.Visual.VisualGetBitsPerRgbMethodInfo
        ResolveX11VisualMethod "getBluePixelDetails" o = Gdk.Visual.VisualGetBluePixelDetailsMethodInfo
        ResolveX11VisualMethod "getByteOrder" o = Gdk.Visual.VisualGetByteOrderMethodInfo
        ResolveX11VisualMethod "getColormapSize" o = Gdk.Visual.VisualGetColormapSizeMethodInfo
        ResolveX11VisualMethod "getData" o = GObject.Object.ObjectGetDataMethodInfo
        ResolveX11VisualMethod "getDepth" o = Gdk.Visual.VisualGetDepthMethodInfo
        ResolveX11VisualMethod "getGreenPixelDetails" o = Gdk.Visual.VisualGetGreenPixelDetailsMethodInfo
        ResolveX11VisualMethod "getProperty" o = GObject.Object.ObjectGetPropertyMethodInfo
        ResolveX11VisualMethod "getQdata" o = GObject.Object.ObjectGetQdataMethodInfo
        ResolveX11VisualMethod "getRedPixelDetails" o = Gdk.Visual.VisualGetRedPixelDetailsMethodInfo
        ResolveX11VisualMethod "getScreen" o = Gdk.Visual.VisualGetScreenMethodInfo
        ResolveX11VisualMethod "getVisualType" o = Gdk.Visual.VisualGetVisualTypeMethodInfo
        ResolveX11VisualMethod "getXvisual" o = X11VisualGetXvisualMethodInfo
        ResolveX11VisualMethod "setData" o = GObject.Object.ObjectSetDataMethodInfo
        ResolveX11VisualMethod "setDataFull" o = GObject.Object.ObjectSetDataFullMethodInfo
        ResolveX11VisualMethod "setProperty" o = GObject.Object.ObjectSetPropertyMethodInfo
        ResolveX11VisualMethod l o = O.MethodResolutionFailed l o

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

    #endif

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

    #if defined(ENABLE_OVERLOADING)
    #endif

    #if defined(ENABLE_OVERLOADING)
    type instance O.SignalList X11Visual = X11VisualSignalList
    type X11VisualSignalList = ('[ '("notify", GObject.Object.ObjectNotifySignalInfo)] :: [(Symbol, *)])

    #endif

    -- method X11Visual::get_xvisual
    -- method type : OrdinaryMethod
    -- Args: [ Arg
    --           { argCName = "visual"
    --           , argType =
    --               TInterface Name { namespace = "GdkX11" , name = "X11Visual" }
    --           , direction = DirectionIn
    --           , mayBeNull = False
    --           , argDoc =
    --               Documentation
    --                 { rawDocText = Just "a #GdkVisual." , sinceVersion = Nothing }
    --           , argScope = ScopeTypeInvalid
    --           , argClosure = -1
    --           , argDestroy = -1
    --           , argCallerAllocates = False
    --           , transfer = TransferNothing
    --           }
    --       ]
    -- Lengths: []
    -- returnType: Just (TInterface Name { namespace = "xlib" , name = "Visual" })
    -- throws : False
    -- Skip return : False

    foreign import ccall "gdk_x11_visual_get_xvisual" gdk_x11_visual_get_xvisual ::
        Ptr X11Visual ->                        -- visual : TInterface (Name {namespace = "GdkX11", name = "X11Visual"})
        IO (Ptr Xlib.Visual.Visual)

    -- | Returns the X visual belonging to a t'GI.Gdk.Objects.Visual.Visual'.
    x11VisualGetXvisual ::
        (B.CallStack.HasCallStack, MonadIO m, IsX11Visual a) =>
        a
        -- ^ /@visual@/: a t'GI.Gdk.Objects.Visual.Visual'.
        -> m Xlib.Visual.Visual
        -- ^ __Returns:__ an Xlib Visual*.
    x11VisualGetXvisual :: a -> m Visual
    x11VisualGetXvisual visual :: a
    visual = IO Visual -> m Visual
    forall (m :: * -> *) a. MonadIO m => IO a -> m a
    liftIO (IO Visual -> m Visual) -> IO Visual -> m Visual
    forall a b. (a -> b) -> a -> b
    $ do
        Ptr X11Visual
    visual' <- a -> IO (Ptr X11Visual)
    forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
    unsafeManagedPtrCastPtr a
    visual
        Ptr Visual
    result <- Ptr X11Visual -> IO (Ptr Visual)
    gdk_x11_visual_get_xvisual Ptr X11Visual
    visual'
        Text -> Ptr Visual -> IO ()
    forall a. HasCallStack => Text -> Ptr a -> IO ()
    checkUnexpectedReturnNULL "x11VisualGetXvisual" Ptr Visual
    result
        Visual
    result' <- ((ManagedPtr Visual -> Visual) -> Ptr Visual -> IO Visual
    forall a.
    (HasCallStack, BoxedPtr a) =>
    (ManagedPtr a -> a) -> Ptr a -> IO a
    newPtr ManagedPtr Visual -> Visual
    Xlib.Visual.Visual) Ptr Visual
    result
        a -> IO ()
    forall a. ManagedPtrNewtype a => a -> IO ()
    touchManagedPtr a
    visual
        Visual -> IO Visual
    forall (m :: * -> *) a. Monad m => a -> m a
    return Visual
    result'

    #if defined(ENABLE_OVERLOADING)
    data X11VisualGetXvisualMethodInfo
    instance (signature ~ (m Xlib.Visual.Visual), MonadIO m, IsX11Visual a) => O.MethodInfo X11VisualGetXvisualMethodInfo a signature where
        overloadedMethod = x11VisualGetXvisual

    #endif