Wrap ImGui::Begin/EndTooltip()

This commit is contained in:
Ollie Charles 2021-01-24 17:39:44 +00:00
parent 4ca9a3d38f
commit 3c3646a645
2 changed files with 25 additions and 1 deletions

View File

@ -48,7 +48,12 @@ loop w checked = do
True -> openPopup "Button Popup" True -> openPopup "Button Popup"
False -> return () False -> return ()
beginPopupModal "Button Popup" >>= whenTrue do isItemHovered >>= whenTrue do
beginTooltip
text "Tooltip?"
endTooltip
beginPopup "Button Popup" >>= whenTrue do
button "Close" >>= whenTrue closeCurrentPopup button "Close" >>= whenTrue closeCurrentPopup
endPopup endPopup

View File

@ -80,6 +80,10 @@ module DearImGui
, endMenu , endMenu
, menuItem , menuItem
-- * Tooltips
, beginTooltip
, endTooltip
-- * Popups/Modals -- * Popups/Modals
, beginPopup , beginPopup
, beginPopupModal , beginPopupModal
@ -493,6 +497,21 @@ menuItem label = liftIO do
(1 ==) <$> [C.exp| bool { MenuItem($(char* labelPtr)) } |] (1 ==) <$> [C.exp| bool { MenuItem($(char* labelPtr)) } |]
-- | Begin/append a tooltip window to create full-featured tooltip (with any
-- kind of items).
--
-- Wraps @ImGui::BeginTooltip()@
beginTooltip :: MonadIO m => m ()
beginTooltip = liftIO do
[C.exp| void { BeginTooltip() } |]
-- | Wraps @ImGui::EndTooltip()@
endTooltip :: MonadIO m => m ()
endTooltip = liftIO do
[C.exp| void { EndTooltip() } |]
-- | Returns 'True' if the popup is open, and you can start outputting to it. -- | Returns 'True' if the popup is open, and you can start outputting to it.
-- --
-- Wraps @ImGui::BeginPopup()@ -- Wraps @ImGui::BeginPopup()@