{-# LANGUAGE BlockArguments #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE LambdaCase #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
module DearImGui
(
Raw.Context(..)
, Raw.createContext
, Raw.destroyContext
, Raw.getCurrentContext
, Raw.setCurrentContext
, Raw.newFrame
, Raw.endFrame
, Raw.render
, Raw.DrawData(..)
, Raw.getDrawData
, Raw.checkVersion
, Raw.showDemoWindow
, Raw.showIDStackToolWindow
, Raw.showMetricsWindow
, Raw.showAboutWindow
, Raw.showStyleSelector
, Raw.showFontSelector
, Raw.showUserGuide
, getVersion
, Raw.showDebugLogWindow
, Raw.logButtons
, logText
, Raw.styleColorsDark
, Raw.styleColorsLight
, Raw.styleColorsClassic
, withWindow
, withWindowOpen
, withCloseableWindow
, withFullscreen
, fullscreenFlags
, begin
, Raw.end
, Raw.getWindowDrawList
, Raw.getWindowPos
, Raw.getWindowSize
, Raw.getWindowWidth
, Raw.getWindowHeight
, Raw.isWindowAppearing
, Raw.isWindowCollapsed
, Raw.isWindowFocused
, setNextWindowPos
, setNextWindowSize
, Raw.setNextWindowFullscreen
, setNextWindowContentSize
, setNextWindowSizeConstraints
, setNextWindowCollapsed
, Raw.setNextWindowFocus
, setNextWindowScroll
, setNextWindowBgAlpha
, Raw.getContentRegionAvail
, Raw.getContentRegionMax
, Raw.getWindowContentRegionMin
, Raw.getWindowContentRegionMax
, withChild
, withChildOpen
, withChildContext
, beginChild
, Raw.endChild
, withStyleColor
, pushStyleColor
, Raw.popStyleColor
, withStyleVar
, pushStyleVar
, popStyleVar
, Raw.pushTabStop
, Raw.popTabStop
, withFont
, Raw.Font.pushFont
, Raw.Font.popFont
, Raw.Font.Font
, Raw.separator
, Raw.sameLine
, Raw.newLine
, Raw.spacing
, dummy
, withIndent
, indent
, unindent
, setNextItemWidth
, withItemWidth
, pushItemWidth
, Raw.popItemWidth
, Raw.calcItemWidth
, withTextWrapPos
, pushTextWrapPos
, Raw.popTextWrapPos
, withGroup
, Raw.beginGroup
, Raw.endGroup
, setCursorPos
, setCursorPosX
, setCursorPosY
, setCursorScreenPos
, Raw.getCursorPos
, getCursorPosX
, getCursorPosY
, Raw.getCursorStartPos
, Raw.alignTextToFramePadding
, getTextLineHeight
, getTextLineHeightWithSpacing
, getFrameHeight
, getFrameHeightWithSpacing
, withID
, ToID(..)
, text
, textColored
, textDisabled
, textWrapped
, labelText
, bulletText
, separatorText
, valueBool
, valueFloat
, valueInt32
, valueWord32
, button
, smallButton
, invisibleButton
, arrowButton
, Raw.image
, checkbox
, checkboxFlags
, checkboxFlagsU
, radioButton
, radioButtonI
, progressBar
, Raw.bullet
, withCombo
, withComboOpen
, beginCombo
, Raw.endCombo
, combo
, dragFloat
, dragFloat2
, dragFloat3
, dragFloat4
, dragFloatRange2
, dragInt
, dragInt2
, dragInt3
, dragInt4
, dragIntRange2
, dragScalar
, dragScalarN
, sliderFloat
, sliderFloat2
, sliderFloat3
, sliderFloat4
, sliderAngle
, sliderInt
, sliderInt2
, sliderInt3
, sliderInt4
, sliderScalar
, sliderScalarN
, vSliderFloat
, vSliderInt
, vSliderScalar
, inputText
, inputTextMultiline
, inputTextWithHint
, inputFloat
, inputFloat2
, inputFloat3
, inputFloat4
, inputInt
, inputInt2
, inputInt3
, inputInt4
, inputScalar
, inputScalarN
, colorEdit3
, colorEdit4
, colorPicker3
, colorPicker4
, colorButton
, Raw.setColorEditOptions
, withTable
, withTableOpen
, TableOptions(..)
, defTableOptions
, beginTable
, Raw.endTable
, tableSetupColumn
, tableSetupColumnWith
, TableColumnOptions(..)
, defTableColumnOptions
, Raw.tableHeadersRow
, Raw.tableHeader
, tableSetupScrollFreeze
, tableNextRow
, tableNextRowWith
, TableRowOptions(..)
, defTableRowOptions
, tableNextColumn
, tableSetColumnIndex
, withSortableTable
, TableSortingSpecs(..)
, tableGetColumnCount
, tableGetColumnIndex
, tableGetRowIndex
, tableGetColumnName
, tableGetColumnFlags
, tableSetColumnEnabled
, tableSetBgColor
, treeNode
, treePush
, Raw.treePop
, setNextItemOpen
, collapsingHeader
, getTreeNodeToLabelSpacing
, selectable
, selectableWith
, SelectableOptions(..)
, defSelectableOptions
, listBox
, plotLines
, plotHistogram
, withMenuBar
, withMenuBarOpen
, Raw.beginMenuBar
, Raw.endMenuBar
, withMainMenuBar
, withMainMenuBarOpen
, Raw.beginMainMenuBar
, Raw.endMainMenuBar
, withMenu
, withMenuOpen
, beginMenu
, Raw.endMenu
, menuItem
, withTabBar
, withTabBarOpen
, beginTabBar
, Raw.endTabBar
, withTabItem
, withTabItemOpen
, beginTabItem
, Raw.endTabItem
, tabItemButton
, setTabItemClosed
, setItemTooltip
, withItemTooltip
, withTooltip
, Raw.beginTooltip
, Raw.endTooltip
, withDisabled
, Raw.beginDisabled
, Raw.endDisabled
, withPopup
, withPopupOpen
, beginPopup
, Raw.endPopup
, withPopupModal
, withPopupModalOpen
, beginPopupModal
, itemContextPopup
, withPopupContextItemOpen
, withPopupContextItem
, beginPopupContextItem
, windowContextPopup
, withPopupContextWindowOpen
, withPopupContextWindow
, beginPopupContextWindow
, voidContextPopup
, withPopupContextVoidOpen
, withPopupContextVoid
, beginPopupContextVoid
, openPopup
, openPopupOnItemClick
, Raw.closeCurrentPopup
, isCurrentPopupOpen
, isAnyPopupOpen
, isAnyLevelPopupOpen
, Raw.isItemHovered
, Raw.isItemActive
, Raw.isItemFocused
, Raw.isItemClicked
, Raw.isItemVisible
, Raw.isItemEdited
, Raw.isItemActivated
, Raw.isItemDeactivated
, Raw.isItemDeactivatedAfterEdit
, Raw.isItemToggledOpen
, Raw.isAnyItemHovered
, Raw.isAnyItemActive
, Raw.isAnyItemFocused
, Raw.getItemID
, Raw.getItemRectMin
, Raw.getItemRectMax
, Raw.getItemRectSize
, Raw.wantCaptureMouse
, Raw.getMousePos
, Raw.getMousePosOnOpeningCurrentPopup
, Raw.isMouseDragging
, Raw.getMouseDragDelta
, Raw.resetMouseDragDelta
, Raw.wantCaptureKeyboard
, Raw.shortcut
, Raw.setNextItemShortcut
, Raw.setItemDefaultFocus
, Raw.setKeyboardFocusHere
, Raw.setNextItemAllowOverlap
, withListClipper
, ClipItems(..)
, ClipRange(..)
, Raw.getBackgroundDrawList
, Raw.getForegroundDrawList
, Raw.imCol32
, Raw.framerate
, Raw.getTime
, Raw.getFrameCount
, calcTextSize
, module DearImGui.Enums
, module DearImGui.Structs
)
where
import Control.Monad
( when )
import Data.Bool
import Data.Foldable
( foldl' )
import Foreign
import Foreign.C
import DearImGui.Enums
import DearImGui.Internal.Text (Text)
import DearImGui.Structs
import qualified DearImGui.Internal.Text as Text
import qualified DearImGui.Raw as Raw
import qualified DearImGui.Raw.Font as Raw.Font
import qualified DearImGui.Raw.ListClipper as Raw.ListClipper
import qualified Control.Monad.Managed as Managed
import Data.StateVar
( HasGetter(get), HasSetter, ($=!) )
import Control.Monad.IO.Class
( MonadIO, liftIO )
import UnliftIO (MonadUnliftIO)
import UnliftIO.Exception (bracket, bracket_)
import qualified Data.Vector as V
import qualified Data.Vector.Storable as VS
import qualified Data.Vector.Unboxed as VU
getVersion :: MonadIO m => m Text
getVersion :: forall (m :: * -> *). MonadIO m => m Text
getVersion = IO Text -> m Text
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO do
IO CString
forall (m :: * -> *). MonadIO m => m CString
Raw.getVersion IO CString -> (CString -> IO Text) -> IO Text
forall a b. IO a -> (a -> IO b) -> IO b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= CString -> IO Text
Text.peekCString
logText :: MonadIO m => Text -> m ()
logText :: forall (m :: * -> *). MonadIO m => Text -> m ()
logText Text
t = IO () -> m ()
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO do
Text -> (CString -> IO ()) -> IO ()
forall (m :: * -> *) a.
MonadUnliftIO m =>
Text -> (CString -> m a) -> m a
Text.withCString Text
t CString -> IO ()
forall (m :: * -> *). MonadIO m => CString -> m ()
Raw.logText
begin :: MonadIO m => Text -> m Bool
begin :: forall (m :: * -> *). MonadIO m => Text -> m Bool
begin Text
name = IO Bool -> m Bool
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO do
Text -> (CString -> IO Bool) -> IO Bool
forall (m :: * -> *) a.
MonadUnliftIO m =>
Text -> (CString -> m a) -> m a
Text.withCString Text
name \CString
namePtr ->
CString -> Maybe (Ptr CBool) -> Maybe ImGuiWindowFlags -> IO Bool
forall (m :: * -> *).
MonadIO m =>
CString -> Maybe (Ptr CBool) -> Maybe ImGuiWindowFlags -> m Bool
Raw.begin CString
namePtr Maybe (Ptr CBool)
forall a. Maybe a
Nothing Maybe ImGuiWindowFlags
forall a. Maybe a
Nothing
withWindow :: MonadUnliftIO m => Text -> (Bool -> m a) -> m a
withWindow :: forall (m :: * -> *) a.
MonadUnliftIO m =>
Text -> (Bool -> m a) -> m a
withWindow Text
name = m Bool -> (Bool -> m ()) -> (Bool -> m a) -> m a
forall (m :: * -> *) a b c.
MonadUnliftIO m =>
m a -> (a -> m b) -> (a -> m c) -> m c
bracket (Text -> m Bool
forall (m :: * -> *). MonadIO m => Text -> m Bool
begin Text
name) (m () -> Bool -> m ()
forall a b. a -> b -> a
const m ()
forall (m :: * -> *). MonadIO m => m ()
Raw.end)
withWindowOpen :: MonadUnliftIO m => Text -> m () -> m ()
withWindowOpen :: forall (m :: * -> *). MonadUnliftIO m => Text -> m () -> m ()
withWindowOpen Text
name m ()
action =
Text -> (Bool -> m ()) -> m ()
forall (m :: * -> *) a.
MonadUnliftIO m =>
Text -> (Bool -> m a) -> m a
withWindow Text
name (Bool -> m () -> m ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
`when` m ()
action)
withCloseableWindow :: (HasSetter ref Bool, MonadUnliftIO m) => Text -> ref -> m () -> m ()
withCloseableWindow :: forall ref (m :: * -> *).
(HasSetter ref Bool, MonadUnliftIO m) =>
Text -> ref -> m () -> m ()
withCloseableWindow Text
name ref
ref m ()
action = m Bool -> (Bool -> m ()) -> (Bool -> m ()) -> m ()
forall (m :: * -> *) a b c.
MonadUnliftIO m =>
m a -> (a -> m b) -> (a -> m c) -> m c
bracket m Bool
open Bool -> m ()
forall {a}. a -> m ()
close (Bool -> m () -> m ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
`when` m ()
action)
where
open :: m Bool
open = IO Bool -> m Bool
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO do
CBool -> (Ptr CBool -> IO Bool) -> IO Bool
forall a b. Storable a => a -> (Ptr a -> IO b) -> IO b
with CBool
1 \Ptr CBool
boolPtr -> do
Text -> (CString -> IO Bool) -> IO Bool
forall (m :: * -> *) a.
MonadUnliftIO m =>
Text -> (CString -> m a) -> m a
Text.withCString Text
name \CString
namePtr -> do
Bool
isVisible <- CString -> Maybe (Ptr CBool) -> Maybe ImGuiWindowFlags -> IO Bool
forall (m :: * -> *).
MonadIO m =>
CString -> Maybe (Ptr CBool) -> Maybe ImGuiWindowFlags -> m Bool
Raw.begin CString
namePtr (Ptr CBool -> Maybe (Ptr CBool)
forall a. a -> Maybe a
Just Ptr CBool
boolPtr) Maybe ImGuiWindowFlags
forall a. Maybe a
Nothing
CBool
isOpen <- Ptr CBool -> IO CBool
forall a. Storable a => Ptr a -> IO a
peek Ptr CBool
boolPtr
Bool -> IO () -> IO ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
when (CBool
isOpen CBool -> CBool -> Bool
forall a. Eq a => a -> a -> Bool
== CBool
0) (IO () -> IO ()) -> IO () -> IO ()
forall a b. (a -> b) -> a -> b
$ ref
ref ref -> Bool -> IO ()
forall t a (m :: * -> *).
(HasSetter t a, MonadIO m) =>
t -> a -> m ()
$=! Bool
False
Bool -> IO Bool
forall a. a -> IO a
forall (f :: * -> *) a. Applicative f => a -> f a
pure Bool
isVisible
close :: a -> m ()
close = IO () -> m ()
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> (a -> IO ()) -> a -> m ()
forall b c a. (b -> c) -> (a -> b) -> a -> c
. IO () -> a -> IO ()
forall a b. a -> b -> a
const IO ()
forall (m :: * -> *). MonadIO m => m ()
Raw.end
withFullscreen :: MonadUnliftIO m => m () -> m ()
withFullscreen :: forall (m :: * -> *). MonadUnliftIO m => m () -> m ()
withFullscreen m ()
action = m Bool -> (Bool -> m ()) -> (Bool -> m ()) -> m ()
forall (m :: * -> *) a b c.
MonadUnliftIO m =>
m a -> (a -> m b) -> (a -> m c) -> m c
bracket m Bool
open Bool -> m ()
forall {a}. a -> m ()
close (Bool -> m () -> m ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
`when` m ()
action)
where
open :: m Bool
open = IO Bool -> m Bool
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO do
IO ()
forall (m :: * -> *). MonadIO m => m ()
Raw.setNextWindowFullscreen
Text -> (CString -> IO Bool) -> IO Bool
forall (m :: * -> *) a.
MonadUnliftIO m =>
Text -> (CString -> m a) -> m a
Text.withCString Text
"FullScreen" \CString
namePtr ->
CString -> Maybe (Ptr CBool) -> Maybe ImGuiWindowFlags -> IO Bool
forall (m :: * -> *).
MonadIO m =>
CString -> Maybe (Ptr CBool) -> Maybe ImGuiWindowFlags -> m Bool
Raw.begin CString
namePtr (Ptr CBool -> Maybe (Ptr CBool)
forall a. a -> Maybe a
Just Ptr CBool
forall a. Ptr a
nullPtr) (ImGuiWindowFlags -> Maybe ImGuiWindowFlags
forall a. a -> Maybe a
Just ImGuiWindowFlags
fullscreenFlags)
close :: a -> m ()
close = IO () -> m ()
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> (a -> IO ()) -> a -> m ()
forall b c a. (b -> c) -> (a -> b) -> a -> c
. IO () -> a -> IO ()
forall a b. a -> b -> a
const IO ()
forall (m :: * -> *). MonadIO m => m ()
Raw.end
fullscreenFlags :: ImGuiWindowFlags
fullscreenFlags :: ImGuiWindowFlags
fullscreenFlags = (ImGuiWindowFlags -> ImGuiWindowFlags -> ImGuiWindowFlags)
-> ImGuiWindowFlags -> [ImGuiWindowFlags] -> ImGuiWindowFlags
forall b a. (b -> a -> b) -> b -> [a] -> b
forall (t :: * -> *) b a.
Foldable t =>
(b -> a -> b) -> b -> t a -> b
foldl' ImGuiWindowFlags -> ImGuiWindowFlags -> ImGuiWindowFlags
forall a. Bits a => a -> a -> a
(.|.) ImGuiWindowFlags
forall a. Bits a => a
zeroBits
[ ImGuiWindowFlags
ImGuiWindowFlags_NoBackground
, ImGuiWindowFlags
ImGuiWindowFlags_NoBringToFrontOnFocus
, ImGuiWindowFlags
ImGuiWindowFlags_NoDecoration
, ImGuiWindowFlags
ImGuiWindowFlags_NoFocusOnAppearing
, ImGuiWindowFlags
ImGuiWindowFlags_NoMove
, ImGuiWindowFlags
ImGuiWindowFlags_NoResize
, ImGuiWindowFlags
ImGuiWindowFlags_NoSavedSettings
, ImGuiWindowFlags
ImGuiWindowFlags_NoScrollbar
, ImGuiWindowFlags
ImGuiWindowFlags_NoScrollWithMouse
, ImGuiWindowFlags
ImGuiWindowFlags_NoTitleBar
]
beginChild :: MonadIO m => Text -> ImVec2 -> Bool -> ImGuiWindowFlags -> m Bool
beginChild :: forall (m :: * -> *).
MonadIO m =>
Text -> ImVec2 -> Bool -> ImGuiWindowFlags -> m Bool
beginChild Text
name ImVec2
size Bool
border ImGuiWindowFlags
flags = IO Bool -> m Bool
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO do
Text -> (CString -> IO Bool) -> IO Bool
forall (m :: * -> *) a.
MonadUnliftIO m =>
Text -> (CString -> m a) -> m a
Text.withCString Text
name \CString
namePtr ->
ImVec2 -> (Ptr ImVec2 -> IO Bool) -> IO Bool
forall a b. Storable a => a -> (Ptr a -> IO b) -> IO b
with ImVec2
size \Ptr ImVec2
sizePtr ->
CString -> Ptr ImVec2 -> CBool -> ImGuiWindowFlags -> IO Bool
forall (m :: * -> *).
MonadIO m =>
CString -> Ptr ImVec2 -> CBool -> ImGuiWindowFlags -> m Bool
Raw.beginChild CString
namePtr Ptr ImVec2
sizePtr (CBool -> CBool -> Bool -> CBool
forall a. a -> a -> Bool -> a
bool CBool
0 CBool
1 Bool
border) ImGuiWindowFlags
flags
withChild :: MonadUnliftIO m => Text -> ImVec2 -> Bool -> ImGuiWindowFlags -> (Bool -> m a) -> m a
withChild :: forall (m :: * -> *) a.
MonadUnliftIO m =>
Text -> ImVec2 -> Bool -> ImGuiWindowFlags -> (Bool -> m a) -> m a
withChild Text
name ImVec2
size Bool
border ImGuiWindowFlags
flags = m Bool -> (Bool -> m ()) -> (Bool -> m a) -> m a
forall (m :: * -> *) a b c.
MonadUnliftIO m =>
m a -> (a -> m b) -> (a -> m c) -> m c
bracket (Text -> ImVec2 -> Bool -> ImGuiWindowFlags -> m Bool
forall (m :: * -> *).
MonadIO m =>
Text -> ImVec2 -> Bool -> ImGuiWindowFlags -> m Bool
beginChild Text
name ImVec2
size Bool
border ImGuiWindowFlags
flags) (m () -> Bool -> m ()
forall a b. a -> b -> a
const m ()
forall (m :: * -> *). MonadIO m => m ()
Raw.endChild)
withChildOpen :: MonadUnliftIO m => Text -> ImVec2 -> Bool -> ImGuiWindowFlags -> m () -> m ()
withChildOpen :: forall (m :: * -> *).
MonadUnliftIO m =>
Text -> ImVec2 -> Bool -> ImGuiWindowFlags -> m () -> m ()
withChildOpen Text
name ImVec2
size Bool
border ImGuiWindowFlags
flags m ()
action =
Text
-> ImVec2 -> Bool -> ImGuiWindowFlags -> (Bool -> m ()) -> m ()
forall (m :: * -> *) a.
MonadUnliftIO m =>
Text -> ImVec2 -> Bool -> ImGuiWindowFlags -> (Bool -> m a) -> m a
withChild Text
name ImVec2
size Bool
border ImGuiWindowFlags
flags (Bool -> m () -> m ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
`when` m ()
action)
withChildContext :: MonadUnliftIO m => Text -> (Bool -> m a) -> m a
withChildContext :: forall (m :: * -> *) a.
MonadUnliftIO m =>
Text -> (Bool -> m a) -> m a
withChildContext Text
name Bool -> m a
action =
m Bool -> (Bool -> m ()) -> (Bool -> m a) -> m a
forall (m :: * -> *) a b c.
MonadUnliftIO m =>
m a -> (a -> m b) -> (a -> m c) -> m c
bracket
(IO Bool -> m Bool
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Bool -> m Bool) -> IO Bool -> m Bool
forall a b. (a -> b) -> a -> b
$ Text -> (CString -> IO Bool) -> IO Bool
forall (m :: * -> *) a.
MonadUnliftIO m =>
Text -> (CString -> m a) -> m a
Text.withCString Text
name CString -> IO Bool
forall (m :: * -> *). MonadIO m => CString -> m Bool
Raw.beginChildContext)
(m () -> Bool -> m ()
forall a b. a -> b -> a
const m ()
forall (m :: * -> *). MonadIO m => m ()
Raw.endChild)
Bool -> m a
action
text :: MonadIO m => Text -> m ()
text :: forall (m :: * -> *). MonadIO m => Text -> m ()
text Text
t = IO () -> m ()
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO do
Text -> (CString -> IO ()) -> IO ()
forall (m :: * -> *) a.
MonadUnliftIO m =>
Text -> (CString -> m a) -> m a
Text.withCString Text
t \CString
textPtr ->
CString -> Maybe CString -> IO ()
forall (m :: * -> *). MonadIO m => CString -> Maybe CString -> m ()
Raw.textUnformatted CString
textPtr Maybe CString
forall a. Maybe a
Nothing
textColored :: (HasGetter ref ImVec4, MonadIO m) => ref -> Text -> m ()
textColored :: forall ref (m :: * -> *).
(HasGetter ref ImVec4, MonadIO m) =>
ref -> Text -> m ()
textColored ref
ref Text
t = IO () -> m ()
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO do
ImVec4
currentValue <- ref -> IO ImVec4
forall t a (m :: * -> *). (HasGetter t a, MonadIO m) => t -> m a
forall (m :: * -> *). MonadIO m => ref -> m ImVec4
get ref
ref
ImVec4 -> (Ptr ImVec4 -> IO ()) -> IO ()
forall a b. Storable a => a -> (Ptr a -> IO b) -> IO b
with ImVec4
currentValue \Ptr ImVec4
refPtr ->
Text -> (CString -> IO ()) -> IO ()
forall (m :: * -> *) a.
MonadUnliftIO m =>
Text -> (CString -> m a) -> m a
Text.withCString Text
t ((CString -> IO ()) -> IO ()) -> (CString -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ Ptr ImVec4 -> CString -> IO ()
forall (m :: * -> *). MonadIO m => Ptr ImVec4 -> CString -> m ()
Raw.textColored Ptr ImVec4
refPtr
textDisabled :: MonadIO m => Text -> m ()
textDisabled :: forall (m :: * -> *). MonadIO m => Text -> m ()
textDisabled Text
t = IO () -> m ()
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO do
Text -> (CString -> IO ()) -> IO ()
forall (m :: * -> *) a.
MonadUnliftIO m =>
Text -> (CString -> m a) -> m a
Text.withCString Text
t CString -> IO ()
forall (m :: * -> *). MonadIO m => CString -> m ()
Raw.textDisabled
textWrapped :: MonadIO m => Text -> m ()
textWrapped :: forall (m :: * -> *). MonadIO m => Text -> m ()
textWrapped Text
t = IO () -> m ()
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO do
Text -> (CString -> IO ()) -> IO ()
forall (m :: * -> *) a.
MonadUnliftIO m =>
Text -> (CString -> m a) -> m a
Text.withCString Text
t CString -> IO ()
forall (m :: * -> *). MonadIO m => CString -> m ()
Raw.textWrapped
labelText :: MonadIO m => Text -> Text -> m ()
labelText :: forall (m :: * -> *). MonadIO m => Text -> Text -> m ()
labelText Text
label Text
t = IO () -> m ()
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO do
Text -> (CString -> IO ()) -> IO ()
forall (m :: * -> *) a.
MonadUnliftIO m =>
Text -> (CString -> m a) -> m a
Text.withCString Text
label \CString
labelPtr ->
Text -> (CString -> IO ()) -> IO ()
forall (m :: * -> *) a.
MonadUnliftIO m =>
Text -> (CString -> m a) -> m a
Text.withCString Text
t \CString
textPtr ->
CString -> CString -> IO ()
forall (m :: * -> *). MonadIO m => CString -> CString -> m ()
Raw.labelText CString
labelPtr CString
textPtr
bulletText :: MonadIO m => Text -> m ()
bulletText :: forall (m :: * -> *). MonadIO m => Text -> m ()
bulletText Text
t = IO () -> m ()
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO do
Text -> (CString -> IO ()) -> IO ()
forall (m :: * -> *) a.
MonadUnliftIO m =>
Text -> (CString -> m a) -> m a
Text.withCString Text
t CString -> IO ()
forall (m :: * -> *). MonadIO m => CString -> m ()
Raw.bulletText
separatorText :: MonadIO m => Text -> m ()
separatorText :: forall (m :: * -> *). MonadIO m => Text -> m ()
separatorText Text
t = IO () -> m ()
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO do
Text -> (CString -> IO ()) -> IO ()
forall (m :: * -> *) a.
MonadUnliftIO m =>
Text -> (CString -> m a) -> m a
Text.withCString Text
t CString -> IO ()
forall (m :: * -> *). MonadIO m => CString -> m ()
Raw.separatorText
valueBool :: MonadIO m => Text -> Bool -> m ()
valueBool :: forall (m :: * -> *). MonadIO m => Text -> Bool -> m ()
valueBool Text
t Bool
b = IO () -> m ()
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO do
Text -> (CString -> IO ()) -> IO ()
forall (m :: * -> *) a.
MonadUnliftIO m =>
Text -> (CString -> m a) -> m a
Text.withCString Text
t \CString
tPtr -> CString -> CBool -> IO ()
forall (m :: * -> *). MonadIO m => CString -> CBool -> m ()
Raw.valueBool CString
tPtr (CBool -> CBool -> Bool -> CBool
forall a. a -> a -> Bool -> a
bool CBool
0 CBool
1 Bool
b)
valueInt32 :: MonadIO m => Text -> Int32 -> m ()
valueInt32 :: forall (m :: * -> *). MonadIO m => Text -> Int32 -> m ()
valueInt32 Text
t Int32
i = IO () -> m ()
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO do
Text -> (CString -> IO ()) -> IO ()
forall (m :: * -> *) a.
MonadUnliftIO m =>
Text -> (CString -> m a) -> m a
Text.withCString Text
t \CString
tPtr -> CString -> CInt -> IO ()
forall (m :: * -> *). MonadIO m => CString -> CInt -> m ()
Raw.valueInt CString
tPtr (Int32 -> CInt
CInt Int32
i)
valueWord32 :: MonadIO m => Text -> Word32 -> m ()
valueWord32 :: forall (m :: * -> *). MonadIO m => Text -> ImGuiID -> m ()
valueWord32 Text
t ImGuiID
w = IO () -> m ()
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO do
Text -> (CString -> IO ()) -> IO ()
forall (m :: * -> *) a.
MonadUnliftIO m =>
Text -> (CString -> m a) -> m a
Text.withCString Text
t \CString
tPtr -> CString -> CUInt -> IO ()
forall (m :: * -> *). MonadIO m => CString -> CUInt -> m ()
Raw.valueUInt CString
tPtr (ImGuiID -> CUInt
CUInt ImGuiID
w)
valueFloat :: MonadIO m => Text -> Float -> Text -> m ()
valueFloat :: forall (m :: * -> *). MonadIO m => Text -> Float -> Text -> m ()
valueFloat Text
t Float
f Text
format = IO () -> m ()
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO do
Text -> (CString -> IO ()) -> IO ()
forall (m :: * -> *) a.
MonadUnliftIO m =>
Text -> (CString -> m a) -> m a
Text.withCString Text
t \CString
tPtr ->
Text -> (CString -> IO ()) -> IO ()
forall (m :: * -> *) a.
MonadUnliftIO m =>
Text -> (CString -> m a) -> m a
Text.withCString Text
format \CString
formatPtr ->
CString -> CFloat -> CString -> IO ()
forall (m :: * -> *).
MonadIO m =>
CString -> CFloat -> CString -> m ()
Raw.valueFloat CString
tPtr (Float -> CFloat
CFloat Float
f) CString
formatPtr
button :: MonadIO m => Text -> m Bool
button :: forall (m :: * -> *). MonadIO m => Text -> m Bool
button Text
label = IO Bool -> m Bool
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO do
Text -> (CString -> IO Bool) -> IO Bool
forall (m :: * -> *) a.
MonadUnliftIO m =>
Text -> (CString -> m a) -> m a
Text.withCString Text
label CString -> IO Bool
forall (m :: * -> *). MonadIO m => CString -> m Bool
Raw.button
smallButton :: MonadIO m => Text -> m Bool
smallButton :: forall (m :: * -> *). MonadIO m => Text -> m Bool
smallButton Text
label = IO Bool -> m Bool
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO do
Text -> (CString -> IO Bool) -> IO Bool
forall (m :: * -> *) a.
MonadUnliftIO m =>
Text -> (CString -> m a) -> m a
Text.withCString Text
label CString -> IO Bool
forall (m :: * -> *). MonadIO m => CString -> m Bool
Raw.smallButton
invisibleButton :: MonadIO m => Text -> ImVec2 -> ImGuiButtonFlags -> m Bool
invisibleButton :: forall (m :: * -> *).
MonadIO m =>
Text -> ImVec2 -> ImGuiButtonFlags -> m Bool
invisibleButton Text
label ImVec2
size ImGuiButtonFlags
flags = IO Bool -> m Bool
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO do
Text -> (CString -> IO Bool) -> IO Bool
forall (m :: * -> *) a.
MonadUnliftIO m =>
Text -> (CString -> m a) -> m a
Text.withCString Text
label \CString
labelPtr ->
ImVec2 -> (Ptr ImVec2 -> IO Bool) -> IO Bool
forall a b. Storable a => a -> (Ptr a -> IO b) -> IO b
with ImVec2
size \Ptr ImVec2
sizePtr ->
CString -> Ptr ImVec2 -> ImGuiButtonFlags -> IO Bool
forall (m :: * -> *).
MonadIO m =>
CString -> Ptr ImVec2 -> ImGuiButtonFlags -> m Bool
Raw.invisibleButton CString
labelPtr Ptr ImVec2
sizePtr ImGuiButtonFlags
flags
arrowButton :: MonadIO m => Text -> ImGuiDir -> m Bool
arrowButton :: forall (m :: * -> *). MonadIO m => Text -> ImGuiDir -> m Bool
arrowButton Text
strId ImGuiDir
dir = IO Bool -> m Bool
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO do
Text -> (CString -> IO Bool) -> IO Bool
forall (m :: * -> *) a.
MonadUnliftIO m =>
Text -> (CString -> m a) -> m a
Text.withCString Text
strId \CString
strIdPtr ->
CString -> ImGuiDir -> IO Bool
forall (m :: * -> *). MonadIO m => CString -> ImGuiDir -> m Bool
Raw.arrowButton CString
strIdPtr ImGuiDir
dir
checkbox :: (HasSetter ref Bool, HasGetter ref Bool, MonadIO m) => Text -> ref -> m Bool
checkbox :: forall ref (m :: * -> *).
(HasSetter ref Bool, HasGetter ref Bool, MonadIO m) =>
Text -> ref -> m Bool
checkbox Text
label ref
ref = IO Bool -> m Bool
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO do
Bool
currentValue <- ref -> IO Bool
forall t a (m :: * -> *). (HasGetter t a, MonadIO m) => t -> m a
forall (m :: * -> *). MonadIO m => ref -> m Bool
get ref
ref
CBool -> (Ptr CBool -> IO Bool) -> IO Bool
forall a b. Storable a => a -> (Ptr a -> IO b) -> IO b
with (CBool -> CBool -> Bool -> CBool
forall a. a -> a -> Bool -> a
bool CBool
0 CBool
1 Bool
currentValue) \Ptr CBool
boolPtr -> do
Bool
changed <- Text -> (CString -> IO Bool) -> IO Bool
forall (m :: * -> *) a.
MonadUnliftIO m =>
Text -> (CString -> m a) -> m a
Text.withCString Text
label \CString
labelPtr ->
CString -> Ptr CBool -> IO Bool
forall (m :: * -> *). MonadIO m => CString -> Ptr CBool -> m Bool
Raw.checkbox CString
labelPtr Ptr CBool
boolPtr
Bool -> IO () -> IO ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
when Bool
changed do
CBool
newValue <- Ptr CBool -> IO CBool
forall a. Storable a => Ptr a -> IO a
peek Ptr CBool
boolPtr
ref
ref ref -> Bool -> IO ()
forall t a (m :: * -> *).
(HasSetter t a, MonadIO m) =>
t -> a -> m ()
$=! (CBool
newValue CBool -> CBool -> Bool
forall a. Eq a => a -> a -> Bool
== CBool
1)
Bool -> IO Bool
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
changed
checkboxFlags :: (HasSetter ref Int32, HasGetter ref Int32, MonadIO m) => Text -> ref -> Int32 -> m Bool
checkboxFlags :: forall ref (m :: * -> *).
(HasSetter ref Int32, HasGetter ref Int32, MonadIO m) =>
Text -> ref -> Int32 -> m Bool
checkboxFlags Text
label ref
ref Int32
flagsValue = IO Bool -> m Bool
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO do
Int32
currentValue <- ref -> IO Int32
forall t a (m :: * -> *). (HasGetter t a, MonadIO m) => t -> m a
forall (m :: * -> *). MonadIO m => ref -> m Int32
get ref
ref
Text -> (CString -> IO Bool) -> IO Bool
forall (m :: * -> *) a.
MonadUnliftIO m =>
Text -> (CString -> m a) -> m a
Text.withCString Text
label \CString
labelPtr ->
CInt -> (Ptr CInt -> IO Bool) -> IO Bool
forall a b. Storable a => a -> (Ptr a -> IO b) -> IO b
with (Int32 -> CInt
CInt Int32
currentValue) \Ptr CInt
flagsPtr -> do
Bool
changed <- CString -> Ptr CInt -> CInt -> IO Bool
forall (m :: * -> *).
MonadIO m =>
CString -> Ptr CInt -> CInt -> m Bool
Raw.checkboxFlags CString
labelPtr Ptr CInt
flagsPtr (Int32 -> CInt
CInt Int32
flagsValue)
Bool -> IO () -> IO ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
when Bool
changed do
CInt Int32
newValue <- Ptr CInt -> IO CInt
forall a. Storable a => Ptr a -> IO a
peek Ptr CInt
flagsPtr
ref
ref ref -> Int32 -> IO ()
forall t a (m :: * -> *).
(HasSetter t a, MonadIO m) =>
t -> a -> m ()
$=! Int32
newValue
Bool -> IO Bool
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
changed
checkboxFlagsU :: (HasSetter ref Word32, HasGetter ref Word32, MonadIO m) => Text -> ref -> Word32 -> m Bool
checkboxFlagsU :: forall ref (m :: * -> *).
(HasSetter ref ImGuiID, HasGetter ref ImGuiID, MonadIO m) =>
Text -> ref -> ImGuiID -> m Bool
checkboxFlagsU Text
label ref
ref ImGuiID
flagsValue = IO Bool -> m Bool
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO do
ImGuiID
currentValue <- ref -> IO ImGuiID
forall t a (m :: * -> *). (HasGetter t a, MonadIO m) => t -> m a
forall (m :: * -> *). MonadIO m => ref -> m ImGuiID
get ref
ref
Text -> (CString -> IO Bool) -> IO Bool
forall (m :: * -> *) a.
MonadUnliftIO m =>
Text -> (CString -> m a) -> m a
Text.withCString Text
label \CString
labelPtr ->
CUInt -> (Ptr CUInt -> IO Bool) -> IO Bool
forall a b. Storable a => a -> (Ptr a -> IO b) -> IO b
with (ImGuiID -> CUInt
CUInt ImGuiID
currentValue) \Ptr CUInt
flagsPtr -> do
Bool
changed <- CString -> Ptr CUInt -> CUInt -> IO Bool
forall (m :: * -> *).
MonadIO m =>
CString -> Ptr CUInt -> CUInt -> m Bool
Raw.checkboxFlagsU CString
labelPtr Ptr CUInt
flagsPtr (ImGuiID -> CUInt
CUInt ImGuiID
flagsValue)
Bool -> IO () -> IO ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
when Bool
changed do
CUInt ImGuiID
newValue <- Ptr CUInt -> IO CUInt
forall a. Storable a => Ptr a -> IO a
peek Ptr CUInt
flagsPtr
ref
ref ref -> ImGuiID -> IO ()
forall t a (m :: * -> *).
(HasSetter t a, MonadIO m) =>
t -> a -> m ()
$=! ImGuiID
newValue
Bool -> IO Bool
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
changed
radioButton :: MonadIO m => Text -> Bool -> m Bool
radioButton :: forall (m :: * -> *). MonadIO m => Text -> Bool -> m Bool
radioButton Text
label Bool
b = IO Bool -> m Bool
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO do
Text -> (CString -> IO Bool) -> IO Bool
forall (m :: * -> *) a.
MonadUnliftIO m =>
Text -> (CString -> m a) -> m a
Text.withCString Text
label \CString
labelPtr ->
CString -> CBool -> IO Bool
forall (m :: * -> *). MonadIO m => CString -> CBool -> m Bool
Raw.radioButton CString
labelPtr (CBool -> CBool -> Bool -> CBool
forall a. a -> a -> Bool -> a
bool CBool
0 CBool
1 Bool
b)
radioButtonI :: (HasSetter ref Int32, HasGetter ref Int32, MonadIO m) => Text -> ref -> Int32 -> m Bool
radioButtonI :: forall ref (m :: * -> *).
(HasSetter ref Int32, HasGetter ref Int32, MonadIO m) =>
Text -> ref -> Int32 -> m Bool
radioButtonI Text
label ref
ref Int32
vButton = IO Bool -> m Bool
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO do
Int32
currentValue <- ref -> IO Int32
forall t a (m :: * -> *). (HasGetter t a, MonadIO m) => t -> m a
forall (m :: * -> *). MonadIO m => ref -> m Int32
get ref
ref
Text -> (CString -> IO Bool) -> IO Bool
forall (m :: * -> *) a.
MonadUnliftIO m =>
Text -> (CString -> m a) -> m a
Text.withCString Text
label \CString
labelPtr ->
CInt -> (Ptr CInt -> IO Bool) -> IO Bool
forall a b. Storable a => a -> (Ptr a -> IO b) -> IO b
with (Int32 -> CInt
CInt Int32
currentValue) \Ptr CInt
valuePtr -> do
Bool
changed <- CString -> Ptr CInt -> CInt -> IO Bool
forall (m :: * -> *).
MonadIO m =>
CString -> Ptr CInt -> CInt -> m Bool
Raw.radioButtonI CString
labelPtr Ptr CInt
valuePtr (Int32 -> CInt
CInt Int32
vButton)
Bool -> IO () -> IO ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
when Bool
changed do
CInt Int32
newValue <- Ptr CInt -> IO CInt
forall a. Storable a => Ptr a -> IO a
peek Ptr CInt
valuePtr
ref
ref ref -> Int32 -> IO ()
forall t a (m :: * -> *).
(HasSetter t a, MonadIO m) =>
t -> a -> m ()
$=! Int32
newValue
Bool -> IO Bool
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
changed
progressBar :: MonadIO m => Float -> Maybe Text -> m ()
progressBar :: forall (m :: * -> *). MonadIO m => Float -> Maybe Text -> m ()
progressBar Float
progress Maybe Text
overlay = IO () -> m ()
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO do
Maybe Text -> (CString -> IO ()) -> IO ()
forall a. Maybe Text -> (CString -> IO a) -> IO a
Text.withCStringOrNull Maybe Text
overlay \CString
overlayPtr ->
CFloat -> CString -> IO ()
forall (m :: * -> *). MonadIO m => CFloat -> CString -> m ()
Raw.progressBar (Float -> CFloat
CFloat Float
progress) CString
overlayPtr
beginCombo :: MonadIO m => Text -> Text -> m Bool
beginCombo :: forall (m :: * -> *). MonadIO m => Text -> Text -> m Bool
beginCombo Text
label Text
previewValue = IO Bool -> m Bool
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Bool -> m Bool) -> IO Bool -> m Bool
forall a b. (a -> b) -> a -> b
$
Text -> (CString -> IO Bool) -> IO Bool
forall (m :: * -> *) a.
MonadUnliftIO m =>
Text -> (CString -> m a) -> m a
Text.withCString Text
label \CString
labelPtr ->
Text -> (CString -> IO Bool) -> IO Bool
forall (m :: * -> *) a.
MonadUnliftIO m =>
Text -> (CString -> m a) -> m a
Text.withCString Text
previewValue \CString
previewValuePtr ->
CString -> CString -> IO Bool
forall (m :: * -> *). MonadIO m => CString -> CString -> m Bool
Raw.beginCombo CString
labelPtr CString
previewValuePtr
withCombo :: MonadUnliftIO m => Text -> Text -> (Bool -> m a) -> m a
withCombo :: forall (m :: * -> *) a.
MonadUnliftIO m =>
Text -> Text -> (Bool -> m a) -> m a
withCombo Text
label Text
previewValue =
m Bool -> (Bool -> m ()) -> (Bool -> m a) -> m a
forall (m :: * -> *) a b c.
MonadUnliftIO m =>
m a -> (a -> m b) -> (a -> m c) -> m c
bracket (Text -> Text -> m Bool
forall (m :: * -> *). MonadIO m => Text -> Text -> m Bool
beginCombo Text
label Text
previewValue) (Bool -> m () -> m ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
`when` m ()
forall (m :: * -> *). MonadIO m => m ()
Raw.endCombo)
withComboOpen :: MonadUnliftIO m => Text -> Text -> m () -> m ()
withComboOpen :: forall (m :: * -> *).
MonadUnliftIO m =>
Text -> Text -> m () -> m ()
withComboOpen Text
label Text
previewValue m ()
action =
Text -> Text -> (Bool -> m ()) -> m ()
forall (m :: * -> *) a.
MonadUnliftIO m =>
Text -> Text -> (Bool -> m a) -> m a
withCombo Text
label Text
previewValue (Bool -> m () -> m ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
`when` m ()
action)
combo :: (MonadIO m, HasGetter ref Int, HasSetter ref Int) => Text -> ref -> [Text] -> m Bool
combo :: forall (m :: * -> *) ref.
(MonadIO m, HasGetter ref Int, HasSetter ref Int) =>
Text -> ref -> [Text] -> m Bool
combo Text
label ref
selectedIndex [Text]
items = IO Bool -> m Bool
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Bool -> m Bool) -> IO Bool -> m Bool
forall a b. (a -> b) -> a -> b
$ Managed Bool -> (Bool -> IO Bool) -> IO Bool
forall a r. Managed a -> (a -> IO r) -> IO r
Managed.with Managed Bool
m Bool -> IO Bool
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return
where
m :: Managed Bool
m = do
Int
i <- ref -> Managed Int
forall t a (m :: * -> *). (HasGetter t a, MonadIO m) => t -> m a
forall (m :: * -> *). MonadIO m => ref -> m Int
get ref
selectedIndex
[CString]
cStrings <- (Text -> Managed CString) -> [Text] -> Managed [CString]
forall (t :: * -> *) (f :: * -> *) a b.
(Traversable t, Applicative f) =>
(a -> f b) -> t a -> f (t b)
forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> [a] -> f [b]
traverse (\Text
str -> (forall r. (CString -> IO r) -> IO r) -> Managed CString
forall (m :: * -> *) a.
MonadManaged m =>
(forall r. (a -> IO r) -> IO r) -> m a
Managed.managed (Text -> (CString -> IO r) -> IO r
forall (m :: * -> *) a.
MonadUnliftIO m =>
Text -> (CString -> m a) -> m a
Text.withCString Text
str)) [Text]
items
CString
labelPtr <- (forall r. (CString -> IO r) -> IO r) -> Managed CString
forall (m :: * -> *) a.
MonadManaged m =>
(forall r. (a -> IO r) -> IO r) -> m a
Managed.managed ((forall r. (CString -> IO r) -> IO r) -> Managed CString)
-> (forall r. (CString -> IO r) -> IO r) -> Managed CString
forall a b. (a -> b) -> a -> b
$ Text -> (CString -> IO r) -> IO r
forall (m :: * -> *) a.
MonadUnliftIO m =>
Text -> (CString -> m a) -> m a
Text.withCString Text
label
Ptr CInt
iPtr <- (forall r. (Ptr CInt -> IO r) -> IO r) -> Managed (Ptr CInt)
forall (m :: * -> *) a.
MonadManaged m =>
(forall r. (a -> IO r) -> IO r) -> m a
Managed.managed ((forall r. (Ptr CInt -> IO r) -> IO r) -> Managed (Ptr CInt))
-> (forall r. (Ptr CInt -> IO r) -> IO r) -> Managed (Ptr CInt)
forall a b. (a -> b) -> a -> b
$ CInt -> (Ptr CInt -> IO r) -> IO r
forall a b. Storable a => a -> (Ptr a -> IO b) -> IO b
with (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
i)
IO Bool -> Managed Bool
forall a. IO a -> Managed a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Bool -> Managed Bool) -> IO Bool -> Managed Bool
forall a b. (a -> b) -> a -> b
$ [CString] -> (Int -> Ptr CString -> IO Bool) -> IO Bool
forall a b. Storable a => [a] -> (Int -> Ptr a -> IO b) -> IO b
withArrayLen [CString]
cStrings \Int
len Ptr CString
itemsPtr -> do
Bool
changed <- CString -> Ptr CInt -> Ptr CString -> CInt -> IO Bool
forall (m :: * -> *).
MonadIO m =>
CString -> Ptr CInt -> Ptr CString -> CInt -> m Bool
Raw.combo CString
labelPtr Ptr CInt
iPtr Ptr CString
itemsPtr (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
len)
Bool -> IO () -> IO ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
when Bool
changed do
CInt
i' <- Ptr CInt -> IO CInt
forall a. Storable a => Ptr a -> IO a
peek Ptr CInt
iPtr
ref
selectedIndex ref -> Int -> IO ()
forall t a (m :: * -> *).
(HasSetter t a, MonadIO m) =>
t -> a -> m ()
$=! CInt -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral CInt
i'
Bool -> IO Bool
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
changed
dragFloat :: (MonadIO m, HasSetter ref Float, HasGetter ref Float) => Text -> ref -> Float -> Float -> Float -> m Bool
dragFloat :: forall (m :: * -> *) ref.
(MonadIO m, HasSetter ref Float, HasGetter ref Float) =>
Text -> ref -> Float -> Float -> Float -> m Bool
dragFloat Text
desc ref
ref Float
speed Float
minValue Float
maxValue = IO Bool -> m Bool
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO do
Float
currentValue <- ref -> IO Float
forall t a (m :: * -> *). (HasGetter t a, MonadIO m) => t -> m a
forall (m :: * -> *). MonadIO m => ref -> m Float
get ref
ref
CFloat -> (Ptr CFloat -> IO Bool) -> IO Bool
forall a b. Storable a => a -> (Ptr a -> IO b) -> IO b
with (Float -> CFloat
forall a b. (Real a, Fractional b) => a -> b
realToFrac Float
currentValue) \Ptr CFloat
floatPtr -> do
Bool
changed <- Text -> (CString -> IO Bool) -> IO Bool
forall (m :: * -> *) a.
MonadUnliftIO m =>
Text -> (CString -> m a) -> m a
Text.withCString Text
desc \CString
descPtr ->
CString
-> Ptr CFloat -> CFloat -> CFloat -> CFloat -> CString -> IO Bool
forall (m :: * -> *).
MonadIO m =>
CString
-> Ptr CFloat -> CFloat -> CFloat -> CFloat -> CString -> m Bool
Raw.dragFloat CString
descPtr Ptr CFloat
floatPtr (Float -> CFloat
CFloat Float
speed) (Float -> CFloat
CFloat Float
minValue) (Float -> CFloat
CFloat Float
maxValue) CString
forall a. Ptr a
nullPtr
Bool -> IO () -> IO ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
when Bool
changed do
CFloat
newValue <- Ptr CFloat -> IO CFloat
forall a. Storable a => Ptr a -> IO a
peek Ptr CFloat
floatPtr
ref
ref ref -> Float -> IO ()
forall t a (m :: * -> *).
(HasSetter t a, MonadIO m) =>
t -> a -> m ()
$=! CFloat -> Float
forall a b. (Real a, Fractional b) => a -> b
realToFrac CFloat
newValue
Bool -> IO Bool
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
changed
dragFloat2 :: (MonadIO m, HasSetter ref (Float, Float), HasGetter ref (Float, Float)) => Text -> ref -> Float -> Float -> Float -> m Bool
dragFloat2 :: forall (m :: * -> *) ref.
(MonadIO m, HasSetter ref (Float, Float),
HasGetter ref (Float, Float)) =>
Text -> ref -> Float -> Float -> Float -> m Bool
dragFloat2 Text
desc ref
ref Float
speed Float
minValue Float
maxValue = IO Bool -> m Bool
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO do
(Float
x, Float
y) <- ref -> IO (Float, Float)
forall t a (m :: * -> *). (HasGetter t a, MonadIO m) => t -> m a
forall (m :: * -> *). MonadIO m => ref -> m (Float, Float)
get ref
ref
[CFloat] -> (Ptr CFloat -> IO Bool) -> IO Bool
forall a b. Storable a => [a] -> (Ptr a -> IO b) -> IO b
withArray [ Float -> CFloat
forall a b. (Real a, Fractional b) => a -> b
realToFrac Float
x, Float -> CFloat
forall a b. (Real a, Fractional b) => a -> b
realToFrac Float
y ] \Ptr CFloat
floatPtr -> do
Bool
changed <- Text -> (CString -> IO Bool) -> IO Bool
forall (m :: * -> *) a.
MonadUnliftIO m =>
Text -> (CString -> m a) -> m a
Text.withCString Text
desc \CString
descPtr ->
CString
-> Ptr CFloat -> CFloat -> CFloat -> CFloat -> CString -> IO Bool
forall (m :: * -> *).
MonadIO m =>
CString
-> Ptr CFloat -> CFloat -> CFloat -> CFloat -> CString -> m Bool
Raw.dragFloat2 CString
descPtr Ptr CFloat
floatPtr (Float -> CFloat
CFloat Float
speed) (Float -> CFloat
CFloat Float
minValue) (Float -> CFloat
CFloat Float
maxValue) CString
forall a. Ptr a
nullPtr
Bool -> IO () -> IO ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
when Bool
changed do
[CFloat
x', CFloat
y'] <- Int -> Ptr CFloat -> IO [CFloat]
forall a. Storable a => Int -> Ptr a -> IO [a]
peekArray Int
2 Ptr CFloat
floatPtr
ref
ref ref -> (Float, Float) -> IO ()
forall t a (m :: * -> *).
(HasSetter t a, MonadIO m) =>
t -> a -> m ()
$=! (CFloat -> Float
forall a b. (Real a, Fractional b) => a -> b
realToFrac CFloat
x', CFloat -> Float
forall a b. (Real a, Fractional b) => a -> b
realToFrac CFloat
y')
Bool -> IO Bool
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
changed
dragFloat3 :: (MonadIO m, HasSetter ref (Float, Float, Float), HasGetter ref (Float, Float, Float)) => Text -> ref -> Float -> Float -> Float -> m Bool
dragFloat3 :: forall (m :: * -> *) ref.
(MonadIO m, HasSetter ref (Float, Float, Float),
HasGetter ref (Float, Float, Float)) =>
Text -> ref -> Float -> Float -> Float -> m Bool
dragFloat3 Text
desc ref
ref Float
speed Float
minValue Float
maxValue = IO Bool -> m Bool
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO do
(Float
x, Float
y, Float
z) <- ref -> IO (Float, Float, Float)
forall t a (m :: * -> *). (HasGetter t a, MonadIO m) => t -> m a
forall (m :: * -> *). MonadIO m => ref -> m (Float, Float, Float)
get ref
ref
[CFloat] -> (Ptr CFloat -> IO Bool) -> IO Bool
forall a b. Storable a => [a] -> (Ptr a -> IO b) -> IO b
withArray [ Float -> CFloat
forall a b. (Real a, Fractional b) => a -> b
realToFrac Float
x, Float -> CFloat
forall a b. (Real a, Fractional b) => a -> b
realToFrac Float
y, Float -> CFloat
forall a b. (Real a, Fractional b) => a -> b
realToFrac Float
z ] \Ptr CFloat
floatPtr -> do
Bool
changed <- Text -> (CString -> IO Bool) -> IO Bool
forall (m :: * -> *) a.
MonadUnliftIO m =>
Text -> (CString -> m a) -> m a
Text.withCString Text
desc \CString
descPtr ->
CString
-> Ptr CFloat -> CFloat -> CFloat -> CFloat -> CString -> IO Bool
forall (m :: * -> *).
MonadIO m =>
CString
-> Ptr CFloat -> CFloat -> CFloat -> CFloat -> CString -> m Bool
Raw.dragFloat3 CString
descPtr Ptr CFloat
floatPtr (Float -> CFloat
CFloat Float
speed) (Float -> CFloat
CFloat Float
minValue) (Float -> CFloat
CFloat Float
maxValue) CString
forall a. Ptr a
nullPtr
Bool -> IO () -> IO ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
when Bool
changed do
[CFloat
x', CFloat
y', CFloat
z'] <- Int -> Ptr CFloat -> IO [CFloat]
forall a. Storable a => Int -> Ptr a -> IO [a]
peekArray Int
3 Ptr CFloat
floatPtr
ref
ref ref -> (Float, Float, Float) -> IO ()
forall t a (m :: * -> *).
(HasSetter t a, MonadIO m) =>
t -> a -> m ()
$=! (CFloat -> Float
forall a b. (Real a, Fractional b) => a -> b
realToFrac CFloat
x', CFloat -> Float
forall a b. (Real a, Fractional b) => a -> b
realToFrac CFloat
y', CFloat -> Float
forall a b. (Real a, Fractional b) => a -> b
realToFrac CFloat
z')
Bool -> IO Bool
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
changed
dragFloat4 :: (MonadIO m, HasSetter ref (Float, Float, Float, Float), HasGetter ref (Float, Float, Float, Float)) => Text -> ref -> Float -> Float -> Float -> m Bool
dragFloat4 :: forall (m :: * -> *) ref.
(MonadIO m, HasSetter ref (Float, Float, Float, Float),
HasGetter ref (Float, Float, Float, Float)) =>
Text -> ref -> Float -> Float -> Float -> m Bool
dragFloat4 Text
desc ref
ref Float
speed Float
minValue Float
maxValue = IO Bool -> m Bool
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO do
(Float
x, Float
y, Float
z, Float
u) <- ref -> IO (Float, Float, Float, Float)
forall t a (m :: * -> *). (HasGetter t a, MonadIO m) => t -> m a
forall (m :: * -> *).
MonadIO m =>
ref -> m (Float, Float, Float, Float)
get ref
ref
[CFloat] -> (Ptr CFloat -> IO Bool) -> IO Bool
forall a b. Storable a => [a] -> (Ptr a -> IO b) -> IO b
withArray [ Float -> CFloat
forall a b. (Real a, Fractional b) => a -> b
realToFrac Float
x, Float -> CFloat
forall a b. (Real a, Fractional b) => a -> b
realToFrac Float
y, Float -> CFloat
forall a b. (Real a, Fractional b) => a -> b
realToFrac Float
z, Float -> CFloat
forall a b. (Real a, Fractional b) => a -> b
realToFrac Float
u ] \Ptr CFloat
floatPtr -> do
Bool
changed <- Text -> (CString -> IO Bool) -> IO Bool
forall (m :: * -> *) a.
MonadUnliftIO m =>
Text -> (CString -> m a) -> m a
Text.withCString Text
desc \CString
descPtr ->
CString
-> Ptr CFloat -> CFloat -> CFloat -> CFloat -> CString -> IO Bool
forall (m :: * -> *).
MonadIO m =>
CString
-> Ptr CFloat -> CFloat -> CFloat -> CFloat -> CString -> m Bool
Raw.dragFloat4 CString
descPtr Ptr CFloat
floatPtr (Float -> CFloat
CFloat Float
speed) (Float -> CFloat
CFloat Float
minValue) (Float -> CFloat
CFloat Float
maxValue) CString
forall a. Ptr a
nullPtr
Bool -> IO () -> IO ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
when Bool
changed do
[CFloat
x', CFloat
y', CFloat
z', CFloat
u'] <- Int -> Ptr CFloat -> IO [CFloat]
forall a. Storable a => Int -> Ptr a -> IO [a]
peekArray Int
4 Ptr CFloat
floatPtr
ref
ref ref -> (Float, Float, Float, Float) -> IO ()
forall t a (m :: * -> *).
(HasSetter t a, MonadIO m) =>
t -> a -> m ()
$=! (CFloat -> Float
forall a b. (Real a, Fractional b) => a -> b
realToFrac CFloat
x', CFloat -> Float
forall a b. (Real a, Fractional b) => a -> b
realToFrac CFloat
y', CFloat -> Float
forall a b. (Real a, Fractional b) => a -> b
realToFrac CFloat
z', CFloat -> Float
forall a b. (Real a, Fractional b) => a -> b
realToFrac CFloat
u')
Bool -> IO Bool
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
changed
dragFloatRange2 :: (MonadIO m, HasSetter ref Float, HasGetter ref Float) => Text -> ref -> ref -> Float -> Float -> Float -> Text -> Text -> m Bool
dragFloatRange2 :: forall (m :: * -> *) ref.
(MonadIO m, HasSetter ref Float, HasGetter ref Float) =>
Text
-> ref -> ref -> Float -> Float -> Float -> Text -> Text -> m Bool
dragFloatRange2 Text
desc ref
refMin ref
refMax Float
speed Float
minValue Float
maxValue Text
minFmt Text
maxFmt = IO Bool -> m Bool
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO do
Float
curMin <- ref -> IO Float
forall t a (m :: * -> *). (HasGetter t a, MonadIO m) => t -> m a
forall (m :: * -> *). MonadIO m => ref -> m Float
get ref
refMin
Float
curMax <- ref -> IO Float
forall t a (m :: * -> *). (HasGetter t a, MonadIO m) => t -> m a
forall (m :: * -> *). MonadIO m => ref -> m Float
get ref
refMax
CFloat -> (Ptr CFloat -> IO Bool) -> IO Bool
forall a b. Storable a => a -> (Ptr a -> IO b) -> IO b
with (Float -> CFloat
CFloat Float
curMin) \Ptr CFloat
minPtr ->
CFloat -> (Ptr CFloat -> IO Bool) -> IO Bool
forall a b. Storable a => a -> (Ptr a -> IO b) -> IO b
with (Float -> CFloat
CFloat Float
curMax) \Ptr CFloat
maxPtr -> do
Bool
changed <-
Text -> (CString -> IO Bool) -> IO Bool
forall (m :: * -> *) a.
MonadUnliftIO m =>
Text -> (CString -> m a) -> m a
Text.withCString Text
desc \CString
descPtr ->
Text -> (CString -> IO Bool) -> IO Bool
forall (m :: * -> *) a.
MonadUnliftIO m =>
Text -> (CString -> m a) -> m a
Text.withCString Text
minFmt \CString
minFmtPtr ->
Text -> (CString -> IO Bool) -> IO Bool
forall (m :: * -> *) a.
MonadUnliftIO m =>
Text -> (CString -> m a) -> m a
Text.withCString Text
maxFmt \CString
maxFmtPtr ->
CString
-> Ptr CFloat
-> Ptr CFloat
-> CFloat
-> CFloat
-> CFloat
-> CString
-> CString
-> ImGuiSliderFlags
-> IO Bool
forall (m :: * -> *).
MonadIO m =>
CString
-> Ptr CFloat
-> Ptr CFloat
-> CFloat
-> CFloat
-> CFloat
-> CString
-> CString
-> ImGuiSliderFlags
-> m Bool
Raw.dragFloatRange2
CString
descPtr
Ptr CFloat
minPtr Ptr CFloat
maxPtr
(Float -> CFloat
CFloat Float
speed) (Float -> CFloat
CFloat Float
minValue) (Float -> CFloat
CFloat Float
maxValue)
CString
minFmtPtr CString
maxFmtPtr
ImGuiSliderFlags
ImGuiSliderFlags_AlwaysClamp
Bool -> IO () -> IO ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
when Bool
changed do
CFloat Float
nextMin <- Ptr CFloat -> IO CFloat
forall a. Storable a => Ptr a -> IO a
peek Ptr CFloat
minPtr
CFloat Float
nextMax <- Ptr CFloat -> IO CFloat
forall a. Storable a => Ptr a -> IO a
peek Ptr CFloat
maxPtr
ref
refMin ref -> Float -> IO ()
forall t a (m :: * -> *).
(HasSetter t a, MonadIO m) =>
t -> a -> m ()
$=! Float
nextMin
ref
refMax ref -> Float -> IO ()
forall t a (m :: * -> *).
(HasSetter t a, MonadIO m) =>
t -> a -> m ()
$=! Float
nextMax
Bool -> IO Bool
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
changed
dragInt :: (MonadIO m, HasSetter ref Int, HasGetter ref Int) => Text -> ref -> Float -> Int -> Int -> m Bool
dragInt :: forall (m :: * -> *) ref.
(MonadIO m, HasSetter ref Int, HasGetter ref Int) =>
Text -> ref -> Float -> Int -> Int -> m Bool
dragInt Text
label ref
ref Float
speed Int
minValue Int
maxValue = IO Bool -> m Bool
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO do
Int
currentValue <- ref -> IO Int
forall t a (m :: * -> *). (HasGetter t a, MonadIO m) => t -> m a
forall (m :: * -> *). MonadIO m => ref -> m Int
get ref
ref
CInt -> (Ptr CInt -> IO Bool) -> IO Bool
forall a b. Storable a => a -> (Ptr a -> IO b) -> IO b
with (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
currentValue) \Ptr CInt
vPtr -> do
Bool
changed <-
Text -> (CString -> IO Bool) -> IO Bool
forall (m :: * -> *) a.
MonadUnliftIO m =>
Text -> (CString -> m a) -> m a
Text.withCString Text
label \CString
labelPtr ->
Text -> (CString -> IO Bool) -> IO Bool
forall (m :: * -> *) a.
MonadUnliftIO m =>
Text -> (CString -> m a) -> m a
Text.withCString Text
"%d" \CString
formatPtr ->
CString
-> Ptr CInt
-> CFloat
-> CInt
-> CInt
-> CString
-> ImGuiSliderFlags
-> IO Bool
forall (m :: * -> *).
MonadIO m =>
CString
-> Ptr CInt
-> CFloat
-> CInt
-> CInt
-> CString
-> ImGuiSliderFlags
-> m Bool
Raw.dragInt
CString
labelPtr
Ptr CInt
vPtr
(Float -> CFloat
CFloat Float
speed)
(Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
minValue)
(Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
maxValue)
CString
formatPtr
ImGuiSliderFlags
ImGuiSliderFlags_AlwaysClamp
Bool -> IO () -> IO ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
when Bool
changed do
CInt
newValue <- Ptr CInt -> IO CInt
forall a. Storable a => Ptr a -> IO a
peek Ptr CInt
vPtr
ref
ref ref -> Int -> IO ()
forall t a (m :: * -> *).
(HasSetter t a, MonadIO m) =>
t -> a -> m ()
$=! CInt -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral CInt
newValue
Bool -> IO Bool
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
changed
dragInt2 :: (MonadIO m, HasSetter ref (Int, Int), HasGetter ref (Int, Int)) => Text -> ref -> Float -> Int -> Int -> m Bool
dragInt2 :: forall (m :: * -> *) ref.
(MonadIO m, HasSetter ref (Int, Int), HasGetter ref (Int, Int)) =>
Text -> ref -> Float -> Int -> Int -> m Bool
dragInt2 Text
label ref
ref Float
speed Int
minValue Int
maxValue = IO Bool -> m Bool
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO do
(Int
x, Int
y) <- ref -> IO (Int, Int)
forall t a (m :: * -> *). (HasGetter t a, MonadIO m) => t -> m a
forall (m :: * -> *). MonadIO m => ref -> m (Int, Int)
get ref
ref
[CInt] -> (Ptr CInt -> IO Bool) -> IO Bool
forall a b. Storable a => [a] -> (Ptr a -> IO b) -> IO b
withArray [ Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
x, Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
y ] \Ptr CInt
vPtr -> do
Bool
changed <-
Text -> (CString -> IO Bool) -> IO Bool
forall (m :: * -> *) a.
MonadUnliftIO m =>
Text -> (CString -> m a) -> m a
Text.withCString Text
label \CString
labelPtr ->
Text -> (CString -> IO Bool) -> IO Bool
forall (m :: * -> *) a.
MonadUnliftIO m =>
Text -> (CString -> m a) -> m a
Text.withCString Text
"%d" \CString
formatPtr ->
CString
-> Ptr CInt
-> CFloat
-> CInt
-> CInt
-> CString
-> ImGuiSliderFlags
-> IO Bool
forall (m :: * -> *).
MonadIO m =>
CString
-> Ptr CInt
-> CFloat
-> CInt
-> CInt
-> CString
-> ImGuiSliderFlags
-> m Bool
Raw.dragInt2
CString
labelPtr
Ptr CInt
vPtr
(Float -> CFloat
CFloat Float
speed)
(Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
minValue)
(Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
maxValue)
CString
formatPtr
ImGuiSliderFlags
ImGuiSliderFlags_AlwaysClamp
Bool -> IO () -> IO ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
when Bool
changed do
[CInt
x', CInt
y'] <- Int -> Ptr CInt -> IO [CInt]
forall a. Storable a => Int -> Ptr a -> IO [a]
peekArray Int
2 Ptr CInt
vPtr
ref
ref ref -> (Int, Int) -> IO ()
forall t a (m :: * -> *).
(HasSetter t a, MonadIO m) =>
t -> a -> m ()
$=! (CInt -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral CInt
x', CInt -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral CInt
y')
Bool -> IO Bool
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
changed
dragInt3 :: (MonadIO m, HasSetter ref (Int, Int, Int), HasGetter ref (Int, Int, Int)) => Text -> ref -> Float -> Int -> Int -> m Bool
dragInt3 :: forall (m :: * -> *) ref.
(MonadIO m, HasSetter ref (Int, Int, Int),
HasGetter ref (Int, Int, Int)) =>
Text -> ref -> Float -> Int -> Int -> m Bool
dragInt3 Text
label ref
ref Float
speed Int
minValue Int
maxValue = IO Bool -> m Bool
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO do
(Int
x, Int
y, Int
z) <- ref -> IO (Int, Int, Int)
forall t a (m :: * -> *). (HasGetter t a, MonadIO m) => t -> m a
forall (m :: * -> *). MonadIO m => ref -> m (Int, Int, Int)
get ref
ref
[CInt] -> (Ptr CInt -> IO Bool) -> IO Bool
forall a b. Storable a => [a] -> (Ptr a -> IO b) -> IO b
withArray [ Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
x, Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
y, Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
z ] \Ptr CInt
vPtr -> do
Bool
changed <-
Text -> (CString -> IO Bool) -> IO Bool
forall (m :: * -> *) a.
MonadUnliftIO m =>
Text -> (CString -> m a) -> m a
Text.withCString Text
label \CString
labelPtr ->
Text -> (CString -> IO Bool) -> IO Bool
forall (m :: * -> *) a.
MonadUnliftIO m =>
Text -> (CString -> m a) -> m a
Text.withCString Text
"%d" \CString
formatPtr ->
CString
-> Ptr CInt
-> CFloat
-> CInt
-> CInt
-> CString
-> ImGuiSliderFlags
-> IO Bool
forall (m :: * -> *).
MonadIO m =>
CString
-> Ptr CInt
-> CFloat
-> CInt
-> CInt
-> CString
-> ImGuiSliderFlags
-> m Bool
Raw.dragInt3
CString
labelPtr
Ptr CInt
vPtr
(Float -> CFloat
CFloat Float
speed)
(Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
minValue)
(Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
maxValue)
CString
formatPtr
ImGuiSliderFlags
ImGuiSliderFlags_AlwaysClamp
Bool -> IO () -> IO ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
when Bool
changed do
[CInt
x', CInt
y', CInt
z'] <- Int -> Ptr CInt -> IO [CInt]
forall a. Storable a => Int -> Ptr a -> IO [a]
peekArray Int
3 Ptr CInt
vPtr
ref
ref ref -> (Int, Int, Int) -> IO ()
forall t a (m :: * -> *).
(HasSetter t a, MonadIO m) =>
t -> a -> m ()
$=! (CInt -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral CInt
x', CInt -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral CInt
y', CInt -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral CInt
z')
Bool -> IO Bool
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
changed
dragInt4 :: (MonadIO m, HasSetter ref (Int, Int, Int, Int), HasGetter ref (Int, Int, Int, Int)) => Text -> ref -> Float -> Int -> Int -> m Bool
dragInt4 :: forall (m :: * -> *) ref.
(MonadIO m, HasSetter ref (Int, Int, Int, Int),
HasGetter ref (Int, Int, Int, Int)) =>
Text -> ref -> Float -> Int -> Int -> m Bool
dragInt4 Text
label ref
ref Float
speed Int
minValue Int
maxValue = IO Bool -> m Bool
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO do
(Int
x, Int
y, Int
z, Int
w) <- ref -> IO (Int, Int, Int, Int)
forall t a (m :: * -> *). (HasGetter t a, MonadIO m) => t -> m a
forall (m :: * -> *). MonadIO m => ref -> m (Int, Int, Int, Int)
get ref
ref
[CInt] -> (Ptr CInt -> IO Bool) -> IO Bool
forall a b. Storable a => [a] -> (Ptr a -> IO b) -> IO b
withArray [ Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
x, Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
y, Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
z, Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
w ] \Ptr CInt
vPtr -> do
Bool
changed <-
Text -> (CString -> IO Bool) -> IO Bool
forall (m :: * -> *) a.
MonadUnliftIO m =>
Text -> (CString -> m a) -> m a
Text.withCString Text
label \CString
labelPtr ->
Text -> (CString -> IO Bool) -> IO Bool
forall (m :: * -> *) a.
MonadUnliftIO m =>
Text -> (CString -> m a) -> m a
Text.withCString Text
"%d" \CString
formatPtr ->
CString
-> Ptr CInt
-> CFloat
-> CInt
-> CInt
-> CString
-> ImGuiSliderFlags
-> IO Bool
forall (m :: * -> *).
MonadIO m =>
CString
-> Ptr CInt
-> CFloat
-> CInt
-> CInt
-> CString
-> ImGuiSliderFlags
-> m Bool
Raw.dragInt4
CString
labelPtr
Ptr CInt
vPtr
(Float -> CFloat
CFloat Float
speed)
(Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
minValue)
(Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
maxValue)
CString
formatPtr
ImGuiSliderFlags
ImGuiSliderFlags_AlwaysClamp
Bool -> IO () -> IO ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
when Bool
changed do
[CInt
x', CInt
y', CInt
z', CInt
w'] <- Int -> Ptr CInt -> IO [CInt]
forall a. Storable a => Int -> Ptr a -> IO [a]
peekArray Int
3 Ptr CInt
vPtr
ref
ref ref -> (Int, Int, Int, Int) -> IO ()
forall t a (m :: * -> *).
(HasSetter t a, MonadIO m) =>
t -> a -> m ()
$=! (CInt -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral CInt
x', CInt -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral CInt
y', CInt -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral CInt
z', CInt -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral CInt
w')
Bool -> IO Bool
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
changed
dragIntRange2 :: (MonadIO m, HasSetter ref Int, HasGetter ref Int) => Text -> ref -> ref -> Float -> Int -> Int -> Text -> Text -> m Bool
dragIntRange2 :: forall (m :: * -> *) ref.
(MonadIO m, HasSetter ref Int, HasGetter ref Int) =>
Text -> ref -> ref -> Float -> Int -> Int -> Text -> Text -> m Bool
dragIntRange2 Text
desc ref
refMin ref
refMax Float
speed Int
minValue Int
maxValue Text
minFmt Text
maxFmt = IO Bool -> m Bool
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO do
Int
curMin <- ref -> IO Int
forall t a (m :: * -> *). (HasGetter t a, MonadIO m) => t -> m a
forall (m :: * -> *). MonadIO m => ref -> m Int
get ref
refMin
Int
curMax <- ref -> IO Int
forall t a (m :: * -> *). (HasGetter t a, MonadIO m) => t -> m a
forall (m :: * -> *). MonadIO m => ref -> m Int
get ref
refMax
CInt -> (Ptr CInt -> IO Bool) -> IO Bool
forall a b. Storable a => a -> (Ptr a -> IO b) -> IO b
with (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
curMin) \Ptr CInt
minPtr ->
CInt -> (Ptr CInt -> IO Bool) -> IO Bool
forall a b. Storable a => a -> (Ptr a -> IO b) -> IO b
with (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
curMax) \Ptr CInt
maxPtr -> do
Bool
changed <-
Text -> (CString -> IO Bool) -> IO Bool
forall (m :: * -> *) a.
MonadUnliftIO m =>
Text -> (CString -> m a) -> m a
Text.withCString Text
desc \CString
descPtr ->
Text -> (CString -> IO Bool) -> IO Bool
forall (m :: * -> *) a.
MonadUnliftIO m =>
Text -> (CString -> m a) -> m a
Text.withCString Text
minFmt \CString
minFmtPtr ->
Text -> (CString -> IO Bool) -> IO Bool
forall (m :: * -> *) a.
MonadUnliftIO m =>
Text -> (CString -> m a) -> m a
Text.withCString Text
maxFmt \CString
maxFmtPtr ->
CString
-> Ptr CInt
-> Ptr CInt
-> CFloat
-> CInt
-> CInt
-> CString
-> CString
-> ImGuiSliderFlags
-> IO Bool
forall (m :: * -> *).
MonadIO m =>
CString
-> Ptr CInt
-> Ptr CInt
-> CFloat
-> CInt
-> CInt
-> CString
-> CString
-> ImGuiSliderFlags
-> m Bool
Raw.dragIntRange2
CString
descPtr
Ptr CInt
minPtr
Ptr CInt
maxPtr
(Float -> CFloat
CFloat Float
speed)
(Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
minValue)
(Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
maxValue)
CString
minFmtPtr CString
maxFmtPtr
ImGuiSliderFlags
ImGuiSliderFlags_AlwaysClamp
Bool -> IO () -> IO ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
when Bool
changed do
CInt
nextMin <- Ptr CInt -> IO CInt
forall a. Storable a => Ptr a -> IO a
peek Ptr CInt
minPtr
CInt
nextMax <- Ptr CInt -> IO CInt
forall a. Storable a => Ptr a -> IO a
peek Ptr CInt
maxPtr
ref
refMin ref -> Int -> IO ()
forall t a (m :: * -> *).
(HasSetter t a, MonadIO m) =>
t -> a -> m ()
$=! CInt -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral CInt
nextMin
ref
refMax ref -> Int -> IO ()
forall t a (m :: * -> *).
(HasSetter t a, MonadIO m) =>
t -> a -> m ()
$=! CInt -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral CInt
nextMax
Bool -> IO Bool
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
changed
dragScalar
:: (HasSetter ref a, HasGetter ref a, HasGetter range a, Storable a, MonadIO m)
=> Text -> ImGuiDataType -> ref -> Float -> range -> range -> Text -> ImGuiSliderFlags -> m Bool
dragScalar :: forall ref a range (m :: * -> *).
(HasSetter ref a, HasGetter ref a, HasGetter range a, Storable a,
MonadIO m) =>
Text
-> ImGuiDataType
-> ref
-> Float
-> range
-> range
-> Text
-> ImGuiSliderFlags
-> m Bool
dragScalar Text
label ImGuiDataType
dataType ref
ref Float
vSpeed range
refMin range
refMax Text
format ImGuiSliderFlags
flags = IO Bool -> m Bool
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO do
a
currentValue <- ref -> IO a
forall t a (m :: * -> *). (HasGetter t a, MonadIO m) => t -> m a
forall (m :: * -> *). MonadIO m => ref -> m a
get ref
ref
a
minValue <- range -> IO a
forall t a (m :: * -> *). (HasGetter t a, MonadIO m) => t -> m a
forall (m :: * -> *). MonadIO m => range -> m a
get range
refMin
a
maxValue <- range -> IO a
forall t a (m :: * -> *). (HasGetter t a, MonadIO m) => t -> m a
forall (m :: * -> *). MonadIO m => range -> m a
get range
refMax
a -> (Ptr a -> IO Bool) -> IO Bool
forall a b. Storable a => a -> (Ptr a -> IO b) -> IO b
with a
currentValue \Ptr a
dataPtr ->
a -> (Ptr a -> IO Bool) -> IO Bool
forall a b. Storable a => a -> (Ptr a -> IO b) -> IO b
with a
minValue \Ptr a
minPtr ->
a -> (Ptr a -> IO Bool) -> IO Bool
forall a b. Storable a => a -> (Ptr a -> IO b) -> IO b
with a
maxValue \Ptr a
maxPtr -> do
Bool
changed <-
Text -> (CString -> IO Bool) -> IO Bool
forall (m :: * -> *) a.
MonadUnliftIO m =>
Text -> (CString -> m a) -> m a
Text.withCString Text
label \CString
labelPtr ->
Text -> (CString -> IO Bool) -> IO Bool
forall (m :: * -> *) a.
MonadUnliftIO m =>
Text -> (CString -> m a) -> m a
Text.withCString Text
format \CString
formatPtr ->
CString
-> ImGuiDataType
-> Ptr a
-> CFloat
-> Ptr a
-> Ptr a
-> CString
-> ImGuiSliderFlags
-> IO Bool
forall (m :: * -> *) a.
MonadIO m =>
CString
-> ImGuiDataType
-> Ptr a
-> CFloat
-> Ptr a
-> Ptr a
-> CString
-> ImGuiSliderFlags
-> m Bool
Raw.dragScalar
CString
labelPtr
ImGuiDataType
dataType
Ptr a
dataPtr
(Float -> CFloat
CFloat Float
vSpeed)
Ptr a
minPtr
Ptr a
maxPtr
CString
formatPtr
ImGuiSliderFlags
flags
Bool -> IO () -> IO ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
when Bool
changed do
a
newValue <- Ptr a -> IO a
forall a. Storable a => Ptr a -> IO a
peek Ptr a
dataPtr
ref
ref ref -> a -> IO ()
forall t a (m :: * -> *).
(HasSetter t a, MonadIO m) =>
t -> a -> m ()
$=! a
newValue
Bool -> IO Bool
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
changed
dragScalarN
:: (HasSetter ref [a], HasGetter ref [a], HasGetter range a, Storable a, MonadIO m)
=> Text -> ImGuiDataType -> ref -> Float -> range -> range -> Text -> ImGuiSliderFlags -> m Bool
dragScalarN :: forall ref a range (m :: * -> *).
(HasSetter ref [a], HasGetter ref [a], HasGetter range a,
Storable a, MonadIO m) =>
Text
-> ImGuiDataType
-> ref
-> Float
-> range
-> range
-> Text
-> ImGuiSliderFlags
-> m Bool
dragScalarN Text
label ImGuiDataType
dataType ref
ref Float
vSpeed range
refMin range
refMax Text
format ImGuiSliderFlags
flags = IO Bool -> m Bool
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO do
[a]
currentValues <- ref -> IO [a]
forall t a (m :: * -> *). (HasGetter t a, MonadIO m) => t -> m a
forall (m :: * -> *). MonadIO m => ref -> m [a]
get ref
ref
a
minValue <- range -> IO a
forall t a (m :: * -> *). (HasGetter t a, MonadIO m) => t -> m a
forall (m :: * -> *). MonadIO m => range -> m a
get range
refMin
a
maxValue <- range -> IO a
forall t a (m :: * -> *). (HasGetter t a, MonadIO m) => t -> m a
forall (m :: * -> *). MonadIO m => range -> m a
get range
refMax
[a] -> (Int -> Ptr a -> IO Bool) -> IO Bool
forall a b. Storable a => [a] -> (Int -> Ptr a -> IO b) -> IO b
withArrayLen [a]
currentValues \Int
components Ptr a
dataPtr ->
a -> (Ptr a -> IO Bool) -> IO Bool
forall a b. Storable a => a -> (Ptr a -> IO b) -> IO b
with a
minValue \Ptr a
minPtr ->
a -> (Ptr a -> IO Bool) -> IO Bool
forall a b. Storable a => a -> (Ptr a -> IO b) -> IO b
with a
maxValue \Ptr a
maxPtr -> do
Bool
changed <-
Text -> (CString -> IO Bool) -> IO Bool
forall (m :: * -> *) a.
MonadUnliftIO m =>
Text -> (CString -> m a) -> m a
Text.withCString Text
label \CString
labelPtr ->
Text -> (CString -> IO Bool) -> IO Bool
forall (m :: * -> *) a.
MonadUnliftIO m =>
Text -> (CString -> m a) -> m a
Text.withCString Text
format \CString
formatPtr ->
CString
-> ImGuiDataType
-> Ptr a
-> CInt
-> CFloat
-> Ptr a
-> Ptr a
-> CString
-> ImGuiSliderFlags
-> IO Bool
forall (m :: * -> *) a.
MonadIO m =>
CString
-> ImGuiDataType
-> Ptr a
-> CInt
-> CFloat
-> Ptr a
-> Ptr a
-> CString
-> ImGuiSliderFlags
-> m Bool
Raw.dragScalarN
CString
labelPtr
ImGuiDataType
dataType
Ptr a
dataPtr
(Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
components)
(Float -> CFloat
CFloat Float
vSpeed)
Ptr a
minPtr
Ptr a
maxPtr
CString
formatPtr
ImGuiSliderFlags
flags
Bool -> IO () -> IO ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
when Bool
changed do
[a]
newValue <- Int -> Ptr a -> IO [a]
forall a. Storable a => Int -> Ptr a -> IO [a]
peekArray Int
components Ptr a
dataPtr
ref
ref ref -> [a] -> IO ()
forall t a (m :: * -> *).
(HasSetter t a, MonadIO m) =>
t -> a -> m ()
$=! [a]
newValue
Bool -> IO Bool
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
changed
sliderScalar
:: (HasGetter ref a, HasSetter ref a, HasGetter range a, Storable a, MonadIO m)
=> Text -> ImGuiDataType -> ref -> range -> range -> Text -> ImGuiSliderFlags -> m Bool
sliderScalar :: forall ref a range (m :: * -> *).
(HasGetter ref a, HasSetter ref a, HasGetter range a, Storable a,
MonadIO m) =>
Text
-> ImGuiDataType
-> ref
-> range
-> range
-> Text
-> ImGuiSliderFlags
-> m Bool
sliderScalar Text
label ImGuiDataType
dataType ref
ref range
refMin range
refMax Text
format ImGuiSliderFlags
flags = IO Bool -> m Bool
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO do
a
currentValue <- ref -> IO a
forall t a (m :: * -> *). (HasGetter t a, MonadIO m) => t -> m a
forall (m :: * -> *). MonadIO m => ref -> m a
get ref
ref
a
minValue <- range -> IO a
forall t a (m :: * -> *). (HasGetter t a, MonadIO m) => t -> m a
forall (m :: * -> *). MonadIO m => range -> m a
get range
refMin
a
maxValue <- range -> IO a
forall t a (m :: * -> *). (HasGetter t a, MonadIO m) => t -> m a
forall (m :: * -> *). MonadIO m => range -> m a
get range
refMax
a -> (Ptr a -> IO Bool) -> IO Bool
forall a b. Storable a => a -> (Ptr a -> IO b) -> IO b
with a
currentValue \Ptr a
dataPtr ->
a -> (Ptr a -> IO Bool) -> IO Bool
forall a b. Storable a => a -> (Ptr a -> IO b) -> IO b
with a
minValue \Ptr a
minPtr ->
a -> (Ptr a -> IO Bool) -> IO Bool
forall a b. Storable a => a -> (Ptr a -> IO b) -> IO b
with a
maxValue \Ptr a
maxPtr -> do
Bool
changed <-
Text -> (CString -> IO Bool) -> IO Bool
forall (m :: * -> *) a.
MonadUnliftIO m =>
Text -> (CString -> m a) -> m a
Text.withCString Text
label \CString
labelPtr ->
Text -> (CString -> IO Bool) -> IO Bool
forall (m :: * -> *) a.
MonadUnliftIO m =>
Text -> (CString -> m a) -> m a
Text.withCString Text
format \CString
formatPtr ->
CString
-> ImGuiDataType
-> Ptr a
-> Ptr a
-> Ptr a
-> CString
-> ImGuiSliderFlags
-> IO Bool
forall (m :: * -> *) a.
MonadIO m =>
CString
-> ImGuiDataType
-> Ptr a
-> Ptr a
-> Ptr a
-> CString
-> ImGuiSliderFlags
-> m Bool
Raw.sliderScalar
CString
labelPtr
ImGuiDataType
dataType
Ptr a
dataPtr
Ptr a
minPtr
Ptr a
maxPtr
CString
formatPtr
ImGuiSliderFlags
flags
Bool -> IO () -> IO ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
when Bool
changed do
a
newValue <- Ptr a -> IO a
forall a. Storable a => Ptr a -> IO a
peek Ptr a
dataPtr
ref
ref ref -> a -> IO ()
forall t a (m :: * -> *).
(HasSetter t a, MonadIO m) =>
t -> a -> m ()
$=! a
newValue
Bool -> IO Bool
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
changed
sliderScalarN
:: (HasSetter value [a], HasGetter value [a], HasGetter range a, Storable a, MonadIO m)
=> Text -> ImGuiDataType -> value -> range -> range -> Text -> ImGuiSliderFlags -> m Bool
sliderScalarN :: forall value a range (m :: * -> *).
(HasSetter value [a], HasGetter value [a], HasGetter range a,
Storable a, MonadIO m) =>
Text
-> ImGuiDataType
-> value
-> range
-> range
-> Text
-> ImGuiSliderFlags
-> m Bool
sliderScalarN Text
label ImGuiDataType
dataType value
ref range
refMin range
refMax Text
format ImGuiSliderFlags
flags = IO Bool -> m Bool
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO do
[a]
currentValues <- value -> IO [a]
forall t a (m :: * -> *). (HasGetter t a, MonadIO m) => t -> m a
forall (m :: * -> *). MonadIO m => value -> m [a]
get value
ref
a
minValue <- range -> IO a
forall t a (m :: * -> *). (HasGetter t a, MonadIO m) => t -> m a
forall (m :: * -> *). MonadIO m => range -> m a
get range
refMin
a
maxValue <- range -> IO a
forall t a (m :: * -> *). (HasGetter t a, MonadIO m) => t -> m a
forall (m :: * -> *). MonadIO m => range -> m a
get range
refMax
[a] -> (Int -> Ptr a -> IO Bool) -> IO Bool
forall a b. Storable a => [a] -> (Int -> Ptr a -> IO b) -> IO b
withArrayLen [a]
currentValues \Int
components Ptr a
dataPtr ->
a -> (Ptr a -> IO Bool) -> IO Bool
forall a b. Storable a => a -> (Ptr a -> IO b) -> IO b
with a
minValue \Ptr a
minPtr ->
a -> (Ptr a -> IO Bool) -> IO Bool
forall a b. Storable a => a -> (Ptr a -> IO b) -> IO b
with a
maxValue \Ptr a
maxPtr -> do
Bool
changed <-
Text -> (CString -> IO Bool) -> IO Bool
forall (m :: * -> *) a.
MonadUnliftIO m =>
Text -> (CString -> m a) -> m a
Text.withCString Text
label \CString
labelPtr ->
Text -> (CString -> IO Bool) -> IO Bool
forall (m :: * -> *) a.
MonadUnliftIO m =>
Text -> (CString -> m a) -> m a
Text.withCString Text
format \CString
formatPtr ->
CString
-> ImGuiDataType
-> Ptr a
-> CInt
-> Ptr a
-> Ptr a
-> CString
-> ImGuiSliderFlags
-> IO Bool
forall (m :: * -> *) a.
MonadIO m =>
CString
-> ImGuiDataType
-> Ptr a
-> CInt
-> Ptr a
-> Ptr a
-> CString
-> ImGuiSliderFlags
-> m Bool
Raw.sliderScalarN
CString
labelPtr
ImGuiDataType
dataType
Ptr a
dataPtr
(Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
components)
Ptr a
minPtr
Ptr a
maxPtr
CString
formatPtr
ImGuiSliderFlags
flags
Bool -> IO () -> IO ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
when Bool
changed do
[a]
newValue <- Int -> Ptr a -> IO [a]
forall a. Storable a => Int -> Ptr a -> IO [a]
peekArray Int
components Ptr a
dataPtr
value
ref value -> [a] -> IO ()
forall t a (m :: * -> *).
(HasSetter t a, MonadIO m) =>
t -> a -> m ()
$=! [a]
newValue
Bool -> IO Bool
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
changed
sliderFloat :: (MonadIO m, HasSetter ref Float, HasGetter ref Float) => Text -> ref -> Float -> Float -> m Bool
sliderFloat :: forall (m :: * -> *) ref.
(MonadIO m, HasSetter ref Float, HasGetter ref Float) =>
Text -> ref -> Float -> Float -> m Bool
sliderFloat Text
desc ref
ref Float
minValue Float
maxValue = IO Bool -> m Bool
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO do
Float
currentValue <- ref -> IO Float
forall t a (m :: * -> *). (HasGetter t a, MonadIO m) => t -> m a
forall (m :: * -> *). MonadIO m => ref -> m Float
get ref
ref
CFloat -> (Ptr CFloat -> IO Bool) -> IO Bool
forall a b. Storable a => a -> (Ptr a -> IO b) -> IO b
with (Float -> CFloat
forall a b. (Real a, Fractional b) => a -> b
realToFrac Float
currentValue) \Ptr CFloat
floatPtr -> do
Bool
changed <- Text -> (CString -> IO Bool) -> IO Bool
forall (m :: * -> *) a.
MonadUnliftIO m =>
Text -> (CString -> m a) -> m a
Text.withCString Text
desc \CString
descPtr ->
CString -> Ptr CFloat -> CFloat -> CFloat -> CString -> IO Bool
forall (m :: * -> *).
MonadIO m =>
CString -> Ptr CFloat -> CFloat -> CFloat -> CString -> m Bool
Raw.sliderFloat CString
descPtr Ptr CFloat
floatPtr (Float -> CFloat
CFloat Float
minValue) (Float -> CFloat
CFloat Float
maxValue) CString
forall a. Ptr a
nullPtr
Bool -> IO () -> IO ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
when Bool
changed do
CFloat
newValue <- Ptr CFloat -> IO CFloat
forall a. Storable a => Ptr a -> IO a
peek Ptr CFloat
floatPtr
ref
ref ref -> Float -> IO ()
forall t a (m :: * -> *).
(HasSetter t a, MonadIO m) =>
t -> a -> m ()
$=! CFloat -> Float
forall a b. (Real a, Fractional b) => a -> b
realToFrac CFloat
newValue
Bool -> IO Bool
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
changed
sliderFloat2 :: (MonadIO m, HasSetter ref (Float, Float), HasGetter ref (Float, Float)) => Text -> ref -> Float -> Float -> m Bool
sliderFloat2 :: forall (m :: * -> *) ref.
(MonadIO m, HasSetter ref (Float, Float),
HasGetter ref (Float, Float)) =>
Text -> ref -> Float -> Float -> m Bool
sliderFloat2 Text
desc ref
ref Float
minValue Float
maxValue = IO Bool -> m Bool
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO do
(Float
x, Float
y) <- ref -> IO (Float, Float)
forall t a (m :: * -> *). (HasGetter t a, MonadIO m) => t -> m a
forall (m :: * -> *). MonadIO m => ref -> m (Float, Float)
get ref
ref
[CFloat] -> (Ptr CFloat -> IO Bool) -> IO Bool
forall a b. Storable a => [a] -> (Ptr a -> IO b) -> IO b
withArray [ Float -> CFloat
forall a b. (Real a, Fractional b) => a -> b
realToFrac Float
x, Float -> CFloat
forall a b. (Real a, Fractional b) => a -> b
realToFrac Float
y ] \Ptr CFloat
floatPtr -> do
Bool
changed <- Text -> (CString -> IO Bool) -> IO Bool
forall (m :: * -> *) a.
MonadUnliftIO m =>
Text -> (CString -> m a) -> m a
Text.withCString Text
desc \CString
descPtr ->
CString -> Ptr CFloat -> CFloat -> CFloat -> CString -> IO Bool
forall (m :: * -> *).
MonadIO m =>
CString -> Ptr CFloat -> CFloat -> CFloat -> CString -> m Bool
Raw.sliderFloat2 CString
descPtr Ptr CFloat
floatPtr (Float -> CFloat
CFloat Float
minValue) (Float -> CFloat
CFloat Float
maxValue) CString
forall a. Ptr a
nullPtr
Bool -> IO () -> IO ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
when Bool
changed do
[CFloat
x', CFloat
y'] <- Int -> Ptr CFloat -> IO [CFloat]
forall a. Storable a => Int -> Ptr a -> IO [a]
peekArray Int
2 Ptr CFloat
floatPtr
ref
ref ref -> (Float, Float) -> IO ()
forall t a (m :: * -> *).
(HasSetter t a, MonadIO m) =>
t -> a -> m ()
$=! (CFloat -> Float
forall a b. (Real a, Fractional b) => a -> b
realToFrac CFloat
x', CFloat -> Float
forall a b. (Real a, Fractional b) => a -> b
realToFrac CFloat
y')
Bool -> IO Bool
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
changed
sliderFloat3 :: (MonadIO m, HasSetter ref (Float, Float, Float), HasGetter ref (Float, Float, Float)) => Text -> ref -> Float -> Float -> m Bool
sliderFloat3 :: forall (m :: * -> *) ref.
(MonadIO m, HasSetter ref (Float, Float, Float),
HasGetter ref (Float, Float, Float)) =>
Text -> ref -> Float -> Float -> m Bool
sliderFloat3 Text
desc ref
ref Float
minValue Float
maxValue = IO Bool -> m Bool
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO do
(Float
x, Float
y, Float
z) <- ref -> IO (Float, Float, Float)
forall t a (m :: * -> *). (HasGetter t a, MonadIO m) => t -> m a
forall (m :: * -> *). MonadIO m => ref -> m (Float, Float, Float)
get ref
ref
[CFloat] -> (Ptr CFloat -> IO Bool) -> IO Bool
forall a b. Storable a => [a] -> (Ptr a -> IO b) -> IO b
withArray [ Float -> CFloat
forall a b. (Real a, Fractional b) => a -> b
realToFrac Float
x, Float -> CFloat
forall a b. (Real a, Fractional b) => a -> b
realToFrac Float
y, Float -> CFloat
forall a b. (Real a, Fractional b) => a -> b
realToFrac Float
z ] \Ptr CFloat
floatPtr -> do
Bool
changed <- Text -> (CString -> IO Bool) -> IO Bool
forall (m :: * -> *) a.
MonadUnliftIO m =>
Text -> (CString -> m a) -> m a
Text.withCString Text
desc \CString
descPtr ->
CString -> Ptr CFloat -> CFloat -> CFloat -> CString -> IO Bool
forall (m :: * -> *).
MonadIO m =>
CString -> Ptr CFloat -> CFloat -> CFloat -> CString -> m Bool
Raw.sliderFloat3 CString
descPtr Ptr CFloat
floatPtr (Float -> CFloat
CFloat Float
minValue) (Float -> CFloat
CFloat Float
maxValue) CString
forall a. Ptr a
nullPtr
Bool -> IO () -> IO ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
when Bool
changed do
[CFloat
x', CFloat
y', CFloat
z'] <- Int -> Ptr CFloat -> IO [CFloat]
forall a. Storable a => Int -> Ptr a -> IO [a]
peekArray Int
3 Ptr CFloat
floatPtr
ref
ref ref -> (Float, Float, Float) -> IO ()
forall t a (m :: * -> *).
(HasSetter t a, MonadIO m) =>
t -> a -> m ()
$=! (CFloat -> Float
forall a b. (Real a, Fractional b) => a -> b
realToFrac CFloat
x', CFloat -> Float
forall a b. (Real a, Fractional b) => a -> b
realToFrac CFloat
y', CFloat -> Float
forall a b. (Real a, Fractional b) => a -> b
realToFrac CFloat
z')
Bool -> IO Bool
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
changed
sliderFloat4 :: (MonadIO m, HasSetter ref (Float, Float, Float, Float), HasGetter ref (Float, Float, Float, Float)) => Text -> ref -> Float -> Float -> m Bool
sliderFloat4 :: forall (m :: * -> *) ref.
(MonadIO m, HasSetter ref (Float, Float, Float, Float),
HasGetter ref (Float, Float, Float, Float)) =>
Text -> ref -> Float -> Float -> m Bool
sliderFloat4 Text
desc ref
ref Float
minValue Float
maxValue = IO Bool -> m Bool
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO do
(Float
x, Float
y, Float
z, Float
u) <- ref -> IO (Float, Float, Float, Float)
forall t a (m :: * -> *). (HasGetter t a, MonadIO m) => t -> m a
forall (m :: * -> *).
MonadIO m =>
ref -> m (Float, Float, Float, Float)
get ref
ref
[CFloat] -> (Ptr CFloat -> IO Bool) -> IO Bool
forall a b. Storable a => [a] -> (Ptr a -> IO b) -> IO b
withArray [ Float -> CFloat
forall a b. (Real a, Fractional b) => a -> b
realToFrac Float
x, Float -> CFloat
forall a b. (Real a, Fractional b) => a -> b
realToFrac Float
y, Float -> CFloat
forall a b. (Real a, Fractional b) => a -> b
realToFrac Float
z, Float -> CFloat
forall a b. (Real a, Fractional b) => a -> b
realToFrac Float
u ] \Ptr CFloat
floatPtr -> do
Bool
changed <- Text -> (CString -> IO Bool) -> IO Bool
forall (m :: * -> *) a.
MonadUnliftIO m =>
Text -> (CString -> m a) -> m a
Text.withCString Text
desc \CString
descPtr ->
CString -> Ptr CFloat -> CFloat -> CFloat -> CString -> IO Bool
forall (m :: * -> *).
MonadIO m =>
CString -> Ptr CFloat -> CFloat -> CFloat -> CString -> m Bool
Raw.sliderFloat4 CString
descPtr Ptr CFloat
floatPtr (Float -> CFloat
CFloat Float
minValue) (Float -> CFloat
CFloat Float
maxValue) CString
forall a. Ptr a
nullPtr
Bool -> IO () -> IO ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
when Bool
changed do
[CFloat
x', CFloat
y', CFloat
z', CFloat
u'] <- Int -> Ptr CFloat -> IO [CFloat]
forall a. Storable a => Int -> Ptr a -> IO [a]
peekArray Int
4 Ptr CFloat
floatPtr
ref
ref ref -> (Float, Float, Float, Float) -> IO ()
forall t a (m :: * -> *).
(HasSetter t a, MonadIO m) =>
t -> a -> m ()
$=! (CFloat -> Float
forall a b. (Real a, Fractional b) => a -> b
realToFrac CFloat
x', CFloat -> Float
forall a b. (Real a, Fractional b) => a -> b
realToFrac CFloat
y', CFloat -> Float
forall a b. (Real a, Fractional b) => a -> b
realToFrac CFloat
z', CFloat -> Float
forall a b. (Real a, Fractional b) => a -> b
realToFrac CFloat
u')
Bool -> IO Bool
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
changed
sliderAngle :: (MonadIO m, HasSetter ref Float, HasGetter ref Float) => Text -> ref -> Float -> Float -> m Bool
sliderAngle :: forall (m :: * -> *) ref.
(MonadIO m, HasSetter ref Float, HasGetter ref Float) =>
Text -> ref -> Float -> Float -> m Bool
sliderAngle Text
desc ref
refRads Float
minDegs Float
maxDegs = IO Bool -> m Bool
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO do
Float
currentRads <- ref -> IO Float
forall t a (m :: * -> *). (HasGetter t a, MonadIO m) => t -> m a
forall (m :: * -> *). MonadIO m => ref -> m Float
get ref
refRads
CFloat -> (Ptr CFloat -> IO Bool) -> IO Bool
forall a b. Storable a => a -> (Ptr a -> IO b) -> IO b
with (Float -> CFloat
CFloat Float
currentRads) \Ptr CFloat
currentRadsPtr -> do
Bool
changed <-
Text -> (CString -> IO Bool) -> IO Bool
forall (m :: * -> *) a.
MonadUnliftIO m =>
Text -> (CString -> m a) -> m a
Text.withCString Text
desc \CString
descPtr ->
Text -> (CString -> IO Bool) -> IO Bool
forall (m :: * -> *) a.
MonadUnliftIO m =>
Text -> (CString -> m a) -> m a
Text.withCString Text
"%.0f deg" \CString
formatPtr ->
CString
-> Ptr CFloat
-> CFloat
-> CFloat
-> CString
-> ImGuiSliderFlags
-> IO Bool
forall (m :: * -> *).
MonadIO m =>
CString
-> Ptr CFloat
-> CFloat
-> CFloat
-> CString
-> ImGuiSliderFlags
-> m Bool
Raw.sliderAngle CString
descPtr Ptr CFloat
currentRadsPtr (Float -> CFloat
CFloat Float
minDegs) (Float -> CFloat
CFloat Float
maxDegs) CString
formatPtr ImGuiSliderFlags
ImGuiSliderFlags_AlwaysClamp
Bool -> IO () -> IO ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
when Bool
changed do
CFloat Float
newRads <- Ptr CFloat -> IO CFloat
forall a. Storable a => Ptr a -> IO a
peek Ptr CFloat
currentRadsPtr
ref
refRads ref -> Float -> IO ()
forall t a (m :: * -> *).
(HasSetter t a, MonadIO m) =>
t -> a -> m ()
$=! Float
newRads
Bool -> IO Bool
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
changed
sliderInt
:: (MonadIO m, HasSetter ref Int, HasGetter ref Int)
=> Text -> ref -> Int -> Int -> m Bool
sliderInt :: forall (m :: * -> *) ref.
(MonadIO m, HasSetter ref Int, HasGetter ref Int) =>
Text -> ref -> Int -> Int -> m Bool
sliderInt Text
label ref
ref Int
minValue Int
maxValue = IO Bool -> m Bool
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO do
Int
currentValue <- ref -> IO Int
forall t a (m :: * -> *). (HasGetter t a, MonadIO m) => t -> m a
forall (m :: * -> *). MonadIO m => ref -> m Int
get ref
ref
CInt -> (Ptr CInt -> IO Bool) -> IO Bool
forall a b. Storable a => a -> (Ptr a -> IO b) -> IO b
with (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
currentValue) \Ptr CInt
vPtr -> do
Bool
changed <-
Text -> (CString -> IO Bool) -> IO Bool
forall (m :: * -> *) a.
MonadUnliftIO m =>
Text -> (CString -> m a) -> m a
Text.withCString Text
label \CString
labelPtr ->
Text -> (CString -> IO Bool) -> IO Bool
forall (m :: * -> *) a.
MonadUnliftIO m =>
Text -> (CString -> m a) -> m a
Text.withCString Text
"%d" \CString
formatPtr ->
CString
-> Ptr CInt
-> CInt
-> CInt
-> CString
-> ImGuiSliderFlags
-> IO Bool
forall (m :: * -> *).
MonadIO m =>
CString
-> Ptr CInt
-> CInt
-> CInt
-> CString
-> ImGuiSliderFlags
-> m Bool
Raw.sliderInt
CString
labelPtr
Ptr CInt
vPtr
(Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
minValue)
(Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
maxValue)
CString
formatPtr
ImGuiSliderFlags
ImGuiSliderFlags_AlwaysClamp
Bool -> IO () -> IO ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
when Bool
changed do
CInt
newValue <- Ptr CInt -> IO CInt
forall a. Storable a => Ptr a -> IO a
peek Ptr CInt
vPtr
ref
ref ref -> Int -> IO ()
forall t a (m :: * -> *).
(HasSetter t a, MonadIO m) =>
t -> a -> m ()
$=! CInt -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral CInt
newValue
Bool -> IO Bool
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
changed
sliderInt2
:: (MonadIO m, HasSetter ref (Int, Int), HasGetter ref (Int, Int))
=> Text -> ref -> Int -> Int -> m Bool
sliderInt2 :: forall (m :: * -> *) ref.
(MonadIO m, HasSetter ref (Int, Int), HasGetter ref (Int, Int)) =>
Text -> ref -> Int -> Int -> m Bool
sliderInt2 Text
label ref
ref Int
minValue Int
maxValue = IO Bool -> m Bool
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO do
(Int
x, Int
y) <- ref -> IO (Int, Int)
forall t a (m :: * -> *). (HasGetter t a, MonadIO m) => t -> m a
forall (m :: * -> *). MonadIO m => ref -> m (Int, Int)
get ref
ref
[CInt] -> (Ptr CInt -> IO Bool) -> IO Bool
forall a b. Storable a => [a] -> (Ptr a -> IO b) -> IO b
withArray [ Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
x, Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
y ] \Ptr CInt
vPtr -> do
Bool
changed <-
Text -> (CString -> IO Bool) -> IO Bool
forall (m :: * -> *) a.
MonadUnliftIO m =>
Text -> (CString -> m a) -> m a
Text.withCString Text
label \CString
labelPtr ->
Text -> (CString -> IO Bool) -> IO Bool
forall (m :: * -> *) a.
MonadUnliftIO m =>
Text -> (CString -> m a) -> m a
Text.withCString Text
"%d" \CString
formatPtr ->
CString
-> Ptr CInt
-> CInt
-> CInt
-> CString
-> ImGuiSliderFlags
-> IO Bool
forall (m :: * -> *).
MonadIO m =>
CString
-> Ptr CInt
-> CInt
-> CInt
-> CString
-> ImGuiSliderFlags
-> m Bool
Raw.sliderInt2
CString
labelPtr
Ptr CInt
vPtr
(Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
minValue)
(Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
maxValue)
CString
formatPtr
ImGuiSliderFlags
ImGuiSliderFlags_AlwaysClamp
Bool -> IO () -> IO ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
when Bool
changed do
[CInt
x', CInt
y'] <- Int -> Ptr CInt -> IO [CInt]
forall a. Storable a => Int -> Ptr a -> IO [a]
peekArray Int
2 Ptr CInt
vPtr
ref
ref ref -> (Int, Int) -> IO ()
forall t a (m :: * -> *).
(HasSetter t a, MonadIO m) =>
t -> a -> m ()
$=! (CInt -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral CInt
x', CInt -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral CInt
y')
Bool -> IO Bool
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
changed
sliderInt3
:: (MonadIO m, HasSetter ref (Int, Int, Int), HasGetter ref (Int, Int, Int))
=> Text -> ref -> Int -> Int -> m Bool
sliderInt3 :: forall (m :: * -> *) ref.
(MonadIO m, HasSetter ref (Int, Int, Int),
HasGetter ref (Int, Int, Int)) =>
Text -> ref -> Int -> Int -> m Bool
sliderInt3 Text
label ref
ref Int
minValue Int
maxValue = IO Bool -> m Bool
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO do
(Int
x, Int
y, Int
z) <- ref -> IO (Int, Int, Int)
forall t a (m :: * -> *). (HasGetter t a, MonadIO m) => t -> m a
forall (m :: * -> *). MonadIO m => ref -> m (Int, Int, Int)
get ref
ref
[CInt] -> (Ptr CInt -> IO Bool) -> IO Bool
forall a b. Storable a => [a] -> (Ptr a -> IO b) -> IO b
withArray [ Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
x, Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
y, Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
z ] \Ptr CInt
vPtr -> do
Bool
changed <-
Text -> (CString -> IO Bool) -> IO Bool
forall (m :: * -> *) a.
MonadUnliftIO m =>
Text -> (CString -> m a) -> m a
Text.withCString Text
label \CString
labelPtr ->
Text -> (CString -> IO Bool) -> IO Bool
forall (m :: * -> *) a.
MonadUnliftIO m =>
Text -> (CString -> m a) -> m a
Text.withCString Text
"%d" \CString
formatPtr ->
CString
-> Ptr CInt
-> CInt
-> CInt
-> CString
-> ImGuiSliderFlags
-> IO Bool
forall (m :: * -> *).
MonadIO m =>
CString
-> Ptr CInt
-> CInt
-> CInt
-> CString
-> ImGuiSliderFlags
-> m Bool
Raw.sliderInt3
CString
labelPtr
Ptr CInt
vPtr
(Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
minValue)
(Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
maxValue)
CString
formatPtr
ImGuiSliderFlags
ImGuiSliderFlags_AlwaysClamp
Bool -> IO () -> IO ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
when Bool
changed do
[CInt
x', CInt
y', CInt
z'] <- Int -> Ptr CInt -> IO [CInt]
forall a. Storable a => Int -> Ptr a -> IO [a]
peekArray Int
3 Ptr CInt
vPtr
ref
ref ref -> (Int, Int, Int) -> IO ()
forall t a (m :: * -> *).
(HasSetter t a, MonadIO m) =>
t -> a -> m ()
$=! (CInt -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral CInt
x', CInt -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral CInt
y', CInt -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral CInt
z')
Bool -> IO Bool
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
changed
sliderInt4
:: (MonadIO m, HasSetter ref (Int, Int, Int, Int), HasGetter ref (Int, Int, Int, Int))
=> Text -> ref -> Int -> Int -> m Bool
sliderInt4 :: forall (m :: * -> *) ref.
(MonadIO m, HasSetter ref (Int, Int, Int, Int),
HasGetter ref (Int, Int, Int, Int)) =>
Text -> ref -> Int -> Int -> m Bool
sliderInt4 Text
label ref
ref Int
minValue Int
maxValue = IO Bool -> m Bool
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO do
(Int
x, Int
y, Int
z, Int
w) <- ref -> IO (Int, Int, Int, Int)
forall t a (m :: * -> *). (HasGetter t a, MonadIO m) => t -> m a
forall (m :: * -> *). MonadIO m => ref -> m (Int, Int, Int, Int)
get ref
ref
[CInt] -> (Ptr CInt -> IO Bool) -> IO Bool
forall a b. Storable a => [a] -> (Ptr a -> IO b) -> IO b
withArray [ Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
x, Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
y, Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
z, Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
w] \Ptr CInt
vPtr -> do
Bool
changed <-
Text -> (CString -> IO Bool) -> IO Bool
forall (m :: * -> *) a.
MonadUnliftIO m =>
Text -> (CString -> m a) -> m a
Text.withCString Text
label \CString
labelPtr ->
Text -> (CString -> IO Bool) -> IO Bool
forall (m :: * -> *) a.
MonadUnliftIO m =>
Text -> (CString -> m a) -> m a
Text.withCString Text
"%d" \CString
formatPtr ->
CString
-> Ptr CInt
-> CInt
-> CInt
-> CString
-> ImGuiSliderFlags
-> IO Bool
forall (m :: * -> *).
MonadIO m =>
CString
-> Ptr CInt
-> CInt
-> CInt
-> CString
-> ImGuiSliderFlags
-> m Bool
Raw.sliderInt4
CString
labelPtr
Ptr CInt
vPtr
(Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
minValue)
(Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
maxValue)
CString
formatPtr
ImGuiSliderFlags
ImGuiSliderFlags_AlwaysClamp
Bool -> IO () -> IO ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
when Bool
changed do
[CInt
x', CInt
y', CInt
z', CInt
w'] <- Int -> Ptr CInt -> IO [CInt]
forall a. Storable a => Int -> Ptr a -> IO [a]
peekArray Int
4 Ptr CInt
vPtr
ref
ref ref -> (Int, Int, Int, Int) -> IO ()
forall t a (m :: * -> *).
(HasSetter t a, MonadIO m) =>
t -> a -> m ()
$=! (CInt -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral CInt
x', CInt -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral CInt
y', CInt -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral CInt
z', CInt -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral CInt
w')
Bool -> IO Bool
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
changed
vSliderFloat
:: (HasSetter ref Float, HasGetter ref Float, MonadIO m)
=> Text -> ImVec2 -> ref -> Float -> Float -> m Bool
vSliderFloat :: forall ref (m :: * -> *).
(HasSetter ref Float, HasGetter ref Float, MonadIO m) =>
Text -> ImVec2 -> ref -> Float -> Float -> m Bool
vSliderFloat Text
label ImVec2
size ref
ref Float
minValue Float
maxValue = IO Bool -> m Bool
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO do
Float
currentValue <- ref -> IO Float
forall t a (m :: * -> *). (HasGetter t a, MonadIO m) => t -> m a
forall (m :: * -> *). MonadIO m => ref -> m Float
get ref
ref
ImVec2 -> (Ptr ImVec2 -> IO Bool) -> IO Bool
forall a b. Storable a => a -> (Ptr a -> IO b) -> IO b
with ImVec2
size \Ptr ImVec2
sizePtr ->
CFloat -> (Ptr CFloat -> IO Bool) -> IO Bool
forall a b. Storable a => a -> (Ptr a -> IO b) -> IO b
with (Float -> CFloat
CFloat Float
currentValue) \Ptr CFloat
dataPtr -> do
Bool
changed <-
Text -> (CString -> IO Bool) -> IO Bool
forall (m :: * -> *) a.
MonadUnliftIO m =>
Text -> (CString -> m a) -> m a
Text.withCString Text
label \CString
labelPtr ->
Text -> (CString -> IO Bool) -> IO Bool
forall (m :: * -> *) a.
MonadUnliftIO m =>
Text -> (CString -> m a) -> m a
Text.withCString Text
"%.3f" \CString
formatPtr ->
CString
-> Ptr ImVec2
-> Ptr CFloat
-> CFloat
-> CFloat
-> CString
-> ImGuiSliderFlags
-> IO Bool
forall (m :: * -> *).
MonadIO m =>
CString
-> Ptr ImVec2
-> Ptr CFloat
-> CFloat
-> CFloat
-> CString
-> ImGuiSliderFlags
-> m Bool
Raw.vSliderFloat
CString
labelPtr
Ptr ImVec2
sizePtr
Ptr CFloat
dataPtr
(Float -> CFloat
CFloat Float
minValue)
(Float -> CFloat
CFloat Float
maxValue)
CString
formatPtr
ImGuiSliderFlags
ImGuiSliderFlags_AlwaysClamp
Bool -> IO () -> IO ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
when Bool
changed do
CFloat Float
newValue <- Ptr CFloat -> IO CFloat
forall a. Storable a => Ptr a -> IO a
peek Ptr CFloat
dataPtr
ref
ref ref -> Float -> IO ()
forall t a (m :: * -> *).
(HasSetter t a, MonadIO m) =>
t -> a -> m ()
$=! Float
newValue
Bool -> IO Bool
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
changed
vSliderInt
:: (HasSetter ref Int, HasGetter ref Int, MonadIO m)
=> Text -> ImVec2 -> ref -> Int -> Int -> m Bool
vSliderInt :: forall ref (m :: * -> *).
(HasSetter ref Int, HasGetter ref Int, MonadIO m) =>
Text -> ImVec2 -> ref -> Int -> Int -> m Bool
vSliderInt Text
label ImVec2
size ref
ref Int
minValue Int
maxValue = IO Bool -> m Bool
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO do
Int
currentValue <- ref -> IO Int
forall t a (m :: * -> *). (HasGetter t a, MonadIO m) => t -> m a
forall (m :: * -> *). MonadIO m => ref -> m Int
get ref
ref
ImVec2 -> (Ptr ImVec2 -> IO Bool) -> IO Bool
forall a b. Storable a => a -> (Ptr a -> IO b) -> IO b
with ImVec2
size \Ptr ImVec2
sizePtr ->
CInt -> (Ptr CInt -> IO Bool) -> IO Bool
forall a b. Storable a => a -> (Ptr a -> IO b) -> IO b
with (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
currentValue) \Ptr CInt
dataPtr -> do
Bool
changed <-
Text -> (CString -> IO Bool) -> IO Bool
forall (m :: * -> *) a.
MonadUnliftIO m =>
Text -> (CString -> m a) -> m a
Text.withCString Text
label \CString
labelPtr ->
Text -> (CString -> IO Bool) -> IO Bool
forall (m :: * -> *) a.
MonadUnliftIO m =>
Text -> (CString -> m a) -> m a
Text.withCString Text
"%d" \CString
formatPtr ->
CString
-> Ptr ImVec2
-> Ptr CInt
-> CInt
-> CInt
-> CString
-> ImGuiSliderFlags
-> IO Bool
forall (m :: * -> *).
MonadIO m =>
CString
-> Ptr ImVec2
-> Ptr CInt
-> CInt
-> CInt
-> CString
-> ImGuiSliderFlags
-> m Bool
Raw.vSliderInt
CString
labelPtr
Ptr ImVec2
sizePtr
Ptr CInt
dataPtr
(Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
minValue)
(Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
maxValue)
CString
formatPtr
ImGuiSliderFlags
ImGuiSliderFlags_AlwaysClamp
Bool -> IO () -> IO ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
when Bool
changed do
CInt
newValue <- Ptr CInt -> IO CInt
forall a. Storable a => Ptr a -> IO a
peek Ptr CInt
dataPtr
ref
ref ref -> Int -> IO ()
forall t a (m :: * -> *).
(HasSetter t a, MonadIO m) =>
t -> a -> m ()
$=! CInt -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral CInt
newValue
Bool -> IO Bool
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
changed
vSliderScalar
:: (HasSetter ref a, HasGetter ref a, HasGetter range a, Storable a, MonadIO m)
=> Text -> ImVec2 -> ImGuiDataType -> ref -> range -> range -> Text -> ImGuiSliderFlags -> m Bool
vSliderScalar :: forall ref a range (m :: * -> *).
(HasSetter ref a, HasGetter ref a, HasGetter range a, Storable a,
MonadIO m) =>
Text
-> ImVec2
-> ImGuiDataType
-> ref
-> range
-> range
-> Text
-> ImGuiSliderFlags
-> m Bool
vSliderScalar Text
label ImVec2
size ImGuiDataType
dataType ref
ref range
refMin range
refMax Text
format ImGuiSliderFlags
flags = IO Bool -> m Bool
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO do
a
currentValue <- ref -> IO a
forall t a (m :: * -> *). (HasGetter t a, MonadIO m) => t -> m a
forall (m :: * -> *). MonadIO m => ref -> m a
get ref
ref
a
minValue <- range -> IO a
forall t a (m :: * -> *). (HasGetter t a, MonadIO m) => t -> m a
forall (m :: * -> *). MonadIO m => range -> m a
get range
refMin
a
maxValue <- range -> IO a
forall t a (m :: * -> *). (HasGetter t a, MonadIO m) => t -> m a
forall (m :: * -> *). MonadIO m => range -> m a
get range
refMax
ImVec2 -> (Ptr ImVec2 -> IO Bool) -> IO Bool
forall a b. Storable a => a -> (Ptr a -> IO b) -> IO b
with ImVec2
size \Ptr ImVec2
sizePtr ->
a -> (Ptr a -> IO Bool) -> IO Bool
forall a b. Storable a => a -> (Ptr a -> IO b) -> IO b
with a
currentValue \Ptr a
dataPtr ->
a -> (Ptr a -> IO Bool) -> IO Bool
forall a b. Storable a => a -> (Ptr a -> IO b) -> IO b
with a
minValue \Ptr a
minPtr ->
a -> (Ptr a -> IO Bool) -> IO Bool
forall a b. Storable a => a -> (Ptr a -> IO b) -> IO b
with a
maxValue \Ptr a
maxPtr -> do
Bool
changed <-
Text -> (CString -> IO Bool) -> IO Bool
forall (m :: * -> *) a.
MonadUnliftIO m =>
Text -> (CString -> m a) -> m a
Text.withCString Text
label \CString
labelPtr ->
Text -> (CString -> IO Bool) -> IO Bool
forall (m :: * -> *) a.
MonadUnliftIO m =>
Text -> (CString -> m a) -> m a
Text.withCString Text
format \CString
formatPtr ->
CString
-> Ptr ImVec2
-> ImGuiDataType
-> Ptr a
-> Ptr a
-> Ptr a
-> CString
-> ImGuiSliderFlags
-> IO Bool
forall (m :: * -> *) a.
MonadIO m =>
CString
-> Ptr ImVec2
-> ImGuiDataType
-> Ptr a
-> Ptr a
-> Ptr a
-> CString
-> ImGuiSliderFlags
-> m Bool
Raw.vSliderScalar
CString
labelPtr
Ptr ImVec2
sizePtr
ImGuiDataType
dataType
Ptr a
dataPtr
Ptr a
minPtr
Ptr a
maxPtr
CString
formatPtr
ImGuiSliderFlags
flags
Bool -> IO () -> IO ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
when Bool
changed do
a
newValue <- Ptr a -> IO a
forall a. Storable a => Ptr a -> IO a
peek Ptr a
dataPtr
ref
ref ref -> a -> IO ()
forall t a (m :: * -> *).
(HasSetter t a, MonadIO m) =>
t -> a -> m ()
$=! a
newValue
Bool -> IO Bool
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
changed
inputText :: (MonadIO m, HasSetter ref Text, HasGetter ref Text) => Text -> ref -> Int -> m Bool
inputText :: forall (m :: * -> *) ref.
(MonadIO m, HasSetter ref Text, HasGetter ref Text) =>
Text -> ref -> Int -> m Bool
inputText Text
label ref
ref Int
bufSize =
ref -> Int -> (CStringLen -> IO Bool) -> m Bool
forall (m :: * -> *) ref.
(MonadIO m, HasSetter ref Text, HasGetter ref Text) =>
ref -> Int -> (CStringLen -> IO Bool) -> m Bool
withInputString ref
ref Int
bufSize \CStringLen
bufPtrLen ->
Text -> (CString -> IO Bool) -> IO Bool
forall (m :: * -> *) a.
MonadUnliftIO m =>
Text -> (CString -> m a) -> m a
Text.withCString Text
label \CString
labelPtr ->
CString -> CStringLen -> ImGuiInputTextFlags -> IO Bool
forall (m :: * -> *).
MonadIO m =>
CString -> CStringLen -> ImGuiInputTextFlags -> m Bool
Raw.inputText
CString
labelPtr
CStringLen
bufPtrLen
ImGuiInputTextFlags
ImGuiInputTextFlags_None
inputTextMultiline :: (MonadIO m, HasSetter ref Text, HasGetter ref Text) => Text -> ref -> Int -> ImVec2 -> m Bool
inputTextMultiline :: forall (m :: * -> *) ref.
(MonadIO m, HasSetter ref Text, HasGetter ref Text) =>
Text -> ref -> Int -> ImVec2 -> m Bool
inputTextMultiline Text
label ref
ref Int
bufSize ImVec2
size =
ref -> Int -> (CStringLen -> IO Bool) -> m Bool
forall (m :: * -> *) ref.
(MonadIO m, HasSetter ref Text, HasGetter ref Text) =>
ref -> Int -> (CStringLen -> IO Bool) -> m Bool
withInputString ref
ref Int
bufSize \CStringLen
bufPtrLen ->
Text -> (CString -> IO Bool) -> IO Bool
forall (m :: * -> *) a.
MonadUnliftIO m =>
Text -> (CString -> m a) -> m a
Text.withCString Text
label \CString
labelPtr ->
ImVec2 -> (Ptr ImVec2 -> IO Bool) -> IO Bool
forall a b. Storable a => a -> (Ptr a -> IO b) -> IO b
with ImVec2
size \Ptr ImVec2
sizePtr ->
CString
-> CStringLen -> Ptr ImVec2 -> ImGuiInputTextFlags -> IO Bool
forall (m :: * -> *).
MonadIO m =>
CString
-> CStringLen -> Ptr ImVec2 -> ImGuiInputTextFlags -> m Bool
Raw.inputTextMultiline
CString
labelPtr
CStringLen
bufPtrLen
Ptr ImVec2
sizePtr
ImGuiInputTextFlags
ImGuiInputTextFlags_None
inputTextWithHint :: (MonadIO m, HasSetter ref Text, HasGetter ref Text) => Text -> Text -> ref -> Int -> m Bool
inputTextWithHint :: forall (m :: * -> *) ref.
(MonadIO m, HasSetter ref Text, HasGetter ref Text) =>
Text -> Text -> ref -> Int -> m Bool
inputTextWithHint Text
label Text
hint ref
ref Int
bufSize =
ref -> Int -> (CStringLen -> IO Bool) -> m Bool
forall (m :: * -> *) ref.
(MonadIO m, HasSetter ref Text, HasGetter ref Text) =>
ref -> Int -> (CStringLen -> IO Bool) -> m Bool
withInputString ref
ref Int
bufSize \CStringLen
bufPtrLen ->
Text -> (CString -> IO Bool) -> IO Bool
forall (m :: * -> *) a.
MonadUnliftIO m =>
Text -> (CString -> m a) -> m a
Text.withCString Text
label \CString
labelPtr ->
Text -> (CString -> IO Bool) -> IO Bool
forall (m :: * -> *) a.
MonadUnliftIO m =>
Text -> (CString -> m a) -> m a
Text.withCString Text
hint \CString
hintPtr ->
CString -> CString -> CStringLen -> ImGuiInputTextFlags -> IO Bool
forall (m :: * -> *).
MonadIO m =>
CString -> CString -> CStringLen -> ImGuiInputTextFlags -> m Bool
Raw.inputTextWithHint
CString
labelPtr
CString
hintPtr
CStringLen
bufPtrLen
ImGuiInputTextFlags
ImGuiInputTextFlags_None
withInputString
:: (MonadIO m, HasSetter ref Text, HasGetter ref Text)
=> ref
-> Int
-> (CStringLen -> IO Bool)
-> m Bool
withInputString :: forall (m :: * -> *) ref.
(MonadIO m, HasSetter ref Text, HasGetter ref Text) =>
ref -> Int -> (CStringLen -> IO Bool) -> m Bool
withInputString ref
ref Int
bufSize CStringLen -> IO Bool
action = IO Bool -> m Bool
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO do
Text
input <- ref -> IO Text
forall t a (m :: * -> *). (HasGetter t a, MonadIO m) => t -> m a
forall (m :: * -> *). MonadIO m => ref -> m Text
get ref
ref
Text -> (CStringLen -> IO Bool) -> IO Bool
forall a. Text -> (CStringLen -> IO a) -> IO a
Text.withCStringLen Text
input \(CString
refPtr, Int
refSize) ->
IO CString -> (CString -> IO ()) -> (CString -> IO Bool) -> IO Bool
forall (m :: * -> *) a b c.
MonadUnliftIO m =>
m a -> (a -> m b) -> (a -> m c) -> m c
bracket (Int -> IO CString
forall {a}. Int -> IO (Ptr a)
mkBuf Int
refSize) CString -> IO ()
forall a. Ptr a -> IO ()
free \CString
bufPtr -> do
CString -> CString -> Int -> IO ()
forall a. Ptr a -> Ptr a -> Int -> IO ()
copyBytes CString
bufPtr CString
refPtr Int
refSize
Bool
changed <- CStringLen -> IO Bool
action (CString
bufPtr, Int
bufSize)
Bool -> IO () -> IO ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
when Bool
changed do
Text
newValue <- CString -> IO Text
Text.peekCString CString
bufPtr
ref
ref ref -> Text -> IO ()
forall t a (m :: * -> *).
(HasSetter t a, MonadIO m) =>
t -> a -> m ()
$=! Text
newValue
Bool -> IO Bool
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
changed
where
mkBuf :: Int -> IO (Ptr a)
mkBuf Int
refSize =
Int -> IO (Ptr a)
forall {a}. Int -> IO (Ptr a)
callocBytes (Int -> IO (Ptr a)) -> Int -> IO (Ptr a)
forall a b. (a -> b) -> a -> b
$
Int -> Int -> Int
forall a. Ord a => a -> a -> a
max Int
refSize Int
bufSize Int -> Int -> Int
forall a. Num a => a -> a -> a
+
Int
5
inputFloat :: (MonadIO m, HasSetter ref Float, HasGetter ref Float) => Text -> ref -> Float -> Float -> m Bool
inputFloat :: forall (m :: * -> *) ref.
(MonadIO m, HasSetter ref Float, HasGetter ref Float) =>
Text -> ref -> Float -> Float -> m Bool
inputFloat Text
desc ref
ref Float
step Float
stepFast = IO Bool -> m Bool
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO do
Float
currentValue <- ref -> IO Float
forall t a (m :: * -> *). (HasGetter t a, MonadIO m) => t -> m a
forall (m :: * -> *). MonadIO m => ref -> m Float
get ref
ref
CFloat -> (Ptr CFloat -> IO Bool) -> IO Bool
forall a b. Storable a => a -> (Ptr a -> IO b) -> IO b
with (Float -> CFloat
CFloat Float
currentValue) \Ptr CFloat
floatPtr -> do
Bool
changed <- Text -> (CString -> IO Bool) -> IO Bool
forall (m :: * -> *) a.
MonadUnliftIO m =>
Text -> (CString -> m a) -> m a
Text.withCString Text
desc \CString
descPtr ->
CString
-> Ptr CFloat
-> CFloat
-> CFloat
-> CString
-> ImGuiInputTextFlags
-> IO Bool
forall (m :: * -> *).
MonadIO m =>
CString
-> Ptr CFloat
-> CFloat
-> CFloat
-> CString
-> ImGuiInputTextFlags
-> m Bool
Raw.inputFloat CString
descPtr Ptr CFloat
floatPtr (Float -> CFloat
CFloat Float
step) (Float -> CFloat
CFloat Float
stepFast) CString
forall a. Ptr a
nullPtr ImGuiInputTextFlags
ImGuiInputTextFlags_None
Bool -> IO () -> IO ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
when Bool
changed do
CFloat Float
newValue <- Ptr CFloat -> IO CFloat
forall a. Storable a => Ptr a -> IO a
peek Ptr CFloat
floatPtr
ref
ref ref -> Float -> IO ()
forall t a (m :: * -> *).
(HasSetter t a, MonadIO m) =>
t -> a -> m ()
$=! Float
newValue
Bool -> IO Bool
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
changed
inputFloat2 :: (MonadIO m, HasSetter ref (Float, Float), HasGetter ref (Float, Float)) => Text -> ref -> m Bool
inputFloat2 :: forall (m :: * -> *) ref.
(MonadIO m, HasSetter ref (Float, Float),
HasGetter ref (Float, Float)) =>
Text -> ref -> m Bool
inputFloat2 Text
desc ref
ref = IO Bool -> m Bool
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO do
(Float
x, Float
y) <- ref -> IO (Float, Float)
forall t a (m :: * -> *). (HasGetter t a, MonadIO m) => t -> m a
forall (m :: * -> *). MonadIO m => ref -> m (Float, Float)
get ref
ref
[CFloat] -> (Ptr CFloat -> IO Bool) -> IO Bool
forall a b. Storable a => [a] -> (Ptr a -> IO b) -> IO b
withArray [ Float -> CFloat
CFloat Float
x, Float -> CFloat
CFloat Float
y ] \Ptr CFloat
floatPtr -> do
Bool
changed <- Text -> (CString -> IO Bool) -> IO Bool
forall (m :: * -> *) a.
MonadUnliftIO m =>
Text -> (CString -> m a) -> m a
Text.withCString Text
desc \CString
descPtr ->
CString -> Ptr CFloat -> CString -> ImGuiInputTextFlags -> IO Bool
forall (m :: * -> *).
MonadIO m =>
CString -> Ptr CFloat -> CString -> ImGuiInputTextFlags -> m Bool
Raw.inputFloat2 CString
descPtr Ptr CFloat
floatPtr CString
forall a. Ptr a
nullPtr ImGuiInputTextFlags
ImGuiInputTextFlags_None
Bool -> IO () -> IO ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
when Bool
changed do
[CFloat Float
x', CFloat Float
y'] <- Int -> Ptr CFloat -> IO [CFloat]
forall a. Storable a => Int -> Ptr a -> IO [a]
peekArray Int
2 Ptr CFloat
floatPtr
ref
ref ref -> (Float, Float) -> IO ()
forall t a (m :: * -> *).
(HasSetter t a, MonadIO m) =>
t -> a -> m ()
$=! (Float
x', Float
y')
Bool -> IO Bool
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
changed
inputFloat3 :: (MonadIO m, HasSetter ref (Float, Float, Float), HasGetter ref (Float, Float, Float)) => Text -> ref -> m Bool
inputFloat3 :: forall (m :: * -> *) ref.
(MonadIO m, HasSetter ref (Float, Float, Float),
HasGetter ref (Float, Float, Float)) =>
Text -> ref -> m Bool
inputFloat3 Text
desc ref
ref = IO Bool -> m Bool
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO do
(Float
x, Float
y, Float
z) <- ref -> IO (Float, Float, Float)
forall t a (m :: * -> *). (HasGetter t a, MonadIO m) => t -> m a
forall (m :: * -> *). MonadIO m => ref -> m (Float, Float, Float)
get ref
ref
[CFloat] -> (Ptr CFloat -> IO Bool) -> IO Bool
forall a b. Storable a => [a] -> (Ptr a -> IO b) -> IO b
withArray [ Float -> CFloat
CFloat Float
x, Float -> CFloat
CFloat Float
y, Float -> CFloat
CFloat Float
z ] \Ptr CFloat
floatPtr -> do
Bool
changed <- Text -> (CString -> IO Bool) -> IO Bool
forall (m :: * -> *) a.
MonadUnliftIO m =>
Text -> (CString -> m a) -> m a
Text.withCString Text
desc \CString
descPtr ->
CString -> Ptr CFloat -> CString -> ImGuiInputTextFlags -> IO Bool
forall (m :: * -> *).
MonadIO m =>
CString -> Ptr CFloat -> CString -> ImGuiInputTextFlags -> m Bool
Raw.inputFloat3 CString
descPtr Ptr CFloat
floatPtr CString
forall a. Ptr a
nullPtr ImGuiInputTextFlags
ImGuiInputTextFlags_None
Bool -> IO () -> IO ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
when Bool
changed do
[CFloat Float
x', CFloat Float
y', CFloat Float
z'] <- Int -> Ptr CFloat -> IO [CFloat]
forall a. Storable a => Int -> Ptr a -> IO [a]
peekArray Int
3 Ptr CFloat
floatPtr
ref
ref ref -> (Float, Float, Float) -> IO ()
forall t a (m :: * -> *).
(HasSetter t a, MonadIO m) =>
t -> a -> m ()
$=! (Float
x', Float
y', Float
z')
Bool -> IO Bool
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
changed
inputFloat4 :: (MonadIO m, HasSetter ref (Float, Float, Float, Float), HasGetter ref (Float, Float, Float, Float)) => Text -> ref -> m Bool
inputFloat4 :: forall (m :: * -> *) ref.
(MonadIO m, HasSetter ref (Float, Float, Float, Float),
HasGetter ref (Float, Float, Float, Float)) =>
Text -> ref -> m Bool
inputFloat4 Text
desc ref
ref = IO Bool -> m Bool
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO do
(Float
x, Float
y, Float
z, Float
u) <- ref -> IO (Float, Float, Float, Float)
forall t a (m :: * -> *). (HasGetter t a, MonadIO m) => t -> m a
forall (m :: * -> *).
MonadIO m =>
ref -> m (Float, Float, Float, Float)
get ref
ref
[CFloat] -> (Ptr CFloat -> IO Bool) -> IO Bool
forall a b. Storable a => [a] -> (Ptr a -> IO b) -> IO b
withArray [ Float -> CFloat
CFloat Float
x, Float -> CFloat
CFloat Float
y, Float -> CFloat
CFloat Float
z, Float -> CFloat
CFloat Float
u ] \Ptr CFloat
floatPtr -> do
Bool
changed <- Text -> (CString -> IO Bool) -> IO Bool
forall (m :: * -> *) a.
MonadUnliftIO m =>
Text -> (CString -> m a) -> m a
Text.withCString Text
desc \CString
descPtr ->
CString -> Ptr CFloat -> CString -> ImGuiInputTextFlags -> IO Bool
forall (m :: * -> *).
MonadIO m =>
CString -> Ptr CFloat -> CString -> ImGuiInputTextFlags -> m Bool
Raw.inputFloat4 CString
descPtr Ptr CFloat
floatPtr CString
forall a. Ptr a
nullPtr ImGuiInputTextFlags
ImGuiInputTextFlags_None
Bool -> IO () -> IO ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
when Bool
changed do
[CFloat Float
x', CFloat Float
y', CFloat Float
z', CFloat Float
u'] <- Int -> Ptr CFloat -> IO [CFloat]
forall a. Storable a => Int -> Ptr a -> IO [a]
peekArray Int
4 Ptr CFloat
floatPtr
ref
ref ref -> (Float, Float, Float, Float) -> IO ()
forall t a (m :: * -> *).
(HasSetter t a, MonadIO m) =>
t -> a -> m ()
$=! (Float
x', Float
y', Float
z', Float
u')
Bool -> IO Bool
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
changed
inputInt :: (MonadIO m, HasSetter ref Int32, HasGetter ref Int32) => Text -> ref -> Int32 -> Int32 -> m Bool
inputInt :: forall (m :: * -> *) ref.
(MonadIO m, HasSetter ref Int32, HasGetter ref Int32) =>
Text -> ref -> Int32 -> Int32 -> m Bool
inputInt Text
desc ref
ref Int32
step Int32
stepFast = IO Bool -> m Bool
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO do
Int32
currentValue <- ref -> IO Int32
forall t a (m :: * -> *). (HasGetter t a, MonadIO m) => t -> m a
forall (m :: * -> *). MonadIO m => ref -> m Int32
get ref
ref
CInt -> (Ptr CInt -> IO Bool) -> IO Bool
forall a b. Storable a => a -> (Ptr a -> IO b) -> IO b
with (Int32 -> CInt
CInt Int32
currentValue) \Ptr CInt
intPtr -> do
Bool
changed <- Text -> (CString -> IO Bool) -> IO Bool
forall (m :: * -> *) a.
MonadUnliftIO m =>
Text -> (CString -> m a) -> m a
Text.withCString Text
desc \CString
descPtr ->
CString
-> Ptr CInt -> CInt -> CInt -> ImGuiInputTextFlags -> IO Bool
forall (m :: * -> *).
MonadIO m =>
CString
-> Ptr CInt -> CInt -> CInt -> ImGuiInputTextFlags -> m Bool
Raw.inputInt CString
descPtr Ptr CInt
intPtr (Int32 -> CInt
CInt Int32
step) (Int32 -> CInt
CInt Int32
stepFast) ImGuiInputTextFlags
ImGuiInputTextFlags_None
Bool -> IO () -> IO ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
when Bool
changed do
CInt Int32
newValue <- Ptr CInt -> IO CInt
forall a. Storable a => Ptr a -> IO a
peek Ptr CInt
intPtr
ref
ref ref -> Int32 -> IO ()
forall t a (m :: * -> *).
(HasSetter t a, MonadIO m) =>
t -> a -> m ()
$=! Int32
newValue
Bool -> IO Bool
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
changed
inputInt2 :: (MonadIO m, HasSetter ref (Int32, Int32), HasGetter ref (Int32, Int32)) => Text -> ref -> m Bool
inputInt2 :: forall (m :: * -> *) ref.
(MonadIO m, HasSetter ref (Int32, Int32),
HasGetter ref (Int32, Int32)) =>
Text -> ref -> m Bool
inputInt2 Text
desc ref
ref = IO Bool -> m Bool
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO do
(Int32
x, Int32
y) <- ref -> IO (Int32, Int32)
forall t a (m :: * -> *). (HasGetter t a, MonadIO m) => t -> m a
forall (m :: * -> *). MonadIO m => ref -> m (Int32, Int32)
get ref
ref
[CInt] -> (Ptr CInt -> IO Bool) -> IO Bool
forall a b. Storable a => [a] -> (Ptr a -> IO b) -> IO b
withArray [ Int32 -> CInt
CInt Int32
x, Int32 -> CInt
CInt Int32
y ] \Ptr CInt
intPtr -> do
Bool
changed <- Text -> (CString -> IO Bool) -> IO Bool
forall (m :: * -> *) a.
MonadUnliftIO m =>
Text -> (CString -> m a) -> m a
Text.withCString Text
desc \CString
descPtr ->
CString -> Ptr CInt -> ImGuiInputTextFlags -> IO Bool
forall (m :: * -> *).
MonadIO m =>
CString -> Ptr CInt -> ImGuiInputTextFlags -> m Bool
Raw.inputInt2 CString
descPtr Ptr CInt
intPtr ImGuiInputTextFlags
ImGuiInputTextFlags_None
Bool -> IO () -> IO ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
when Bool
changed do
[CInt Int32
x', CInt Int32
y'] <- Int -> Ptr CInt -> IO [CInt]
forall a. Storable a => Int -> Ptr a -> IO [a]
peekArray Int
2 Ptr CInt
intPtr
ref
ref ref -> (Int32, Int32) -> IO ()
forall t a (m :: * -> *).
(HasSetter t a, MonadIO m) =>
t -> a -> m ()
$=! (Int32
x', Int32
y')
Bool -> IO Bool
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
changed
inputInt3 :: (MonadIO m, HasSetter ref (Int32, Int32, Int32), HasGetter ref (Int32, Int32, Int32)) => Text -> ref -> m Bool
inputInt3 :: forall (m :: * -> *) ref.
(MonadIO m, HasSetter ref (Int32, Int32, Int32),
HasGetter ref (Int32, Int32, Int32)) =>
Text -> ref -> m Bool
inputInt3 Text
desc ref
ref = IO Bool -> m Bool
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO do
(Int32
x, Int32
y, Int32
z) <- ref -> IO (Int32, Int32, Int32)
forall t a (m :: * -> *). (HasGetter t a, MonadIO m) => t -> m a
forall (m :: * -> *). MonadIO m => ref -> m (Int32, Int32, Int32)
get ref
ref
[CInt] -> (Ptr CInt -> IO Bool) -> IO Bool
forall a b. Storable a => [a] -> (Ptr a -> IO b) -> IO b
withArray [ Int32 -> CInt
CInt Int32
x, Int32 -> CInt
CInt Int32
y, Int32 -> CInt
CInt Int32
z ] \Ptr CInt
intPtr -> do
Bool
changed <- Text -> (CString -> IO Bool) -> IO Bool
forall (m :: * -> *) a.
MonadUnliftIO m =>
Text -> (CString -> m a) -> m a
Text.withCString Text
desc \CString
descPtr ->
CString -> Ptr CInt -> ImGuiInputTextFlags -> IO Bool
forall (m :: * -> *).
MonadIO m =>
CString -> Ptr CInt -> ImGuiInputTextFlags -> m Bool
Raw.inputInt3 CString
descPtr Ptr CInt
intPtr ImGuiInputTextFlags
ImGuiInputTextFlags_None
Bool -> IO () -> IO ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
when Bool
changed do
[CInt Int32
x', CInt Int32
y', CInt Int32
z'] <- Int -> Ptr CInt -> IO [CInt]
forall a. Storable a => Int -> Ptr a -> IO [a]
peekArray Int
3 Ptr CInt
intPtr
ref
ref ref -> (Int32, Int32, Int32) -> IO ()
forall t a (m :: * -> *).
(HasSetter t a, MonadIO m) =>
t -> a -> m ()
$=! (Int32
x', Int32
y', Int32
z')
Bool -> IO Bool
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
changed
inputInt4 :: (MonadIO m, HasSetter ref (Int32, Int32, Int32, Int32), HasGetter ref (Int32, Int32, Int32, Int32)) => Text -> ref -> m Bool
inputInt4 :: forall (m :: * -> *) ref.
(MonadIO m, HasSetter ref (Int32, Int32, Int32, Int32),
HasGetter ref (Int32, Int32, Int32, Int32)) =>
Text -> ref -> m Bool
inputInt4 Text
desc ref
ref = IO Bool -> m Bool
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO do
(Int32
x, Int32
y, Int32
z, Int32
u) <- ref -> IO (Int32, Int32, Int32, Int32)
forall t a (m :: * -> *). (HasGetter t a, MonadIO m) => t -> m a
forall (m :: * -> *).
MonadIO m =>
ref -> m (Int32, Int32, Int32, Int32)
get ref
ref
[CInt] -> (Ptr CInt -> IO Bool) -> IO Bool
forall a b. Storable a => [a] -> (Ptr a -> IO b) -> IO b
withArray [ Int32 -> CInt
CInt Int32
x, Int32 -> CInt
CInt Int32
y, Int32 -> CInt
CInt Int32
z, Int32 -> CInt
CInt Int32
u ] \Ptr CInt
intPtr -> do
Bool
changed <- Text -> (CString -> IO Bool) -> IO Bool
forall (m :: * -> *) a.
MonadUnliftIO m =>
Text -> (CString -> m a) -> m a
Text.withCString Text
desc \CString
descPtr ->
CString -> Ptr CInt -> ImGuiInputTextFlags -> IO Bool
forall (m :: * -> *).
MonadIO m =>
CString -> Ptr CInt -> ImGuiInputTextFlags -> m Bool
Raw.inputInt4 CString
descPtr Ptr CInt
intPtr ImGuiInputTextFlags
ImGuiInputTextFlags_None
Bool -> IO () -> IO ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
when Bool
changed do
[CInt Int32
x', CInt Int32
y', CInt Int32
z', CInt Int32
u'] <- Int -> Ptr CInt -> IO [CInt]
forall a. Storable a => Int -> Ptr a -> IO [a]
peekArray Int
4 Ptr CInt
intPtr
ref
ref ref -> (Int32, Int32, Int32, Int32) -> IO ()
forall t a (m :: * -> *).
(HasSetter t a, MonadIO m) =>
t -> a -> m ()
$=! (Int32
x', Int32
y', Int32
z', Int32
u')
Bool -> IO Bool
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
changed
inputScalar
:: (HasGetter ref a, HasSetter ref a, HasGetter range a, Storable a, MonadIO m)
=> Text -> ImGuiDataType -> ref -> range -> range -> Text -> ImGuiInputTextFlags -> m Bool
inputScalar :: forall ref a range (m :: * -> *).
(HasGetter ref a, HasSetter ref a, HasGetter range a, Storable a,
MonadIO m) =>
Text
-> ImGuiDataType
-> ref
-> range
-> range
-> Text
-> ImGuiInputTextFlags
-> m Bool
inputScalar Text
label ImGuiDataType
dataType ref
ref range
refMin range
refMax Text
format ImGuiInputTextFlags
flags = IO Bool -> m Bool
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO do
a
currentValue <- ref -> IO a
forall t a (m :: * -> *). (HasGetter t a, MonadIO m) => t -> m a
forall (m :: * -> *). MonadIO m => ref -> m a
get ref
ref
a
minValue <- range -> IO a
forall t a (m :: * -> *). (HasGetter t a, MonadIO m) => t -> m a
forall (m :: * -> *). MonadIO m => range -> m a
get range
refMin
a
maxValue <- range -> IO a
forall t a (m :: * -> *). (HasGetter t a, MonadIO m) => t -> m a
forall (m :: * -> *). MonadIO m => range -> m a
get range
refMax
a -> (Ptr a -> IO Bool) -> IO Bool
forall a b. Storable a => a -> (Ptr a -> IO b) -> IO b
with a
currentValue \Ptr a
dataPtr ->
a -> (Ptr a -> IO Bool) -> IO Bool
forall a b. Storable a => a -> (Ptr a -> IO b) -> IO b
with a
minValue \Ptr a
minPtr ->
a -> (Ptr a -> IO Bool) -> IO Bool
forall a b. Storable a => a -> (Ptr a -> IO b) -> IO b
with a
maxValue \Ptr a
maxPtr -> do
Bool
changed <-
Text -> (CString -> IO Bool) -> IO Bool
forall (m :: * -> *) a.
MonadUnliftIO m =>
Text -> (CString -> m a) -> m a
Text.withCString Text
label \CString
labelPtr ->
Text -> (CString -> IO Bool) -> IO Bool
forall (m :: * -> *) a.
MonadUnliftIO m =>
Text -> (CString -> m a) -> m a
Text.withCString Text
format \CString
formatPtr ->
CString
-> ImGuiDataType
-> Ptr a
-> Ptr a
-> Ptr a
-> CString
-> ImGuiInputTextFlags
-> IO Bool
forall (m :: * -> *) a.
MonadIO m =>
CString
-> ImGuiDataType
-> Ptr a
-> Ptr a
-> Ptr a
-> CString
-> ImGuiInputTextFlags
-> m Bool
Raw.inputScalar
CString
labelPtr
ImGuiDataType
dataType
Ptr a
dataPtr
Ptr a
minPtr
Ptr a
maxPtr
CString
formatPtr
ImGuiInputTextFlags
flags
Bool -> IO () -> IO ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
when Bool
changed do
a
newValue <- Ptr a -> IO a
forall a. Storable a => Ptr a -> IO a
peek Ptr a
dataPtr
ref
ref ref -> a -> IO ()
forall t a (m :: * -> *).
(HasSetter t a, MonadIO m) =>
t -> a -> m ()
$=! a
newValue
Bool -> IO Bool
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
changed
inputScalarN
:: (HasSetter value [a], HasGetter value [a], HasGetter range a, Storable a, MonadIO m)
=> Text -> ImGuiDataType -> value -> range -> range -> Text -> ImGuiInputTextFlags -> m Bool
inputScalarN :: forall value a range (m :: * -> *).
(HasSetter value [a], HasGetter value [a], HasGetter range a,
Storable a, MonadIO m) =>
Text
-> ImGuiDataType
-> value
-> range
-> range
-> Text
-> ImGuiInputTextFlags
-> m Bool
inputScalarN Text
label ImGuiDataType
dataType value
ref range
refMin range
refMax Text
format ImGuiInputTextFlags
flags = IO Bool -> m Bool
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO do
[a]
currentValues <- value -> IO [a]
forall t a (m :: * -> *). (HasGetter t a, MonadIO m) => t -> m a
forall (m :: * -> *). MonadIO m => value -> m [a]
get value
ref
a
minValue <- range -> IO a
forall t a (m :: * -> *). (HasGetter t a, MonadIO m) => t -> m a
forall (m :: * -> *). MonadIO m => range -> m a
get range
refMin
a
maxValue <- range -> IO a
forall t a (m :: * -> *). (HasGetter t a, MonadIO m) => t -> m a
forall (m :: * -> *). MonadIO m => range -> m a
get range
refMax
[a] -> (Int -> Ptr a -> IO Bool) -> IO Bool
forall a b. Storable a => [a] -> (Int -> Ptr a -> IO b) -> IO b
withArrayLen [a]
currentValues \Int
components Ptr a
dataPtr ->
a -> (Ptr a -> IO Bool) -> IO Bool
forall a b. Storable a => a -> (Ptr a -> IO b) -> IO b
with a
minValue \Ptr a
minPtr ->
a -> (Ptr a -> IO Bool) -> IO Bool
forall a b. Storable a => a -> (Ptr a -> IO b) -> IO b
with a
maxValue \Ptr a
maxPtr -> do
Bool
changed <-
Text -> (CString -> IO Bool) -> IO Bool
forall (m :: * -> *) a.
MonadUnliftIO m =>
Text -> (CString -> m a) -> m a
Text.withCString Text
label \CString
labelPtr ->
Text -> (CString -> IO Bool) -> IO Bool
forall (m :: * -> *) a.
MonadUnliftIO m =>
Text -> (CString -> m a) -> m a
Text.withCString Text
format \CString
formatPtr ->
CString
-> ImGuiDataType
-> Ptr a
-> CInt
-> Ptr a
-> Ptr a
-> CString
-> ImGuiInputTextFlags
-> IO Bool
forall (m :: * -> *) a.
MonadIO m =>
CString
-> ImGuiDataType
-> Ptr a
-> CInt
-> Ptr a
-> Ptr a
-> CString
-> ImGuiInputTextFlags
-> m Bool
Raw.inputScalarN
CString
labelPtr
ImGuiDataType
dataType
Ptr a
dataPtr
(Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
components)
Ptr a
minPtr
Ptr a
maxPtr
CString
formatPtr
ImGuiInputTextFlags
flags
Bool -> IO () -> IO ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
when Bool
changed do
[a]
newValue <- Int -> Ptr a -> IO [a]
forall a. Storable a => Int -> Ptr a -> IO [a]
peekArray Int
components Ptr a
dataPtr
value
ref value -> [a] -> IO ()
forall t a (m :: * -> *).
(HasSetter t a, MonadIO m) =>
t -> a -> m ()
$=! [a]
newValue
Bool -> IO Bool
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
changed
colorEdit3 :: (MonadIO m, HasSetter ref ImVec3, HasGetter ref ImVec3) => Text -> ref -> m Bool
colorEdit3 :: forall (m :: * -> *) ref.
(MonadIO m, HasSetter ref ImVec3, HasGetter ref ImVec3) =>
Text -> ref -> m Bool
colorEdit3 Text
desc ref
ref = IO Bool -> m Bool
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO do
ImVec3
currentValue <- ref -> IO ImVec3
forall t a (m :: * -> *). (HasGetter t a, MonadIO m) => t -> m a
forall (m :: * -> *). MonadIO m => ref -> m ImVec3
get ref
ref
ImVec3 -> (Ptr ImVec3 -> IO Bool) -> IO Bool
forall a b. Storable a => a -> (Ptr a -> IO b) -> IO b
with ImVec3
currentValue \Ptr ImVec3
refPtr -> do
Bool
changed <- Text -> (CString -> IO Bool) -> IO Bool
forall (m :: * -> *) a.
MonadUnliftIO m =>
Text -> (CString -> m a) -> m a
Text.withCString Text
desc \CString
descPtr ->
CString -> Ptr CFloat -> ImGuiColorEditFlags -> IO Bool
forall (m :: * -> *).
MonadIO m =>
CString -> Ptr CFloat -> ImGuiColorEditFlags -> m Bool
Raw.colorEdit3 CString
descPtr (Ptr ImVec3 -> Ptr CFloat
forall a b. Ptr a -> Ptr b
castPtr Ptr ImVec3
refPtr) ImGuiColorEditFlags
ImGuiColorEditFlags_None
Bool -> IO () -> IO ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
when Bool
changed do
ImVec3
newValue <- Ptr ImVec3 -> IO ImVec3
forall a. Storable a => Ptr a -> IO a
peek Ptr ImVec3
refPtr
ref
ref ref -> ImVec3 -> IO ()
forall t a (m :: * -> *).
(HasSetter t a, MonadIO m) =>
t -> a -> m ()
$=! ImVec3
newValue
Bool -> IO Bool
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
changed
colorEdit4 :: (MonadIO m, HasSetter ref ImVec4, HasGetter ref ImVec4) => Text -> ref -> m Bool
colorEdit4 :: forall (m :: * -> *) ref.
(MonadIO m, HasSetter ref ImVec4, HasGetter ref ImVec4) =>
Text -> ref -> m Bool
colorEdit4 Text
desc ref
ref = IO Bool -> m Bool
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO do
ImVec4
currentValue <- ref -> IO ImVec4
forall t a (m :: * -> *). (HasGetter t a, MonadIO m) => t -> m a
forall (m :: * -> *). MonadIO m => ref -> m ImVec4
get ref
ref
ImVec4 -> (Ptr ImVec4 -> IO Bool) -> IO Bool
forall a b. Storable a => a -> (Ptr a -> IO b) -> IO b
with ImVec4
currentValue \Ptr ImVec4
refPtr -> do
Bool
changed <- Text -> (CString -> IO Bool) -> IO Bool
forall (m :: * -> *) a.
MonadUnliftIO m =>
Text -> (CString -> m a) -> m a
Text.withCString Text
desc \CString
descPtr ->
CString -> Ptr CFloat -> ImGuiColorEditFlags -> IO Bool
forall (m :: * -> *).
MonadIO m =>
CString -> Ptr CFloat -> ImGuiColorEditFlags -> m Bool
Raw.colorEdit4 CString
descPtr (Ptr ImVec4 -> Ptr CFloat
forall a b. Ptr a -> Ptr b
castPtr Ptr ImVec4
refPtr) ImGuiColorEditFlags
ImGuiColorEditFlags_None
Bool -> IO () -> IO ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
when Bool
changed do
ImVec4
newValue <- Ptr ImVec4 -> IO ImVec4
forall a. Storable a => Ptr a -> IO a
peek Ptr ImVec4
refPtr
ref
ref ref -> ImVec4 -> IO ()
forall t a (m :: * -> *).
(HasSetter t a, MonadIO m) =>
t -> a -> m ()
$=! ImVec4
newValue
Bool -> IO Bool
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
changed
colorPicker3 :: (MonadIO m, HasSetter ref ImVec3, HasGetter ref ImVec3) => Text -> ref -> m Bool
colorPicker3 :: forall (m :: * -> *) ref.
(MonadIO m, HasSetter ref ImVec3, HasGetter ref ImVec3) =>
Text -> ref -> m Bool
colorPicker3 Text
desc ref
ref = IO Bool -> m Bool
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO do
ImVec3
currentValue <- ref -> IO ImVec3
forall t a (m :: * -> *). (HasGetter t a, MonadIO m) => t -> m a
forall (m :: * -> *). MonadIO m => ref -> m ImVec3
get ref
ref
ImVec3 -> (Ptr ImVec3 -> IO Bool) -> IO Bool
forall a b. Storable a => a -> (Ptr a -> IO b) -> IO b
with ImVec3
currentValue \Ptr ImVec3
refPtr -> do
Bool
changed <- Text -> (CString -> IO Bool) -> IO Bool
forall (m :: * -> *) a.
MonadUnliftIO m =>
Text -> (CString -> m a) -> m a
Text.withCString Text
desc \CString
descPtr ->
CString -> Ptr CFloat -> ImGuiColorEditFlags -> IO Bool
forall (m :: * -> *).
MonadIO m =>
CString -> Ptr CFloat -> ImGuiColorEditFlags -> m Bool
Raw.colorPicker3 CString
descPtr (Ptr ImVec3 -> Ptr CFloat
forall a b. Ptr a -> Ptr b
castPtr Ptr ImVec3
refPtr) ImGuiColorEditFlags
ImGuiColorEditFlags_None
Bool -> IO () -> IO ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
when Bool
changed do
ImVec3
newValue <- Ptr ImVec3 -> IO ImVec3
forall a. Storable a => Ptr a -> IO a
peek Ptr ImVec3
refPtr
ref
ref ref -> ImVec3 -> IO ()
forall t a (m :: * -> *).
(HasSetter t a, MonadIO m) =>
t -> a -> m ()
$=! ImVec3
newValue
Bool -> IO Bool
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
changed
colorPicker4 :: (MonadIO m, HasSetter ref ImVec4, HasGetter ref ImVec4) => Text -> ref -> Maybe ImVec4 -> m Bool
colorPicker4 :: forall (m :: * -> *) ref.
(MonadIO m, HasSetter ref ImVec4, HasGetter ref ImVec4) =>
Text -> ref -> Maybe ImVec4 -> m Bool
colorPicker4 Text
desc ref
ref Maybe ImVec4
refColor = IO Bool -> m Bool
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO do
ImVec4
currentValue <- ref -> IO ImVec4
forall t a (m :: * -> *). (HasGetter t a, MonadIO m) => t -> m a
forall (m :: * -> *). MonadIO m => ref -> m ImVec4
get ref
ref
ImVec4 -> (Ptr ImVec4 -> IO Bool) -> IO Bool
forall a b. Storable a => a -> (Ptr a -> IO b) -> IO b
with ImVec4
currentValue \Ptr ImVec4
refPtr -> do
Bool
changed <- Text -> (CString -> IO Bool) -> IO Bool
forall (m :: * -> *) a.
MonadUnliftIO m =>
Text -> (CString -> m a) -> m a
Text.withCString Text
desc \CString
descPtr ->
(ImVec4 -> (Ptr ImVec4 -> IO Bool) -> IO Bool)
-> Maybe ImVec4 -> (Ptr ImVec4 -> IO Bool) -> IO Bool
forall a b c.
(a -> (Ptr b -> IO c) -> IO c)
-> Maybe a -> (Ptr b -> IO c) -> IO c
maybeWith ImVec4 -> (Ptr ImVec4 -> IO Bool) -> IO Bool
forall a b. Storable a => a -> (Ptr a -> IO b) -> IO b
with Maybe ImVec4
refColor \Ptr ImVec4
refColorPtr ->
CString
-> Ptr CFloat -> ImGuiColorEditFlags -> Ptr CFloat -> IO Bool
forall (m :: * -> *).
MonadIO m =>
CString
-> Ptr CFloat -> ImGuiColorEditFlags -> Ptr CFloat -> m Bool
Raw.colorPicker4 CString
descPtr (Ptr ImVec4 -> Ptr CFloat
forall a b. Ptr a -> Ptr b
castPtr Ptr ImVec4
refPtr) ImGuiColorEditFlags
ImGuiColorEditFlags_None (Ptr ImVec4 -> Ptr CFloat
forall a b. Ptr a -> Ptr b
castPtr Ptr ImVec4
refColorPtr)
Bool -> IO () -> IO ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
when Bool
changed do
ImVec4
newValue <- Ptr ImVec4 -> IO ImVec4
forall a. Storable a => Ptr a -> IO a
peek Ptr ImVec4
refPtr
ref
ref ref -> ImVec4 -> IO ()
forall t a (m :: * -> *).
(HasSetter t a, MonadIO m) =>
t -> a -> m ()
$=! ImVec4
newValue
Bool -> IO Bool
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
changed
colorButton :: (MonadIO m, HasSetter ref ImVec4, HasGetter ref ImVec4) => Text -> ref -> m Bool
colorButton :: forall (m :: * -> *) ref.
(MonadIO m, HasSetter ref ImVec4, HasGetter ref ImVec4) =>
Text -> ref -> m Bool
colorButton Text
desc ref
ref = IO Bool -> m Bool
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO do
ImVec4
currentValue <- ref -> IO ImVec4
forall t a (m :: * -> *). (HasGetter t a, MonadIO m) => t -> m a
forall (m :: * -> *). MonadIO m => ref -> m ImVec4
get ref
ref
ImVec4 -> (Ptr ImVec4 -> IO Bool) -> IO Bool
forall a b. Storable a => a -> (Ptr a -> IO b) -> IO b
with ImVec4
currentValue \Ptr ImVec4
refPtr -> do
Bool
changed <- Text -> (CString -> IO Bool) -> IO Bool
forall (m :: * -> *) a.
MonadUnliftIO m =>
Text -> (CString -> m a) -> m a
Text.withCString Text
desc \CString
descPtr ->
CString -> Ptr ImVec4 -> IO Bool
forall (m :: * -> *). MonadIO m => CString -> Ptr ImVec4 -> m Bool
Raw.colorButton CString
descPtr Ptr ImVec4
refPtr
Bool -> IO () -> IO ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
when Bool
changed do
ImVec4
newValue <- Ptr ImVec4 -> IO ImVec4
forall a. Storable a => Ptr a -> IO a
peek Ptr ImVec4
refPtr
ref
ref ref -> ImVec4 -> IO ()
forall t a (m :: * -> *).
(HasSetter t a, MonadIO m) =>
t -> a -> m ()
$=! ImVec4
newValue
Bool -> IO Bool
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
changed
data TableOptions = TableOptions
{ TableOptions -> ImGuiTableFlags
tableFlags :: ImGuiTableFlags
, TableOptions -> ImVec2
tableOuterSize :: ImVec2
, TableOptions -> Float
tableInnerWidth :: Float
} deriving Int -> TableOptions -> ShowS
[TableOptions] -> ShowS
TableOptions -> String
(Int -> TableOptions -> ShowS)
-> (TableOptions -> String)
-> ([TableOptions] -> ShowS)
-> Show TableOptions
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> TableOptions -> ShowS
showsPrec :: Int -> TableOptions -> ShowS
$cshow :: TableOptions -> String
show :: TableOptions -> String
$cshowList :: [TableOptions] -> ShowS
showList :: [TableOptions] -> ShowS
Show
defTableOptions :: TableOptions
defTableOptions :: TableOptions
defTableOptions = TableOptions
{ $sel:tableFlags:TableOptions :: ImGuiTableFlags
tableFlags = ImGuiTableFlags
ImGuiTableFlags_None
, $sel:tableOuterSize:TableOptions :: ImVec2
tableOuterSize = Float -> Float -> ImVec2
ImVec2 Float
0 Float
0
, $sel:tableInnerWidth:TableOptions :: Float
tableInnerWidth = Float
0
}
beginTable :: MonadIO m => TableOptions -> Text -> Int -> m Bool
beginTable :: forall (m :: * -> *).
MonadIO m =>
TableOptions -> Text -> Int -> m Bool
beginTable TableOptions{Float
ImGuiTableFlags
ImVec2
$sel:tableFlags:TableOptions :: TableOptions -> ImGuiTableFlags
$sel:tableOuterSize:TableOptions :: TableOptions -> ImVec2
$sel:tableInnerWidth:TableOptions :: TableOptions -> Float
tableFlags :: ImGuiTableFlags
tableOuterSize :: ImVec2
tableInnerWidth :: Float
..} Text
label Int
columns = IO Bool -> m Bool
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO do
Text -> (CString -> IO Bool) -> IO Bool
forall (m :: * -> *) a.
MonadUnliftIO m =>
Text -> (CString -> m a) -> m a
Text.withCString Text
label \CString
labelPtr ->
ImVec2 -> (Ptr ImVec2 -> IO Bool) -> IO Bool
forall a b. Storable a => a -> (Ptr a -> IO b) -> IO b
with ImVec2
tableOuterSize \Ptr ImVec2
outerSizePtr ->
CString
-> CInt -> ImGuiTableFlags -> Ptr ImVec2 -> CFloat -> IO Bool
forall (m :: * -> *).
MonadIO m =>
CString
-> CInt -> ImGuiTableFlags -> Ptr ImVec2 -> CFloat -> m Bool
Raw.beginTable CString
labelPtr (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
columns) ImGuiTableFlags
tableFlags Ptr ImVec2
outerSizePtr (Float -> CFloat
CFloat Float
tableInnerWidth)
withTable :: MonadUnliftIO m => TableOptions -> Text -> Int -> (Bool -> m a) -> m a
withTable :: forall (m :: * -> *) a.
MonadUnliftIO m =>
TableOptions -> Text -> Int -> (Bool -> m a) -> m a
withTable TableOptions
options Text
label Int
columns =
m Bool -> (Bool -> m ()) -> (Bool -> m a) -> m a
forall (m :: * -> *) a b c.
MonadUnliftIO m =>
m a -> (a -> m b) -> (a -> m c) -> m c
bracket (TableOptions -> Text -> Int -> m Bool
forall (m :: * -> *).
MonadIO m =>
TableOptions -> Text -> Int -> m Bool
beginTable TableOptions
options Text
label Int
columns) (Bool -> m () -> m ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
`when` m ()
forall (m :: * -> *). MonadIO m => m ()
Raw.endTable)
withTableOpen :: MonadUnliftIO m => TableOptions -> Text -> Int -> m () -> m ()
withTableOpen :: forall (m :: * -> *).
MonadUnliftIO m =>
TableOptions -> Text -> Int -> m () -> m ()
withTableOpen TableOptions
options Text
label Int
columns m ()
action =
TableOptions -> Text -> Int -> (Bool -> m ()) -> m ()
forall (m :: * -> *) a.
MonadUnliftIO m =>
TableOptions -> Text -> Int -> (Bool -> m a) -> m a
withTable TableOptions
options Text
label Int
columns (Bool -> m () -> m ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
`when` m ()
action)
tableNextRow :: MonadIO m => m ()
tableNextRow :: forall (m :: * -> *). MonadIO m => m ()
tableNextRow = TableRowOptions -> m ()
forall (m :: * -> *). MonadIO m => TableRowOptions -> m ()
tableNextRowWith TableRowOptions
defTableRowOptions
data TableRowOptions = TableRowOptions
{ TableRowOptions -> ImGuiTableRowFlags
tableRowFlags :: ImGuiTableRowFlags
, TableRowOptions -> Float
tableRowMinHeight :: Float
} deriving Int -> TableRowOptions -> ShowS
[TableRowOptions] -> ShowS
TableRowOptions -> String
(Int -> TableRowOptions -> ShowS)
-> (TableRowOptions -> String)
-> ([TableRowOptions] -> ShowS)
-> Show TableRowOptions
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> TableRowOptions -> ShowS
showsPrec :: Int -> TableRowOptions -> ShowS
$cshow :: TableRowOptions -> String
show :: TableRowOptions -> String
$cshowList :: [TableRowOptions] -> ShowS
showList :: [TableRowOptions] -> ShowS
Show
defTableRowOptions :: TableRowOptions
defTableRowOptions :: TableRowOptions
defTableRowOptions = TableRowOptions
{ $sel:tableRowFlags:TableRowOptions :: ImGuiTableRowFlags
tableRowFlags = ImGuiTableRowFlags
ImGuiTableRowFlags_None
, $sel:tableRowMinHeight:TableRowOptions :: Float
tableRowMinHeight = Float
0
}
tableNextRowWith :: MonadIO m => TableRowOptions -> m ()
tableNextRowWith :: forall (m :: * -> *). MonadIO m => TableRowOptions -> m ()
tableNextRowWith TableRowOptions{Float
ImGuiTableRowFlags
$sel:tableRowFlags:TableRowOptions :: TableRowOptions -> ImGuiTableRowFlags
$sel:tableRowMinHeight:TableRowOptions :: TableRowOptions -> Float
tableRowFlags :: ImGuiTableRowFlags
tableRowMinHeight :: Float
..} = IO () -> m ()
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO do
ImGuiTableRowFlags -> CFloat -> IO ()
forall (m :: * -> *).
MonadIO m =>
ImGuiTableRowFlags -> CFloat -> m ()
Raw.tableNextRow ImGuiTableRowFlags
tableRowFlags (Float -> CFloat
CFloat Float
tableRowMinHeight)
tableNextColumn :: MonadIO m => m () -> m ()
tableNextColumn :: forall (m :: * -> *). MonadIO m => m () -> m ()
tableNextColumn m ()
action = m Bool
forall (m :: * -> *). MonadIO m => m Bool
Raw.tableNextColumn m Bool -> (Bool -> m ()) -> m ()
forall a b. m a -> (a -> m b) -> m b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= (Bool -> m () -> m ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
`when` m ()
action)
tableSetColumnIndex :: MonadIO m => Int -> m Bool
tableSetColumnIndex :: forall (m :: * -> *). MonadIO m => Int -> m Bool
tableSetColumnIndex Int
column = IO Bool -> m Bool
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO do
CInt -> IO Bool
forall (m :: * -> *). MonadIO m => CInt -> m Bool
Raw.tableSetColumnIndex (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
column)
data TableColumnOptions = TableColumnOptions
{ TableColumnOptions -> ImGuiTableColumnFlags
tableColumnFlags :: ImGuiTableColumnFlags
, TableColumnOptions -> Float
tableColumnInitWidthOrWeight :: Float
, TableColumnOptions -> ImGuiID
tableColumnUserId :: ImGuiID
} deriving Int -> TableColumnOptions -> ShowS
[TableColumnOptions] -> ShowS
TableColumnOptions -> String
(Int -> TableColumnOptions -> ShowS)
-> (TableColumnOptions -> String)
-> ([TableColumnOptions] -> ShowS)
-> Show TableColumnOptions
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> TableColumnOptions -> ShowS
showsPrec :: Int -> TableColumnOptions -> ShowS
$cshow :: TableColumnOptions -> String
show :: TableColumnOptions -> String
$cshowList :: [TableColumnOptions] -> ShowS
showList :: [TableColumnOptions] -> ShowS
Show
defTableColumnOptions :: TableColumnOptions
defTableColumnOptions :: TableColumnOptions
defTableColumnOptions = TableColumnOptions
{ $sel:tableColumnFlags:TableColumnOptions :: ImGuiTableColumnFlags
tableColumnFlags = ImGuiTableColumnFlags
ImGuiTableColumnFlags_None
, $sel:tableColumnInitWidthOrWeight:TableColumnOptions :: Float
tableColumnInitWidthOrWeight = Float
0
, $sel:tableColumnUserId:TableColumnOptions :: ImGuiID
tableColumnUserId = ImGuiID
0
}
tableSetupColumn :: MonadIO m => Text -> m ()
tableSetupColumn :: forall (m :: * -> *). MonadIO m => Text -> m ()
tableSetupColumn = TableColumnOptions -> Text -> m ()
forall (m :: * -> *).
MonadIO m =>
TableColumnOptions -> Text -> m ()
tableSetupColumnWith TableColumnOptions
defTableColumnOptions
tableSetupColumnWith :: MonadIO m => TableColumnOptions -> Text -> m ()
tableSetupColumnWith :: forall (m :: * -> *).
MonadIO m =>
TableColumnOptions -> Text -> m ()
tableSetupColumnWith TableColumnOptions{Float
ImGuiID
ImGuiTableColumnFlags
$sel:tableColumnFlags:TableColumnOptions :: TableColumnOptions -> ImGuiTableColumnFlags
$sel:tableColumnInitWidthOrWeight:TableColumnOptions :: TableColumnOptions -> Float
$sel:tableColumnUserId:TableColumnOptions :: TableColumnOptions -> ImGuiID
tableColumnFlags :: ImGuiTableColumnFlags
tableColumnInitWidthOrWeight :: Float
tableColumnUserId :: ImGuiID
..} Text
label = IO () -> m ()
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO do
Text -> (CString -> IO ()) -> IO ()
forall (m :: * -> *) a.
MonadUnliftIO m =>
Text -> (CString -> m a) -> m a
Text.withCString Text
label \CString
labelPtr ->
CString -> ImGuiTableColumnFlags -> CFloat -> ImGuiID -> IO ()
forall (m :: * -> *).
MonadIO m =>
CString -> ImGuiTableColumnFlags -> CFloat -> ImGuiID -> m ()
Raw.tableSetupColumn CString
labelPtr ImGuiTableColumnFlags
tableColumnFlags (Float -> CFloat
CFloat Float
tableColumnInitWidthOrWeight) ImGuiID
tableColumnUserId
tableSetupScrollFreeze :: MonadIO m => Int -> Int -> m ()
tableSetupScrollFreeze :: forall (m :: * -> *). MonadIO m => Int -> Int -> m ()
tableSetupScrollFreeze Int
cols Int
rows = IO () -> m ()
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO do
CInt -> CInt -> IO ()
forall (m :: * -> *). MonadIO m => CInt -> CInt -> m ()
Raw.tableSetupScrollFreeze (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
cols) (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
rows)
data TableSortingSpecs = TableSortingSpecs
{ TableSortingSpecs -> Int
tableSortingColumn :: Int
, TableSortingSpecs -> Bool
tableSortingReverse :: Bool
, TableSortingSpecs -> ImGuiID
tableSortingUserId :: ImGuiID
} deriving (TableSortingSpecs -> TableSortingSpecs -> Bool
(TableSortingSpecs -> TableSortingSpecs -> Bool)
-> (TableSortingSpecs -> TableSortingSpecs -> Bool)
-> Eq TableSortingSpecs
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: TableSortingSpecs -> TableSortingSpecs -> Bool
== :: TableSortingSpecs -> TableSortingSpecs -> Bool
$c/= :: TableSortingSpecs -> TableSortingSpecs -> Bool
/= :: TableSortingSpecs -> TableSortingSpecs -> Bool
Eq, Eq TableSortingSpecs
Eq TableSortingSpecs =>
(TableSortingSpecs -> TableSortingSpecs -> Ordering)
-> (TableSortingSpecs -> TableSortingSpecs -> Bool)
-> (TableSortingSpecs -> TableSortingSpecs -> Bool)
-> (TableSortingSpecs -> TableSortingSpecs -> Bool)
-> (TableSortingSpecs -> TableSortingSpecs -> Bool)
-> (TableSortingSpecs -> TableSortingSpecs -> TableSortingSpecs)
-> (TableSortingSpecs -> TableSortingSpecs -> TableSortingSpecs)
-> Ord TableSortingSpecs
TableSortingSpecs -> TableSortingSpecs -> Bool
TableSortingSpecs -> TableSortingSpecs -> Ordering
TableSortingSpecs -> TableSortingSpecs -> TableSortingSpecs
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
$ccompare :: TableSortingSpecs -> TableSortingSpecs -> Ordering
compare :: TableSortingSpecs -> TableSortingSpecs -> Ordering
$c< :: TableSortingSpecs -> TableSortingSpecs -> Bool
< :: TableSortingSpecs -> TableSortingSpecs -> Bool
$c<= :: TableSortingSpecs -> TableSortingSpecs -> Bool
<= :: TableSortingSpecs -> TableSortingSpecs -> Bool
$c> :: TableSortingSpecs -> TableSortingSpecs -> Bool
> :: TableSortingSpecs -> TableSortingSpecs -> Bool
$c>= :: TableSortingSpecs -> TableSortingSpecs -> Bool
>= :: TableSortingSpecs -> TableSortingSpecs -> Bool
$cmax :: TableSortingSpecs -> TableSortingSpecs -> TableSortingSpecs
max :: TableSortingSpecs -> TableSortingSpecs -> TableSortingSpecs
$cmin :: TableSortingSpecs -> TableSortingSpecs -> TableSortingSpecs
min :: TableSortingSpecs -> TableSortingSpecs -> TableSortingSpecs
Ord, Int -> TableSortingSpecs -> ShowS
[TableSortingSpecs] -> ShowS
TableSortingSpecs -> String
(Int -> TableSortingSpecs -> ShowS)
-> (TableSortingSpecs -> String)
-> ([TableSortingSpecs] -> ShowS)
-> Show TableSortingSpecs
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> TableSortingSpecs -> ShowS
showsPrec :: Int -> TableSortingSpecs -> ShowS
$cshow :: TableSortingSpecs -> String
show :: TableSortingSpecs -> String
$cshowList :: [TableSortingSpecs] -> ShowS
showList :: [TableSortingSpecs] -> ShowS
Show)
convertTableSortingSpecs :: ImGuiTableColumnSortSpecs -> TableSortingSpecs
convertTableSortingSpecs :: ImGuiTableColumnSortSpecs -> TableSortingSpecs
convertTableSortingSpecs ImGuiTableColumnSortSpecs{ImS16
ImGuiID
ImGuiSortDirection
columnUserID :: ImGuiID
columnIndex :: ImS16
sortOrder :: ImS16
sortDirection :: ImGuiSortDirection
$sel:columnUserID:ImGuiTableColumnSortSpecs :: ImGuiTableColumnSortSpecs -> ImGuiID
$sel:columnIndex:ImGuiTableColumnSortSpecs :: ImGuiTableColumnSortSpecs -> ImS16
$sel:sortOrder:ImGuiTableColumnSortSpecs :: ImGuiTableColumnSortSpecs -> ImS16
$sel:sortDirection:ImGuiTableColumnSortSpecs :: ImGuiTableColumnSortSpecs -> ImGuiSortDirection
..} =
TableSortingSpecs
{ $sel:tableSortingColumn:TableSortingSpecs :: Int
tableSortingColumn = ImS16 -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral ImS16
columnIndex
, $sel:tableSortingReverse:TableSortingSpecs :: Bool
tableSortingReverse = ImGuiSortDirection
sortDirection ImGuiSortDirection -> ImGuiSortDirection -> Bool
forall a. Eq a => a -> a -> Bool
== ImGuiSortDirection
ImGuiSortDirection_Descending
, $sel:tableSortingUserId:TableSortingSpecs :: ImGuiID
tableSortingUserId = ImGuiID
columnUserID
}
withSortableTable :: MonadIO m => (Bool -> [TableSortingSpecs] -> m ()) -> m ()
withSortableTable :: forall (m :: * -> *).
MonadIO m =>
(Bool -> [TableSortingSpecs] -> m ()) -> m ()
withSortableTable Bool -> [TableSortingSpecs] -> m ()
action = do
IO (Maybe (Ptr ImGuiTableSortSpecs))
-> m (Maybe (Ptr ImGuiTableSortSpecs))
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO IO (Maybe (Ptr ImGuiTableSortSpecs))
forall (m :: * -> *).
MonadIO m =>
m (Maybe (Ptr ImGuiTableSortSpecs))
Raw.tableGetSortSpecs m (Maybe (Ptr ImGuiTableSortSpecs))
-> (Maybe (Ptr ImGuiTableSortSpecs) -> m ()) -> m ()
forall a b. m a -> (a -> m b) -> m b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \case
Maybe (Ptr ImGuiTableSortSpecs)
Nothing ->
() -> m ()
forall a. a -> m a
forall (f :: * -> *) a. Applicative f => a -> f a
pure ()
Just Ptr ImGuiTableSortSpecs
specsPtr -> do
ImGuiTableSortSpecs{Ptr ImGuiTableColumnSortSpecs
CBool
CInt
specs :: Ptr ImGuiTableColumnSortSpecs
specsCount :: CInt
specsDirty :: CBool
$sel:specs:ImGuiTableSortSpecs :: ImGuiTableSortSpecs -> Ptr ImGuiTableColumnSortSpecs
$sel:specsCount:ImGuiTableSortSpecs :: ImGuiTableSortSpecs -> CInt
$sel:specsDirty:ImGuiTableSortSpecs :: ImGuiTableSortSpecs -> CBool
..} <- IO ImGuiTableSortSpecs -> m ImGuiTableSortSpecs
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO ImGuiTableSortSpecs -> m ImGuiTableSortSpecs)
-> IO ImGuiTableSortSpecs -> m ImGuiTableSortSpecs
forall a b. (a -> b) -> a -> b
$ Ptr ImGuiTableSortSpecs -> IO ImGuiTableSortSpecs
forall a. Storable a => Ptr a -> IO a
peek Ptr ImGuiTableSortSpecs
specsPtr
let isDirty :: Bool
isDirty = CBool
0 CBool -> CBool -> Bool
forall a. Eq a => a -> a -> Bool
/= CBool
specsDirty
[ImGuiTableColumnSortSpecs]
columns <- IO [ImGuiTableColumnSortSpecs] -> m [ImGuiTableColumnSortSpecs]
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO [ImGuiTableColumnSortSpecs] -> m [ImGuiTableColumnSortSpecs])
-> IO [ImGuiTableColumnSortSpecs] -> m [ImGuiTableColumnSortSpecs]
forall a b. (a -> b) -> a -> b
$ Int
-> Ptr ImGuiTableColumnSortSpecs -> IO [ImGuiTableColumnSortSpecs]
forall a. Storable a => Int -> Ptr a -> IO [a]
peekArray (CInt -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral CInt
specsCount) Ptr ImGuiTableColumnSortSpecs
specs
Bool -> [TableSortingSpecs] -> m ()
action Bool
isDirty ((ImGuiTableColumnSortSpecs -> TableSortingSpecs)
-> [ImGuiTableColumnSortSpecs] -> [TableSortingSpecs]
forall a b. (a -> b) -> [a] -> [b]
map ImGuiTableColumnSortSpecs -> TableSortingSpecs
convertTableSortingSpecs [ImGuiTableColumnSortSpecs]
columns)
Bool -> m () -> m ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
when Bool
isDirty (m () -> m ()) -> m () -> m ()
forall a b. (a -> b) -> a -> b
$
Ptr ImGuiTableSortSpecs -> m ()
forall (m :: * -> *). MonadIO m => Ptr ImGuiTableSortSpecs -> m ()
Raw.tableClearSortSpecsDirty Ptr ImGuiTableSortSpecs
specsPtr
tableGetColumnCount :: MonadIO m => m Int
tableGetColumnCount :: forall (m :: * -> *). MonadIO m => m Int
tableGetColumnCount =
CInt -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral (CInt -> Int) -> m CInt -> m Int
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> m CInt
forall (m :: * -> *). MonadIO m => m CInt
Raw.tableGetColumnCount
tableGetColumnIndex :: MonadIO m => m Int
tableGetColumnIndex :: forall (m :: * -> *). MonadIO m => m Int
tableGetColumnIndex =
CInt -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral (CInt -> Int) -> m CInt -> m Int
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> m CInt
forall (m :: * -> *). MonadIO m => m CInt
Raw.tableGetColumnIndex
tableGetRowIndex :: MonadIO m => m Int
tableGetRowIndex :: forall (m :: * -> *). MonadIO m => m Int
tableGetRowIndex =
CInt -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral (CInt -> Int) -> m CInt -> m Int
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> m CInt
forall (m :: * -> *). MonadIO m => m CInt
Raw.tableGetRowIndex
tableGetColumnName :: MonadIO m => Maybe Int -> m Text
tableGetColumnName :: forall (m :: * -> *). MonadIO m => Maybe Int -> m Text
tableGetColumnName Maybe Int
c = IO Text -> m Text
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO do
Maybe CInt -> IO CString
forall (m :: * -> *). MonadIO m => Maybe CInt -> m CString
Raw.tableGetColumnName (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> CInt) -> Maybe Int -> Maybe CInt
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Maybe Int
c) IO CString -> (CString -> IO Text) -> IO Text
forall a b. IO a -> (a -> IO b) -> IO b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= CString -> IO Text
Text.peekCString
tableGetColumnFlags :: MonadIO m => Maybe Int -> m ImGuiTableColumnFlags
tableGetColumnFlags :: forall (m :: * -> *).
MonadIO m =>
Maybe Int -> m ImGuiTableColumnFlags
tableGetColumnFlags =
Maybe CInt -> m ImGuiTableColumnFlags
forall (m :: * -> *).
MonadIO m =>
Maybe CInt -> m ImGuiTableColumnFlags
Raw.tableGetColumnFlags (Maybe CInt -> m ImGuiTableColumnFlags)
-> (Maybe Int -> Maybe CInt)
-> Maybe Int
-> m ImGuiTableColumnFlags
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Int -> CInt) -> Maybe Int -> Maybe CInt
forall a b. (a -> b) -> Maybe a -> Maybe b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral
tableSetColumnEnabled :: MonadIO m => Int -> Bool -> m ()
tableSetColumnEnabled :: forall (m :: * -> *). MonadIO m => Int -> Bool -> m ()
tableSetColumnEnabled Int
column_n Bool
v =
CInt -> CBool -> m ()
forall (m :: * -> *). MonadIO m => CInt -> CBool -> m ()
Raw.tableSetColumnEnabled (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
column_n) (CBool -> CBool -> Bool -> CBool
forall a. a -> a -> Bool -> a
bool CBool
0 CBool
1 Bool
v)
tableSetBgColor :: MonadIO m => ImGuiTableBgTarget -> ImU32 -> Maybe Int -> m ()
tableSetBgColor :: forall (m :: * -> *).
MonadIO m =>
ImGuiTableBgTarget -> ImGuiID -> Maybe Int -> m ()
tableSetBgColor ImGuiTableBgTarget
target ImGuiID
color Maybe Int
column_n =
ImGuiTableBgTarget -> ImGuiID -> Maybe CInt -> m ()
forall (m :: * -> *).
MonadIO m =>
ImGuiTableBgTarget -> ImGuiID -> Maybe CInt -> m ()
Raw.tableSetBgColor ImGuiTableBgTarget
target ImGuiID
color (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> CInt) -> Maybe Int -> Maybe CInt
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Maybe Int
column_n)
treeNode :: MonadIO m => Text -> m Bool
treeNode :: forall (m :: * -> *). MonadIO m => Text -> m Bool
treeNode Text
label = IO Bool -> m Bool
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO do
Text -> (CString -> IO Bool) -> IO Bool
forall (m :: * -> *) a.
MonadUnliftIO m =>
Text -> (CString -> m a) -> m a
Text.withCString Text
label CString -> IO Bool
forall (m :: * -> *). MonadIO m => CString -> m Bool
Raw.treeNode
treePush :: MonadIO m => Text -> m ()
treePush :: forall (m :: * -> *). MonadIO m => Text -> m ()
treePush Text
label = IO () -> m ()
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO do
Text -> (CString -> IO ()) -> IO ()
forall (m :: * -> *) a.
MonadUnliftIO m =>
Text -> (CString -> m a) -> m a
Text.withCString Text
label CString -> IO ()
forall (m :: * -> *). MonadIO m => CString -> m ()
Raw.treePush
getTreeNodeToLabelSpacing :: (MonadIO m) => m Float
getTreeNodeToLabelSpacing :: forall (m :: * -> *). MonadIO m => m Float
getTreeNodeToLabelSpacing = IO Float -> m Float
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO do
CFloat Float
x <- IO CFloat
forall (m :: * -> *). MonadIO m => m CFloat
Raw.getTreeNodeToLabelSpacing
Float -> IO Float
forall a. a -> IO a
forall (f :: * -> *) a. Applicative f => a -> f a
pure Float
x
collapsingHeader :: (MonadIO m) => Text -> Maybe Bool -> m Bool
Text
label Maybe Bool
visible = IO Bool -> m Bool
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO do
Text -> (CString -> IO Bool) -> IO Bool
forall (m :: * -> *) a.
MonadUnliftIO m =>
Text -> (CString -> m a) -> m a
Text.withCString Text
label \CString
labelPtr ->
(CBool -> (Ptr CBool -> IO Bool) -> IO Bool)
-> Maybe CBool -> (Ptr CBool -> IO Bool) -> IO Bool
forall a b c.
(a -> (Ptr b -> IO c) -> IO c)
-> Maybe a -> (Ptr b -> IO c) -> IO c
maybeWith CBool -> (Ptr CBool -> IO Bool) -> IO Bool
forall a b. Storable a => a -> (Ptr a -> IO b) -> IO b
with (CBool -> CBool -> Bool -> CBool
forall a. a -> a -> Bool -> a
bool CBool
0 CBool
1 (Bool -> CBool) -> Maybe Bool -> Maybe CBool
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Maybe Bool
visible) \Ptr CBool
visiblePtr ->
CString -> Ptr CBool -> ImGuiTreeNodeFlags -> IO Bool
forall (m :: * -> *).
MonadIO m =>
CString -> Ptr CBool -> ImGuiTreeNodeFlags -> m Bool
Raw.collapsingHeader CString
labelPtr Ptr CBool
visiblePtr ImGuiTreeNodeFlags
ImGuiTreeNodeFlags_None
setNextItemOpen :: MonadIO m => Bool -> m ()
setNextItemOpen :: forall (m :: * -> *). MonadIO m => Bool -> m ()
setNextItemOpen Bool
is_open = CBool -> m ()
forall (m :: * -> *). MonadIO m => CBool -> m ()
Raw.setNextItemOpen (CBool -> CBool -> Bool -> CBool
forall a. a -> a -> Bool -> a
bool CBool
0 CBool
1 Bool
is_open)
selectable :: MonadIO m => Text -> m Bool
selectable :: forall (m :: * -> *). MonadIO m => Text -> m Bool
selectable = SelectableOptions -> Text -> m Bool
forall (m :: * -> *).
MonadIO m =>
SelectableOptions -> Text -> m Bool
selectableWith SelectableOptions
defSelectableOptions
data SelectableOptions = SelectableOptions
{ SelectableOptions -> Bool
selected :: Bool
, SelectableOptions -> ImGuiSelectableFlags
flags :: ImGuiSelectableFlags
, SelectableOptions -> ImVec2
size :: ImVec2
} deriving Int -> SelectableOptions -> ShowS
[SelectableOptions] -> ShowS
SelectableOptions -> String
(Int -> SelectableOptions -> ShowS)
-> (SelectableOptions -> String)
-> ([SelectableOptions] -> ShowS)
-> Show SelectableOptions
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> SelectableOptions -> ShowS
showsPrec :: Int -> SelectableOptions -> ShowS
$cshow :: SelectableOptions -> String
show :: SelectableOptions -> String
$cshowList :: [SelectableOptions] -> ShowS
showList :: [SelectableOptions] -> ShowS
Show
defSelectableOptions :: SelectableOptions
defSelectableOptions :: SelectableOptions
defSelectableOptions = SelectableOptions
{ $sel:selected:SelectableOptions :: Bool
selected = Bool
False
, $sel:flags:SelectableOptions :: ImGuiSelectableFlags
flags = ImGuiSelectableFlags
ImGuiSelectableFlags_None
, $sel:size:SelectableOptions :: ImVec2
size = Float -> Float -> ImVec2
ImVec2 Float
0 Float
0
}
selectableWith :: MonadIO m => SelectableOptions -> Text -> m Bool
selectableWith :: forall (m :: * -> *).
MonadIO m =>
SelectableOptions -> Text -> m Bool
selectableWith (SelectableOptions Bool
selected ImGuiSelectableFlags
flags ImVec2
size) Text
label = IO Bool -> m Bool
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO do
ImVec2 -> (Ptr ImVec2 -> IO Bool) -> IO Bool
forall a b. Storable a => a -> (Ptr a -> IO b) -> IO b
with ImVec2
size \Ptr ImVec2
sizePtr ->
Text -> (CString -> IO Bool) -> IO Bool
forall (m :: * -> *) a.
MonadUnliftIO m =>
Text -> (CString -> m a) -> m a
Text.withCString Text
label \CString
labelPtr ->
CString -> CBool -> ImGuiSelectableFlags -> Ptr ImVec2 -> IO Bool
forall (m :: * -> *).
MonadIO m =>
CString -> CBool -> ImGuiSelectableFlags -> Ptr ImVec2 -> m Bool
Raw.selectable CString
labelPtr (CBool -> CBool -> Bool -> CBool
forall a. a -> a -> Bool -> a
bool CBool
0 CBool
1 Bool
selected) ImGuiSelectableFlags
flags Ptr ImVec2
sizePtr
listBox :: (MonadIO m, HasGetter ref Int, HasSetter ref Int) => Text -> ref -> [Text] -> m Bool
listBox :: forall (m :: * -> *) ref.
(MonadIO m, HasGetter ref Int, HasSetter ref Int) =>
Text -> ref -> [Text] -> m Bool
listBox Text
label ref
selectedIndex [Text]
items = IO Bool -> m Bool
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Bool -> m Bool) -> IO Bool -> m Bool
forall a b. (a -> b) -> a -> b
$ Managed Bool -> (Bool -> IO Bool) -> IO Bool
forall a r. Managed a -> (a -> IO r) -> IO r
Managed.with Managed Bool
m Bool -> IO Bool
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return
where
m :: Managed Bool
m = do
Int
i <- ref -> Managed Int
forall t a (m :: * -> *). (HasGetter t a, MonadIO m) => t -> m a
forall (m :: * -> *). MonadIO m => ref -> m Int
get ref
selectedIndex
[CString]
cStrings <- (Text -> Managed CString) -> [Text] -> Managed [CString]
forall (t :: * -> *) (f :: * -> *) a b.
(Traversable t, Applicative f) =>
(a -> f b) -> t a -> f (t b)
forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> [a] -> f [b]
traverse (\Text
str -> (forall r. (CString -> IO r) -> IO r) -> Managed CString
forall (m :: * -> *) a.
MonadManaged m =>
(forall r. (a -> IO r) -> IO r) -> m a
Managed.managed (Text -> (CString -> IO r) -> IO r
forall (m :: * -> *) a.
MonadUnliftIO m =>
Text -> (CString -> m a) -> m a
Text.withCString Text
str)) [Text]
items
CString
labelPtr <- (forall r. (CString -> IO r) -> IO r) -> Managed CString
forall (m :: * -> *) a.
MonadManaged m =>
(forall r. (a -> IO r) -> IO r) -> m a
Managed.managed ((forall r. (CString -> IO r) -> IO r) -> Managed CString)
-> (forall r. (CString -> IO r) -> IO r) -> Managed CString
forall a b. (a -> b) -> a -> b
$ Text -> (CString -> IO r) -> IO r
forall (m :: * -> *) a.
MonadUnliftIO m =>
Text -> (CString -> m a) -> m a
Text.withCString Text
label
Ptr CInt
iPtr <- (forall r. (Ptr CInt -> IO r) -> IO r) -> Managed (Ptr CInt)
forall (m :: * -> *) a.
MonadManaged m =>
(forall r. (a -> IO r) -> IO r) -> m a
Managed.managed ((forall r. (Ptr CInt -> IO r) -> IO r) -> Managed (Ptr CInt))
-> (forall r. (Ptr CInt -> IO r) -> IO r) -> Managed (Ptr CInt)
forall a b. (a -> b) -> a -> b
$ CInt -> (Ptr CInt -> IO r) -> IO r
forall a b. Storable a => a -> (Ptr a -> IO b) -> IO b
with (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
i)
IO Bool -> Managed Bool
forall a. IO a -> Managed a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Bool -> Managed Bool) -> IO Bool -> Managed Bool
forall a b. (a -> b) -> a -> b
$ [CString] -> (Int -> Ptr CString -> IO Bool) -> IO Bool
forall a b. Storable a => [a] -> (Int -> Ptr a -> IO b) -> IO b
withArrayLen [CString]
cStrings \Int
len Ptr CString
itemsPtr -> do
Bool
changed <- CString -> Ptr CInt -> Ptr CString -> CInt -> IO Bool
forall (m :: * -> *).
MonadIO m =>
CString -> Ptr CInt -> Ptr CString -> CInt -> m Bool
Raw.listBox CString
labelPtr Ptr CInt
iPtr Ptr CString
itemsPtr (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
len)
Bool -> IO () -> IO ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
when Bool
changed do
CInt
i' <- Ptr CInt -> IO CInt
forall a. Storable a => Ptr a -> IO a
peek Ptr CInt
iPtr
ref
selectedIndex ref -> Int -> IO ()
forall t a (m :: * -> *).
(HasSetter t a, MonadIO m) =>
t -> a -> m ()
$=! CInt -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral CInt
i'
Bool -> IO Bool
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
changed
plotLines :: MonadIO m => Text -> [CFloat] -> m ()
plotLines :: forall (m :: * -> *). MonadIO m => Text -> [CFloat] -> m ()
plotLines Text
label [CFloat]
values = IO () -> m ()
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$
[CFloat] -> (Int -> Ptr CFloat -> IO ()) -> IO ()
forall a b. Storable a => [a] -> (Int -> Ptr a -> IO b) -> IO b
withArrayLen [CFloat]
values \Int
len Ptr CFloat
valuesPtr ->
Text -> (CString -> IO ()) -> IO ()
forall (m :: * -> *) a.
MonadUnliftIO m =>
Text -> (CString -> m a) -> m a
Text.withCString Text
label \CString
labelPtr ->
CString -> Ptr CFloat -> CInt -> IO ()
forall (m :: * -> *).
MonadIO m =>
CString -> Ptr CFloat -> CInt -> m ()
Raw.plotLines CString
labelPtr Ptr CFloat
valuesPtr (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
len)
plotHistogram :: MonadIO m => Text -> [CFloat] -> m ()
plotHistogram :: forall (m :: * -> *). MonadIO m => Text -> [CFloat] -> m ()
plotHistogram Text
label [CFloat]
values = IO () -> m ()
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$
[CFloat] -> (Int -> Ptr CFloat -> IO ()) -> IO ()
forall a b. Storable a => [a] -> (Int -> Ptr a -> IO b) -> IO b
withArrayLen [CFloat]
values \Int
len Ptr CFloat
valuesPtr ->
Text -> (CString -> IO ()) -> IO ()
forall (m :: * -> *) a.
MonadUnliftIO m =>
Text -> (CString -> m a) -> m a
Text.withCString Text
label \CString
labelPtr ->
CString -> Ptr CFloat -> CInt -> IO ()
forall (m :: * -> *).
MonadIO m =>
CString -> Ptr CFloat -> CInt -> m ()
Raw.plotHistogram CString
labelPtr Ptr CFloat
valuesPtr (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
len)
withMainMenuBar :: MonadUnliftIO m => (Bool -> m a) -> m a
withMainMenuBar :: forall (m :: * -> *) a. MonadUnliftIO m => (Bool -> m a) -> m a
withMainMenuBar = m Bool -> (Bool -> m ()) -> (Bool -> m a) -> m a
forall (m :: * -> *) a b c.
MonadUnliftIO m =>
m a -> (a -> m b) -> (a -> m c) -> m c
bracket m Bool
forall (m :: * -> *). MonadIO m => m Bool
Raw.beginMainMenuBar (Bool -> m () -> m ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
`when` m ()
forall (m :: * -> *). MonadIO m => m ()
Raw.endMainMenuBar)
withMainMenuBarOpen :: MonadUnliftIO m => m () -> m ()
withMainMenuBarOpen :: forall (m :: * -> *). MonadUnliftIO m => m () -> m ()
withMainMenuBarOpen m ()
action =
(Bool -> m ()) -> m ()
forall (m :: * -> *) a. MonadUnliftIO m => (Bool -> m a) -> m a
withMainMenuBar (Bool -> m () -> m ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
`when` m ()
action)
withMenuBar :: MonadUnliftIO m => (Bool -> m a) -> m a
= m Bool -> (Bool -> m ()) -> (Bool -> m a) -> m a
forall (m :: * -> *) a b c.
MonadUnliftIO m =>
m a -> (a -> m b) -> (a -> m c) -> m c
bracket m Bool
forall (m :: * -> *). MonadIO m => m Bool
Raw.beginMenuBar (Bool -> m () -> m ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
`when` m ()
forall (m :: * -> *). MonadIO m => m ()
Raw.endMenuBar)
withMenuBarOpen :: MonadUnliftIO m => m () -> m ()
m ()
action =
(Bool -> m ()) -> m ()
forall (m :: * -> *) a. MonadUnliftIO m => (Bool -> m a) -> m a
withMenuBar (Bool -> m () -> m ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
`when` m ()
action)
beginMenu :: MonadIO m => Text -> m Bool
Text
label = IO Bool -> m Bool
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO do
Text -> (CString -> IO Bool) -> IO Bool
forall (m :: * -> *) a.
MonadUnliftIO m =>
Text -> (CString -> m a) -> m a
Text.withCString Text
label CString -> IO Bool
forall (m :: * -> *). MonadIO m => CString -> m Bool
Raw.beginMenu
withMenu :: MonadUnliftIO m => Text -> (Bool -> m a) -> m a
Text
label = m Bool -> (Bool -> m ()) -> (Bool -> m a) -> m a
forall (m :: * -> *) a b c.
MonadUnliftIO m =>
m a -> (a -> m b) -> (a -> m c) -> m c
bracket (Text -> m Bool
forall (m :: * -> *). MonadIO m => Text -> m Bool
beginMenu Text
label) (Bool -> m () -> m ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
`when` m ()
forall (m :: * -> *). MonadIO m => m ()
Raw.endMenu)
withMenuOpen :: MonadUnliftIO m => Text -> m () -> m ()
Text
label m ()
action =
Text -> (Bool -> m ()) -> m ()
forall (m :: * -> *) a.
MonadUnliftIO m =>
Text -> (Bool -> m a) -> m a
withMenu Text
label (Bool -> m () -> m ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
`when` m ()
action)
menuItem :: MonadIO m => Text -> m Bool
Text
label = IO Bool -> m Bool
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO do
Text -> (CString -> IO Bool) -> IO Bool
forall (m :: * -> *) a.
MonadUnliftIO m =>
Text -> (CString -> m a) -> m a
Text.withCString Text
label CString -> IO Bool
forall (m :: * -> *). MonadIO m => CString -> m Bool
Raw.menuItem
beginTabBar :: MonadIO m => Text -> ImGuiTabBarFlags -> m Bool
beginTabBar :: forall (m :: * -> *).
MonadIO m =>
Text -> ImGuiTabBarFlags -> m Bool
beginTabBar Text
tabBarID ImGuiTabBarFlags
flags = IO Bool -> m Bool
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO do
Text -> (CString -> IO Bool) -> IO Bool
forall (m :: * -> *) a.
MonadUnliftIO m =>
Text -> (CString -> m a) -> m a
Text.withCString Text
tabBarID \CString
ptr ->
CString -> ImGuiTabBarFlags -> IO Bool
forall (m :: * -> *).
MonadIO m =>
CString -> ImGuiTabBarFlags -> m Bool
Raw.beginTabBar CString
ptr ImGuiTabBarFlags
flags
withTabBar :: MonadUnliftIO m => Text -> ImGuiTabBarFlags -> (Bool -> m a) -> m a
withTabBar :: forall (m :: * -> *) a.
MonadUnliftIO m =>
Text -> ImGuiTabBarFlags -> (Bool -> m a) -> m a
withTabBar Text
tabBarID ImGuiTabBarFlags
flags =
m Bool -> (Bool -> m ()) -> (Bool -> m a) -> m a
forall (m :: * -> *) a b c.
MonadUnliftIO m =>
m a -> (a -> m b) -> (a -> m c) -> m c
bracket (Text -> ImGuiTabBarFlags -> m Bool
forall (m :: * -> *).
MonadIO m =>
Text -> ImGuiTabBarFlags -> m Bool
beginTabBar Text
tabBarID ImGuiTabBarFlags
flags) (Bool -> m () -> m ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
`when` m ()
forall (m :: * -> *). MonadIO m => m ()
Raw.endTabBar)
withTabBarOpen :: MonadUnliftIO m => Text -> ImGuiTabBarFlags -> m () -> m ()
withTabBarOpen :: forall (m :: * -> *).
MonadUnliftIO m =>
Text -> ImGuiTabBarFlags -> m () -> m ()
withTabBarOpen Text
tabBarID ImGuiTabBarFlags
flags m ()
action =
Text -> ImGuiTabBarFlags -> (Bool -> m ()) -> m ()
forall (m :: * -> *) a.
MonadUnliftIO m =>
Text -> ImGuiTabBarFlags -> (Bool -> m a) -> m a
withTabBar Text
tabBarID ImGuiTabBarFlags
flags (Bool -> m () -> m ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
`when` m ()
action)
beginTabItem :: (MonadIO m, HasGetter ref Bool, HasSetter ref Bool) => Text -> ref -> ImGuiTabItemFlags -> m Bool
beginTabItem :: forall (m :: * -> *) ref.
(MonadIO m, HasGetter ref Bool, HasSetter ref Bool) =>
Text -> ref -> ImGuiTabItemFlags -> m Bool
beginTabItem Text
tabName ref
ref ImGuiTabItemFlags
flags = IO Bool -> m Bool
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO do
Bool
currentValue <- ref -> IO Bool
forall t a (m :: * -> *). (HasGetter t a, MonadIO m) => t -> m a
forall (m :: * -> *). MonadIO m => ref -> m Bool
get ref
ref
CBool -> (Ptr CBool -> IO Bool) -> IO Bool
forall a b. Storable a => a -> (Ptr a -> IO b) -> IO b
with (CBool -> CBool -> Bool -> CBool
forall a. a -> a -> Bool -> a
bool CBool
0 CBool
1 Bool
currentValue) \Ptr CBool
refPtr -> do
Bool
open <- Text -> (CString -> IO Bool) -> IO Bool
forall (m :: * -> *) a.
MonadUnliftIO m =>
Text -> (CString -> m a) -> m a
Text.withCString Text
tabName \CString
ptrName ->
CString -> Ptr CBool -> ImGuiTabItemFlags -> IO Bool
forall (m :: * -> *).
MonadIO m =>
CString -> Ptr CBool -> ImGuiTabItemFlags -> m Bool
Raw.beginTabItem CString
ptrName Ptr CBool
refPtr ImGuiTabItemFlags
flags
Bool
newValue <- (CBool
0 CBool -> CBool -> Bool
forall a. Eq a => a -> a -> Bool
/=) (CBool -> Bool) -> IO CBool -> IO Bool
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Ptr CBool -> IO CBool
forall a. Storable a => Ptr a -> IO a
peek Ptr CBool
refPtr
Bool -> IO () -> IO ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
when (Bool
newValue Bool -> Bool -> Bool
forall a. Eq a => a -> a -> Bool
/= Bool
currentValue) do
ref
ref ref -> Bool -> IO ()
forall t a (m :: * -> *).
(HasSetter t a, MonadIO m) =>
t -> a -> m ()
$=! Bool
newValue
Bool -> IO Bool
forall a. a -> IO a
forall (f :: * -> *) a. Applicative f => a -> f a
pure Bool
open
withTabItem :: (MonadUnliftIO m, HasGetter ref Bool, HasSetter ref Bool) => Text -> ref -> ImGuiTabItemFlags -> (Bool -> m a) -> m a
withTabItem :: forall (m :: * -> *) ref a.
(MonadUnliftIO m, HasGetter ref Bool, HasSetter ref Bool) =>
Text -> ref -> ImGuiTabItemFlags -> (Bool -> m a) -> m a
withTabItem Text
tabName ref
ref ImGuiTabItemFlags
flags =
m Bool -> (Bool -> m ()) -> (Bool -> m a) -> m a
forall (m :: * -> *) a b c.
MonadUnliftIO m =>
m a -> (a -> m b) -> (a -> m c) -> m c
bracket (Text -> ref -> ImGuiTabItemFlags -> m Bool
forall (m :: * -> *) ref.
(MonadIO m, HasGetter ref Bool, HasSetter ref Bool) =>
Text -> ref -> ImGuiTabItemFlags -> m Bool
beginTabItem Text
tabName ref
ref ImGuiTabItemFlags
flags) (Bool -> m () -> m ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
`when` m ()
forall (m :: * -> *). MonadIO m => m ()
Raw.endTabItem)
withTabItemOpen :: (MonadUnliftIO m, HasGetter ref Bool, HasSetter ref Bool) => Text -> ref -> ImGuiTabItemFlags -> m () -> m ()
withTabItemOpen :: forall (m :: * -> *) ref.
(MonadUnliftIO m, HasGetter ref Bool, HasSetter ref Bool) =>
Text -> ref -> ImGuiTabItemFlags -> m () -> m ()
withTabItemOpen Text
tabName ref
ref ImGuiTabItemFlags
flags m ()
action =
Text -> ref -> ImGuiTabItemFlags -> (Bool -> m ()) -> m ()
forall (m :: * -> *) ref a.
(MonadUnliftIO m, HasGetter ref Bool, HasSetter ref Bool) =>
Text -> ref -> ImGuiTabItemFlags -> (Bool -> m a) -> m a
withTabItem Text
tabName ref
ref ImGuiTabItemFlags
flags (Bool -> m () -> m ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
`when` m ()
action)
tabItemButton :: MonadIO m => Text -> ImGuiTabItemFlags -> m Bool
tabItemButton :: forall (m :: * -> *).
MonadIO m =>
Text -> ImGuiTabItemFlags -> m Bool
tabItemButton Text
tabName ImGuiTabItemFlags
flags = IO Bool -> m Bool
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO do
Text -> (CString -> IO Bool) -> IO Bool
forall (m :: * -> *) a.
MonadUnliftIO m =>
Text -> (CString -> m a) -> m a
Text.withCString Text
tabName \CString
namePtr ->
CString -> ImGuiTabItemFlags -> IO Bool
forall (m :: * -> *).
MonadIO m =>
CString -> ImGuiTabItemFlags -> m Bool
Raw.tabItemButton CString
namePtr ImGuiTabItemFlags
flags
setTabItemClosed :: MonadIO m => Text -> m ()
setTabItemClosed :: forall (m :: * -> *). MonadIO m => Text -> m ()
setTabItemClosed Text
tabName = IO () -> m ()
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO do
Text -> (CString -> IO ()) -> IO ()
forall (m :: * -> *) a.
MonadUnliftIO m =>
Text -> (CString -> m a) -> m a
Text.withCString Text
tabName CString -> IO ()
forall (m :: * -> *). MonadIO m => CString -> m ()
Raw.setTabItemClosed
setItemTooltip :: MonadIO m => Text -> m ()
setItemTooltip :: forall (m :: * -> *). MonadIO m => Text -> m ()
setItemTooltip Text
tabName = IO () -> m ()
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO do
Text -> (CString -> IO ()) -> IO ()
forall (m :: * -> *) a.
MonadUnliftIO m =>
Text -> (CString -> m a) -> m a
Text.withCString Text
tabName CString -> IO ()
forall (m :: * -> *). MonadIO m => CString -> m ()
Raw.setItemTooltip
withItemTooltip :: MonadUnliftIO m => m () -> m ()
withItemTooltip :: forall (m :: * -> *). MonadUnliftIO m => m () -> m ()
withItemTooltip m ()
action = m Bool -> (Bool -> m ()) -> (Bool -> m ()) -> m ()
forall (m :: * -> *) a b c.
MonadUnliftIO m =>
m a -> (a -> m b) -> (a -> m c) -> m c
bracket m Bool
forall (m :: * -> *). MonadIO m => m Bool
Raw.beginItemTooltip (Bool -> m () -> m ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
`when` m ()
forall (m :: * -> *). MonadIO m => m ()
Raw.endTooltip) (Bool -> m () -> m ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
`when` m ()
action)
withTooltip :: MonadUnliftIO m => m () -> m ()
withTooltip :: forall (m :: * -> *). MonadUnliftIO m => m () -> m ()
withTooltip m ()
action = m Bool -> (Bool -> m ()) -> (Bool -> m ()) -> m ()
forall (m :: * -> *) a b c.
MonadUnliftIO m =>
m a -> (a -> m b) -> (a -> m c) -> m c
bracket m Bool
forall (m :: * -> *). MonadIO m => m Bool
Raw.beginItemTooltip (Bool -> m () -> m ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
`when` m ()
forall (m :: * -> *). MonadIO m => m ()
Raw.endTooltip) (Bool -> m () -> m ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
`when` m ()
action)
withDisabled :: (MonadUnliftIO m, HasGetter ref Bool) => ref -> m a -> m a
withDisabled :: forall (m :: * -> *) ref a.
(MonadUnliftIO m, HasGetter ref Bool) =>
ref -> m a -> m a
withDisabled ref
disabledRef m a
action = do
Bool
disabled <- ref -> m Bool
forall t a (m :: * -> *). (HasGetter t a, MonadIO m) => t -> m a
forall (m :: * -> *). MonadIO m => ref -> m Bool
get ref
disabledRef
if Bool
disabled then m () -> m () -> m a -> m a
forall (m :: * -> *) a b c.
MonadUnliftIO m =>
m a -> m b -> m c -> m c
bracket_ (CBool -> m ()
forall (m :: * -> *). MonadIO m => CBool -> m ()
Raw.beginDisabled CBool
1) m ()
forall (m :: * -> *). MonadIO m => m ()
Raw.endDisabled m a
action else m a
action
beginPopup :: MonadIO m => Text -> m Bool
Text
popupId = IO Bool -> m Bool
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO do
Text -> (CString -> IO Bool) -> IO Bool
forall (m :: * -> *) a.
MonadUnliftIO m =>
Text -> (CString -> m a) -> m a
Text.withCString Text
popupId CString -> IO Bool
forall (m :: * -> *). MonadIO m => CString -> m Bool
Raw.beginPopup
withPopup :: MonadUnliftIO m => Text -> (Bool -> m a) -> m a
Text
popupId = m Bool -> (Bool -> m ()) -> (Bool -> m a) -> m a
forall (m :: * -> *) a b c.
MonadUnliftIO m =>
m a -> (a -> m b) -> (a -> m c) -> m c
bracket (Text -> m Bool
forall (m :: * -> *). MonadIO m => Text -> m Bool
beginPopup Text
popupId) (Bool -> m () -> m ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
`when` m ()
forall (m :: * -> *). MonadIO m => m ()
Raw.endPopup)
withPopupOpen :: MonadUnliftIO m => Text -> m () -> m ()
Text
popupId m ()
action =
Text -> (Bool -> m ()) -> m ()
forall (m :: * -> *) a.
MonadUnliftIO m =>
Text -> (Bool -> m a) -> m a
withPopup Text
popupId (Bool -> m () -> m ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
`when` m ()
action)
beginPopupModal :: MonadIO m => Text -> m Bool
Text
popupId = IO Bool -> m Bool
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO do
Text -> (CString -> IO Bool) -> IO Bool
forall (m :: * -> *) a.
MonadUnliftIO m =>
Text -> (CString -> m a) -> m a
Text.withCString Text
popupId CString -> IO Bool
forall (m :: * -> *). MonadIO m => CString -> m Bool
Raw.beginPopupModal
withPopupModal :: MonadUnliftIO m => Text -> (Bool -> m a) -> m a
Text
popupId = m Bool -> (Bool -> m ()) -> (Bool -> m a) -> m a
forall (m :: * -> *) a b c.
MonadUnliftIO m =>
m a -> (a -> m b) -> (a -> m c) -> m c
bracket (Text -> m Bool
forall (m :: * -> *). MonadIO m => Text -> m Bool
beginPopupModal Text
popupId) (Bool -> m () -> m ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
`when` m ()
forall (m :: * -> *). MonadIO m => m ()
Raw.endPopup)
withPopupModalOpen :: MonadUnliftIO m => Text -> m () -> m ()
Text
popupId m ()
action =
Text -> (Bool -> m ()) -> m ()
forall (m :: * -> *) a.
MonadUnliftIO m =>
Text -> (Bool -> m a) -> m a
withPopupModal Text
popupId (Bool -> m () -> m ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
`when` m ()
action)
beginPopupContextItem :: MonadIO m => Maybe Text -> ImGuiPopupFlags -> m Bool
Maybe Text
itemId ImGuiPopupFlags
flags = IO Bool -> m Bool
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO do
Maybe Text -> (CString -> IO Bool) -> IO Bool
forall a. Maybe Text -> (CString -> IO a) -> IO a
Text.withCStringOrNull Maybe Text
itemId \CString
popupIdPtr ->
CString -> ImGuiPopupFlags -> IO Bool
forall (m :: * -> *).
MonadIO m =>
CString -> ImGuiPopupFlags -> m Bool
Raw.beginPopupContextItem CString
popupIdPtr ImGuiPopupFlags
flags
withPopupContextItem :: MonadUnliftIO m => Maybe Text -> ImGuiPopupFlags -> (Bool -> m a) -> m a
Maybe Text
popupId ImGuiPopupFlags
flags = m Bool -> (Bool -> m ()) -> (Bool -> m a) -> m a
forall (m :: * -> *) a b c.
MonadUnliftIO m =>
m a -> (a -> m b) -> (a -> m c) -> m c
bracket (Maybe Text -> ImGuiPopupFlags -> m Bool
forall (m :: * -> *).
MonadIO m =>
Maybe Text -> ImGuiPopupFlags -> m Bool
beginPopupContextItem Maybe Text
popupId ImGuiPopupFlags
flags) (Bool -> m () -> m ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
`when` m ()
forall (m :: * -> *). MonadIO m => m ()
Raw.endPopup)
withPopupContextItemOpen :: MonadUnliftIO m => Maybe Text -> ImGuiPopupFlags -> m () -> m ()
Maybe Text
popupId ImGuiPopupFlags
flags m ()
action = Maybe Text -> ImGuiPopupFlags -> (Bool -> m ()) -> m ()
forall (m :: * -> *) a.
MonadUnliftIO m =>
Maybe Text -> ImGuiPopupFlags -> (Bool -> m a) -> m a
withPopupContextItem Maybe Text
popupId ImGuiPopupFlags
flags (Bool -> m () -> m ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
`when` m ()
action)
itemContextPopup :: MonadUnliftIO m => m () -> m ()
= Maybe Text -> ImGuiPopupFlags -> m () -> m ()
forall (m :: * -> *).
MonadUnliftIO m =>
Maybe Text -> ImGuiPopupFlags -> m () -> m ()
withPopupContextItemOpen Maybe Text
forall a. Maybe a
Nothing ImGuiPopupFlags
ImGuiPopupFlags_MouseButtonRight
beginPopupContextWindow :: MonadIO m => Maybe Text -> ImGuiPopupFlags -> m Bool
Maybe Text
popupId ImGuiPopupFlags
flags = IO Bool -> m Bool
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO do
Maybe Text -> (CString -> IO Bool) -> IO Bool
forall a. Maybe Text -> (CString -> IO a) -> IO a
Text.withCStringOrNull Maybe Text
popupId \CString
popupIdPtr ->
CString -> ImGuiPopupFlags -> IO Bool
forall (m :: * -> *).
MonadIO m =>
CString -> ImGuiPopupFlags -> m Bool
Raw.beginPopupContextWindow CString
popupIdPtr ImGuiPopupFlags
flags
withPopupContextWindow :: MonadUnliftIO m => Maybe Text -> ImGuiPopupFlags -> (Bool -> m a) -> m a
Maybe Text
popupId ImGuiPopupFlags
flags = m Bool -> (Bool -> m ()) -> (Bool -> m a) -> m a
forall (m :: * -> *) a b c.
MonadUnliftIO m =>
m a -> (a -> m b) -> (a -> m c) -> m c
bracket (Maybe Text -> ImGuiPopupFlags -> m Bool
forall (m :: * -> *).
MonadIO m =>
Maybe Text -> ImGuiPopupFlags -> m Bool
beginPopupContextWindow Maybe Text
popupId ImGuiPopupFlags
flags) (Bool -> m () -> m ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
`when` m ()
forall (m :: * -> *). MonadIO m => m ()
Raw.endPopup)
withPopupContextWindowOpen :: MonadUnliftIO m => Maybe Text -> ImGuiPopupFlags -> m () -> m ()
Maybe Text
popupId ImGuiPopupFlags
flags m ()
action = Maybe Text -> ImGuiPopupFlags -> (Bool -> m ()) -> m ()
forall (m :: * -> *) a.
MonadUnliftIO m =>
Maybe Text -> ImGuiPopupFlags -> (Bool -> m a) -> m a
withPopupContextWindow Maybe Text
popupId ImGuiPopupFlags
flags (Bool -> m () -> m ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
`when` m ()
action)
windowContextPopup :: MonadUnliftIO m => m () -> m ()
= Maybe Text -> ImGuiPopupFlags -> m () -> m ()
forall (m :: * -> *).
MonadUnliftIO m =>
Maybe Text -> ImGuiPopupFlags -> m () -> m ()
withPopupContextWindowOpen Maybe Text
forall a. Maybe a
Nothing ImGuiPopupFlags
ImGuiPopupFlags_MouseButtonRight
beginPopupContextVoid :: MonadIO m => Maybe Text -> ImGuiPopupFlags -> m Bool
Maybe Text
popupId ImGuiPopupFlags
flags = IO Bool -> m Bool
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO do
Maybe Text -> (CString -> IO Bool) -> IO Bool
forall a. Maybe Text -> (CString -> IO a) -> IO a
Text.withCStringOrNull Maybe Text
popupId \CString
popupIdPtr ->
CString -> ImGuiPopupFlags -> IO Bool
forall (m :: * -> *).
MonadIO m =>
CString -> ImGuiPopupFlags -> m Bool
Raw.beginPopupContextVoid CString
popupIdPtr ImGuiPopupFlags
flags
withPopupContextVoid :: MonadUnliftIO m => Maybe Text -> ImGuiPopupFlags -> (Bool -> m a) -> m a
Maybe Text
popupId ImGuiPopupFlags
flags = m Bool -> (Bool -> m ()) -> (Bool -> m a) -> m a
forall (m :: * -> *) a b c.
MonadUnliftIO m =>
m a -> (a -> m b) -> (a -> m c) -> m c
bracket (Maybe Text -> ImGuiPopupFlags -> m Bool
forall (m :: * -> *).
MonadIO m =>
Maybe Text -> ImGuiPopupFlags -> m Bool
beginPopupContextVoid Maybe Text
popupId ImGuiPopupFlags
flags) (Bool -> m () -> m ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
`when` m ()
forall (m :: * -> *). MonadIO m => m ()
Raw.endPopup)
withPopupContextVoidOpen :: MonadUnliftIO m => Maybe Text -> ImGuiPopupFlags -> m () -> m ()
Maybe Text
popupId ImGuiPopupFlags
flags m ()
action = Maybe Text -> ImGuiPopupFlags -> (Bool -> m ()) -> m ()
forall (m :: * -> *) a.
MonadUnliftIO m =>
Maybe Text -> ImGuiPopupFlags -> (Bool -> m a) -> m a
withPopupContextVoid Maybe Text
popupId ImGuiPopupFlags
flags (Bool -> m () -> m ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
`when` m ()
action)
voidContextPopup :: MonadUnliftIO m => m () -> m ()
= Maybe Text -> ImGuiPopupFlags -> m () -> m ()
forall (m :: * -> *).
MonadUnliftIO m =>
Maybe Text -> ImGuiPopupFlags -> m () -> m ()
withPopupContextWindowOpen Maybe Text
forall a. Maybe a
Nothing ImGuiPopupFlags
ImGuiPopupFlags_MouseButtonRight
openPopup :: MonadIO m => Text -> m ()
Text
popupId = IO () -> m ()
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO do
Text -> (CString -> IO ()) -> IO ()
forall (m :: * -> *) a.
MonadUnliftIO m =>
Text -> (CString -> m a) -> m a
Text.withCString Text
popupId CString -> IO ()
forall (m :: * -> *). MonadIO m => CString -> m ()
Raw.openPopup
openPopupOnItemClick :: MonadIO m => Text -> ImGuiPopupFlags -> m ()
Text
popupId ImGuiPopupFlags
flags = IO () -> m ()
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO do
Text -> (CString -> IO ()) -> IO ()
forall (m :: * -> *) a.
MonadUnliftIO m =>
Text -> (CString -> m a) -> m a
Text.withCString Text
popupId ((CString -> IO ()) -> IO ()) -> (CString -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \CString
idPtr ->
CString -> ImGuiPopupFlags -> IO ()
forall (m :: * -> *).
MonadIO m =>
CString -> ImGuiPopupFlags -> m ()
Raw.openPopupOnItemClick CString
idPtr ImGuiPopupFlags
flags
isCurrentPopupOpen :: MonadIO m => Text -> m Bool
Text
popupId = IO Bool -> m Bool
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO do
Text -> (CString -> IO Bool) -> IO Bool
forall (m :: * -> *) a.
MonadUnliftIO m =>
Text -> (CString -> m a) -> m a
Text.withCString Text
popupId ((CString -> IO Bool) -> IO Bool)
-> (CString -> IO Bool) -> IO Bool
forall a b. (a -> b) -> a -> b
$ \CString
idPtr ->
CString -> ImGuiPopupFlags -> IO Bool
forall (m :: * -> *).
MonadIO m =>
CString -> ImGuiPopupFlags -> m Bool
Raw.isPopupOpen CString
idPtr ImGuiPopupFlags
ImGuiPopupFlags_None
isAnyPopupOpen :: MonadIO m => Text -> m Bool
Text
popupId = IO Bool -> m Bool
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO do
Text -> (CString -> IO Bool) -> IO Bool
forall (m :: * -> *) a.
MonadUnliftIO m =>
Text -> (CString -> m a) -> m a
Text.withCString Text
popupId ((CString -> IO Bool) -> IO Bool)
-> (CString -> IO Bool) -> IO Bool
forall a b. (a -> b) -> a -> b
$ \CString
idPtr ->
CString -> ImGuiPopupFlags -> IO Bool
forall (m :: * -> *).
MonadIO m =>
CString -> ImGuiPopupFlags -> m Bool
Raw.isPopupOpen CString
idPtr ImGuiPopupFlags
ImGuiPopupFlags_AnyPopupId
isAnyLevelPopupOpen :: MonadIO m => Text -> m Bool
Text
popupId = IO Bool -> m Bool
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO do
Text -> (CString -> IO Bool) -> IO Bool
forall (m :: * -> *) a.
MonadUnliftIO m =>
Text -> (CString -> m a) -> m a
Text.withCString Text
popupId ((CString -> IO Bool) -> IO Bool)
-> (CString -> IO Bool) -> IO Bool
forall a b. (a -> b) -> a -> b
$ \CString
idPtr ->
CString -> ImGuiPopupFlags -> IO Bool
forall (m :: * -> *).
MonadIO m =>
CString -> ImGuiPopupFlags -> m Bool
Raw.isPopupOpen CString
idPtr (ImGuiPopupFlags -> IO Bool) -> ImGuiPopupFlags -> IO Bool
forall a b. (a -> b) -> a -> b
$
ImGuiPopupFlags
ImGuiPopupFlags_AnyPopupId ImGuiPopupFlags -> ImGuiPopupFlags -> ImGuiPopupFlags
forall a. Bits a => a -> a -> a
.|. ImGuiPopupFlags
ImGuiPopupFlags_AnyPopupLevel
setNextWindowPos
:: (MonadIO m, HasGetter ref ImVec2)
=> ref
-> ImGuiCond
-> Maybe ref
-> m ()
setNextWindowPos :: forall (m :: * -> *) ref.
(MonadIO m, HasGetter ref ImVec2) =>
ref -> ImGuiCond -> Maybe ref -> m ()
setNextWindowPos ref
posRef ImGuiCond
cond Maybe ref
pivotMaybe = IO () -> m ()
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO do
ImVec2
pos <- ref -> IO ImVec2
forall t a (m :: * -> *). (HasGetter t a, MonadIO m) => t -> m a
forall (m :: * -> *). MonadIO m => ref -> m ImVec2
get ref
posRef
ImVec2 -> (Ptr ImVec2 -> IO ()) -> IO ()
forall a b. Storable a => a -> (Ptr a -> IO b) -> IO b
with ImVec2
pos ((Ptr ImVec2 -> IO ()) -> IO ()) -> (Ptr ImVec2 -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr ImVec2
posPtr ->
case Maybe ref
pivotMaybe of
Just ref
pivotRef -> do
ImVec2
pivot <- ref -> IO ImVec2
forall t a (m :: * -> *). (HasGetter t a, MonadIO m) => t -> m a
forall (m :: * -> *). MonadIO m => ref -> m ImVec2
get ref
pivotRef
ImVec2 -> (Ptr ImVec2 -> IO ()) -> IO ()
forall a b. Storable a => a -> (Ptr a -> IO b) -> IO b
with ImVec2
pivot ((Ptr ImVec2 -> IO ()) -> IO ()) -> (Ptr ImVec2 -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr ImVec2
pivotPtr ->
Ptr ImVec2 -> ImGuiCond -> Maybe (Ptr ImVec2) -> IO ()
forall (m :: * -> *).
MonadIO m =>
Ptr ImVec2 -> ImGuiCond -> Maybe (Ptr ImVec2) -> m ()
Raw.setNextWindowPos Ptr ImVec2
posPtr ImGuiCond
cond (Ptr ImVec2 -> Maybe (Ptr ImVec2)
forall a. a -> Maybe a
Just Ptr ImVec2
pivotPtr)
Maybe ref
Nothing ->
Ptr ImVec2 -> ImGuiCond -> Maybe (Ptr ImVec2) -> IO ()
forall (m :: * -> *).
MonadIO m =>
Ptr ImVec2 -> ImGuiCond -> Maybe (Ptr ImVec2) -> m ()
Raw.setNextWindowPos Ptr ImVec2
posPtr ImGuiCond
cond Maybe (Ptr ImVec2)
forall a. Maybe a
Nothing
setNextWindowSize :: (MonadIO m, HasGetter ref ImVec2) => ref -> ImGuiCond -> m ()
setNextWindowSize :: forall (m :: * -> *) ref.
(MonadIO m, HasGetter ref ImVec2) =>
ref -> ImGuiCond -> m ()
setNextWindowSize ref
sizeRef ImGuiCond
cond = IO () -> m ()
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO do
ImVec2
size' <- ref -> IO ImVec2
forall t a (m :: * -> *). (HasGetter t a, MonadIO m) => t -> m a
forall (m :: * -> *). MonadIO m => ref -> m ImVec2
get ref
sizeRef
ImVec2 -> (Ptr ImVec2 -> IO ()) -> IO ()
forall a b. Storable a => a -> (Ptr a -> IO b) -> IO b
with ImVec2
size' \Ptr ImVec2
sizePtr ->
Ptr ImVec2 -> ImGuiCond -> IO ()
forall (m :: * -> *). MonadIO m => Ptr ImVec2 -> ImGuiCond -> m ()
Raw.setNextWindowSize Ptr ImVec2
sizePtr ImGuiCond
cond
setNextWindowContentSize :: (MonadIO m, HasGetter ref ImVec2) => ref -> m ()
setNextWindowContentSize :: forall (m :: * -> *) ref.
(MonadIO m, HasGetter ref ImVec2) =>
ref -> m ()
setNextWindowContentSize ref
sizeRef = IO () -> m ()
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO do
ImVec2
size' <- ref -> IO ImVec2
forall t a (m :: * -> *). (HasGetter t a, MonadIO m) => t -> m a
forall (m :: * -> *). MonadIO m => ref -> m ImVec2
get ref
sizeRef
ImVec2 -> (Ptr ImVec2 -> IO ()) -> IO ()
forall a b. Storable a => a -> (Ptr a -> IO b) -> IO b
with ImVec2
size' Ptr ImVec2 -> IO ()
forall (m :: * -> *). MonadIO m => Ptr ImVec2 -> m ()
Raw.setNextWindowContentSize
setNextWindowSizeConstraints :: (MonadIO m, HasGetter ref ImVec2) => ref -> ref -> m ()
setNextWindowSizeConstraints :: forall (m :: * -> *) ref.
(MonadIO m, HasGetter ref ImVec2) =>
ref -> ref -> m ()
setNextWindowSizeConstraints ref
sizeMinRef ref
sizeMaxRef = IO () -> m ()
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO do
ImVec2
sizeMin <- ref -> IO ImVec2
forall t a (m :: * -> *). (HasGetter t a, MonadIO m) => t -> m a
forall (m :: * -> *). MonadIO m => ref -> m ImVec2
get ref
sizeMinRef
ImVec2
sizeMax <- ref -> IO ImVec2
forall t a (m :: * -> *). (HasGetter t a, MonadIO m) => t -> m a
forall (m :: * -> *). MonadIO m => ref -> m ImVec2
get ref
sizeMaxRef
ImVec2 -> (Ptr ImVec2 -> IO ()) -> IO ()
forall a b. Storable a => a -> (Ptr a -> IO b) -> IO b
with ImVec2
sizeMin \Ptr ImVec2
sizeMinPtr ->
ImVec2 -> (Ptr ImVec2 -> IO ()) -> IO ()
forall a b. Storable a => a -> (Ptr a -> IO b) -> IO b
with ImVec2
sizeMax \Ptr ImVec2
sizeMaxPtr ->
Ptr ImVec2 -> Ptr ImVec2 -> IO ()
forall (m :: * -> *). MonadIO m => Ptr ImVec2 -> Ptr ImVec2 -> m ()
Raw.setNextWindowSizeConstraints Ptr ImVec2
sizeMinPtr Ptr ImVec2
sizeMaxPtr
setNextWindowCollapsed :: (MonadIO m) => Bool -> ImGuiCond -> m ()
setNextWindowCollapsed :: forall (m :: * -> *). MonadIO m => Bool -> ImGuiCond -> m ()
setNextWindowCollapsed Bool
b ImGuiCond
cond = IO () -> m ()
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO do
CBool -> ImGuiCond -> IO ()
forall (m :: * -> *). MonadIO m => CBool -> ImGuiCond -> m ()
Raw.setNextWindowCollapsed (CBool -> CBool -> Bool -> CBool
forall a. a -> a -> Bool -> a
bool CBool
0 CBool
1 Bool
b) ImGuiCond
cond
setNextWindowScroll :: (MonadIO m) => ImVec2 -> m ()
setNextWindowScroll :: forall (m :: * -> *). MonadIO m => ImVec2 -> m ()
setNextWindowScroll ImVec2
scroll = IO () -> m ()
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO do
ImVec2 -> (Ptr ImVec2 -> IO ()) -> IO ()
forall a b. Storable a => a -> (Ptr a -> IO b) -> IO b
with ImVec2
scroll Ptr ImVec2 -> IO ()
forall (m :: * -> *). MonadIO m => Ptr ImVec2 -> m ()
Raw.setNextWindowScroll
setNextWindowBgAlpha :: (MonadIO m) => Float -> m ()
setNextWindowBgAlpha :: forall (m :: * -> *). MonadIO m => Float -> m ()
setNextWindowBgAlpha Float
alpha = IO () -> m ()
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO do
CFloat -> IO ()
forall (m :: * -> *). MonadIO m => CFloat -> m ()
Raw.setNextWindowBgAlpha (Float -> CFloat
CFloat Float
alpha)
dummy :: (MonadIO m, HasGetter ref ImVec2) => ref -> m ()
dummy :: forall (m :: * -> *) ref.
(MonadIO m, HasGetter ref ImVec2) =>
ref -> m ()
dummy ref
sizeRef = IO () -> m ()
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO do
ImVec2
size' <- ref -> IO ImVec2
forall t a (m :: * -> *). (HasGetter t a, MonadIO m) => t -> m a
forall (m :: * -> *). MonadIO m => ref -> m ImVec2
get ref
sizeRef
ImVec2 -> (Ptr ImVec2 -> IO ()) -> IO ()
forall a b. Storable a => a -> (Ptr a -> IO b) -> IO b
with ImVec2
size' Ptr ImVec2 -> IO ()
forall (m :: * -> *). MonadIO m => Ptr ImVec2 -> m ()
Raw.dummy
withIndent :: MonadUnliftIO m => Float -> m a -> m a
withIndent :: forall (m :: * -> *) a. MonadUnliftIO m => Float -> m a -> m a
withIndent Float
width =
m () -> m () -> m a -> m a
forall (m :: * -> *) a b c.
MonadUnliftIO m =>
m a -> m b -> m c -> m c
bracket_ (Float -> m ()
forall (m :: * -> *). MonadIO m => Float -> m ()
indent Float
width) (Float -> m ()
forall (m :: * -> *). MonadIO m => Float -> m ()
unindent Float
width)
indent :: (MonadIO m) => Float -> m ()
indent :: forall (m :: * -> *). MonadIO m => Float -> m ()
indent Float
indent_w = IO () -> m ()
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO do
CFloat -> IO ()
forall (m :: * -> *). MonadIO m => CFloat -> m ()
Raw.indent (Float -> CFloat
CFloat Float
indent_w)
unindent :: (MonadIO m) => Float -> m ()
unindent :: forall (m :: * -> *). MonadIO m => Float -> m ()
unindent Float
f = IO () -> m ()
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO do
CFloat -> IO ()
forall (m :: * -> *). MonadIO m => CFloat -> m ()
Raw.unindent (Float -> CFloat
CFloat Float
f)
setNextItemWidth :: (MonadIO m) => Float -> m ()
setNextItemWidth :: forall (m :: * -> *). MonadIO m => Float -> m ()
setNextItemWidth Float
itemWidth = IO () -> m ()
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO do
CFloat -> IO ()
forall (m :: * -> *). MonadIO m => CFloat -> m ()
Raw.setNextItemWidth (Float -> CFloat
CFloat Float
itemWidth)
withItemWidth :: MonadUnliftIO m => Float -> m a -> m a
withItemWidth :: forall (m :: * -> *) a. MonadUnliftIO m => Float -> m a -> m a
withItemWidth Float
width =
m () -> m () -> m a -> m a
forall (m :: * -> *) a b c.
MonadUnliftIO m =>
m a -> m b -> m c -> m c
bracket_ (Float -> m ()
forall (m :: * -> *). MonadIO m => Float -> m ()
pushItemWidth Float
width) m ()
forall (m :: * -> *). MonadIO m => m ()
Raw.popItemWidth
pushItemWidth :: (MonadIO m) => Float -> m ()
pushItemWidth :: forall (m :: * -> *). MonadIO m => Float -> m ()
pushItemWidth Float
itemWidth = IO () -> m ()
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO do
CFloat -> IO ()
forall (m :: * -> *). MonadIO m => CFloat -> m ()
Raw.pushItemWidth (Float -> CFloat
CFloat Float
itemWidth)
withTextWrapPos :: MonadUnliftIO m => Float -> m a -> m a
withTextWrapPos :: forall (m :: * -> *) a. MonadUnliftIO m => Float -> m a -> m a
withTextWrapPos Float
width =
m () -> m () -> m a -> m a
forall (m :: * -> *) a b c.
MonadUnliftIO m =>
m a -> m b -> m c -> m c
bracket_ (Float -> m ()
forall (m :: * -> *). MonadIO m => Float -> m ()
pushTextWrapPos Float
width) m ()
forall (m :: * -> *). MonadIO m => m ()
Raw.popTextWrapPos
pushTextWrapPos :: (MonadIO m) => Float -> m ()
pushTextWrapPos :: forall (m :: * -> *). MonadIO m => Float -> m ()
pushTextWrapPos Float
wrapLocalPosX = IO () -> m ()
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO do
CFloat -> IO ()
forall (m :: * -> *). MonadIO m => CFloat -> m ()
Raw.pushTextWrapPos (Float -> CFloat
CFloat Float
wrapLocalPosX)
withGroup :: MonadUnliftIO m => m a -> m a
withGroup :: forall (m :: * -> *) a. MonadUnliftIO m => m a -> m a
withGroup = m () -> m () -> m a -> m a
forall (m :: * -> *) a b c.
MonadUnliftIO m =>
m a -> m b -> m c -> m c
bracket_ m ()
forall (m :: * -> *). MonadIO m => m ()
Raw.beginGroup m ()
forall (m :: * -> *). MonadIO m => m ()
Raw.endGroup
setCursorPos :: (MonadIO m, HasGetter ref ImVec2) => ref -> m ()
setCursorPos :: forall (m :: * -> *) ref.
(MonadIO m, HasGetter ref ImVec2) =>
ref -> m ()
setCursorPos ref
posRef = IO () -> m ()
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO do
ImVec2
pos <- ref -> IO ImVec2
forall t a (m :: * -> *). (HasGetter t a, MonadIO m) => t -> m a
forall (m :: * -> *). MonadIO m => ref -> m ImVec2
get ref
posRef
ImVec2 -> (Ptr ImVec2 -> IO ()) -> IO ()
forall a b. Storable a => a -> (Ptr a -> IO b) -> IO b
with ImVec2
pos Ptr ImVec2 -> IO ()
forall (m :: * -> *). MonadIO m => Ptr ImVec2 -> m ()
Raw.setCursorPos
setCursorPosX :: (MonadIO m) => Float -> m ()
setCursorPosX :: forall (m :: * -> *). MonadIO m => Float -> m ()
setCursorPosX Float
x = CFloat -> m ()
forall (m :: * -> *). MonadIO m => CFloat -> m ()
Raw.setCursorPosX (Float -> CFloat
CFloat Float
x)
setCursorPosY :: (MonadIO m) => Float -> m ()
setCursorPosY :: forall (m :: * -> *). MonadIO m => Float -> m ()
setCursorPosY Float
y = CFloat -> m ()
forall (m :: * -> *). MonadIO m => CFloat -> m ()
Raw.setCursorPosY (Float -> CFloat
CFloat Float
y)
setCursorScreenPos :: (MonadIO m) => ImVec2 -> m ()
setCursorScreenPos :: forall (m :: * -> *). MonadIO m => ImVec2 -> m ()
setCursorScreenPos ImVec2
pos = IO () -> m ()
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO do
ImVec2 -> (Ptr ImVec2 -> IO ()) -> IO ()
forall a b. Storable a => a -> (Ptr a -> IO b) -> IO b
with ImVec2
pos Ptr ImVec2 -> IO ()
forall (m :: * -> *). MonadIO m => Ptr ImVec2 -> m ()
Raw.setCursorScreenPos
getCursorPosX :: (MonadIO m) => m Float
getCursorPosX :: forall (m :: * -> *). MonadIO m => m Float
getCursorPosX = IO Float -> m Float
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO do
CFloat Float
x <- IO CFloat
forall (m :: * -> *). MonadIO m => m CFloat
Raw.getCursorPosX
Float -> IO Float
forall a. a -> IO a
forall (f :: * -> *) a. Applicative f => a -> f a
pure Float
x
getCursorPosY :: (MonadIO m) => m Float
getCursorPosY :: forall (m :: * -> *). MonadIO m => m Float
getCursorPosY = IO Float -> m Float
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO do
CFloat Float
y <- IO CFloat
forall (m :: * -> *). MonadIO m => m CFloat
Raw.getCursorPosY
Float -> IO Float
forall a. a -> IO a
forall (f :: * -> *) a. Applicative f => a -> f a
pure Float
y
getTextLineHeight :: (MonadIO m) => m Float
getTextLineHeight :: forall (m :: * -> *). MonadIO m => m Float
getTextLineHeight = IO Float -> m Float
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO do
CFloat Float
h <- IO CFloat
forall (m :: * -> *). MonadIO m => m CFloat
Raw.getTextLineHeight
Float -> IO Float
forall a. a -> IO a
forall (f :: * -> *) a. Applicative f => a -> f a
pure Float
h
getTextLineHeightWithSpacing :: (MonadIO m) => m Float
getTextLineHeightWithSpacing :: forall (m :: * -> *). MonadIO m => m Float
getTextLineHeightWithSpacing = IO Float -> m Float
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO do
CFloat Float
h <- IO CFloat
forall (m :: * -> *). MonadIO m => m CFloat
Raw.getTextLineHeightWithSpacing
Float -> IO Float
forall a. a -> IO a
forall (f :: * -> *) a. Applicative f => a -> f a
pure Float
h
getFrameHeight :: (MonadIO m) => m Float
getFrameHeight :: forall (m :: * -> *). MonadIO m => m Float
getFrameHeight = IO Float -> m Float
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO do
CFloat Float
h <- IO CFloat
forall (m :: * -> *). MonadIO m => m CFloat
Raw.getFrameHeight
Float -> IO Float
forall a. a -> IO a
forall (f :: * -> *) a. Applicative f => a -> f a
pure Float
h
getFrameHeightWithSpacing :: (MonadIO m) => m Float
getFrameHeightWithSpacing :: forall (m :: * -> *). MonadIO m => m Float
getFrameHeightWithSpacing = IO Float -> m Float
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO do
CFloat Float
h <- IO CFloat
forall (m :: * -> *). MonadIO m => m CFloat
Raw.getFrameHeightWithSpacing
Float -> IO Float
forall a. a -> IO a
forall (f :: * -> *) a. Applicative f => a -> f a
pure Float
h
withID :: (MonadUnliftIO m, ToID id) => id -> m a -> m a
withID :: forall (m :: * -> *) id a.
(MonadUnliftIO m, ToID id) =>
id -> m a -> m a
withID id
i = m () -> m () -> m a -> m a
forall (m :: * -> *) a b c.
MonadUnliftIO m =>
m a -> m b -> m c -> m c
bracket_ (IO () -> m ()
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ id -> IO ()
forall a (m :: * -> *). (ToID a, MonadIO m) => a -> m ()
forall (m :: * -> *). MonadIO m => id -> m ()
pushID id
i) m ()
forall (m :: * -> *). MonadIO m => m ()
Raw.popID
class ToID a where
pushID :: MonadIO m => a -> m ()
instance ToID CInt where
pushID :: forall (m :: * -> *). MonadIO m => CInt -> m ()
pushID = CInt -> m ()
forall (m :: * -> *). MonadIO m => CInt -> m ()
Raw.pushIDInt
instance ToID Int where
pushID :: forall (m :: * -> *). MonadIO m => Int -> m ()
pushID = CInt -> m ()
forall (m :: * -> *). MonadIO m => CInt -> m ()
Raw.pushIDInt (CInt -> m ()) -> (Int -> CInt) -> Int -> m ()
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral
instance ToID Integer where
pushID :: forall (m :: * -> *). MonadIO m => Integer -> m ()
pushID = CInt -> m ()
forall (m :: * -> *). MonadIO m => CInt -> m ()
Raw.pushIDInt (CInt -> m ()) -> (Integer -> CInt) -> Integer -> m ()
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Integer -> CInt
forall a. Num a => Integer -> a
fromInteger
instance {-# OVERLAPPABLE #-} ToID (Ptr a) where
pushID :: forall (m :: * -> *). MonadIO m => Ptr a -> m ()
pushID = Ptr a -> m ()
forall (m :: * -> *) a. MonadIO m => Ptr a -> m ()
Raw.pushIDPtr
instance {-# OVERLAPPING #-} ToID (Ptr CChar) where
pushID :: forall (m :: * -> *). MonadIO m => CString -> m ()
pushID = CString -> m ()
forall (m :: * -> *). MonadIO m => CString -> m ()
Raw.pushIDStr
instance ToID (Ptr CChar, Int) where
pushID :: forall (m :: * -> *). MonadIO m => CStringLen -> m ()
pushID = CStringLen -> m ()
forall (m :: * -> *). MonadIO m => CStringLen -> m ()
Raw.pushIDStrLen
instance ToID Text where
pushID :: forall (m :: * -> *). MonadIO m => Text -> m ()
pushID Text
t = IO () -> m ()
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ Text -> (CStringLen -> IO ()) -> IO ()
forall a. Text -> (CStringLen -> IO a) -> IO a
Text.withCStringLen Text
t CStringLen -> IO ()
forall a (m :: * -> *). (ToID a, MonadIO m) => a -> m ()
forall (m :: * -> *). MonadIO m => CStringLen -> m ()
pushID
withStyleColor :: (MonadUnliftIO m, HasGetter ref ImVec4) => ImGuiCol -> ref -> m a -> m a
withStyleColor :: forall (m :: * -> *) ref a.
(MonadUnliftIO m, HasGetter ref ImVec4) =>
ImGuiCol -> ref -> m a -> m a
withStyleColor ImGuiCol
color ref
ref =
m () -> m () -> m a -> m a
forall (m :: * -> *) a b c.
MonadUnliftIO m =>
m a -> m b -> m c -> m c
bracket_ (ImGuiCol -> ref -> m ()
forall (m :: * -> *) ref.
(MonadIO m, HasGetter ref ImVec4) =>
ImGuiCol -> ref -> m ()
pushStyleColor ImGuiCol
color ref
ref) (CInt -> m ()
forall (m :: * -> *). MonadIO m => CInt -> m ()
Raw.popStyleColor CInt
1)
pushStyleColor :: (MonadIO m, HasGetter ref ImVec4) => ImGuiCol -> ref -> m ()
pushStyleColor :: forall (m :: * -> *) ref.
(MonadIO m, HasGetter ref ImVec4) =>
ImGuiCol -> ref -> m ()
pushStyleColor ImGuiCol
col ref
colorRef = IO () -> m ()
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO do
ImVec4
color <- ref -> IO ImVec4
forall t a (m :: * -> *). (HasGetter t a, MonadIO m) => t -> m a
forall (m :: * -> *). MonadIO m => ref -> m ImVec4
get ref
colorRef
ImVec4 -> (Ptr ImVec4 -> IO ()) -> IO ()
forall a b. Storable a => a -> (Ptr a -> IO b) -> IO b
with ImVec4
color \Ptr ImVec4
colorPtr ->
ImGuiCol -> Ptr ImVec4 -> IO ()
forall (m :: * -> *). MonadIO m => ImGuiCol -> Ptr ImVec4 -> m ()
Raw.pushStyleColor ImGuiCol
col Ptr ImVec4
colorPtr
withStyleVar :: (MonadUnliftIO m, HasGetter ref ImVec2) => ImGuiStyleVar -> ref -> m a -> m a
withStyleVar :: forall (m :: * -> *) ref a.
(MonadUnliftIO m, HasGetter ref ImVec2) =>
ImGuiStyleVar -> ref -> m a -> m a
withStyleVar ImGuiStyleVar
style ref
ref =
m () -> m () -> m a -> m a
forall (m :: * -> *) a b c.
MonadUnliftIO m =>
m a -> m b -> m c -> m c
bracket_ (ImGuiStyleVar -> ref -> m ()
forall (m :: * -> *) ref.
(MonadIO m, HasGetter ref ImVec2) =>
ImGuiStyleVar -> ref -> m ()
pushStyleVar ImGuiStyleVar
style ref
ref) (CInt -> m ()
forall (m :: * -> *). MonadIO m => CInt -> m ()
Raw.popStyleVar CInt
1)
pushStyleVar :: (MonadIO m, HasGetter ref ImVec2) => ImGuiStyleVar -> ref -> m ()
pushStyleVar :: forall (m :: * -> *) ref.
(MonadIO m, HasGetter ref ImVec2) =>
ImGuiStyleVar -> ref -> m ()
pushStyleVar ImGuiStyleVar
style ref
valRef = IO () -> m ()
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO do
ImVec2
val <- ref -> IO ImVec2
forall t a (m :: * -> *). (HasGetter t a, MonadIO m) => t -> m a
forall (m :: * -> *). MonadIO m => ref -> m ImVec2
get ref
valRef
ImVec2 -> (Ptr ImVec2 -> IO ()) -> IO ()
forall a b. Storable a => a -> (Ptr a -> IO b) -> IO b
with ImVec2
val \Ptr ImVec2
valPtr ->
ImGuiStyleVar -> Ptr ImVec2 -> IO ()
forall (m :: * -> *).
MonadIO m =>
ImGuiStyleVar -> Ptr ImVec2 -> m ()
Raw.pushStyleVar ImGuiStyleVar
style Ptr ImVec2
valPtr
popStyleVar :: (MonadIO m) => Int -> m ()
popStyleVar :: forall (m :: * -> *). MonadIO m => Int -> m ()
popStyleVar Int
n = IO () -> m ()
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO do
CInt -> IO ()
forall (m :: * -> *). MonadIO m => CInt -> m ()
Raw.popStyleVar (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
n)
withFont :: MonadUnliftIO m => Raw.Font.Font -> m a -> m a
withFont :: forall (m :: * -> *) a. MonadUnliftIO m => Font -> m a -> m a
withFont Font
font = m () -> m () -> m a -> m a
forall (m :: * -> *) a b c.
MonadUnliftIO m =>
m a -> m b -> m c -> m c
bracket_ (Font -> m ()
forall (m :: * -> *). MonadIO m => Font -> m ()
Raw.Font.pushFont Font
font) m ()
forall (m :: * -> *). MonadIO m => m ()
Raw.Font.popFont
withListClipper :: (ClipItems t a, MonadUnliftIO m) => Maybe Float -> t a -> (a -> m ()) -> m ()
withListClipper :: forall (t :: * -> *) a (m :: * -> *).
(ClipItems t a, MonadUnliftIO m) =>
Maybe Float -> t a -> (a -> m ()) -> m ()
withListClipper Maybe Float
itemHeight t a
items a -> m ()
action =
m (Ptr ImGuiListClipper)
-> (Ptr ImGuiListClipper -> m ())
-> (Ptr ImGuiListClipper -> m ())
-> m ()
forall (m :: * -> *) a b c.
MonadUnliftIO m =>
m a -> (a -> m b) -> (a -> m c) -> m c
bracket
(IO (Ptr ImGuiListClipper) -> m (Ptr ImGuiListClipper)
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (Ptr ImGuiListClipper) -> m (Ptr ImGuiListClipper))
-> IO (Ptr ImGuiListClipper) -> m (Ptr ImGuiListClipper)
forall a b. (a -> b) -> a -> b
$ String -> IO (Ptr ImGuiListClipper) -> IO (Ptr ImGuiListClipper)
forall a. String -> IO (Ptr a) -> IO (Ptr a)
throwIfNull String
"withListClipper: ListClipper allocation failed" IO (Ptr ImGuiListClipper)
forall (m :: * -> *). MonadIO m => m (Ptr ImGuiListClipper)
Raw.ListClipper.new)
Ptr ImGuiListClipper -> m ()
forall (m :: * -> *). MonadIO m => Ptr ImGuiListClipper -> m ()
Raw.ListClipper.delete
Ptr ImGuiListClipper -> m ()
step
where
itemHeight' :: CFloat
itemHeight' = CFloat -> (Float -> CFloat) -> Maybe Float -> CFloat
forall b a. b -> (a -> b) -> Maybe a -> b
maybe (-CFloat
1.0) Float -> CFloat
CFloat Maybe Float
itemHeight
itemCount' :: CInt
itemCount' = CInt -> (Int -> CInt) -> Maybe Int -> CInt
forall b a. b -> (a -> b) -> Maybe a -> b
maybe CInt
forall a. Bounded a => a
maxBound Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral (t a -> Maybe Int
forall (t :: * -> *) a. ClipItems t a => t a -> Maybe Int
itemCount t a
items)
step :: Ptr ImGuiListClipper -> m ()
step Ptr ImGuiListClipper
clipper = do
Ptr ImGuiListClipper -> CInt -> CFloat -> m ()
forall (m :: * -> *).
MonadIO m =>
Ptr ImGuiListClipper -> CInt -> CFloat -> m ()
Raw.ListClipper.begin Ptr ImGuiListClipper
clipper CInt
itemCount' CFloat
itemHeight'
Ptr ImGuiListClipper -> m ()
go Ptr ImGuiListClipper
clipper
go :: Ptr ImGuiListClipper -> m ()
go Ptr ImGuiListClipper
clipper = do
Bool
doStep <- Ptr ImGuiListClipper -> m Bool
forall (m :: * -> *). MonadIO m => Ptr ImGuiListClipper -> m Bool
Raw.ListClipper.step Ptr ImGuiListClipper
clipper
Bool -> m () -> m ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
when Bool
doStep do
let
startIndex :: Int
startIndex = CInt -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral (CInt -> Int) -> CInt -> Int
forall a b. (a -> b) -> a -> b
$ Ptr ImGuiListClipper -> CInt
Raw.ListClipper.displayStart Ptr ImGuiListClipper
clipper
endIndex :: Int
endIndex = CInt -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral (CInt -> Int) -> CInt -> Int
forall a b. (a -> b) -> a -> b
$ Ptr ImGuiListClipper -> CInt
Raw.ListClipper.displayEnd Ptr ImGuiListClipper
clipper
(a -> m ()) -> t a -> m ()
forall (m :: * -> *). Monad m => (a -> m ()) -> t a -> m ()
forall (t :: * -> *) a (m :: * -> *).
(ClipItems t a, Monad m) =>
(a -> m ()) -> t a -> m ()
stepItems a -> m ()
action (t a -> m ()) -> t a -> m ()
forall a b. (a -> b) -> a -> b
$
Int -> Int -> t a -> t a
forall (t :: * -> *) a. ClipItems t a => Int -> Int -> t a -> t a
clipItems Int
startIndex Int
endIndex t a
items
Ptr ImGuiListClipper -> m ()
go Ptr ImGuiListClipper
clipper
calcTextSize :: MonadIO m => Text -> Bool -> Float -> m ImVec2
calcTextSize :: forall (m :: * -> *).
MonadIO m =>
Text -> Bool -> Float -> m ImVec2
calcTextSize Text
t Bool
hideAfterDoubleHash Float
wrapWidth = IO ImVec2 -> m ImVec2
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO do
Text -> (CStringLen -> IO ImVec2) -> IO ImVec2
forall a. Text -> (CStringLen -> IO a) -> IO a
Text.withCStringLen Text
t \(CString
textPtr, Int
textLen) ->
CString -> CString -> CBool -> CFloat -> IO ImVec2
forall (m :: * -> *).
MonadIO m =>
CString -> CString -> CBool -> CFloat -> m ImVec2
Raw.calcTextSize CString
textPtr (CString
textPtr CString -> Int -> CString
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
textLen) (CBool -> CBool -> Bool -> CBool
forall a. a -> a -> Bool -> a
bool CBool
0 CBool
1 Bool
hideAfterDoubleHash) (Float -> CFloat
CFloat Float
wrapWidth)
class ClipItems t a where
itemCount :: t a -> Maybe Int
clipItems :: Int -> Int -> t a -> t a
stepItems :: Monad m => (a -> m ()) -> t a -> m ()
instance ClipItems [] a where
itemCount :: [a] -> Maybe Int
itemCount = Maybe Int -> [a] -> Maybe Int
forall a b. a -> b -> a
const Maybe Int
forall a. Maybe a
Nothing
clipItems :: Int -> Int -> [a] -> [a]
clipItems Int
displayStart Int
displayEnd =
Int -> [a] -> [a]
forall a. Int -> [a] -> [a]
take (Int
displayEnd Int -> Int -> Int
forall a. Num a => a -> a -> a
- Int
displayStart) ([a] -> [a]) -> ([a] -> [a]) -> [a] -> [a]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int -> [a] -> [a]
forall a. Int -> [a] -> [a]
drop Int
displayStart
stepItems :: forall (m :: * -> *). Monad m => (a -> m ()) -> [a] -> m ()
stepItems = (a -> m ()) -> [a] -> m ()
forall (t :: * -> *) (m :: * -> *) a b.
(Foldable t, Monad m) =>
(a -> m b) -> t a -> m ()
mapM_
instance ClipItems V.Vector a where
itemCount :: Vector a -> Maybe Int
itemCount = Int -> Maybe Int
forall a. a -> Maybe a
Just (Int -> Maybe Int) -> (Vector a -> Int) -> Vector a -> Maybe Int
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Vector a -> Int
forall a. Vector a -> Int
V.length
clipItems :: Int -> Int -> Vector a -> Vector a
clipItems Int
displayStart Int
displayEnd =
Int -> Int -> Vector a -> Vector a
forall a. Int -> Int -> Vector a -> Vector a
V.slice Int
displayStart (Int
displayEnd Int -> Int -> Int
forall a. Num a => a -> a -> a
- Int
displayStart)
stepItems :: forall (m :: * -> *). Monad m => (a -> m ()) -> Vector a -> m ()
stepItems = (a -> m ()) -> Vector a -> m ()
forall (m :: * -> *) a b. Monad m => (a -> m b) -> Vector a -> m ()
V.mapM_
instance Storable a => ClipItems VS.Vector a where
itemCount :: Vector a -> Maybe Int
itemCount = Int -> Maybe Int
forall a. a -> Maybe a
Just (Int -> Maybe Int) -> (Vector a -> Int) -> Vector a -> Maybe Int
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Vector a -> Int
forall a. Storable a => Vector a -> Int
VS.length
clipItems :: Int -> Int -> Vector a -> Vector a
clipItems Int
displayStart Int
displayEnd =
Int -> Int -> Vector a -> Vector a
forall a. Storable a => Int -> Int -> Vector a -> Vector a
VS.slice Int
displayStart (Int
displayEnd Int -> Int -> Int
forall a. Num a => a -> a -> a
- Int
displayStart)
stepItems :: forall (m :: * -> *). Monad m => (a -> m ()) -> Vector a -> m ()
stepItems = (a -> m ()) -> Vector a -> m ()
forall (m :: * -> *) a b.
(Monad m, Storable a) =>
(a -> m b) -> Vector a -> m ()
VS.mapM_
instance VU.Unbox a => ClipItems VU.Vector a where
itemCount :: Vector a -> Maybe Int
itemCount = Int -> Maybe Int
forall a. a -> Maybe a
Just (Int -> Maybe Int) -> (Vector a -> Int) -> Vector a -> Maybe Int
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Vector a -> Int
forall a. Unbox a => Vector a -> Int
VU.length
clipItems :: Int -> Int -> Vector a -> Vector a
clipItems Int
displayStart Int
displayEnd =
Int -> Int -> Vector a -> Vector a
forall a. Unbox a => Int -> Int -> Vector a -> Vector a
VU.slice Int
displayStart (Int
displayEnd Int -> Int -> Int
forall a. Num a => a -> a -> a
- Int
displayStart)
stepItems :: forall (m :: * -> *). Monad m => (a -> m ()) -> Vector a -> m ()
stepItems = (a -> m ()) -> Vector a -> m ()
forall (m :: * -> *) a b.
(Monad m, Unbox a) =>
(a -> m b) -> Vector a -> m ()
VU.mapM_
data ClipRange a = ClipRange a a
deriving (ClipRange a -> ClipRange a -> Bool
(ClipRange a -> ClipRange a -> Bool)
-> (ClipRange a -> ClipRange a -> Bool) -> Eq (ClipRange a)
forall a. Eq a => ClipRange a -> ClipRange a -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: forall a. Eq a => ClipRange a -> ClipRange a -> Bool
== :: ClipRange a -> ClipRange a -> Bool
$c/= :: forall a. Eq a => ClipRange a -> ClipRange a -> Bool
/= :: ClipRange a -> ClipRange a -> Bool
Eq, Eq (ClipRange a)
Eq (ClipRange a) =>
(ClipRange a -> ClipRange a -> Ordering)
-> (ClipRange a -> ClipRange a -> Bool)
-> (ClipRange a -> ClipRange a -> Bool)
-> (ClipRange a -> ClipRange a -> Bool)
-> (ClipRange a -> ClipRange a -> Bool)
-> (ClipRange a -> ClipRange a -> ClipRange a)
-> (ClipRange a -> ClipRange a -> ClipRange a)
-> Ord (ClipRange a)
ClipRange a -> ClipRange a -> Bool
ClipRange a -> ClipRange a -> Ordering
ClipRange a -> ClipRange a -> ClipRange a
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
forall a. Ord a => Eq (ClipRange a)
forall a. Ord a => ClipRange a -> ClipRange a -> Bool
forall a. Ord a => ClipRange a -> ClipRange a -> Ordering
forall a. Ord a => ClipRange a -> ClipRange a -> ClipRange a
$ccompare :: forall a. Ord a => ClipRange a -> ClipRange a -> Ordering
compare :: ClipRange a -> ClipRange a -> Ordering
$c< :: forall a. Ord a => ClipRange a -> ClipRange a -> Bool
< :: ClipRange a -> ClipRange a -> Bool
$c<= :: forall a. Ord a => ClipRange a -> ClipRange a -> Bool
<= :: ClipRange a -> ClipRange a -> Bool
$c> :: forall a. Ord a => ClipRange a -> ClipRange a -> Bool
> :: ClipRange a -> ClipRange a -> Bool
$c>= :: forall a. Ord a => ClipRange a -> ClipRange a -> Bool
>= :: ClipRange a -> ClipRange a -> Bool
$cmax :: forall a. Ord a => ClipRange a -> ClipRange a -> ClipRange a
max :: ClipRange a -> ClipRange a -> ClipRange a
$cmin :: forall a. Ord a => ClipRange a -> ClipRange a -> ClipRange a
min :: ClipRange a -> ClipRange a -> ClipRange a
Ord, Int -> ClipRange a -> ShowS
[ClipRange a] -> ShowS
ClipRange a -> String
(Int -> ClipRange a -> ShowS)
-> (ClipRange a -> String)
-> ([ClipRange a] -> ShowS)
-> Show (ClipRange a)
forall a. Show a => Int -> ClipRange a -> ShowS
forall a. Show a => [ClipRange a] -> ShowS
forall a. Show a => ClipRange a -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: forall a. Show a => Int -> ClipRange a -> ShowS
showsPrec :: Int -> ClipRange a -> ShowS
$cshow :: forall a. Show a => ClipRange a -> String
show :: ClipRange a -> String
$cshowList :: forall a. Show a => [ClipRange a] -> ShowS
showList :: [ClipRange a] -> ShowS
Show)
instance (Ord a, Enum a, Num a) => ClipItems ClipRange a where
itemCount :: ClipRange a -> Maybe Int
itemCount (ClipRange a
_begin a
end) =
Int -> Maybe Int
forall a. a -> Maybe a
Just (Int -> Maybe Int) -> Int -> Maybe Int
forall a b. (a -> b) -> a -> b
$ a -> Int
forall a. Enum a => a -> Int
fromEnum a
end
clipItems :: Int -> Int -> ClipRange a -> ClipRange a
clipItems Int
clipBegin Int
clipEnd (ClipRange a
oldBegin a
oldEnd) =
a -> a -> ClipRange a
forall a. a -> a -> ClipRange a
ClipRange
(Int -> a
forall a. Enum a => Int -> a
toEnum (Int -> a) -> Int -> a
forall a b. (a -> b) -> a -> b
$ Int -> Int -> Int
forall a. Ord a => a -> a -> a
max Int
clipBegin (Int -> Int) -> Int -> Int
forall a b. (a -> b) -> a -> b
$ a -> Int
forall a. Enum a => a -> Int
fromEnum a
oldBegin)
(Int -> a
forall a. Enum a => Int -> a
toEnum (Int -> a) -> Int -> a
forall a b. (a -> b) -> a -> b
$ Int -> Int -> Int
forall a. Ord a => a -> a -> a
min Int
clipEnd (Int -> Int) -> Int -> Int
forall a b. (a -> b) -> a -> b
$ a -> Int
forall a. Enum a => a -> Int
fromEnum a
oldEnd)
stepItems :: forall (m :: * -> *). Monad m => (a -> m ()) -> ClipRange a -> m ()
stepItems a -> m ()
action (ClipRange a
start a
end) =
(a -> m ()) -> [a] -> m ()
forall (t :: * -> *) (m :: * -> *) a b.
(Foldable t, Monad m) =>
(a -> m b) -> t a -> m ()
mapM_ a -> m ()
action [a
start .. a
end a -> a -> a
forall a. Num a => a -> a -> a
- a
1]