packages feed

dear-imgui-raw-implot-1.0.0: src/DearImGui/Raw/ImPlot/Style.hsc

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

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

module DearImGui.Raw.ImPlot.Style
  ( Style
  , colorsLength
  , destroy
  , init
  , withDefault
  ) where

import Control.Exception (bracket_)
import DearImGui.Raw.ImPlot.Enums.Colormap (Colormap)
import DearImGui.Raw.ImVec2 (ImVec2)
import DearImGui.Raw.ImVec4 (ImVec4)
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 Style
instance Storable Style where
  sizeOf _    = #{size ImPlotStyle}
  alignment _ = #{alignment ImPlotStyle}
  peek _ = error "Style: opaque struct, peek not supported in v0"
  poke _ _ = error "Style: opaque struct, poke not supported in v0"

instance HasField "plotDefaultSize" (Ptr Style) (Ptr ImVec2) where
  getField = #{ptr ImPlotStyle, PlotDefaultSize}

instance HasField "plotMinSize" (Ptr Style) (Ptr ImVec2) where
  getField = #{ptr ImPlotStyle, PlotMinSize}

instance HasField "plotBorderSize" (Ptr Style) (Ptr Float) where
  getField = #{ptr ImPlotStyle, PlotBorderSize}

instance HasField "minorAlpha" (Ptr Style) (Ptr Float) where
  getField = #{ptr ImPlotStyle, MinorAlpha}

instance HasField "majorTickLen" (Ptr Style) (Ptr ImVec2) where
  getField = #{ptr ImPlotStyle, MajorTickLen}

instance HasField "minorTickLen" (Ptr Style) (Ptr ImVec2) where
  getField = #{ptr ImPlotStyle, MinorTickLen}

instance HasField "majorTickSize" (Ptr Style) (Ptr ImVec2) where
  getField = #{ptr ImPlotStyle, MajorTickSize}

instance HasField "minorTickSize" (Ptr Style) (Ptr ImVec2) where
  getField = #{ptr ImPlotStyle, MinorTickSize}

instance HasField "majorGridSize" (Ptr Style) (Ptr ImVec2) where
  getField = #{ptr ImPlotStyle, MajorGridSize}

instance HasField "minorGridSize" (Ptr Style) (Ptr ImVec2) where
  getField = #{ptr ImPlotStyle, MinorGridSize}

instance HasField "plotPadding" (Ptr Style) (Ptr ImVec2) where
  getField = #{ptr ImPlotStyle, PlotPadding}

instance HasField "labelPadding" (Ptr Style) (Ptr ImVec2) where
  getField = #{ptr ImPlotStyle, LabelPadding}

instance HasField "legendPadding" (Ptr Style) (Ptr ImVec2) where
  getField = #{ptr ImPlotStyle, LegendPadding}

instance HasField "legendInnerPadding" (Ptr Style) (Ptr ImVec2) where
  getField = #{ptr ImPlotStyle, LegendInnerPadding}

instance HasField "legendSpacing" (Ptr Style) (Ptr ImVec2) where
  getField = #{ptr ImPlotStyle, LegendSpacing}

instance HasField "mousePosPadding" (Ptr Style) (Ptr ImVec2) where
  getField = #{ptr ImPlotStyle, MousePosPadding}

instance HasField "annotationPadding" (Ptr Style) (Ptr ImVec2) where
  getField = #{ptr ImPlotStyle, AnnotationPadding}

instance HasField "fitPadding" (Ptr Style) (Ptr ImVec2) where
  getField = #{ptr ImPlotStyle, FitPadding}

instance HasField "digitalPadding" (Ptr Style) (Ptr Float) where
  getField = #{ptr ImPlotStyle, DigitalPadding}

instance HasField "digitalSpacing" (Ptr Style) (Ptr Float) where
  getField = #{ptr ImPlotStyle, DigitalSpacing}

instance HasField "colors" (Ptr Style) (Ptr ImVec4) where
  getField = #{ptr ImPlotStyle, Colors}

colorsLength :: Int
colorsLength = #{const ImPlotCol_COUNT}

instance HasField "colormap" (Ptr Style) (Ptr Colormap) where
  getField = #{ptr ImPlotStyle, Colormap}

instance HasField "useLocalTime" (Ptr Style) (Ptr CBool) where
  getField = #{ptr ImPlotStyle, UseLocalTime}

instance HasField "useISO8601" (Ptr Style) (Ptr CBool) where
  getField = #{ptr ImPlotStyle, UseISO8601}

instance HasField "use24HourClock" (Ptr Style) (Ptr CBool) where
  getField = #{ptr ImPlotStyle, Use24HourClock}

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

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

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