mirror of
https://github.com/Drezil/dear-imgui.hs.git
synced 2025-02-16 17:02:42 +00:00
Updated all widgets
This commit is contained in:
parent
b2e02f123b
commit
9fa65a8462
375
src/DearImGui.hs
375
src/DearImGui.hs
@ -80,33 +80,48 @@ module DearImGui
|
|||||||
|
|
||||||
-- ** Main
|
-- ** Main
|
||||||
, button
|
, button
|
||||||
|
, Button(..)
|
||||||
, smallButton
|
, smallButton
|
||||||
|
, SmallButton(..)
|
||||||
, arrowButton
|
, arrowButton
|
||||||
, checkbox
|
, checkbox
|
||||||
, Checkbox(..)
|
, Checkbox(..)
|
||||||
, progressBar
|
, progressBar
|
||||||
|
, ProgressBar(..)
|
||||||
, bullet
|
, bullet
|
||||||
|
|
||||||
-- ** Combo Box
|
-- ** Combo Box
|
||||||
, beginCombo
|
, beginCombo
|
||||||
|
, BeginCombo(..)
|
||||||
, endCombo
|
, endCombo
|
||||||
, combo
|
, combo
|
||||||
|
, Combo(..)
|
||||||
|
|
||||||
-- ** Drag Sliders
|
-- ** Drag Sliders
|
||||||
, dragFloat
|
, dragFloat
|
||||||
|
, DragFloat(..)
|
||||||
, dragFloat2
|
, dragFloat2
|
||||||
|
, DragFloat2(..)
|
||||||
, dragFloat3
|
, dragFloat3
|
||||||
|
, DragFloat3(..)
|
||||||
, dragFloat4
|
, dragFloat4
|
||||||
|
, DragFloat4(..)
|
||||||
|
|
||||||
-- ** Slider
|
-- ** Slider
|
||||||
, sliderFloat
|
, sliderFloat
|
||||||
|
, SliderFloat(..)
|
||||||
, sliderFloat2
|
, sliderFloat2
|
||||||
|
, SliderFloat2(..)
|
||||||
, sliderFloat3
|
, sliderFloat3
|
||||||
|
, SliderFloat3(..)
|
||||||
, sliderFloat4
|
, sliderFloat4
|
||||||
|
, SliderFloat4(..)
|
||||||
|
|
||||||
-- * Color Editor/Picker
|
-- * Color Editor/Picker
|
||||||
, colorPicker3
|
, colorPicker3
|
||||||
|
, ColorPicker3(..)
|
||||||
, colorButton
|
, colorButton
|
||||||
|
, ColorButton(..)
|
||||||
|
|
||||||
-- * Trees
|
-- * Trees
|
||||||
, treeNode
|
, treeNode
|
||||||
@ -118,9 +133,11 @@ module DearImGui
|
|||||||
|
|
||||||
-- ** List Boxes
|
-- ** List Boxes
|
||||||
, listBox
|
, listBox
|
||||||
|
, ListBox(..)
|
||||||
|
|
||||||
-- * Data Plotting
|
-- * Data Plotting
|
||||||
, plotHistogram
|
, plotHistogram
|
||||||
|
, PlotHistogram(..)
|
||||||
|
|
||||||
-- ** Menus
|
-- ** Menus
|
||||||
, beginMenuBar
|
, beginMenuBar
|
||||||
@ -133,10 +150,12 @@ module DearImGui
|
|||||||
|
|
||||||
-- ** Tabs, tab bar
|
-- ** Tabs, tab bar
|
||||||
, beginTabBar
|
, beginTabBar
|
||||||
|
, BeginTabBar(..)
|
||||||
, endTabBar
|
, endTabBar
|
||||||
, beginTabItem
|
, beginTabItem
|
||||||
, endTabItem
|
, endTabItem
|
||||||
, tabItemButton
|
, tabItemButton
|
||||||
|
, TabItemButton(..)
|
||||||
, setTabItemClosed
|
, setTabItemClosed
|
||||||
|
|
||||||
-- * Tooltips
|
-- * Tooltips
|
||||||
@ -164,10 +183,8 @@ module DearImGui
|
|||||||
|
|
||||||
-- base
|
-- base
|
||||||
import Data.Bool
|
import Data.Bool
|
||||||
import Data.Coerce
|
import Data.Coerce
|
||||||
( coerce )
|
( coerce )
|
||||||
import Data.Int
|
|
||||||
( Int32 )
|
|
||||||
import Foreign
|
import Foreign
|
||||||
import Foreign.C
|
import Foreign.C
|
||||||
|
|
||||||
@ -388,33 +405,53 @@ text t = liftIO do
|
|||||||
[C.exp| void { Text("%s", $(char* textPtr)) } |]
|
[C.exp| void { Text("%s", $(char* textPtr)) } |]
|
||||||
|
|
||||||
|
|
||||||
|
data Button = Button
|
||||||
|
{ label :: String
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
-- | A button. Returns 'True' when clicked.
|
-- | A button. Returns 'True' when clicked.
|
||||||
--
|
--
|
||||||
-- Wraps @ImGui::Button()@.
|
-- Wraps @ImGui::Button()@.
|
||||||
button :: MonadIO m => String -> m Bool
|
button :: MonadIO m => Button -> m Bool
|
||||||
button label = liftIO do
|
button Button{ label } = liftIO $
|
||||||
withCString label \labelPtr ->
|
withCString label \labelPtr ->
|
||||||
(0 /=) <$> [C.exp| bool { Button($(char* labelPtr)) } |]
|
(0 /=) <$> [C.exp| bool { Button($(char* labelPtr)) } |]
|
||||||
|
|
||||||
|
|
||||||
|
data SmallButton = SmallButton
|
||||||
|
{ label :: String
|
||||||
|
}
|
||||||
|
|
||||||
-- | Button with @FramePadding=(0,0)@ to easily embed within text.
|
-- | Button with @FramePadding=(0,0)@ to easily embed within text.
|
||||||
--
|
--
|
||||||
-- Wraps @ImGui::SmallButton()@.
|
-- Wraps @ImGui::SmallButton()@.
|
||||||
smallButton :: MonadIO m => String -> m Bool
|
smallButton :: MonadIO m => SmallButton -> m Bool
|
||||||
smallButton label = liftIO do
|
smallButton SmallButton{ label } = liftIO do
|
||||||
withCString label \labelPtr ->
|
withCString label \labelPtr ->
|
||||||
(0 /=) <$> [C.exp| bool { SmallButton($(char* labelPtr)) } |]
|
(0 /=) <$> [C.exp| bool { SmallButton($(char* labelPtr)) } |]
|
||||||
|
|
||||||
|
|
||||||
|
data ArrowButton = ArrowButton
|
||||||
|
{ strId :: String
|
||||||
|
, dir :: ImGuiDir
|
||||||
|
}
|
||||||
|
|
||||||
-- | Square button with an arrow shape.
|
-- | Square button with an arrow shape.
|
||||||
--
|
--
|
||||||
-- Wraps @ImGui::ArrowButton()@.
|
-- Wraps @ImGui::ArrowButton()@.
|
||||||
arrowButton :: MonadIO m => String -> ImGuiDir -> m Bool
|
arrowButton :: MonadIO m => ArrowButton -> m Bool
|
||||||
arrowButton strId dir = liftIO do
|
arrowButton ArrowButton{ strId, dir } = liftIO do
|
||||||
withCString strId \strIdPtr ->
|
withCString strId \strIdPtr ->
|
||||||
(0 /=) <$> [C.exp| bool { ArrowButton($(char* strIdPtr), $(ImGuiDir dir)) } |]
|
(0 /=) <$> [C.exp| bool { ArrowButton($(char* strIdPtr), $(ImGuiDir dir)) } |]
|
||||||
|
|
||||||
|
|
||||||
|
data Checkbox = Checkbox
|
||||||
|
{ label :: String
|
||||||
|
, checked :: StateVar Bool
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
-- | Wraps @ImGui::Checkbox()@.
|
-- | Wraps @ImGui::Checkbox()@.
|
||||||
checkbox :: MonadIO m => Checkbox -> m Bool
|
checkbox :: MonadIO m => Checkbox -> m Bool
|
||||||
checkbox Checkbox{ label, checked } = liftIO $
|
checkbox Checkbox{ label, checked } = liftIO $
|
||||||
@ -423,14 +460,14 @@ checkbox Checkbox{ label, checked } = liftIO $
|
|||||||
cBoolToBool <$> [C.exp| bool { Checkbox($(char* labelPtr), $(bool* boolPtr)) } |]
|
cBoolToBool <$> [C.exp| bool { Checkbox($(char* labelPtr), $(bool* boolPtr)) } |]
|
||||||
|
|
||||||
|
|
||||||
data Checkbox = Checkbox
|
data ProgressBar = ProgressBar
|
||||||
{ label :: String
|
{ progress :: Float
|
||||||
, checked :: StateVar Bool
|
, overlay :: Maybe String
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
progressBar :: MonadIO m => Float -> Maybe String -> m ()
|
progressBar :: MonadIO m => ProgressBar -> m ()
|
||||||
progressBar progress overlay = liftIO do
|
progressBar ProgressBar{ progress, overlay } = liftIO do
|
||||||
withCStringOrNull overlay \overlayPtr ->
|
withCStringOrNull overlay \overlayPtr ->
|
||||||
[C.exp| void { ProgressBar($(float c'progress), ImVec2(-FLT_MIN, 0), $(char* overlayPtr)) } |]
|
[C.exp| void { ProgressBar($(float c'progress), ImVec2(-FLT_MIN, 0), $(char* overlayPtr)) } |]
|
||||||
where
|
where
|
||||||
@ -445,14 +482,20 @@ bullet = liftIO do
|
|||||||
[C.exp| void { Bullet() } |]
|
[C.exp| void { Bullet() } |]
|
||||||
|
|
||||||
|
|
||||||
|
data BeginCombo = BeginCombo
|
||||||
|
{ label :: String
|
||||||
|
, previewValue :: String
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
-- | Begin creating a combo box with a given label and preview value.
|
-- | Begin creating a combo box with a given label and preview value.
|
||||||
--
|
--
|
||||||
-- Returns 'True' if the combo box is open. In this state, you should populate
|
-- Returns 'True' if the combo box is open. In this state, you should populate
|
||||||
-- the contents of the combo box - for example, by calling 'selectable'.
|
-- the contents of the combo box - for example, by calling 'selectable'.
|
||||||
--
|
--
|
||||||
-- Wraps @ImGui::BeginCombo()@.
|
-- Wraps @ImGui::BeginCombo()@.
|
||||||
beginCombo :: MonadIO m => String -> String -> m Bool
|
beginCombo :: MonadIO m => BeginCombo -> m Bool
|
||||||
beginCombo label previewValue = liftIO $
|
beginCombo BeginCombo{ label, previewValue } = liftIO $
|
||||||
withCString label \labelPtr ->
|
withCString label \labelPtr ->
|
||||||
withCString previewValue \previewValuePtr ->
|
withCString previewValue \previewValuePtr ->
|
||||||
(0 /=) <$> [C.exp| bool { BeginCombo($(char* labelPtr), $(char* previewValuePtr)) } |]
|
(0 /=) <$> [C.exp| bool { BeginCombo($(char* labelPtr), $(char* previewValuePtr)) } |]
|
||||||
@ -466,9 +509,15 @@ endCombo = liftIO do
|
|||||||
[C.exp| void { EndCombo() } |]
|
[C.exp| void { EndCombo() } |]
|
||||||
|
|
||||||
|
|
||||||
|
data Combo = Combo
|
||||||
|
{ label :: String
|
||||||
|
, selectedIndex :: StateVar Int
|
||||||
|
, items :: [String]
|
||||||
|
}
|
||||||
|
|
||||||
-- | Wraps @ImGui::Combo()@.
|
-- | Wraps @ImGui::Combo()@.
|
||||||
combo :: (MonadIO m, HasGetter ref Int, HasSetter ref Int) => String -> ref -> [String] -> m Bool
|
combo :: (MonadIO m) => Combo -> m Bool
|
||||||
combo label selectedIndex items = liftIO $ Managed.with m return
|
combo Combo{ label, selectedIndex, items } = liftIO $ Managed.with m return
|
||||||
where
|
where
|
||||||
m = do
|
m = do
|
||||||
i <- get selectedIndex
|
i <- get selectedIndex
|
||||||
@ -487,16 +536,24 @@ combo label selectedIndex items = liftIO $ Managed.with m return
|
|||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
|
data DragFloat = DragFloat
|
||||||
|
{ desc :: String
|
||||||
|
, value :: StateVar Float
|
||||||
|
, speed :: Float
|
||||||
|
, minValue :: Float
|
||||||
|
, maxValue :: Float
|
||||||
|
}
|
||||||
|
|
||||||
-- | Wraps @ImGui::DragFloat()@
|
-- | Wraps @ImGui::DragFloat()@
|
||||||
dragFloat :: (MonadIO m, HasSetter ref Float, HasGetter ref Float) => String -> ref -> Float -> Float -> Float -> m Bool
|
dragFloat :: MonadIO m => DragFloat -> m Bool
|
||||||
dragFloat desc ref speed minValue maxValue = liftIO do
|
dragFloat DragFloat{ desc, value, speed, minValue, maxValue } = liftIO do
|
||||||
currentValue <- get ref
|
currentValue <- get value
|
||||||
with (realToFrac currentValue) \floatPtr -> do
|
with (realToFrac currentValue) \floatPtr -> do
|
||||||
changed <- withCString desc \descPtr ->
|
changed <- withCString desc \descPtr ->
|
||||||
(0 /=) <$> [C.exp| bool { DragFloat( $(char* descPtr), $(float *floatPtr), $(float speed'), $(float min'), $(float max')) } |]
|
(0 /=) <$> [C.exp| bool { DragFloat( $(char* descPtr), $(float *floatPtr), $(float speed'), $(float min'), $(float max')) } |]
|
||||||
|
|
||||||
newValue <- peek floatPtr
|
newValue <- peek floatPtr
|
||||||
ref $=! realToFrac newValue
|
value $=! realToFrac newValue
|
||||||
|
|
||||||
return changed
|
return changed
|
||||||
where
|
where
|
||||||
@ -506,16 +563,24 @@ dragFloat desc ref speed minValue maxValue = liftIO do
|
|||||||
speed' = realToFrac speed
|
speed' = realToFrac speed
|
||||||
|
|
||||||
|
|
||||||
|
data DragFloat2 = DragFloat2
|
||||||
|
{ desc :: String
|
||||||
|
, value :: StateVar (Float, Float)
|
||||||
|
, speed :: Float
|
||||||
|
, minValue :: Float
|
||||||
|
, maxValue :: Float
|
||||||
|
}
|
||||||
|
|
||||||
-- | Wraps @ImGui::DragFloat2()@
|
-- | Wraps @ImGui::DragFloat2()@
|
||||||
dragFloat2 :: (MonadIO m, HasSetter ref (Float, Float), HasGetter ref (Float, Float)) => String -> ref -> Float -> Float -> Float -> m Bool
|
dragFloat2 :: MonadIO m => DragFloat2 -> m Bool
|
||||||
dragFloat2 desc ref speed minValue maxValue = liftIO do
|
dragFloat2 DragFloat2{ desc, value, speed, minValue, maxValue } = liftIO do
|
||||||
(x, y) <- get ref
|
(x, y) <- get value
|
||||||
withArray [ realToFrac x, realToFrac y ] \floatPtr -> do
|
withArray [ realToFrac x, realToFrac y ] \floatPtr -> do
|
||||||
changed <- withCString desc \descPtr ->
|
changed <- withCString desc \descPtr ->
|
||||||
(0 /=) <$> [C.exp| bool { DragFloat2( $(char* descPtr), $(float *floatPtr), $(float speed'), $(float min'), $(float max')) } |]
|
(0 /=) <$> [C.exp| bool { DragFloat2( $(char* descPtr), $(float *floatPtr), $(float speed'), $(float min'), $(float max')) } |]
|
||||||
|
|
||||||
[x', y'] <- peekArray 2 floatPtr
|
[x', y'] <- peekArray 2 floatPtr
|
||||||
ref $=! (realToFrac x', realToFrac y')
|
value $=! (realToFrac x', realToFrac y')
|
||||||
|
|
||||||
return changed
|
return changed
|
||||||
where
|
where
|
||||||
@ -525,16 +590,25 @@ dragFloat2 desc ref speed minValue maxValue = liftIO do
|
|||||||
speed' = realToFrac speed
|
speed' = realToFrac speed
|
||||||
|
|
||||||
|
|
||||||
|
data DragFloat3 = DragFloat3
|
||||||
|
{ desc :: String
|
||||||
|
, value :: StateVar (Float, Float, Float)
|
||||||
|
, speed :: Float
|
||||||
|
, minValue :: Float
|
||||||
|
, maxValue :: Float
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
-- | Wraps @ImGui::DragFloat3()@
|
-- | Wraps @ImGui::DragFloat3()@
|
||||||
dragFloat3 :: (MonadIO m, HasSetter ref (Float, Float, Float), HasGetter ref (Float, Float, Float)) => String -> ref -> Float -> Float -> Float -> m Bool
|
dragFloat3 :: MonadIO m => DragFloat3 -> m Bool
|
||||||
dragFloat3 desc ref speed minValue maxValue = liftIO do
|
dragFloat3 DragFloat3{ desc, value, speed, minValue, maxValue } = liftIO do
|
||||||
(x, y, z) <- get ref
|
(x, y, z) <- get value
|
||||||
withArray [ realToFrac x, realToFrac y, realToFrac z ] \floatPtr -> do
|
withArray [ realToFrac x, realToFrac y, realToFrac z ] \floatPtr -> do
|
||||||
changed <- withCString desc \descPtr ->
|
changed <- withCString desc \descPtr ->
|
||||||
(0 /=) <$> [C.exp| bool { DragFloat3( $(char* descPtr), $(float *floatPtr), $(float speed'), $(float min'), $(float max')) } |]
|
(0 /=) <$> [C.exp| bool { DragFloat3( $(char* descPtr), $(float *floatPtr), $(float speed'), $(float min'), $(float max')) } |]
|
||||||
|
|
||||||
[x', y', z'] <- peekArray 3 floatPtr
|
[x', y', z'] <- peekArray 3 floatPtr
|
||||||
ref $=! (realToFrac x', realToFrac y', realToFrac z')
|
value $=! (realToFrac x', realToFrac y', realToFrac z')
|
||||||
|
|
||||||
return changed
|
return changed
|
||||||
where
|
where
|
||||||
@ -544,16 +618,25 @@ dragFloat3 desc ref speed minValue maxValue = liftIO do
|
|||||||
speed' = realToFrac speed
|
speed' = realToFrac speed
|
||||||
|
|
||||||
|
|
||||||
|
data DragFloat4 = DragFloat4
|
||||||
|
{ desc :: String
|
||||||
|
, value :: StateVar (Float, Float, Float, Float)
|
||||||
|
, speed :: Float
|
||||||
|
, minValue :: Float
|
||||||
|
, maxValue :: Float
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
-- | Wraps @ImGui::DragFloat4()@
|
-- | Wraps @ImGui::DragFloat4()@
|
||||||
dragFloat4 :: (MonadIO m, HasSetter ref (Float, Float, Float, Float), HasGetter ref (Float, Float, Float, Float)) => String -> ref -> Float -> Float -> Float -> m Bool
|
dragFloat4 :: MonadIO m => DragFloat4 -> m Bool
|
||||||
dragFloat4 desc ref speed minValue maxValue = liftIO do
|
dragFloat4 DragFloat4{ desc, value, speed, minValue, maxValue } = liftIO do
|
||||||
(x, y, z, u) <- get ref
|
(x, y, z, u) <- get value
|
||||||
withArray [ realToFrac x, realToFrac y, realToFrac z, realToFrac u ] \floatPtr -> do
|
withArray [ realToFrac x, realToFrac y, realToFrac z, realToFrac u ] \floatPtr -> do
|
||||||
changed <- withCString desc \descPtr ->
|
changed <- withCString desc \descPtr ->
|
||||||
(0 /=) <$> [C.exp| bool { DragFloat4( $(char* descPtr), $(float *floatPtr), $(float speed'), $(float min'), $(float max')) } |]
|
(0 /=) <$> [C.exp| bool { DragFloat4( $(char* descPtr), $(float *floatPtr), $(float speed'), $(float min'), $(float max')) } |]
|
||||||
|
|
||||||
[x', y', z', u'] <- peekArray 4 floatPtr
|
[x', y', z', u'] <- peekArray 4 floatPtr
|
||||||
ref $=! (realToFrac x', realToFrac y', realToFrac z', realToFrac u')
|
value $=! (realToFrac x', realToFrac y', realToFrac z', realToFrac u')
|
||||||
|
|
||||||
return changed
|
return changed
|
||||||
where
|
where
|
||||||
@ -563,16 +646,24 @@ dragFloat4 desc ref speed minValue maxValue = liftIO do
|
|||||||
speed' = realToFrac speed
|
speed' = realToFrac speed
|
||||||
|
|
||||||
|
|
||||||
|
data SliderFloat = SliderFloat
|
||||||
|
{ desc :: String
|
||||||
|
, value :: StateVar Float
|
||||||
|
, minValue :: Float
|
||||||
|
, maxValue :: Float
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
-- | Wraps @ImGui::SliderFloat()@
|
-- | Wraps @ImGui::SliderFloat()@
|
||||||
sliderFloat :: (MonadIO m, HasSetter ref Float, HasGetter ref Float) => String -> ref -> Float -> Float -> m Bool
|
sliderFloat :: MonadIO m => SliderFloat -> m Bool
|
||||||
sliderFloat desc ref minValue maxValue = liftIO do
|
sliderFloat SliderFloat{ desc, value, minValue, maxValue } = liftIO do
|
||||||
currentValue <- get ref
|
currentValue <- get value
|
||||||
with (realToFrac currentValue) \floatPtr -> do
|
with (realToFrac currentValue) \floatPtr -> do
|
||||||
changed <- withCString desc \descPtr ->
|
changed <- withCString desc \descPtr ->
|
||||||
(0 /=) <$> [C.exp| bool { SliderFloat( $(char* descPtr), $(float *floatPtr), $(float min'), $(float max')) } |]
|
(0 /=) <$> [C.exp| bool { SliderFloat( $(char* descPtr), $(float *floatPtr), $(float min'), $(float max')) } |]
|
||||||
|
|
||||||
newValue <- peek floatPtr
|
newValue <- peek floatPtr
|
||||||
ref $=! realToFrac newValue
|
value $=! realToFrac newValue
|
||||||
|
|
||||||
return changed
|
return changed
|
||||||
where
|
where
|
||||||
@ -581,16 +672,24 @@ sliderFloat desc ref minValue maxValue = liftIO do
|
|||||||
max' = realToFrac maxValue
|
max' = realToFrac maxValue
|
||||||
|
|
||||||
|
|
||||||
|
data SliderFloat2 = SliderFloat2
|
||||||
|
{ desc :: String
|
||||||
|
, value :: StateVar (Float, Float)
|
||||||
|
, minValue :: Float
|
||||||
|
, maxValue :: Float
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
-- | Wraps @ImGui::SliderFloat2()@
|
-- | Wraps @ImGui::SliderFloat2()@
|
||||||
sliderFloat2 :: (MonadIO m, HasSetter ref (Float, Float), HasGetter ref (Float, Float)) => String -> ref -> Float -> Float -> m Bool
|
sliderFloat2 :: MonadIO m => SliderFloat2 -> m Bool
|
||||||
sliderFloat2 desc ref minValue maxValue = liftIO do
|
sliderFloat2 SliderFloat2{ desc, value, minValue, maxValue } = liftIO do
|
||||||
(x, y) <- get ref
|
(x, y) <- get value
|
||||||
withArray [ realToFrac x, realToFrac y ] \floatPtr -> do
|
withArray [ realToFrac x, realToFrac y ] \floatPtr -> do
|
||||||
changed <- withCString desc \descPtr ->
|
changed <- withCString desc \descPtr ->
|
||||||
(0 /=) <$> [C.exp| bool { SliderFloat2( $(char* descPtr), $(float *floatPtr), $(float min'), $(float max')) } |]
|
(0 /=) <$> [C.exp| bool { SliderFloat2( $(char* descPtr), $(float *floatPtr), $(float min'), $(float max')) } |]
|
||||||
|
|
||||||
[x', y'] <- peekArray 2 floatPtr
|
[x', y'] <- peekArray 2 floatPtr
|
||||||
ref $=! (realToFrac x', realToFrac y')
|
value $=! (realToFrac x', realToFrac y')
|
||||||
|
|
||||||
return changed
|
return changed
|
||||||
where
|
where
|
||||||
@ -599,16 +698,24 @@ sliderFloat2 desc ref minValue maxValue = liftIO do
|
|||||||
max' = realToFrac maxValue
|
max' = realToFrac maxValue
|
||||||
|
|
||||||
|
|
||||||
|
data SliderFloat3 = SliderFloat3
|
||||||
|
{ desc :: String
|
||||||
|
, value :: StateVar (Float, Float, Float)
|
||||||
|
, minValue :: Float
|
||||||
|
, maxValue :: Float
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
-- | Wraps @ImGui::SliderFloat3()@
|
-- | Wraps @ImGui::SliderFloat3()@
|
||||||
sliderFloat3 :: (MonadIO m, HasSetter ref (Float, Float, Float), HasGetter ref (Float, Float, Float)) => String -> ref -> Float -> Float -> m Bool
|
sliderFloat3 :: MonadIO m => SliderFloat3 -> m Bool
|
||||||
sliderFloat3 desc ref minValue maxValue = liftIO do
|
sliderFloat3 SliderFloat3{ desc, value, minValue, maxValue } = liftIO do
|
||||||
(x, y, z) <- get ref
|
(x, y, z) <- get value
|
||||||
withArray [ realToFrac x, realToFrac y, realToFrac z ] \floatPtr -> do
|
withArray [ realToFrac x, realToFrac y, realToFrac z ] \floatPtr -> do
|
||||||
changed <- withCString desc \descPtr ->
|
changed <- withCString desc \descPtr ->
|
||||||
(0 /=) <$> [C.exp| bool { SliderFloat3( $(char* descPtr), $(float *floatPtr), $(float min'), $(float max')) } |]
|
(0 /=) <$> [C.exp| bool { SliderFloat3( $(char* descPtr), $(float *floatPtr), $(float min'), $(float max')) } |]
|
||||||
|
|
||||||
[x', y', z'] <- peekArray 3 floatPtr
|
[x', y', z'] <- peekArray 3 floatPtr
|
||||||
ref $=! (realToFrac x', realToFrac y', realToFrac z')
|
value $=! (realToFrac x', realToFrac y', realToFrac z')
|
||||||
|
|
||||||
return changed
|
return changed
|
||||||
where
|
where
|
||||||
@ -617,16 +724,24 @@ sliderFloat3 desc ref minValue maxValue = liftIO do
|
|||||||
max' = realToFrac maxValue
|
max' = realToFrac maxValue
|
||||||
|
|
||||||
|
|
||||||
|
data SliderFloat4 = SliderFloat4
|
||||||
|
{ desc :: String
|
||||||
|
, value :: StateVar (Float, Float, Float, Float)
|
||||||
|
, minValue :: Float
|
||||||
|
, maxValue :: Float
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
-- | Wraps @ImGui::SliderFloat4()@
|
-- | Wraps @ImGui::SliderFloat4()@
|
||||||
sliderFloat4 :: (MonadIO m, HasSetter ref (Float, Float, Float, Float), HasGetter ref (Float, Float, Float, Float)) => String -> ref -> Float -> Float -> m Bool
|
sliderFloat4 :: MonadIO m => SliderFloat4 -> m Bool
|
||||||
sliderFloat4 desc ref minValue maxValue = liftIO do
|
sliderFloat4 SliderFloat4{ desc, value, minValue, maxValue } = liftIO do
|
||||||
(x, y, z, u) <- get ref
|
(x, y, z, u) <- get value
|
||||||
withArray [ realToFrac x, realToFrac y, realToFrac z, realToFrac u ] \floatPtr -> do
|
withArray [ realToFrac x, realToFrac y, realToFrac z, realToFrac u ] \floatPtr -> do
|
||||||
changed <- withCString desc \descPtr ->
|
changed <- withCString desc \descPtr ->
|
||||||
(0 /=) <$> [C.exp| bool { SliderFloat4( $(char* descPtr), $(float *floatPtr), $(float min'), $(float max')) } |]
|
(0 /=) <$> [C.exp| bool { SliderFloat4( $(char* descPtr), $(float *floatPtr), $(float min'), $(float max')) } |]
|
||||||
|
|
||||||
[x', y', z', u'] <- peekArray 4 floatPtr
|
[x', y', z', u'] <- peekArray 4 floatPtr
|
||||||
ref $=! (realToFrac x', realToFrac y', realToFrac z', realToFrac u')
|
value $=! (realToFrac x', realToFrac y', realToFrac z', realToFrac u')
|
||||||
|
|
||||||
return changed
|
return changed
|
||||||
where
|
where
|
||||||
@ -635,35 +750,48 @@ sliderFloat4 desc ref minValue maxValue = liftIO do
|
|||||||
max' = realToFrac maxValue
|
max' = realToFrac maxValue
|
||||||
|
|
||||||
|
|
||||||
-- | Wraps @ImGui::ColorPicker3()@.
|
data ColorPicker3 = ColorPicker3
|
||||||
colorPicker3 :: (MonadIO m, HasSetter ref ImVec3, HasGetter ref ImVec3) => String -> ref -> m Bool
|
{ desc :: String
|
||||||
colorPicker3 desc ref = liftIO do
|
, value :: StateVar ImVec3
|
||||||
ImVec3{x, y, z} <- get ref
|
}
|
||||||
withArray (realToFrac <$> [x, y, z]) \refPtr -> do
|
|
||||||
changed <- withCString desc \descPtr ->
|
|
||||||
(0 /= ) <$> [C.exp| bool { ColorPicker3( $(char* descPtr), $(float *refPtr) ) } |]
|
|
||||||
|
|
||||||
[x', y', z'] <- peekArray 3 refPtr
|
|
||||||
ref $=! ImVec3 (realToFrac x') (realToFrac y') (realToFrac z')
|
-- | Wraps @ImGui::ColorPicker3()@.
|
||||||
|
colorPicker3 :: MonadIO m => ColorPicker3 -> m Bool
|
||||||
|
colorPicker3 ColorPicker3{ desc, value } = liftIO do
|
||||||
|
ImVec3{x, y, z} <- get value
|
||||||
|
withArray (realToFrac <$> [x, y, z]) \valuePtr -> do
|
||||||
|
changed <- withCString desc \descPtr ->
|
||||||
|
(0 /= ) <$> [C.exp| bool { ColorPicker3( $(char* descPtr), $(float *valuePtr) ) } |]
|
||||||
|
|
||||||
|
[x', y', z'] <- peekArray 3 valuePtr
|
||||||
|
value $=! ImVec3 (realToFrac x') (realToFrac y') (realToFrac z')
|
||||||
|
|
||||||
return changed
|
return changed
|
||||||
|
|
||||||
|
|
||||||
|
data ColorButton = ColorButton
|
||||||
|
{ desc :: String
|
||||||
|
, value :: StateVar ImVec4
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
-- | Display a color square/button, hover for details, return true when pressed.
|
-- | Display a color square/button, hover for details, return true when pressed.
|
||||||
--
|
--
|
||||||
-- Wraps @ImGui::ColorButton()@.
|
-- Wraps @ImGui::ColorButton()@.
|
||||||
colorButton :: (MonadIO m, HasSetter ref ImVec4, HasGetter ref ImVec4) => String -> ref -> m Bool
|
colorButton :: MonadIO m => ColorButton -> m Bool
|
||||||
colorButton desc ref = liftIO do
|
colorButton ColorButton{ desc, value } = liftIO do
|
||||||
currentValue <- get ref
|
currentValue <- get value
|
||||||
with currentValue \refPtr -> do
|
with currentValue \valuePtr -> do
|
||||||
changed <- withCString desc \descPtr ->
|
changed <- withCString desc \descPtr ->
|
||||||
(0 /=) <$> [C.exp| bool { ColorButton( $(char* descPtr), *$(ImVec4 *refPtr) ) } |]
|
(0 /=) <$> [C.exp| bool { ColorButton( $(char* descPtr), *$(ImVec4 *valuePtr) ) } |]
|
||||||
|
|
||||||
newValue <- peek refPtr
|
newValue <- peek valuePtr
|
||||||
ref $=! newValue
|
value $=! newValue
|
||||||
|
|
||||||
return changed
|
return changed
|
||||||
|
|
||||||
|
|
||||||
-- | Wraps @ImGui::TreeNode()@.
|
-- | Wraps @ImGui::TreeNode()@.
|
||||||
treeNode :: MonadIO m => String -> m Bool
|
treeNode :: MonadIO m => String -> m Bool
|
||||||
treeNode label = liftIO do
|
treeNode label = liftIO do
|
||||||
@ -690,8 +818,16 @@ selectable label = liftIO do
|
|||||||
withCString label \labelPtr ->
|
withCString label \labelPtr ->
|
||||||
(0 /=) <$> [C.exp| bool { Selectable($(char* labelPtr)) } |]
|
(0 /=) <$> [C.exp| bool { Selectable($(char* labelPtr)) } |]
|
||||||
|
|
||||||
listBox :: (MonadIO m, HasGetter ref Int, HasSetter ref Int) => String -> ref -> [String] -> m Bool
|
|
||||||
listBox label selectedIndex items = liftIO $ Managed.with m return
|
data ListBox = ListBox
|
||||||
|
{ label :: String
|
||||||
|
, selectedIndex :: StateVar Int
|
||||||
|
, items :: [String]
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
listBox :: MonadIO m => ListBox -> m Bool
|
||||||
|
listBox ListBox{ label, selectedIndex, items } = liftIO $ Managed.with m return
|
||||||
where
|
where
|
||||||
m = do
|
m = do
|
||||||
i <- get selectedIndex
|
i <- get selectedIndex
|
||||||
@ -709,10 +845,15 @@ listBox label selectedIndex items = liftIO $ Managed.with m return
|
|||||||
selectedIndex $=! fromIntegral i'
|
selectedIndex $=! fromIntegral i'
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
data PlotHistogram = PlotHistogram
|
||||||
|
{ label :: String
|
||||||
|
, values :: [CFloat]
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
-- | Wraps @ImGui::PlotHistogram()@.
|
-- | Wraps @ImGui::PlotHistogram()@.
|
||||||
plotHistogram :: MonadIO m => String -> [CFloat] -> m ()
|
plotHistogram :: MonadIO m => PlotHistogram -> m ()
|
||||||
plotHistogram label values = liftIO $
|
plotHistogram PlotHistogram{ label, values } = liftIO $
|
||||||
withArrayLen values \len valuesPtr ->
|
withArrayLen values \len valuesPtr ->
|
||||||
withCString label \labelPtr -> do
|
withCString label \labelPtr -> do
|
||||||
let c'len = fromIntegral len
|
let c'len = fromIntegral len
|
||||||
@ -778,14 +919,22 @@ menuItem label = liftIO do
|
|||||||
withCString label \labelPtr ->
|
withCString label \labelPtr ->
|
||||||
(0 /=) <$> [C.exp| bool { MenuItem($(char* labelPtr)) } |]
|
(0 /=) <$> [C.exp| bool { MenuItem($(char* labelPtr)) } |]
|
||||||
|
|
||||||
|
|
||||||
|
data BeginTabBar = BeginTabBar
|
||||||
|
{ tabBarID :: String
|
||||||
|
, flags :: ImGuiTabBarFlags
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
-- | Create a @TabBar@ and start appending to it.
|
-- | Create a @TabBar@ and start appending to it.
|
||||||
--
|
--
|
||||||
-- Wraps @ImGui::BeginTabBar@.
|
-- Wraps @ImGui::BeginTabBar@.
|
||||||
beginTabBar :: MonadIO m => String -> ImGuiTabBarFlags -> m Bool
|
beginTabBar :: MonadIO m => BeginTabBar -> m Bool
|
||||||
beginTabBar tabBarID flags = liftIO do
|
beginTabBar BeginTabBar{ tabBarID, flags } = liftIO do
|
||||||
withCString tabBarID \ptr ->
|
withCString tabBarID \ptr ->
|
||||||
(0 /=) <$> [C.exp| bool { BeginTabBar($(char* ptr), $(ImGuiTabBarFlags flags) ) } |]
|
(0 /=) <$> [C.exp| bool { BeginTabBar($(char* ptr), $(ImGuiTabBarFlags flags) ) } |]
|
||||||
|
|
||||||
|
|
||||||
-- | Finish appending elements to a tab bar. Only call if 'beginTabBar' returns @True@.
|
-- | Finish appending elements to a tab bar. Only call if 'beginTabBar' returns @True@.
|
||||||
--
|
--
|
||||||
-- Wraps @ImGui::EndTabBar@.
|
-- Wraps @ImGui::EndTabBar@.
|
||||||
@ -793,19 +942,28 @@ endTabBar :: MonadIO m => m ()
|
|||||||
endTabBar = liftIO do
|
endTabBar = liftIO do
|
||||||
[C.exp| void { EndTabBar(); } |]
|
[C.exp| void { EndTabBar(); } |]
|
||||||
|
|
||||||
|
|
||||||
|
data BeginTabItem = BeginTabItem
|
||||||
|
{ tabName :: String
|
||||||
|
, isSelected :: StateVar Bool
|
||||||
|
, flags :: ImGuiTabBarFlags
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
-- | Create a new tab. Returns @True@ if the tab is selected.
|
-- | Create a new tab. Returns @True@ if the tab is selected.
|
||||||
--
|
--
|
||||||
-- Wraps @ImGui::BeginTabItem@.
|
-- Wraps @ImGui::BeginTabItem@.
|
||||||
beginTabItem :: ( MonadIO m, HasGetter ref Bool, HasSetter ref Bool ) => String -> ref -> ImGuiTabBarFlags -> m Bool
|
beginTabItem :: MonadIO m => BeginTabItem -> m Bool
|
||||||
beginTabItem tabName ref flags = liftIO do
|
beginTabItem BeginTabItem{ tabName, isSelected, flags } = liftIO do
|
||||||
currentValue <- get ref
|
currentValue <- get isSelected
|
||||||
with ( bool 0 1 currentValue :: CBool ) \ refPtr -> do
|
with ( bool 0 1 currentValue :: CBool ) \ valuePtr -> do
|
||||||
open <- withCString tabName \ ptrName ->
|
open <- withCString tabName \ ptrName ->
|
||||||
(0 /=) <$> [C.exp| bool { BeginTabItem($(char* ptrName), $(bool* refPtr), $(ImGuiTabBarFlags flags) ) } |]
|
(0 /=) <$> [C.exp| bool { BeginTabItem($(char* ptrName), $(bool* valuePtr), $(ImGuiTabBarFlags flags) ) } |]
|
||||||
newValue <- (0 /=) <$> peek refPtr
|
newValue <- (0 /=) <$> peek valuePtr
|
||||||
ref $=! newValue
|
isSelected $=! newValue
|
||||||
pure open
|
pure open
|
||||||
|
|
||||||
|
|
||||||
-- | Finish appending elements to a tab. Only call if 'beginTabItem' returns @True@.
|
-- | Finish appending elements to a tab. Only call if 'beginTabItem' returns @True@.
|
||||||
--
|
--
|
||||||
-- Wraps @ImGui::EndTabItem@.
|
-- Wraps @ImGui::EndTabItem@.
|
||||||
@ -813,11 +971,18 @@ endTabItem :: MonadIO m => m ()
|
|||||||
endTabItem = liftIO do
|
endTabItem = liftIO do
|
||||||
[C.exp| void { EndTabItem(); } |]
|
[C.exp| void { EndTabItem(); } |]
|
||||||
|
|
||||||
|
|
||||||
|
data TabItemButton = TabItemButton
|
||||||
|
{ tabName :: String
|
||||||
|
, flags :: ImGuiTabItemFlags
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
-- | Create a tab that behaves like a button. Returns @True@ when clicked. Cannot be selected in the tab bar.
|
-- | Create a tab that behaves like a button. Returns @True@ when clicked. Cannot be selected in the tab bar.
|
||||||
--
|
--
|
||||||
-- Wraps @ImGui.TabItemButton@.
|
-- Wraps @ImGui.TabItemButton@.
|
||||||
tabItemButton :: MonadIO m => String -> ImGuiTabItemFlags -> m Bool
|
tabItemButton :: MonadIO m => TabItemButton -> m Bool
|
||||||
tabItemButton tabName flags = liftIO do
|
tabItemButton TabItemButton{ tabName, flags } = liftIO do
|
||||||
withCString tabName \ namePtr ->
|
withCString tabName \ namePtr ->
|
||||||
(0 /=) <$> [C.exp| bool { TabItemButton($(char* namePtr), $(ImGuiTabItemFlags flags) ) } |]
|
(0 /=) <$> [C.exp| bool { TabItemButton($(char* namePtr), $(ImGuiTabItemFlags flags) ) } |]
|
||||||
|
|
||||||
@ -904,7 +1069,7 @@ withCStringOrNull (Just s) k = withCString s k
|
|||||||
-- | Set next window position. Call before `begin` Use pivot=(0.5,0.5) to center on given point, etc.
|
-- | Set next window position. Call before `begin` Use pivot=(0.5,0.5) to center on given point, etc.
|
||||||
--
|
--
|
||||||
-- Wraps @ImGui::SetNextWindowPos()@
|
-- Wraps @ImGui::SetNextWindowPos()@
|
||||||
setNextWindowPos :: (MonadIO m, HasGetter ref ImVec2) => ref -> ImGuiCond -> Maybe ref -> m ()
|
setNextWindowPos :: (MonadIO m, HasGetter value ImVec2) => value -> ImGuiCond -> Maybe value -> m ()
|
||||||
setNextWindowPos posRef cond pivotMaybe = liftIO do
|
setNextWindowPos posRef cond pivotMaybe = liftIO do
|
||||||
pos <- get posRef
|
pos <- get posRef
|
||||||
with pos $ \posPtr ->
|
with pos $ \posPtr ->
|
||||||
@ -916,34 +1081,34 @@ setNextWindowPos posRef cond pivotMaybe = liftIO do
|
|||||||
Nothing ->
|
Nothing ->
|
||||||
[C.exp| void { SetNextWindowPos(*$(ImVec2 *posPtr), $(ImGuiCond cond)) } |]
|
[C.exp| void { SetNextWindowPos(*$(ImVec2 *posPtr), $(ImGuiCond cond)) } |]
|
||||||
|
|
||||||
-- | Set next window size. Call before `begin`
|
-- | Set next window size. Call before `begin`
|
||||||
--
|
--
|
||||||
-- Wraps @ImGui::SetNextWindowSize()@
|
-- Wraps @ImGui::SetNextWindowSize()@
|
||||||
setNextWindowSize :: (MonadIO m, HasGetter ref ImVec2) => ref -> ImGuiCond -> m ()
|
setNextWindowSize :: (MonadIO m, HasGetter value ImVec2) => value -> ImGuiCond -> m ()
|
||||||
setNextWindowSize sizeRef cond = liftIO do
|
setNextWindowSize sizeRef cond = liftIO do
|
||||||
size' <- get sizeRef
|
size' <- get sizeRef
|
||||||
with size' $
|
with size' $
|
||||||
\sizePtr ->[C.exp| void { SetNextWindowSize(*$(ImVec2 *sizePtr), $(ImGuiCond cond)) } |]
|
\sizePtr ->[C.exp| void { SetNextWindowSize(*$(ImVec2 *sizePtr), $(ImGuiCond cond)) } |]
|
||||||
|
|
||||||
-- | Set next window content size (~ scrollable client area, which enforce the range of scrollbars). Not including window decorations (title bar, menu bar, etc.) nor WindowPadding. call before `begin`
|
-- | Set next window content size (~ scrollable client area, which enforce the range of scrollbars). Not including window decorations (title bar, menu bar, etc.) nor WindowPadding. call before `begin`
|
||||||
--
|
--
|
||||||
-- Wraps @ImGui::SetNextWindowContentSize()@
|
-- Wraps @ImGui::SetNextWindowContentSize()@
|
||||||
setNextWindowContentSize :: (MonadIO m, HasGetter ref ImVec2) => ref -> m ()
|
setNextWindowContentSize :: (MonadIO m, HasGetter value ImVec2) => value -> m ()
|
||||||
setNextWindowContentSize sizeRef = liftIO do
|
setNextWindowContentSize sizeRef = liftIO do
|
||||||
size' <- get sizeRef
|
size' <- get sizeRef
|
||||||
with size' $
|
with size' $
|
||||||
\sizePtr ->[C.exp| void { SetNextWindowContentSize(*$(ImVec2 *sizePtr)) } |]
|
\sizePtr ->[C.exp| void { SetNextWindowContentSize(*$(ImVec2 *sizePtr)) } |]
|
||||||
|
|
||||||
-- | Set next window size limits. use -1,-1 on either X/Y axis to preserve the current size. Sizes will be rounded down.
|
-- | Set next window size limits. use -1,-1 on either X/Y axis to preserve the current size. Sizes will be rounded down.
|
||||||
--
|
--
|
||||||
-- Wraps @ImGui::SetNextWindowContentSize()@
|
-- Wraps @ImGui::SetNextWindowContentSize()@
|
||||||
setNextWindowSizeConstraints :: (MonadIO m, HasGetter ref ImVec2) => ref -> ref -> m ()
|
setNextWindowSizeConstraints :: (MonadIO m, HasGetter value ImVec2) => value -> value -> m ()
|
||||||
setNextWindowSizeConstraints sizeMinRef sizeMaxRef = liftIO do
|
setNextWindowSizeConstraints sizeMinRef sizeMaxRef = liftIO do
|
||||||
sizeMin <- get sizeMinRef
|
sizeMin <- get sizeMinRef
|
||||||
sizeMax <- get sizeMaxRef
|
sizeMax <- get sizeMaxRef
|
||||||
with sizeMin $
|
with sizeMin $
|
||||||
\sizeMinPtr ->
|
\sizeMinPtr ->
|
||||||
with sizeMax $ \sizeMaxPtr ->
|
with sizeMax $ \sizeMaxPtr ->
|
||||||
[C.exp| void { SetNextWindowSizeConstraints(*$(ImVec2 *sizeMinPtr), *$(ImVec2 *sizeMaxPtr)) } |]
|
[C.exp| void { SetNextWindowSizeConstraints(*$(ImVec2 *sizeMinPtr), *$(ImVec2 *sizeMaxPtr)) } |]
|
||||||
|
|
||||||
-- | Set next window collapsed state. call before `begin`
|
-- | Set next window collapsed state. call before `begin`
|
||||||
@ -979,8 +1144,8 @@ spacing = liftIO do
|
|||||||
-- | Add a dummy item of given size. unlike `invisibleButton`, `dummy` won't take the mouse click or be navigable into.
|
-- | Add a dummy item of given size. unlike `invisibleButton`, `dummy` won't take the mouse click or be navigable into.
|
||||||
--
|
--
|
||||||
-- Wraps @ImGui::Dummy()@
|
-- Wraps @ImGui::Dummy()@
|
||||||
dummy :: (MonadIO m, HasGetter ref ImVec2) => ref -> m ()
|
dummy :: (MonadIO m, HasGetter value ImVec2) => value -> m ()
|
||||||
dummy sizeRef = liftIO do
|
dummy sizeRef = liftIO do
|
||||||
size' <- get sizeRef
|
size' <- get sizeRef
|
||||||
with size' $ \ sizePtr -> [C.exp| void { Dummy(*$(ImVec2 *sizePtr)) } |]
|
with size' $ \ sizePtr -> [C.exp| void { Dummy(*$(ImVec2 *sizePtr)) } |]
|
||||||
|
|
||||||
@ -1015,30 +1180,30 @@ endGroup = liftIO do
|
|||||||
[C.exp| void { EndGroup() } |]
|
[C.exp| void { EndGroup() } |]
|
||||||
|
|
||||||
-- | Vertically align upcoming text baseline to FramePadding.y so that it will align properly to regularly framed items (call if you have text on a line before a framed item)
|
-- | Vertically align upcoming text baseline to FramePadding.y so that it will align properly to regularly framed items (call if you have text on a line before a framed item)
|
||||||
--
|
--
|
||||||
-- Wraps @ImGui::AlignTextToFramePadding()@
|
-- Wraps @ImGui::AlignTextToFramePadding()@
|
||||||
alignTextToFramePadding :: (MonadIO m) => m ()
|
alignTextToFramePadding :: (MonadIO m) => m ()
|
||||||
alignTextToFramePadding = liftIO do
|
alignTextToFramePadding = liftIO do
|
||||||
[C.exp| void { AlignTextToFramePadding() } |]
|
[C.exp| void { AlignTextToFramePadding() } |]
|
||||||
|
|
||||||
-- | Set cursor position in window-local coordinates
|
-- | Set cursor position in window-local coordinates
|
||||||
--
|
--
|
||||||
-- Wraps @ImGui::SetCursorPos()@
|
-- Wraps @ImGui::SetCursorPos()@
|
||||||
setCursorPos :: (MonadIO m, HasGetter ref ImVec2) => ref -> m ()
|
setCursorPos :: (MonadIO m, HasGetter value ImVec2) => value -> m ()
|
||||||
setCursorPos posRef = liftIO do
|
setCursorPos posRef = liftIO do
|
||||||
pos <- get posRef
|
pos <- get posRef
|
||||||
with pos $ \ posPtr -> [C.exp| void { SetCursorPos(*$(ImVec2 *posPtr)) } |]
|
with pos $ \ posPtr -> [C.exp| void { SetCursorPos(*$(ImVec2 *posPtr)) } |]
|
||||||
|
|
||||||
-- | Modify a style color by pushing to the shared stack. always use this if you modify the style after `newFrame`
|
-- | Modify a style color by pushing to the shared stack. always use this if you modify the style after `newFrame`
|
||||||
--
|
--
|
||||||
-- Wraps @ImGui::PushStyleColor()@
|
-- Wraps @ImGui::PushStyleColor()@
|
||||||
pushStyleColor :: (MonadIO m, HasGetter ref ImVec4) => ImGuiCol -> ref -> m ()
|
pushStyleColor :: (MonadIO m, HasGetter value ImVec4) => ImGuiCol -> value -> m ()
|
||||||
pushStyleColor col colorRef = liftIO do
|
pushStyleColor col colorRef = liftIO do
|
||||||
color <- get colorRef
|
color <- get colorRef
|
||||||
with color $ \ colorPtr -> [C.exp| void { PushStyleColor($(ImGuiCol col), *$(ImVec4 *colorPtr)) } |]
|
with color $ \ colorPtr -> [C.exp| void { PushStyleColor($(ImGuiCol col), *$(ImVec4 *colorPtr)) } |]
|
||||||
|
|
||||||
-- | Remove style color modifications from the shared stack
|
-- | Remove style color modifications from the shared stack
|
||||||
--
|
--
|
||||||
-- Wraps @ImGui::PopStyleColor()@
|
-- Wraps @ImGui::PopStyleColor()@
|
||||||
popStyleColor :: (MonadIO m) => Int32 -> m ()
|
popStyleColor :: (MonadIO m) => Int32 -> m ()
|
||||||
popStyleColor n = liftIO do
|
popStyleColor n = liftIO do
|
||||||
@ -1048,15 +1213,15 @@ popStyleColor n = liftIO do
|
|||||||
[C.exp| void { PopStyleColor($(int m)) } |]
|
[C.exp| void { PopStyleColor($(int m)) } |]
|
||||||
|
|
||||||
-- | Modify a style variable by pushing to the shared stack. always use this if you modify the style after `newFrame`
|
-- | Modify a style variable by pushing to the shared stack. always use this if you modify the style after `newFrame`
|
||||||
--
|
--
|
||||||
-- Wraps @ImGui::PushStyleVar()@
|
-- Wraps @ImGui::PushStyleVar()@
|
||||||
pushStyleVar :: (MonadIO m, HasGetter ref ImVec2) => ImGuiStyleVar -> ref -> m ()
|
pushStyleVar :: (MonadIO m, HasGetter value ImVec2) => ImGuiStyleVar -> value -> m ()
|
||||||
pushStyleVar style valRef = liftIO do
|
pushStyleVar style valRef = liftIO do
|
||||||
val <- get valRef
|
val <- get valRef
|
||||||
with val $ \ valPtr -> [C.exp| void { PushStyleVar($(ImGuiStyleVar style), *$(ImVec2 *valPtr)) } |]
|
with val $ \ valPtr -> [C.exp| void { PushStyleVar($(ImGuiStyleVar style), *$(ImVec2 *valPtr)) } |]
|
||||||
|
|
||||||
-- | Remove style variable modifications from the shared stack
|
-- | Remove style variable modifications from the shared stack
|
||||||
--
|
--
|
||||||
-- Wraps @ImGui::PopStyleVar()@
|
-- Wraps @ImGui::PopStyleVar()@
|
||||||
popStyleVar :: (MonadIO m) => Int32 -> m ()
|
popStyleVar :: (MonadIO m) => Int32 -> m ()
|
||||||
popStyleVar n = liftIO do
|
popStyleVar n = liftIO do
|
||||||
|
Loading…
x
Reference in New Issue
Block a user