mirror of
https://github.com/Drezil/dear-imgui.hs.git
synced 2024-11-26 02:27:00 +00:00
Wrap ImGui::TreeNode, TreePush, TreePop (#24)
This commit is contained in:
parent
24903ce76f
commit
bb82e87553
9
Main.hs
9
Main.hs
@ -91,6 +91,15 @@ loop w checked color slider = do
|
||||
|
||||
colorPicker3 "Test" color
|
||||
|
||||
treeNode "Tree Node 1" >>= whenTrue do
|
||||
treeNode "Tree Node 2" >>= whenTrue do
|
||||
treePop
|
||||
|
||||
treeNode "Tree Node 3" >>= whenTrue do
|
||||
treePop
|
||||
|
||||
treePop
|
||||
|
||||
beginMainMenuBar >>= whenTrue do
|
||||
beginMenu "Hello" >>= whenTrue do
|
||||
menuItem "Hello"
|
||||
|
@ -83,6 +83,11 @@ module DearImGui
|
||||
, colorPicker3
|
||||
, colorButton
|
||||
|
||||
-- * Trees
|
||||
, treeNode
|
||||
, treePush
|
||||
, treePop
|
||||
|
||||
-- ** Selectables
|
||||
, selectable
|
||||
|
||||
@ -583,6 +588,25 @@ colorButton desc ref = liftIO do
|
||||
|
||||
return changed
|
||||
|
||||
-- | Wraps @ImGui::TreeNode()@.
|
||||
treeNode :: MonadIO m => String -> m Bool
|
||||
treeNode label = liftIO do
|
||||
withCString label \labelPtr ->
|
||||
(0 /=) <$> [C.exp| bool { TreeNode($(char* labelPtr)) } |]
|
||||
|
||||
|
||||
-- | Wraps @ImGui::TreePush()@.
|
||||
treePush :: MonadIO m => String -> m ()
|
||||
treePush label = liftIO do
|
||||
withCString label \labelPtr ->
|
||||
[C.exp| void { TreePush($(char* labelPtr)) } |]
|
||||
|
||||
|
||||
-- | Wraps @ImGui::TreePop()@.
|
||||
treePop :: MonadIO m => m ()
|
||||
treePop = liftIO do
|
||||
[C.exp| void { TreePop() } |]
|
||||
|
||||
|
||||
-- | Wraps @ImGui::Selectable()@.
|
||||
selectable :: MonadIO m => String -> m Bool
|
||||
|
Loading…
Reference in New Issue
Block a user