packages feed

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

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

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

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

import Control.Exception (bracket_)
import DearImGui.Raw (ImGuiID)
import DearImGui.Raw.ImVec2 (ImVec2)
import DearImGui.Raw.Internal.ImVec1 (ImVec1)
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" "ImGuiGroupData" #-} ImGuiGroupData = ImGuiGroupData
  { windowID :: ImGuiID
  , backupCursorPos :: ImVec2
  , backupCursorMaxPos :: ImVec2
  , backupCursorPosPrevLine :: ImVec2
  , backupIndent :: ImVec1
  , backupGroupOffset :: ImVec1
  , backupCurrLineSize :: ImVec2
  , backupCurrLineTextBaseOffset :: Float
  , backupActiveIdIsAlive :: ImGuiID
  , backupAnyIdHasBeenEditedThisFrame :: CBool
  , backupDeactivatedIdIsAlive :: CBool
  , backupHoveredIdIsAlive :: CBool
  , backupIsSameLine :: CBool
  , emitItem :: CBool
  }
  deriving (Eq, Show)
instance Storable ImGuiGroupData where
  sizeOf _    = #{size ImGuiGroupData}
  alignment _ = #{alignment ImGuiGroupData}
  peek p = ImGuiGroupData <$> #{peek ImGuiGroupData, WindowID} p <*> #{peek ImGuiGroupData, BackupCursorPos} p <*> #{peek ImGuiGroupData, BackupCursorMaxPos} p <*> #{peek ImGuiGroupData, BackupCursorPosPrevLine} p <*> #{peek ImGuiGroupData, BackupIndent} p <*> #{peek ImGuiGroupData, BackupGroupOffset} p <*> #{peek ImGuiGroupData, BackupCurrLineSize} p <*> #{peek ImGuiGroupData, BackupCurrLineTextBaseOffset} p <*> #{peek ImGuiGroupData, BackupActiveIdIsAlive} p <*> #{peek ImGuiGroupData, BackupAnyIdHasBeenEditedThisFrame} p <*> #{peek ImGuiGroupData, BackupDeactivatedIdIsAlive} p <*> #{peek ImGuiGroupData, BackupHoveredIdIsAlive} p <*> #{peek ImGuiGroupData, BackupIsSameLine} p <*> #{peek ImGuiGroupData, EmitItem} p
  poke p v = do
    #{poke ImGuiGroupData, WindowID} p v.windowID
    #{poke ImGuiGroupData, BackupCursorPos} p v.backupCursorPos
    #{poke ImGuiGroupData, BackupCursorMaxPos} p v.backupCursorMaxPos
    #{poke ImGuiGroupData, BackupCursorPosPrevLine} p v.backupCursorPosPrevLine
    #{poke ImGuiGroupData, BackupIndent} p v.backupIndent
    #{poke ImGuiGroupData, BackupGroupOffset} p v.backupGroupOffset
    #{poke ImGuiGroupData, BackupCurrLineSize} p v.backupCurrLineSize
    #{poke ImGuiGroupData, BackupCurrLineTextBaseOffset} p v.backupCurrLineTextBaseOffset
    #{poke ImGuiGroupData, BackupActiveIdIsAlive} p v.backupActiveIdIsAlive
    #{poke ImGuiGroupData, BackupAnyIdHasBeenEditedThisFrame} p v.backupAnyIdHasBeenEditedThisFrame
    #{poke ImGuiGroupData, BackupDeactivatedIdIsAlive} p v.backupDeactivatedIdIsAlive
    #{poke ImGuiGroupData, BackupHoveredIdIsAlive} p v.backupHoveredIdIsAlive
    #{poke ImGuiGroupData, BackupIsSameLine} p v.backupIsSameLine
    #{poke ImGuiGroupData, EmitItem} p v.emitItem

instance HasField "windowID" (Ptr ImGuiGroupData) (Ptr ImGuiID) where
  getField = #{ptr ImGuiGroupData, WindowID}

instance HasField "backupCursorPos" (Ptr ImGuiGroupData) (Ptr ImVec2) where
  getField = #{ptr ImGuiGroupData, BackupCursorPos}

instance HasField "backupCursorMaxPos" (Ptr ImGuiGroupData) (Ptr ImVec2) where
  getField = #{ptr ImGuiGroupData, BackupCursorMaxPos}

instance HasField "backupCursorPosPrevLine" (Ptr ImGuiGroupData) (Ptr ImVec2) where
  getField = #{ptr ImGuiGroupData, BackupCursorPosPrevLine}

instance HasField "backupIndent" (Ptr ImGuiGroupData) (Ptr ImVec1) where
  getField = #{ptr ImGuiGroupData, BackupIndent}

instance HasField "backupGroupOffset" (Ptr ImGuiGroupData) (Ptr ImVec1) where
  getField = #{ptr ImGuiGroupData, BackupGroupOffset}

instance HasField "backupCurrLineSize" (Ptr ImGuiGroupData) (Ptr ImVec2) where
  getField = #{ptr ImGuiGroupData, BackupCurrLineSize}

instance HasField "backupCurrLineTextBaseOffset" (Ptr ImGuiGroupData) (Ptr Float) where
  getField = #{ptr ImGuiGroupData, BackupCurrLineTextBaseOffset}

instance HasField "backupActiveIdIsAlive" (Ptr ImGuiGroupData) (Ptr ImGuiID) where
  getField = #{ptr ImGuiGroupData, BackupActiveIdIsAlive}

instance HasField "backupAnyIdHasBeenEditedThisFrame" (Ptr ImGuiGroupData) (Ptr CBool) where
  getField = #{ptr ImGuiGroupData, BackupAnyIdHasBeenEditedThisFrame}

instance HasField "backupDeactivatedIdIsAlive" (Ptr ImGuiGroupData) (Ptr CBool) where
  getField = #{ptr ImGuiGroupData, BackupDeactivatedIdIsAlive}

instance HasField "backupHoveredIdIsAlive" (Ptr ImGuiGroupData) (Ptr CBool) where
  getField = #{ptr ImGuiGroupData, BackupHoveredIdIsAlive}

instance HasField "backupIsSameLine" (Ptr ImGuiGroupData) (Ptr CBool) where
  getField = #{ptr ImGuiGroupData, BackupIsSameLine}

instance HasField "emitItem" (Ptr ImGuiGroupData) (Ptr CBool) where
  getField = #{ptr ImGuiGroupData, EmitItem}

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

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

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