dear-imgui-raw-internal-1.0.0: src/DearImGui/Raw/Internal/ImGuiKeyOwnerData.hsc
{-# LANGUAGE CApiFFI #-}
{-# LANGUAGE PatternSynonyms #-}
-- This file was generated by dear-bindings-ffi. Do not edit by hand.
module DearImGui.Raw.Internal.ImGuiKeyOwnerData
( ImGuiKeyOwnerData (..)
, destroy
, init
, withDefault
) where
import Control.Exception (bracket_)
import DearImGui.Raw (ImGuiID)
import Foreign.C.Types
import Foreign.Marshal.Alloc (alloca)
import Foreign.Ptr (Ptr, plusPtr)
import Foreign.Storable (Storable (..))
import GHC.Records (HasField (..))
import Prelude hiding (init)
#include "dcimgui_nodefaultargfunctions_internal.h"
-- structs (opaque)
data {-# CTYPE "dcimgui_nodefaultargfunctions_internal.h" "ImGuiKeyOwnerData" #-} ImGuiKeyOwnerData = ImGuiKeyOwnerData
{ ownerCurr :: ImGuiID
, ownerNext :: ImGuiID
, lockThisFrame :: CBool
, lockUntilRelease :: CBool
}
deriving (Eq, Show)
instance Storable ImGuiKeyOwnerData where
sizeOf _ = #{size ImGuiKeyOwnerData}
alignment _ = #{alignment ImGuiKeyOwnerData}
peek p = ImGuiKeyOwnerData <$> #{peek ImGuiKeyOwnerData, OwnerCurr} p <*> #{peek ImGuiKeyOwnerData, OwnerNext} p <*> #{peek ImGuiKeyOwnerData, LockThisFrame} p <*> #{peek ImGuiKeyOwnerData, LockUntilRelease} p
poke p v = do
#{poke ImGuiKeyOwnerData, OwnerCurr} p v.ownerCurr
#{poke ImGuiKeyOwnerData, OwnerNext} p v.ownerNext
#{poke ImGuiKeyOwnerData, LockThisFrame} p v.lockThisFrame
#{poke ImGuiKeyOwnerData, LockUntilRelease} p v.lockUntilRelease
instance HasField "ownerCurr" (Ptr ImGuiKeyOwnerData) (Ptr ImGuiID) where
getField = #{ptr ImGuiKeyOwnerData, OwnerCurr}
instance HasField "ownerNext" (Ptr ImGuiKeyOwnerData) (Ptr ImGuiID) where
getField = #{ptr ImGuiKeyOwnerData, OwnerNext}
instance HasField "lockThisFrame" (Ptr ImGuiKeyOwnerData) (Ptr CBool) where
getField = #{ptr ImGuiKeyOwnerData, LockThisFrame}
instance HasField "lockUntilRelease" (Ptr ImGuiKeyOwnerData) (Ptr CBool) where
getField = #{ptr ImGuiKeyOwnerData, LockUntilRelease}
foreign import capi unsafe "DearImGuiWrappers.h ImGuiKeyOwnerData_Init_wrap"
init
:: Ptr ImGuiKeyOwnerData
-> IO ()
foreign import capi unsafe "DearImGuiWrappers.h ImGuiKeyOwnerData_Destroy_wrap"
destroy
:: Ptr ImGuiKeyOwnerData
-> IO ()
withDefault :: (Ptr ImGuiKeyOwnerData -> IO a) -> IO a
withDefault k = alloca $ \p -> bracket_ (init p) (destroy p) (k p)