mirror of https://github.com/ocornut/imgui
Tabs: Added ImGuiTabItemFlags_NoAssumedClosure to enable app to react on closure attempt. (#7084)
This commit is contained in:
parent
1fade35159
commit
c58d2c89c3
|
@ -3465,6 +3465,8 @@ Decorated log and release notes: https://github.com/ocornut/imgui/releases/tag/v
|
|||
|
||||
Breaking Changes:
|
||||
|
||||
- Tabs: Added ImGuiTabItemFlags_NoAssumedClosure to enable app to react on closure attempt, without having to draw
|
||||
an unsaved document marker (ImGuiTabItemFlags_UnsavedDocument sets _NoAssumedClosure automatically). (#7084)
|
||||
- DragInt(): The default compile-time format string has been changed from "%.0f" to "%d", as we are not using integers internally
|
||||
any more. If you used DragInt() with custom format strings, make sure you change them to use %d or an integer-compatible format.
|
||||
To honor backward-compatibility, the DragInt() code will currently parse and modify format strings to replace %*f with %d,
|
||||
|
|
9
imgui.h
9
imgui.h
|
@ -1162,7 +1162,7 @@ enum ImGuiTabBarFlags_
|
|||
ImGuiTabBarFlags_Reorderable = 1 << 0, // Allow manually dragging tabs to re-order them + New tabs are appended at the end of list
|
||||
ImGuiTabBarFlags_AutoSelectNewTabs = 1 << 1, // Automatically select new tabs when they appear
|
||||
ImGuiTabBarFlags_TabListPopupButton = 1 << 2, // Disable buttons to open the tab list popup
|
||||
ImGuiTabBarFlags_NoCloseWithMiddleMouseButton = 1 << 3, // Disable behavior of closing tabs (that are submitted with p_open != NULL) with middle mouse button. You can still repro this behavior on user's side with if (IsItemHovered() && IsMouseClicked(2)) *p_open = false.
|
||||
ImGuiTabBarFlags_NoCloseWithMiddleMouseButton = 1 << 3, // Disable behavior of closing tabs (that are submitted with p_open != NULL) with middle mouse button. You may handle this behavior manually on user's side with if (IsItemHovered() && IsMouseClicked(2)) *p_open = false.
|
||||
ImGuiTabBarFlags_NoTabListScrollingButtons = 1 << 4, // Disable scrolling buttons (apply when fitting policy is ImGuiTabBarFlags_FittingPolicyScroll)
|
||||
ImGuiTabBarFlags_NoTooltip = 1 << 5, // Disable tooltips when hovering a tab
|
||||
ImGuiTabBarFlags_FittingPolicyResizeDown = 1 << 6, // Resize tabs when they don't fit
|
||||
|
@ -1175,14 +1175,15 @@ enum ImGuiTabBarFlags_
|
|||
enum ImGuiTabItemFlags_
|
||||
{
|
||||
ImGuiTabItemFlags_None = 0,
|
||||
ImGuiTabItemFlags_UnsavedDocument = 1 << 0, // Display a dot next to the title + tab is selected when clicking the X + closure is not assumed (will wait for user to stop submitting the tab). Otherwise closure is assumed when pressing the X, so if you keep submitting the tab may reappear at end of tab bar.
|
||||
ImGuiTabItemFlags_UnsavedDocument = 1 << 0, // Display a dot next to the title + set ImGuiTabItemFlags_NoAssumedClosure.
|
||||
ImGuiTabItemFlags_SetSelected = 1 << 1, // Trigger flag to programmatically make the tab selected when calling BeginTabItem()
|
||||
ImGuiTabItemFlags_NoCloseWithMiddleMouseButton = 1 << 2, // Disable behavior of closing tabs (that are submitted with p_open != NULL) with middle mouse button. You can still repro this behavior on user's side with if (IsItemHovered() && IsMouseClicked(2)) *p_open = false.
|
||||
ImGuiTabItemFlags_NoPushId = 1 << 3, // Don't call PushID(tab->ID)/PopID() on BeginTabItem()/EndTabItem()
|
||||
ImGuiTabItemFlags_NoCloseWithMiddleMouseButton = 1 << 2, // Disable behavior of closing tabs (that are submitted with p_open != NULL) with middle mouse button. You may handle this behavior manually on user's side with if (IsItemHovered() && IsMouseClicked(2)) *p_open = false.
|
||||
ImGuiTabItemFlags_NoPushId = 1 << 3, // Don't call PushID()/PopID() on BeginTabItem()/EndTabItem()
|
||||
ImGuiTabItemFlags_NoTooltip = 1 << 4, // Disable tooltip for the given tab
|
||||
ImGuiTabItemFlags_NoReorder = 1 << 5, // Disable reordering this tab or having another tab cross over this tab
|
||||
ImGuiTabItemFlags_Leading = 1 << 6, // Enforce the tab position to the left of the tab bar (after the tab list popup button)
|
||||
ImGuiTabItemFlags_Trailing = 1 << 7, // Enforce the tab position to the right of the tab bar (before the scrolling buttons)
|
||||
ImGuiTabItemFlags_NoAssumedClosure = 1 << 8, // Tab is selected when trying to close + closure is not immediately assumed (will wait for user to stop submitting the tab). Otherwise closure is assumed when pressing the X, so if you keep submitting the tab may reappear at end of tab bar.
|
||||
};
|
||||
|
||||
// Flags for ImGui::IsWindowFocused()
|
||||
|
|
|
@ -8257,7 +8257,7 @@ void ImGui::TabBarCloseTab(ImGuiTabBar* tab_bar, ImGuiTabItem* tab)
|
|||
if (tab->Flags & ImGuiTabItemFlags_Button)
|
||||
return; // A button appended with TabItemButton().
|
||||
|
||||
if (!(tab->Flags & ImGuiTabItemFlags_UnsavedDocument))
|
||||
if ((tab->Flags & (ImGuiTabItemFlags_UnsavedDocument | ImGuiTabItemFlags_NoAssumedClosure)) == 0)
|
||||
{
|
||||
// This will remove a frame of lag for selecting another tab on closure.
|
||||
// However we don't run it in the case where the 'Unsaved' flag is set, so user gets a chance to fully undo the closure
|
||||
|
|
Loading…
Reference in New Issue