Skip to content

Commit

Permalink
Add setNextItemOpen (#161)
Browse files Browse the repository at this point in the history
This change enables starting a new TreeNode open.
  • Loading branch information
TristanCacqueray authored Nov 28, 2022
1 parent a2feb73 commit 48486ee
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/DearImGui.hs
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,7 @@ module DearImGui
, treeNode
, treePush
, Raw.treePop
, setNextItemOpen

-- ** Selectables
, selectable
Expand Down Expand Up @@ -1546,6 +1547,9 @@ treePush :: MonadIO m => Text -> m ()
treePush label = liftIO do
Text.withCString label Raw.treePush

-- | Wraps @ImGui::SetNextItemOpen()@.
setNextItemOpen :: MonadIO m => Bool -> m ()
setNextItemOpen is_open = Raw.setNextItemOpen (bool 0 1 is_open)

-- | Wraps @ImGui::Selectable()@ with default options.
selectable :: MonadIO m => Text -> m Bool
Expand Down
6 changes: 6 additions & 0 deletions src/DearImGui/Raw.hs
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,7 @@ module DearImGui.Raw
, treeNode
, treePush
, treePop
, setNextItemOpen

-- ** Selectables
, selectable
Expand Down Expand Up @@ -1233,6 +1234,11 @@ treePop = liftIO do
[C.exp| void { TreePop() } |]


-- | Wraps @ImGui::SetNextItemOpen()@.
setNextItemOpen :: (MonadIO m) => CBool -> m ()
setNextItemOpen is_open = liftIO do
[C.exp| void { SetNextItemOpen($(bool is_open)) } |]

-- -- | Wraps @ImGui::Selectable()@.
-- selectable :: (MonadIO m) => CString -> m Bool
-- selectable labelPtr = liftIO do
Expand Down

0 comments on commit 48486ee

Please sign in to comment.