Tab Bar: Further simplification of section/clip rect handling. (#3291)

This commit is contained in:
ocornut
2020-09-22 16:14:04 +02:00
parent 6b76781c66
commit 1ec464eb9a
3 changed files with 38 additions and 51 deletions

View File

@ -1725,16 +1725,6 @@ struct ImGuiTabItem
ImGuiTabItem() { ID = 0; Flags = ImGuiTabItemFlags_None; LastFrameVisible = LastFrameSelected = -1; NameOffset = -1; Offset = Width = ContentWidth = 0.0f; BeginOrder = -1; IndexDuringLayout = -1; WantClose = false; }
};
struct ImGuiTabBarSection
{
int TabStartIndex; // Index of first tab in this section.
int TabCount; // Number of tabs in this section.
float Width; // Sum of width of tabs in this section (after shrinking down)
float Spacing; // Horizontal spacing at the end of the section.
ImGuiTabBarSection(){ memset(this, 0, sizeof(*this)); }
};
// Storage for a tab bar (sizeof() 92~96 bytes)
struct ImGuiTabBar
{
@ -1753,6 +1743,8 @@ struct ImGuiTabBar
float ScrollingTarget;
float ScrollingTargetDistToVisibility;
float ScrollingSpeed;
float ScrollingRectMinX;
float ScrollingRectMaxX;
ImGuiTabBarFlags Flags;
ImGuiID ReorderRequestTabId;
ImS8 ReorderRequestDir;
@ -1762,7 +1754,6 @@ struct ImGuiTabBar
bool TabsAddedNew; // Set to true when a new tab item or button has been added to the tab bar during last frame
short LastTabItemIdx; // Index of last BeginTabItem() tab for use by EndTabItem()
ImVec2 FramePadding; // style.FramePadding locked at the time of BeginTabBar()
ImGuiTabBarSection Sections[3]; // Layout sections: Leading, Central, Trailing
ImGuiTextBuffer TabsNames; // For non-docking tab bar we re-append names in a contiguous buffer.
ImGuiTabBar();