    {-# LANGUAGE TypeApplications #-}

    -- | Copyright  : Will Thompson and Iñaki García Etxebarria
    -- License    : LGPL-2.1
    -- Maintainer : Iñaki García Etxebarria
    --
    -- A t'GI.Gdk.Structs.TimeCoord.TimeCoord' stores a single event in a motion history.

    #if !defined(__HADDOCK_VERSION__)
    #define ENABLE_OVERLOADING
    #endif

    module GI.Gdk.Structs.TimeCoord
        (

    -- * Exported types
        TimeCoord(..)                           ,
        newZeroTimeCoord                        ,

     -- * Methods

    #if defined(ENABLE_OVERLOADING)
        ResolveTimeCoordMethod                  ,
    #endif

     -- * Properties

    -- ** time #attr:time#
    -- | The timestamp for this event.

        getTimeCoordTime                        ,
        setTimeCoordTime                        ,
    #if defined(ENABLE_OVERLOADING)
        timeCoord_time                          ,
    #endif

        ) 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

    -- Workaround for https://gitlab.haskell.org/ghc/ghc/-/issues/23392
    #if MIN_VERSION_base(4,18,0)

    #else

    #endif

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

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

    instance BoxedPtr TimeCoord where
        boxedPtrCopy :: TimeCoord -> IO TimeCoord
    boxedPtrCopy = \TimeCoord
    p -> TimeCoord -> (Ptr TimeCoord -> IO TimeCoord) -> IO TimeCoord
    forall a c.
    (HasCallStack, ManagedPtrNewtype a) =>
    a -> (Ptr a -> IO c) -> IO c
    B.ManagedPtr.withManagedPtr TimeCoord
    p (Int -> Ptr TimeCoord -> IO (Ptr TimeCoord)
    forall a. (HasCallStack, CallocPtr a) => Int -> Ptr a -> IO (Ptr a)
    copyBytes Int
    1032 (Ptr TimeCoord -> IO (Ptr TimeCoord))
    -> (Ptr TimeCoord -> IO TimeCoord) -> Ptr TimeCoord -> IO TimeCoord
    forall (m :: * -> *) a b c.
    Monad m =>
    (a -> m b) -> (b -> m c) -> a -> m c
    >=> (ManagedPtr TimeCoord -> TimeCoord)
    -> Ptr TimeCoord -> IO TimeCoord
    forall a.
    (HasCallStack, BoxedPtr a) =>
    (ManagedPtr a -> a) -> Ptr a -> IO a
    B.ManagedPtr.wrapPtr ManagedPtr TimeCoord -> TimeCoord
    TimeCoord)
        boxedPtrFree :: TimeCoord -> IO ()
    boxedPtrFree = \TimeCoord
    x -> TimeCoord -> (Ptr TimeCoord -> IO ()) -> IO ()
    forall a c.
    (HasCallStack, ManagedPtrNewtype a) =>
    a -> (Ptr a -> IO c) -> IO c
    SP.withManagedPtr TimeCoord
    x Ptr TimeCoord -> IO ()
    forall a. Ptr a -> IO ()
    SP.freeMem
    instance CallocPtr TimeCoord where
        boxedPtrCalloc :: IO (Ptr TimeCoord)
    boxedPtrCalloc = Int -> IO (Ptr TimeCoord)
    forall a. Int -> IO (Ptr a)
    callocBytes Int
    1032

    -- | Construct a t'TimeCoord' struct initialized to zero.
    newZeroTimeCoord :: MonadIO m => m TimeCoord
    newZeroTimeCoord :: forall (m :: * -> *). MonadIO m => m TimeCoord
    newZeroTimeCoord = IO TimeCoord -> m TimeCoord
    forall a. IO a -> m a
    forall (m :: * -> *) a. MonadIO m => IO a -> m a
    liftIO (IO TimeCoord -> m TimeCoord) -> IO TimeCoord -> m TimeCoord
    forall a b. (a -> b) -> a -> b
    $ IO (Ptr TimeCoord)
    forall a. CallocPtr a => IO (Ptr a)
    boxedPtrCalloc IO (Ptr TimeCoord)
    -> (Ptr TimeCoord -> IO TimeCoord) -> IO TimeCoord
    forall a b. IO a -> (a -> IO b) -> IO b
    forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
    >>= (ManagedPtr TimeCoord -> TimeCoord)
    -> Ptr TimeCoord -> IO TimeCoord
    forall a.
    (HasCallStack, BoxedPtr a) =>
    (ManagedPtr a -> a) -> Ptr a -> IO a
    wrapPtr ManagedPtr TimeCoord -> TimeCoord
    TimeCoord

    instance tag ~ 'AttrSet => Constructible TimeCoord tag where
        new :: forall (m :: * -> *).
    MonadIO m =>
    (ManagedPtr TimeCoord -> TimeCoord)
    -> [AttrOp TimeCoord tag] -> m TimeCoord
    new ManagedPtr TimeCoord -> TimeCoord
    _ [AttrOp TimeCoord tag]
    attrs = do
            o <- m TimeCoord
    forall (m :: * -> *). MonadIO m => m TimeCoord
    newZeroTimeCoord
            GI.Attributes.set o attrs
            return o

    -- | Get the value of the “@time@” field.
    -- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
    --
    -- @
    -- 'Data.GI.Base.Attributes.get' timeCoord #time
    -- @
    getTimeCoordTime :: MonadIO m => TimeCoord -> m Word32
    getTimeCoordTime :: forall (m :: * -> *). MonadIO m => TimeCoord -> m Word32
    getTimeCoordTime TimeCoord
    s = 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
    $ TimeCoord -> (Ptr TimeCoord -> IO Word32) -> IO Word32
    forall a c.
    (HasCallStack, ManagedPtrNewtype a) =>
    a -> (Ptr a -> IO c) -> IO c
    withManagedPtr TimeCoord
    s ((Ptr TimeCoord -> IO Word32) -> IO Word32)
    -> (Ptr TimeCoord -> IO Word32) -> IO Word32
    forall a b. (a -> b) -> a -> b
    $ \Ptr TimeCoord
    ptr -> do
        val <- Ptr Word32 -> IO Word32
    forall a. Storable a => Ptr a -> IO a
    peek (Ptr TimeCoord
    ptr Ptr TimeCoord -> Int -> Ptr Word32
    forall a b. Ptr a -> Int -> Ptr b
    `plusPtr` Int
    0) :: IO Word32
        return val

    -- | Set the value of the “@time@” field.
    -- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
    --
    -- @
    -- 'Data.GI.Base.Attributes.set' timeCoord [ #time 'Data.GI.Base.Attributes.:=' value ]
    -- @
    setTimeCoordTime :: MonadIO m => TimeCoord -> Word32 -> m ()
    setTimeCoordTime :: forall (m :: * -> *). MonadIO m => TimeCoord -> Word32 -> m ()
    setTimeCoordTime TimeCoord
    s Word32
    val = 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
    $ TimeCoord -> (Ptr TimeCoord -> IO ()) -> IO ()
    forall a c.
    (HasCallStack, ManagedPtrNewtype a) =>
    a -> (Ptr a -> IO c) -> IO c
    withManagedPtr TimeCoord
    s ((Ptr TimeCoord -> IO ()) -> IO ())
    -> (Ptr TimeCoord -> IO ()) -> IO ()
    forall a b. (a -> b) -> a -> b
    $ \Ptr TimeCoord
    ptr -> do
        Ptr Word32 -> Word32 -> IO ()
    forall a. Storable a => Ptr a -> a -> IO ()
    poke (Ptr TimeCoord
    ptr Ptr TimeCoord -> Int -> Ptr Word32
    forall a b. Ptr a -> Int -> Ptr b
    `plusPtr` Int
    0) (Word32
    val :: Word32)

    #if defined(ENABLE_OVERLOADING)
    data TimeCoordTimeFieldInfo
    instance AttrInfo TimeCoordTimeFieldInfo where
        type AttrBaseTypeConstraint TimeCoordTimeFieldInfo = (~) TimeCoord
        type AttrAllowedOps TimeCoordTimeFieldInfo = '[ 'AttrSet, 'AttrGet]
        type AttrSetTypeConstraint TimeCoordTimeFieldInfo = (~) Word32
        type AttrTransferTypeConstraint TimeCoordTimeFieldInfo = (~)Word32
        type AttrTransferType TimeCoordTimeFieldInfo = Word32
        type AttrGetType TimeCoordTimeFieldInfo = Word32
        type AttrLabel TimeCoordTimeFieldInfo = "time"
        type AttrOrigin TimeCoordTimeFieldInfo = TimeCoord
        attrGet = getTimeCoordTime
        attrSet = setTimeCoordTime
        attrConstruct = undefined
        attrClear = undefined
        attrTransfer _ v = do
            return v
        dbgAttrInfo = P.Just (O.ResolvedSymbolInfo {
            O.resolvedSymbolName = "GI.Gdk.Structs.TimeCoord.time"
            , O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gdk3-3.0.30/docs/GI-Gdk-Structs-TimeCoord.html#g:attr:time"
            })

    timeCoord_time :: AttrLabelProxy "time"
    timeCoord_time = AttrLabelProxy

    #endif

    -- XXX Skipped attribute for "TimeCoord:axes"
    -- Not implemented: Don't know how to unpack C array of type TCArray False 128 (-1) (TBasicType TDouble)

    #if defined(ENABLE_OVERLOADING)
    instance O.HasAttributeList TimeCoord
    type instance O.AttributeList TimeCoord = TimeCoordAttributeList
    type TimeCoordAttributeList = ('[ '("time", TimeCoordTimeFieldInfo)] :: [(Symbol, DK.Type)])
    #endif

    #if defined(ENABLE_OVERLOADING)
    type family ResolveTimeCoordMethod (t :: Symbol) (o :: DK.Type) :: DK.Type where
        ResolveTimeCoordMethod l o = O.MethodResolutionFailed l o

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

    #endif

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

    #endif