mirror of
https://github.com/Drezil/imgui.git
synced 2025-07-07 21:39:54 +02:00
Docking: Another attempt at tidying the inconsistent focus / tab bar reordering issues, and toward generalizing single window dock nodes. (#2109)
This commit is contained in:
@ -5813,7 +5813,7 @@ namespace ImGui
|
||||
ImGuiTabBar::ImGuiTabBar()
|
||||
{
|
||||
ID = 0;
|
||||
SelectedTabId = NextSelectedTabId = VisibleTabId = WantFocusTabId = 0;
|
||||
SelectedTabId = NextSelectedTabId = VisibleTabId = 0;
|
||||
CurrFrameVisible = PrevFrameVisible = -1;
|
||||
OffsetMax = OffsetNextTab = 0.0f;
|
||||
ScrollingAnim = ScrollingTarget = 0.0f;
|
||||
@ -5960,7 +5960,6 @@ static void ImGui::TabBarLayout(ImGuiTabBar* tab_bar)
|
||||
|
||||
// Setup next selected tab
|
||||
ImGuiID scroll_track_selected_tab_id = 0;
|
||||
tab_bar->WantFocusTabId = 0;
|
||||
if (tab_bar->NextSelectedTabId)
|
||||
{
|
||||
tab_bar->SelectedTabId = tab_bar->NextSelectedTabId;
|
||||
@ -6157,7 +6156,6 @@ void ImGui::TabBarRemoveTab(ImGuiTabBar* tab_bar, ImGuiID tab_id)
|
||||
if (ImGuiTabItem* tab = TabBarFindTabByID(tab_bar, tab_id))
|
||||
tab_bar->Tabs.erase(tab);
|
||||
if (tab_bar->VisibleTabId == tab_id) { tab_bar->VisibleTabId = 0; }
|
||||
if (tab_bar->WantFocusTabId == tab_id) { tab_bar->WantFocusTabId = 0; }
|
||||
if (tab_bar->SelectedTabId == tab_id) { tab_bar->SelectedTabId = 0; }
|
||||
if (tab_bar->NextSelectedTabId == tab_id) { tab_bar->NextSelectedTabId = 0; }
|
||||
}
|
||||
@ -6447,8 +6445,8 @@ bool ImGui::TabItemEx(ImGuiTabBar* tab_bar, const char* label, bool* p_open,
|
||||
bool hovered, held;
|
||||
bool pressed = ButtonBehavior(bb, id, &hovered, &held, button_flags);
|
||||
hovered |= (g.HoveredId == id);
|
||||
if (pressed || ((flags & ImGuiTabItemFlags_SetSelected) && !tab_contents_visible)) // SetSelected can only be passed on explicit tab bar, so we don't need to set WantFocusTabId
|
||||
tab_bar->NextSelectedTabId = tab_bar->WantFocusTabId = id;
|
||||
if (pressed || ((flags & ImGuiTabItemFlags_SetSelected) && !tab_contents_visible)) // SetSelected can only be passed on explicit tab bar
|
||||
tab_bar->NextSelectedTabId = id;
|
||||
|
||||
// Allow the close button to overlap unless we are dragging (in which case we don't want any overlapping tabs to be hovered)
|
||||
if (!held)
|
||||
@ -6531,7 +6529,7 @@ bool ImGui::TabItemEx(ImGuiTabBar* tab_bar, const char* label, bool* p_open,
|
||||
// Select with right mouse button. This is so the common idiom for context menu automatically highlight the current widget.
|
||||
const bool hovered_unblocked = IsItemHovered(ImGuiHoveredFlags_AllowWhenBlockedByPopup);
|
||||
if (hovered_unblocked && (IsMouseClicked(1) || IsMouseReleased(1)))
|
||||
tab_bar->NextSelectedTabId = tab_bar->WantFocusTabId = id;
|
||||
tab_bar->NextSelectedTabId = id;
|
||||
|
||||
if (tab_bar->Flags & ImGuiTabBarFlags_NoCloseWithMiddleMouseButton)
|
||||
flags |= ImGuiTabItemFlags_NoCloseWithMiddleMouseButton;
|
||||
|
Reference in New Issue
Block a user