packages feed

dear-imgui-raw-internal-1.0.0: src/DearImGui/Raw/Internal/ImGuiInputTextDeactivatedState.hsc

{-# LANGUAGE CApiFFI #-}
{-# LANGUAGE PatternSynonyms #-}

-- This file was generated by dear-bindings-ffi. Do not edit by hand.

module DearImGui.Raw.Internal.ImGuiInputTextDeactivatedState
  ( ImGuiInputTextDeactivatedState (..)
  , clearFreeMemory
  , destroy
  , init
  , withDefault
  ) where

import Control.Exception (bracket_)
import DearImGui.Raw (ImGuiID)
import DearImGui.Raw.ImVector (ImVector)
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" "ImGuiInputTextDeactivatedState" #-} ImGuiInputTextDeactivatedState = ImGuiInputTextDeactivatedState
  { iD :: ImGuiID
  , elapseFrame :: CInt
  , textA :: ImVector CChar
  }
  deriving (Eq, Show)
instance Storable ImGuiInputTextDeactivatedState where
  sizeOf _    = #{size ImGuiInputTextDeactivatedState}
  alignment _ = #{alignment ImGuiInputTextDeactivatedState}
  peek p = ImGuiInputTextDeactivatedState <$> #{peek ImGuiInputTextDeactivatedState, ID} p <*> #{peek ImGuiInputTextDeactivatedState, ElapseFrame} p <*> #{peek ImGuiInputTextDeactivatedState, TextA} p
  poke p v = do
    #{poke ImGuiInputTextDeactivatedState, ID} p v.iD
    #{poke ImGuiInputTextDeactivatedState, ElapseFrame} p v.elapseFrame
    #{poke ImGuiInputTextDeactivatedState, TextA} p v.textA

instance HasField "iD" (Ptr ImGuiInputTextDeactivatedState) (Ptr ImGuiID) where
  getField = #{ptr ImGuiInputTextDeactivatedState, ID}

instance HasField "elapseFrame" (Ptr ImGuiInputTextDeactivatedState) (Ptr CInt) where
  getField = #{ptr ImGuiInputTextDeactivatedState, ElapseFrame}

instance HasField "textA" (Ptr ImGuiInputTextDeactivatedState) (Ptr (ImVector CChar)) where
  getField = #{ptr ImGuiInputTextDeactivatedState, TextA}

foreign import capi unsafe "DearImGuiWrappers.h ImGuiInputTextDeactivatedState_Init_wrap"
  init
    :: Ptr ImGuiInputTextDeactivatedState
    -> IO ()

foreign import capi unsafe "DearImGuiWrappers.h ImGuiInputTextDeactivatedState_Destroy_wrap"
  destroy
    :: Ptr ImGuiInputTextDeactivatedState
    -> IO ()

withDefault :: (Ptr ImGuiInputTextDeactivatedState -> IO a) -> IO a
withDefault k = alloca $ \p -> bracket_ (init p) (destroy p) (k p)

-- functions

-- C: void ClearFreeMemory(ImGuiInputTextDeactivatedState* self)
foreign import capi unsafe "dcimgui_nodefaultargfunctions_internal.h ImGuiInputTextDeactivatedState_ClearFreeMemory"
  clearFreeMemory
    :: (Ptr ImGuiInputTextDeactivatedState) -- ^ self
    -> IO ()