Skip to content

Commit 8960aad

Browse files
authored
Add Tree Node function that accepts flags (#211)
1 parent 3526e6f commit 8960aad

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

src/DearImGui.hs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -283,6 +283,7 @@ module DearImGui
283283

284284
-- ** Trees
285285
, treeNode
286+
, treeNodeWith
286287
, treePush
287288
, Raw.treePop
288289
, setNextItemOpen
@@ -1958,6 +1959,10 @@ treeNode :: MonadIO m => Text -> m Bool
19581959
treeNode label = liftIO do
19591960
Text.withCString label Raw.treeNode
19601961

1962+
-- | Wraps @ImGui::TreeNodeEx()@.
1963+
treeNodeWith :: MonadIO m => Text -> ImGuiTreeNodeFlags -> m Bool
1964+
treeNodeWith label flags = liftIO do
1965+
Text.withCString label (flip Raw.treeNodeEx flags)
19611966

19621967
-- | Wraps @ImGui::TreePush()@.
19631968
treePush :: MonadIO m => Text -> m ()

src/DearImGui/Raw.hs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -245,6 +245,7 @@ module DearImGui.Raw
245245

246246
-- * Trees
247247
, treeNode
248+
, treeNodeEx
248249
, treePush
249250
, treePop
250251
, getTreeNodeToLabelSpacing
@@ -1520,6 +1521,10 @@ treeNode :: (MonadIO m) => CString -> m Bool
15201521
treeNode labelPtr = liftIO do
15211522
(0 /=) <$> [C.exp| bool { TreeNode($(char* labelPtr)) } |]
15221523

1524+
-- | Wraps @ImGui::TreeNodeEx()@.
1525+
treeNodeEx :: (MonadIO m) => CString -> ImGuiTreeNodeFlags -> m Bool
1526+
treeNodeEx labelPtr flags = liftIO do
1527+
(0 /=) <$> [C.exp| bool { TreeNodeEx($(char* labelPtr), $(ImGuiTreeNodeFlags flags)) } |]
15231528

15241529
-- | Wraps @ImGui::TreePush()@.
15251530
treePush :: (MonadIO m) => CString -> m ()

0 commit comments

Comments
 (0)