Tab Bar: Added TabItemButton(), ImGuiTabItemFlags_Leading, ImGuiTabItemFlags_Trailing + demo. (#3291)

(squashed various commits by 2 authors)
This commit is contained in:
Louis Schnellbach
2020-08-03 18:55:51 +02:00
committed by ocornut
parent 29836412e1
commit 4a57a982be
5 changed files with 264 additions and 50 deletions

View File

@ -1703,7 +1703,8 @@ enum ImGuiTabBarFlagsPrivate_
// Extend ImGuiTabItemFlags_
enum ImGuiTabItemFlagsPrivate_
{
ImGuiTabItemFlags_NoCloseButton = 1 << 20 // Track whether p_open was set or not (we'll need this info on the next frame to recompute ContentWidth during layout)
ImGuiTabItemFlags_NoCloseButton = 1 << 20, // Track whether p_open was set or not (we'll need this info on the next frame to recompute ContentWidth during layout)
ImGuiTabItemFlags_Button = 1 << 21 // [Internal] Used by TabItemButton, change the tab item behavior to mimic a button
};
// Storage for one active tab item (sizeof() 28~32 bytes)
@ -1737,7 +1738,8 @@ struct ImGuiTabBar
float LastTabContentHeight; // Record the height of contents submitted below the tab bar
float WidthAllTabs; // Actual width of all tabs (locked during layout)
float WidthAllTabsIdeal; // Ideal width if all tabs were visible and not clipped
float OffsetNextTab; // Distance from BarRect.Min.x, incremented with each BeginTabItem() call, not used if ImGuiTabBarFlags_Reorderable if set.
float LeadingWidth; // Total width used by leading button
float TrailingWidth; // Total width used by trailing button
float ScrollingAnim;
float ScrollingTarget;
float ScrollingTargetDistToVisibility;