mirror of
https://github.com/ocornut/imgui.git
synced 2026-02-28 06:15:13 +00:00
TabBar: expose NextScrollToTabId to internal API.
This commit is contained in:
@@ -3026,7 +3026,7 @@ struct ImGuiTabItem
|
||||
ImGuiWindow* Window; // When TabItem is part of a DockNode's TabBar, we hold on to a window.
|
||||
int LastFrameVisible;
|
||||
int LastFrameSelected; // This allows us to infer an ordered list of the last activated tabs with little maintenance
|
||||
float Offset; // Position relative to beginning of tab
|
||||
float Offset; // Position relative to beginning of tab bar
|
||||
float Width; // Width currently displayed
|
||||
float ContentWidth; // Width of label + padding, stored during BeginTabItem() call (misnamed as "Content" would normally imply width of label only)
|
||||
float RequestedWidth; // Width optionally requested by caller, -1.0f is unused
|
||||
@@ -3047,6 +3047,7 @@ struct IMGUI_API ImGuiTabBar
|
||||
ImGuiID ID; // Zero for tab-bars used by docking
|
||||
ImGuiID SelectedTabId; // Selected tab/window
|
||||
ImGuiID NextSelectedTabId; // Next selected tab/window. Will also trigger a scrolling animation
|
||||
ImGuiID NextScrollToTabId;
|
||||
ImGuiID VisibleTabId; // Can occasionally be != SelectedTabId (e.g. when previewing contents for Ctrl+Tab preview)
|
||||
int CurrFrameVisible;
|
||||
int PrevFrameVisible;
|
||||
|
||||
@@ -9816,6 +9816,11 @@ static void ImGui::TabBarLayout(ImGuiTabBar* tab_bar)
|
||||
|
||||
// Setup next selected tab
|
||||
ImGuiID scroll_to_tab_id = 0;
|
||||
if (tab_bar->NextScrollToTabId)
|
||||
{
|
||||
scroll_to_tab_id = tab_bar->NextScrollToTabId;
|
||||
tab_bar->NextScrollToTabId = 0;
|
||||
}
|
||||
if (tab_bar->NextSelectedTabId)
|
||||
{
|
||||
tab_bar->SelectedTabId = tab_bar->NextSelectedTabId;
|
||||
|
||||
Reference in New Issue
Block a user