Skip to content

Commit 3c3646a

Browse files
committed
Wrap ImGui::Begin/EndTooltip()
1 parent 4ca9a3d commit 3c3646a

File tree

2 files changed

+25
-1
lines changed

2 files changed

+25
-1
lines changed

Main.hs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,12 @@ loop w checked = do
4848
True -> openPopup "Button Popup"
4949
False -> return ()
5050

51-
beginPopupModal "Button Popup" >>= whenTrue do
51+
isItemHovered >>= whenTrue do
52+
beginTooltip
53+
text "Tooltip?"
54+
endTooltip
55+
56+
beginPopup "Button Popup" >>= whenTrue do
5257
button "Close" >>= whenTrue closeCurrentPopup
5358
endPopup
5459

src/DearImGui.hs

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,10 @@ module DearImGui
8080
, endMenu
8181
, menuItem
8282

83+
-- * Tooltips
84+
, beginTooltip
85+
, endTooltip
86+
8387
-- * Popups/Modals
8488
, beginPopup
8589
, beginPopupModal
@@ -493,6 +497,21 @@ menuItem label = liftIO do
493497
(1 ==) <$> [C.exp| bool { MenuItem($(char* labelPtr)) } |]
494498

495499

500+
-- | Begin/append a tooltip window to create full-featured tooltip (with any
501+
-- kind of items).
502+
--
503+
-- Wraps @ImGui::BeginTooltip()@
504+
beginTooltip :: MonadIO m => m ()
505+
beginTooltip = liftIO do
506+
[C.exp| void { BeginTooltip() } |]
507+
508+
509+
-- | Wraps @ImGui::EndTooltip()@
510+
endTooltip :: MonadIO m => m ()
511+
endTooltip = liftIO do
512+
[C.exp| void { EndTooltip() } |]
513+
514+
496515
-- | Returns 'True' if the popup is open, and you can start outputting to it.
497516
--
498517
-- Wraps @ImGui::BeginPopup()@

0 commit comments

Comments
 (0)