diff --git a/Main.hs b/Main.hs index 185beb4..2d46499 100644 --- a/Main.hs +++ b/Main.hs @@ -79,10 +79,10 @@ loop window checked color slider r pos size' selected tab1Ref tab2Ref = do text "Hello!" beginTabBar "My tab bar" ImGuiTabBarFlags_Reorderable >>= whenTrue do - beginTabItem "Tab 1" tab1Ref ImGuiTabBarFlags_None >>= whenTrue do + beginTabItem "Tab 1" tab1Ref ImGuiTabItemFlags_None >>= whenTrue do text "Tab 1 is currently selected." endTabItem - beginTabItem "Tab 2" tab2Ref ImGuiTabBarFlags_None >>= whenTrue do + beginTabItem "Tab 2" tab2Ref ImGuiTabItemFlags_None >>= whenTrue do text "Tab 2 is selected now." endTabItem reOpen <- tabItemButton "ReopenTabs" ImGuiTabItemFlags_Trailing diff --git a/src/DearImGui.hs b/src/DearImGui.hs index 3c669c6..1bd9188 100644 --- a/src/DearImGui.hs +++ b/src/DearImGui.hs @@ -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) diff --git a/src/DearImGui/Raw.hs b/src/DearImGui/Raw.hs index 749ba4b..e42a261 100644 --- a/src/DearImGui/Raw.hs +++ b/src/DearImGui/Raw.hs @@ -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@.