mirror of
https://github.com/Drezil/dear-imgui.hs.git
synced 2025-07-21 20:23:15 +02:00
committed by
GitHub
parent
6dbb455d62
commit
8df98e075c
@ -1690,7 +1690,7 @@ withTabBarOpen tabBarID flags action =
|
||||
-- | Create a new tab. Returns @True@ if the tab is selected.
|
||||
--
|
||||
-- Wraps @ImGui::BeginTabItem@.
|
||||
beginTabItem :: (MonadIO m, HasGetter ref Bool, HasSetter ref Bool) => Text -> ref -> ImGuiTabBarFlags -> m Bool
|
||||
beginTabItem :: (MonadIO m, HasGetter ref Bool, HasSetter ref Bool) => Text -> ref -> ImGuiTabItemFlags -> m Bool
|
||||
beginTabItem tabName ref flags = liftIO do
|
||||
currentValue <- get ref
|
||||
with (bool 0 1 currentValue) \refPtr -> do
|
||||
@ -1706,14 +1706,14 @@ beginTabItem tabName ref flags = liftIO do
|
||||
-- | Create a new tab.
|
||||
--
|
||||
-- The action will get 'True' if the tab is selected.
|
||||
withTabItem :: (MonadUnliftIO m, HasGetter ref Bool, HasSetter ref Bool) => Text -> ref -> ImGuiTabBarFlags -> (Bool -> m a) -> m a
|
||||
withTabItem :: (MonadUnliftIO m, HasGetter ref Bool, HasSetter ref Bool) => Text -> ref -> ImGuiTabItemFlags -> (Bool -> m a) -> m a
|
||||
withTabItem tabName ref flags =
|
||||
bracket (beginTabItem tabName ref flags) (`when` Raw.endTabItem)
|
||||
|
||||
-- | Create a new tab.
|
||||
--
|
||||
-- The action will be skipped unless the tab is selected.
|
||||
withTabItemOpen :: (MonadUnliftIO m, HasGetter ref Bool, HasSetter ref Bool) => Text -> ref -> ImGuiTabBarFlags -> m () -> m ()
|
||||
withTabItemOpen :: (MonadUnliftIO m, HasGetter ref Bool, HasSetter ref Bool) => Text -> ref -> ImGuiTabItemFlags -> m () -> m ()
|
||||
withTabItemOpen tabName ref flags action =
|
||||
withTabItem tabName ref flags (`when` action)
|
||||
|
||||
|
@ -1346,9 +1346,9 @@ endTabBar = liftIO do
|
||||
-- | Create a new tab. Returns @True@ if the tab is selected.
|
||||
--
|
||||
-- Wraps @ImGui::BeginTabItem@.
|
||||
beginTabItem :: (MonadIO m) => CString -> Ptr CBool -> ImGuiTabBarFlags -> m Bool
|
||||
beginTabItem :: (MonadIO m) => CString -> Ptr CBool -> ImGuiTabItemFlags -> m Bool
|
||||
beginTabItem namePtr refPtr flags = liftIO do
|
||||
(0 /=) <$> [C.exp| bool { BeginTabItem($(char* namePtr), $(bool* refPtr), $(ImGuiTabBarFlags flags) ) } |]
|
||||
(0 /=) <$> [C.exp| bool { BeginTabItem($(char* namePtr), $(bool* refPtr), $(ImGuiTabItemFlags flags) ) } |]
|
||||
|
||||
|
||||
-- | Finish appending elements to a tab. Only call if 'beginTabItem' returns @True@.
|
||||
|
Reference in New Issue
Block a user