mirror of
https://github.com/Drezil/dear-imgui.hs.git
synced 2024-11-22 16:57:00 +00:00
Add invisibleButton (#91)
This commit is contained in:
parent
efaaa5723a
commit
4bfc7e7099
@ -120,6 +120,7 @@ module DearImGui
|
||||
-- ** Main
|
||||
, button
|
||||
, smallButton
|
||||
, invisibleButton
|
||||
, arrowButton
|
||||
, checkbox
|
||||
, progressBar
|
||||
@ -416,6 +417,19 @@ smallButton label = liftIO do
|
||||
withCString label Raw.smallButton
|
||||
|
||||
|
||||
-- | Flexible button behavior without the visuals.
|
||||
--
|
||||
-- Frequently useful to build custom behaviors using the public api
|
||||
-- (along with IsItemActive, IsItemHovered, etc).
|
||||
--
|
||||
-- Wraps @ImGui::InvisibleButton()@.
|
||||
invisibleButton :: MonadIO m => String -> ImVec2 -> ImGuiButtonFlags -> m Bool
|
||||
invisibleButton label size flags = liftIO do
|
||||
withCString label \labelPtr ->
|
||||
with size \sizePtr ->
|
||||
Raw.invisibleButton labelPtr sizePtr flags
|
||||
|
||||
|
||||
-- | Square button with an arrow shape.
|
||||
--
|
||||
-- Wraps @ImGui::ArrowButton()@.
|
||||
|
@ -99,6 +99,7 @@ module DearImGui.Raw
|
||||
-- ** Main
|
||||
, button
|
||||
, smallButton
|
||||
, invisibleButton
|
||||
, arrowButton
|
||||
, checkbox
|
||||
, progressBar
|
||||
@ -478,6 +479,24 @@ smallButton labelPtr = liftIO do
|
||||
(0 /=) <$> [C.exp| bool { SmallButton($(char* labelPtr)) } |]
|
||||
|
||||
|
||||
-- | Flexible button behavior without the visuals.
|
||||
--
|
||||
-- Frequently useful to build custom behaviors using the public api
|
||||
-- (along with IsItemActive, IsItemHovered, etc).
|
||||
--
|
||||
-- Wraps @ImGui::InvisibleButton()@.
|
||||
invisibleButton :: (MonadIO m) => CString -> Ptr ImVec2 -> ImGuiButtonFlags -> m Bool
|
||||
invisibleButton labelPtr size flags = liftIO do
|
||||
(0 /=) <$> [C.exp|
|
||||
bool {
|
||||
InvisibleButton(
|
||||
$(char* labelPtr),
|
||||
*$(ImVec2* size),
|
||||
$(ImGuiButtonFlags flags)
|
||||
)
|
||||
}
|
||||
|]
|
||||
|
||||
-- | Square button with an arrow shape.
|
||||
--
|
||||
-- Wraps @ImGui::ArrowButton()@.
|
||||
|
Loading…
Reference in New Issue
Block a user