File tree Expand file tree Collapse file tree 2 files changed +20
-0
lines changed Expand file tree Collapse file tree 2 files changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -245,6 +245,7 @@ module DearImGui
245
245
, Raw. endPopup
246
246
247
247
, openPopup
248
+ , openPopupOnItemClick
248
249
, Raw. closeCurrentPopup
249
250
250
251
-- * Item/Widgets Utilities
@@ -1486,6 +1487,17 @@ openPopup :: MonadIO m => String -> m ()
1486
1487
openPopup popupId = liftIO do
1487
1488
withCString popupId Raw. openPopup
1488
1489
1490
+ -- | Opens a defined popup (i.e. defined with 'withPopup') on defined action.
1491
+ --
1492
+ -- Example:
1493
+ --
1494
+ -- > openPopupOnItemClick "myPopup" ImGuiPopupFlags_MouseButtonRight
1495
+ --
1496
+ -- Wraps @ImGui::OpenPopup()@
1497
+ openPopupOnItemClick :: MonadIO m => String -> ImGuiPopupFlags -> m ()
1498
+ openPopupOnItemClick popupId flags = liftIO do
1499
+ withCString popupId $ \ popupId' -> Raw. openPopupOnItemClick popupId' flags
1500
+
1489
1501
1490
1502
withCStringOrNull :: Maybe String -> (Ptr CChar -> IO a ) -> IO a
1491
1503
withCStringOrNull Nothing k = k nullPtr
Original file line number Diff line number Diff line change @@ -197,6 +197,7 @@ module DearImGui.Raw
197
197
, beginPopupModal
198
198
, endPopup
199
199
, openPopup
200
+ , openPopupOnItemClick
200
201
, closeCurrentPopup
201
202
202
203
-- * ID stack/scopes
@@ -1252,6 +1253,13 @@ openPopup :: (MonadIO m) => CString -> m ()
1252
1253
openPopup popupIdPtr = liftIO do
1253
1254
[C. exp | void { OpenPopup($(char* popupIdPtr)) } |]
1254
1255
1256
+ -- | Call to mark popup as open (don't call every frame!).
1257
+ --
1258
+ -- Wraps @ImGui::OpenPopupOnItemClick()@
1259
+ openPopupOnItemClick :: (MonadIO m ) => CString -> ImGuiPopupFlags -> m ()
1260
+ openPopupOnItemClick popupIdPtr flags = liftIO do
1261
+ [C. exp | void { OpenPopupOnItemClick($(char* popupIdPtr), $(ImGuiPopupFlags flags)) } |]
1262
+
1255
1263
1256
1264
-- | Manually close the popup we have begin-ed into.
1257
1265
--
You can’t perform that action at this time.
0 commit comments