mirror of
https://github.com/Drezil/dear-imgui.hs.git
synced 2024-11-22 16:57:00 +00:00
added openPopupOnItemClick (#133)
This commit is contained in:
parent
67e169dc35
commit
b837d583a5
@ -245,6 +245,7 @@ module DearImGui
|
|||||||
, Raw.endPopup
|
, Raw.endPopup
|
||||||
|
|
||||||
, openPopup
|
, openPopup
|
||||||
|
, openPopupOnItemClick
|
||||||
, Raw.closeCurrentPopup
|
, Raw.closeCurrentPopup
|
||||||
|
|
||||||
-- * Item/Widgets Utilities
|
-- * Item/Widgets Utilities
|
||||||
@ -1486,6 +1487,17 @@ openPopup :: MonadIO m => String -> m ()
|
|||||||
openPopup popupId = liftIO do
|
openPopup popupId = liftIO do
|
||||||
withCString popupId Raw.openPopup
|
withCString popupId Raw.openPopup
|
||||||
|
|
||||||
|
-- | Opens a defined popup (i.e. defined with 'withPopup') on defined action.
|
||||||
|
--
|
||||||
|
-- Example:
|
||||||
|
--
|
||||||
|
-- > openPopupOnItemClick "myPopup" ImGuiPopupFlags_MouseButtonRight
|
||||||
|
--
|
||||||
|
-- Wraps @ImGui::OpenPopup()@
|
||||||
|
openPopupOnItemClick :: MonadIO m => String -> ImGuiPopupFlags -> m ()
|
||||||
|
openPopupOnItemClick popupId flags = liftIO do
|
||||||
|
withCString popupId $ \popupId' -> Raw.openPopupOnItemClick popupId' flags
|
||||||
|
|
||||||
|
|
||||||
withCStringOrNull :: Maybe String -> (Ptr CChar -> IO a) -> IO a
|
withCStringOrNull :: Maybe String -> (Ptr CChar -> IO a) -> IO a
|
||||||
withCStringOrNull Nothing k = k nullPtr
|
withCStringOrNull Nothing k = k nullPtr
|
||||||
|
@ -197,6 +197,7 @@ module DearImGui.Raw
|
|||||||
, beginPopupModal
|
, beginPopupModal
|
||||||
, endPopup
|
, endPopup
|
||||||
, openPopup
|
, openPopup
|
||||||
|
, openPopupOnItemClick
|
||||||
, closeCurrentPopup
|
, closeCurrentPopup
|
||||||
|
|
||||||
-- * ID stack/scopes
|
-- * ID stack/scopes
|
||||||
@ -1252,6 +1253,13 @@ openPopup :: (MonadIO m) => CString -> m ()
|
|||||||
openPopup popupIdPtr = liftIO do
|
openPopup popupIdPtr = liftIO do
|
||||||
[C.exp| void { OpenPopup($(char* popupIdPtr)) } |]
|
[C.exp| void { OpenPopup($(char* popupIdPtr)) } |]
|
||||||
|
|
||||||
|
-- | Call to mark popup as open (don't call every frame!).
|
||||||
|
--
|
||||||
|
-- Wraps @ImGui::OpenPopupOnItemClick()@
|
||||||
|
openPopupOnItemClick :: (MonadIO m) => CString -> ImGuiPopupFlags-> m ()
|
||||||
|
openPopupOnItemClick popupIdPtr flags = liftIO do
|
||||||
|
[C.exp| void { OpenPopupOnItemClick($(char* popupIdPtr), $(ImGuiPopupFlags flags)) } |]
|
||||||
|
|
||||||
|
|
||||||
-- | Manually close the popup we have begin-ed into.
|
-- | Manually close the popup we have begin-ed into.
|
||||||
--
|
--
|
||||||
|
Loading…
Reference in New Issue
Block a user