TabBar: added TabBarQueueFocus() by name for non-docking tab bars. (#8029, #6681)

This commit is contained in:
ocornut 2024-09-30 19:36:58 +02:00
parent 03f007d4cd
commit 655fcf8287
2 changed files with 8 additions and 0 deletions

View File

@ -3318,6 +3318,7 @@ namespace ImGui
IMGUI_API void TabBarRemoveTab(ImGuiTabBar* tab_bar, ImGuiID tab_id);
IMGUI_API void TabBarCloseTab(ImGuiTabBar* tab_bar, ImGuiTabItem* tab);
IMGUI_API void TabBarQueueFocus(ImGuiTabBar* tab_bar, ImGuiTabItem* tab);
IMGUI_API void TabBarQueueFocus(ImGuiTabBar* tab_bar, const char* tab_name);
IMGUI_API void TabBarQueueReorder(ImGuiTabBar* tab_bar, ImGuiTabItem* tab, int offset);
IMGUI_API void TabBarQueueReorderFromMousePos(ImGuiTabBar* tab_bar, ImGuiTabItem* tab, ImVec2 mouse_pos);
IMGUI_API bool TabBarProcessReorder(ImGuiTabBar* tab_bar);

View File

@ -9627,6 +9627,13 @@ void ImGui::TabBarQueueFocus(ImGuiTabBar* tab_bar, ImGuiTabItem* tab)
tab_bar->NextSelectedTabId = tab->ID;
}
void ImGui::TabBarQueueFocus(ImGuiTabBar* tab_bar, const char* tab_name)
{
IM_ASSERT((tab_bar->Flags & ImGuiTabBarFlags_DockNode) == 0); // Only supported for manual/explicit tab bars
ImGuiID tab_id = TabBarCalcTabID(tab_bar, tab_name);
tab_bar->NextSelectedTabId = tab_id;
}
void ImGui::TabBarQueueReorder(ImGuiTabBar* tab_bar, ImGuiTabItem* tab, int offset)
{
IM_ASSERT(offset != 0);