dear-imgui-raw-implot-1.0.0: src/DearImGui/Raw/ImPlot/InputMap.hsc
{-# LANGUAGE CApiFFI #-}
{-# LANGUAGE PatternSynonyms #-}
-- This file was generated by dear-bindings-ffi. Do not edit by hand.
module DearImGui.Raw.ImPlot.InputMap
( InputMap (..)
, destroy
, init
, withDefault
) where
import Control.Exception (bracket_)
import DearImGui.Raw.Enums.ImGuiMouseButton (ImGuiMouseButton)
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_implot.h"
-- structs (opaque)
data {-# CTYPE "dcimgui_implot.h" "ImPlotInputMap" #-} InputMap = InputMap
{ pan :: ImGuiMouseButton
, panMod :: CInt
, fit :: ImGuiMouseButton
, select :: ImGuiMouseButton
, selectCancel :: ImGuiMouseButton
, selectMod :: CInt
, selectHorzMod :: CInt
, selectVertMod :: CInt
, menu :: ImGuiMouseButton
, overrideMod :: CInt
, zoomMod :: CInt
, zoomRate :: Float
}
deriving (Eq, Show)
instance Storable InputMap where
sizeOf _ = #{size ImPlotInputMap}
alignment _ = #{alignment ImPlotInputMap}
peek p = InputMap <$> #{peek ImPlotInputMap, Pan} p <*> #{peek ImPlotInputMap, PanMod} p <*> #{peek ImPlotInputMap, Fit} p <*> #{peek ImPlotInputMap, Select} p <*> #{peek ImPlotInputMap, SelectCancel} p <*> #{peek ImPlotInputMap, SelectMod} p <*> #{peek ImPlotInputMap, SelectHorzMod} p <*> #{peek ImPlotInputMap, SelectVertMod} p <*> #{peek ImPlotInputMap, Menu} p <*> #{peek ImPlotInputMap, OverrideMod} p <*> #{peek ImPlotInputMap, ZoomMod} p <*> #{peek ImPlotInputMap, ZoomRate} p
poke p v = do
#{poke ImPlotInputMap, Pan} p v.pan
#{poke ImPlotInputMap, PanMod} p v.panMod
#{poke ImPlotInputMap, Fit} p v.fit
#{poke ImPlotInputMap, Select} p v.select
#{poke ImPlotInputMap, SelectCancel} p v.selectCancel
#{poke ImPlotInputMap, SelectMod} p v.selectMod
#{poke ImPlotInputMap, SelectHorzMod} p v.selectHorzMod
#{poke ImPlotInputMap, SelectVertMod} p v.selectVertMod
#{poke ImPlotInputMap, Menu} p v.menu
#{poke ImPlotInputMap, OverrideMod} p v.overrideMod
#{poke ImPlotInputMap, ZoomMod} p v.zoomMod
#{poke ImPlotInputMap, ZoomRate} p v.zoomRate
instance HasField "pan" (Ptr InputMap) (Ptr ImGuiMouseButton) where
getField = #{ptr ImPlotInputMap, Pan}
instance HasField "panMod" (Ptr InputMap) (Ptr CInt) where
getField = #{ptr ImPlotInputMap, PanMod}
instance HasField "fit" (Ptr InputMap) (Ptr ImGuiMouseButton) where
getField = #{ptr ImPlotInputMap, Fit}
instance HasField "select" (Ptr InputMap) (Ptr ImGuiMouseButton) where
getField = #{ptr ImPlotInputMap, Select}
instance HasField "selectCancel" (Ptr InputMap) (Ptr ImGuiMouseButton) where
getField = #{ptr ImPlotInputMap, SelectCancel}
instance HasField "selectMod" (Ptr InputMap) (Ptr CInt) where
getField = #{ptr ImPlotInputMap, SelectMod}
instance HasField "selectHorzMod" (Ptr InputMap) (Ptr CInt) where
getField = #{ptr ImPlotInputMap, SelectHorzMod}
instance HasField "selectVertMod" (Ptr InputMap) (Ptr CInt) where
getField = #{ptr ImPlotInputMap, SelectVertMod}
instance HasField "menu" (Ptr InputMap) (Ptr ImGuiMouseButton) where
getField = #{ptr ImPlotInputMap, Menu}
instance HasField "overrideMod" (Ptr InputMap) (Ptr CInt) where
getField = #{ptr ImPlotInputMap, OverrideMod}
instance HasField "zoomMod" (Ptr InputMap) (Ptr CInt) where
getField = #{ptr ImPlotInputMap, ZoomMod}
instance HasField "zoomRate" (Ptr InputMap) (Ptr Float) where
getField = #{ptr ImPlotInputMap, ZoomRate}
foreign import capi unsafe "DearImGuiWrappers.h ImPlotInputMap_Init_wrap"
init
:: Ptr InputMap
-> IO ()
foreign import capi unsafe "DearImGuiWrappers.h ImPlotInputMap_Destroy_wrap"
destroy
:: Ptr InputMap
-> IO ()
withDefault :: (Ptr InputMap -> IO a) -> IO a
withDefault k = alloca $ \p -> bracket_ (init p) (destroy p) (k p)