Add invisibleButton (#91)

This commit is contained in:
Alexander Bondarenko 2021-09-11 14:01:03 +03:00 committed by GitHub
parent efaaa5723a
commit 4bfc7e7099
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 33 additions and 0 deletions

View File

@ -120,6 +120,7 @@ module DearImGui
-- ** Main -- ** Main
, button , button
, smallButton , smallButton
, invisibleButton
, arrowButton , arrowButton
, checkbox , checkbox
, progressBar , progressBar
@ -416,6 +417,19 @@ smallButton label = liftIO do
withCString label Raw.smallButton 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. -- | Square button with an arrow shape.
-- --
-- Wraps @ImGui::ArrowButton()@. -- Wraps @ImGui::ArrowButton()@.

View File

@ -99,6 +99,7 @@ module DearImGui.Raw
-- ** Main -- ** Main
, button , button
, smallButton , smallButton
, invisibleButton
, arrowButton , arrowButton
, checkbox , checkbox
, progressBar , progressBar
@ -478,6 +479,24 @@ smallButton labelPtr = liftIO do
(0 /=) <$> [C.exp| bool { SmallButton($(char* labelPtr)) } |] (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. -- | Square button with an arrow shape.
-- --
-- Wraps @ImGui::ArrowButton()@. -- Wraps @ImGui::ArrowButton()@.