dear-imgui-raw-1.0.0: src/DearImGui/Raw/ImGuiPlatformImeData.hsc
{-# LANGUAGE CApiFFI #-}
{-# LANGUAGE PatternSynonyms #-}
-- This file was generated by dear-bindings-ffi. Do not edit by hand.
module DearImGui.Raw.ImGuiPlatformImeData
( ImGuiPlatformImeData (..)
, destroy
, init
, withDefault
) where
import Control.Exception (bracket_)
import DearImGui.Raw (ImGuiID)
import DearImGui.Raw.ImVec2 (ImVec2)
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.h"
-- structs (opaque)
data {-# CTYPE "dcimgui_nodefaultargfunctions.h" "ImGuiPlatformImeData" #-} ImGuiPlatformImeData = ImGuiPlatformImeData
{ wantVisible :: CBool
, wantTextInput :: CBool
, inputPos :: ImVec2
, inputLineHeight :: Float
, viewportId :: ImGuiID
}
deriving (Eq, Show)
instance Storable ImGuiPlatformImeData where
sizeOf _ = #{size ImGuiPlatformImeData}
alignment _ = #{alignment ImGuiPlatformImeData}
peek p = ImGuiPlatformImeData <$> #{peek ImGuiPlatformImeData, WantVisible} p <*> #{peek ImGuiPlatformImeData, WantTextInput} p <*> #{peek ImGuiPlatformImeData, InputPos} p <*> #{peek ImGuiPlatformImeData, InputLineHeight} p <*> #{peek ImGuiPlatformImeData, ViewportId} p
poke p v = do
#{poke ImGuiPlatformImeData, WantVisible} p v.wantVisible
#{poke ImGuiPlatformImeData, WantTextInput} p v.wantTextInput
#{poke ImGuiPlatformImeData, InputPos} p v.inputPos
#{poke ImGuiPlatformImeData, InputLineHeight} p v.inputLineHeight
#{poke ImGuiPlatformImeData, ViewportId} p v.viewportId
instance HasField "wantVisible" (Ptr ImGuiPlatformImeData) (Ptr CBool) where
getField = #{ptr ImGuiPlatformImeData, WantVisible}
instance HasField "wantTextInput" (Ptr ImGuiPlatformImeData) (Ptr CBool) where
getField = #{ptr ImGuiPlatformImeData, WantTextInput}
instance HasField "inputPos" (Ptr ImGuiPlatformImeData) (Ptr ImVec2) where
getField = #{ptr ImGuiPlatformImeData, InputPos}
instance HasField "inputLineHeight" (Ptr ImGuiPlatformImeData) (Ptr Float) where
getField = #{ptr ImGuiPlatformImeData, InputLineHeight}
instance HasField "viewportId" (Ptr ImGuiPlatformImeData) (Ptr ImGuiID) where
getField = #{ptr ImGuiPlatformImeData, ViewportId}
foreign import capi unsafe "DearImGuiWrappers.h ImGuiPlatformImeData_Init_wrap"
init
:: Ptr ImGuiPlatformImeData
-> IO ()
foreign import capi unsafe "DearImGuiWrappers.h ImGuiPlatformImeData_Destroy_wrap"
destroy
:: Ptr ImGuiPlatformImeData
-> IO ()
withDefault :: (Ptr ImGuiPlatformImeData -> IO a) -> IO a
withDefault k = alloca $ \p -> bracket_ (init p) (destroy p) (k p)