packages feed

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

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

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

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

import Control.Exception (bracket_)
import DearImGui.Raw (ImGuiID)
import DearImGui.Raw.ImVec2 (ImVec2)
import {-# SOURCE #-} DearImGui.Raw.Internal.ImGuiWindow (ImGuiWindow)
import DearImGui.Raw.Internal.ImRect (ImRect)
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 ImGuiBoxSelectState
instance Storable ImGuiBoxSelectState where
  sizeOf _    = #{size ImGuiBoxSelectState}
  alignment _ = #{alignment ImGuiBoxSelectState}
  peek _ = error "ImGuiBoxSelectState: opaque struct, peek not supported in v0"
  poke _ _ = error "ImGuiBoxSelectState: opaque struct, poke not supported in v0"

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

instance HasField "isActive" (Ptr ImGuiBoxSelectState) (Ptr CBool) where
  getField = #{ptr ImGuiBoxSelectState, IsActive}

instance HasField "isStarting" (Ptr ImGuiBoxSelectState) (Ptr CBool) where
  getField = #{ptr ImGuiBoxSelectState, IsStarting}

instance HasField "isStartedFromVoid" (Ptr ImGuiBoxSelectState) (Ptr CBool) where
  getField = #{ptr ImGuiBoxSelectState, IsStartedFromVoid}

instance HasField "isStartedSetNavIdOnce" (Ptr ImGuiBoxSelectState) (Ptr CBool) where
  getField = #{ptr ImGuiBoxSelectState, IsStartedSetNavIdOnce}

instance HasField "requestClear" (Ptr ImGuiBoxSelectState) (Ptr CBool) where
  getField = #{ptr ImGuiBoxSelectState, RequestClear}

instance HasField "startPosRel" (Ptr ImGuiBoxSelectState) (Ptr ImVec2) where
  getField = #{ptr ImGuiBoxSelectState, StartPosRel}

instance HasField "endPosRel" (Ptr ImGuiBoxSelectState) (Ptr ImVec2) where
  getField = #{ptr ImGuiBoxSelectState, EndPosRel}

instance HasField "scrollAccum" (Ptr ImGuiBoxSelectState) (Ptr ImVec2) where
  getField = #{ptr ImGuiBoxSelectState, ScrollAccum}

instance HasField "window" (Ptr ImGuiBoxSelectState) (Ptr (Ptr ImGuiWindow)) where
  getField = #{ptr ImGuiBoxSelectState, Window}

instance HasField "unclipMode" (Ptr ImGuiBoxSelectState) (Ptr CBool) where
  getField = #{ptr ImGuiBoxSelectState, UnclipMode}

instance HasField "unclipRect" (Ptr ImGuiBoxSelectState) (Ptr ImRect) where
  getField = #{ptr ImGuiBoxSelectState, UnclipRect}

instance HasField "unclipRects" (Ptr ImGuiBoxSelectState) (Ptr ImRect) where
  getField = #{ptr ImGuiBoxSelectState, UnclipRects}

unclipRectsLength :: Int
unclipRectsLength = #{const 2}

instance HasField "boxSelectRectPrev" (Ptr ImGuiBoxSelectState) (Ptr ImRect) where
  getField = #{ptr ImGuiBoxSelectState, BoxSelectRectPrev}

instance HasField "boxSelectRectCurr" (Ptr ImGuiBoxSelectState) (Ptr ImRect) where
  getField = #{ptr ImGuiBoxSelectState, BoxSelectRectCurr}

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

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

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