mirror of
https://github.com/Drezil/dear-imgui.hs.git
synced 2025-07-06 04:58:48 +02:00
Add withID (#75)
Raw versions are specialized to match overloaded C++ functions.
This commit is contained in:
committed by
GitHub
parent
bde2030c25
commit
d7dc999e8b
@ -178,6 +178,13 @@ module DearImGui.Raw
|
||||
, openPopup
|
||||
, closeCurrentPopup
|
||||
|
||||
-- * ID stack/scopes
|
||||
, pushIDInt
|
||||
, pushIDPtr
|
||||
, pushIDStr
|
||||
, pushIDStrLen
|
||||
, popID
|
||||
|
||||
-- * Item/Widgets Utilities
|
||||
, isItemHovered
|
||||
, wantCaptureMouse
|
||||
@ -1261,6 +1268,44 @@ popStyleVar :: (MonadIO m) => CInt -> m ()
|
||||
popStyleVar n = liftIO do
|
||||
[C.exp| void { PopStyleVar($(int n)) } |]
|
||||
|
||||
|
||||
-- | Push integer into the ID stack (will hash int).
|
||||
--
|
||||
-- Wraps @ImGui::PushId@
|
||||
pushIDInt :: (MonadIO m) => CInt -> m ()
|
||||
pushIDInt intId = liftIO do
|
||||
[C.exp| void { PushID($(int intId)) } |]
|
||||
|
||||
-- | Push pointer into the ID stack (will hash pointer).
|
||||
--
|
||||
-- Wraps @ImGui::PushId@
|
||||
pushIDPtr :: (MonadIO m) => Ptr a -> m ()
|
||||
pushIDPtr ptr = liftIO do
|
||||
[C.exp| void { PushID($(void * ptr_)) } |]
|
||||
where
|
||||
ptr_ = castPtr ptr
|
||||
|
||||
-- | Push string into the ID stack (will hash string).
|
||||
--
|
||||
-- Wraps @ImGui::PushId@
|
||||
pushIDStr :: (MonadIO m) => CString -> m ()
|
||||
pushIDStr strId = liftIO do
|
||||
[C.exp| void { PushID($(char * strId)) } |]
|
||||
|
||||
-- | Push string into the ID stack (will hash string).
|
||||
--
|
||||
-- Wraps @ImGui::PushId@
|
||||
pushIDStrLen :: (MonadIO m) => CStringLen -> m ()
|
||||
pushIDStrLen (strBegin, strLen) = liftIO do
|
||||
[C.exp| void { PushID($(char * strBegin), $(char * strEnd)) } |]
|
||||
where
|
||||
strEnd = plusPtr strBegin strLen
|
||||
|
||||
popID :: (MonadIO m) => m ()
|
||||
popID = liftIO do
|
||||
[C.exp| void { PopID() } |]
|
||||
|
||||
|
||||
wantCaptureMouse :: MonadIO m => m Bool
|
||||
wantCaptureMouse = liftIO do
|
||||
(0 /=) <$> [C.exp| bool { GetIO().WantCaptureMouse } |]
|
||||
|
Reference in New Issue
Block a user