You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Added BETA api for Tab Bar/Tabs widgets. (ocornut#261, ocornut#351) (merged this feature from the from Docking branch so it can be used earlier as as standalone feature)
- Added BeginTabBar(), EndTabBar(), BeginTabItem(), EndTabItem(), SetTabItemClosed() API.
- Added ImGuiTabBarFlags flags for BeginTabBar().
- Added ImGuiTabItemFlags flags for BeginTabItem().
- Style: Added ImGuiCol_Tab, ImGuiCol_TabHovered, ImGuiCol_TabActive, ImGuiCol_TabUnfocused, ImGuiCol_TabUnfocusedActive colors.
- Demo: Added Layout->Tabs demo code.
- Demo: Added "Documents" example app showcasing possible use for tabs.
Copy file name to clipboardExpand all lines: imgui.cpp
+55-13
Original file line number
Diff line number
Diff line change
@@ -1015,6 +1015,8 @@ ImGuiStyle::ImGuiStyle()
1015
1015
ScrollbarRounding = 9.0f; // Radius of grab corners rounding for scrollbar
1016
1016
GrabMinSize = 10.0f; // Minimum width/height of a grab box for slider/scrollbar
1017
1017
GrabRounding = 0.0f; // Radius of grabs corners rounding. Set to 0.0f to have rectangular slider grabs.
1018
+
TabRounding = 4.0f; // Radius of upper corners of a tab. Set to 0.0f to have rectangular tabs.
1019
+
TabBorderSize = 0.0f; // Thickness of border around tabs.
1018
1020
ButtonTextAlign = ImVec2(0.5f,0.5f);// Alignment of button text when button is larger than text.
1019
1021
DisplayWindowPadding = ImVec2(19,19); // Window position are clamped to be visible within the display area by at least this amount. Only applies to regular windows.
1020
1022
DisplaySafeAreaPadding = ImVec2(3,3); // If you cannot see the edge of your screen (e.g. on a TV) increase the safe area padding. Covers popups/tooltips as well regular windows.
IMGUI_API voidSetColumnOffset(int column_index, float offset_x); // set position of column line (in pixels, from the left side of the contents region). pass -1 to use current column
529
531
IMGUI_API intGetColumnsCount();
530
532
533
+
// Tab Bars, Tabs
534
+
// [BETA API] API may evolve!
535
+
IMGUI_API boolBeginTabBar(constchar* str_id, ImGuiTabBarFlags flags = 0); // create and append into a TabBar
536
+
IMGUI_API voidEndTabBar();
537
+
IMGUI_API boolBeginTabItem(constchar* label, bool* p_open = NULL, ImGuiTabItemFlags flags = 0);// create a Tab. Returns true if the Tab is selected.
538
+
IMGUI_API voidEndTabItem(); // only call EndTabItem() if BeginTabItem() returns true!
539
+
IMGUI_API voidSetTabItemClosed(constchar* tab_or_docked_window_label); // notify TabBar or Docking system of a closed tab/window ahead (useful to reduce visual flicker on reorderable tab bars). For tab-bar: call after BeginTabBar() and before Tab submissions. Otherwise call with a window name.
540
+
531
541
// Logging/Capture: all text output from interface is captured to tty/file/clipboard. By default, tree nodes are automatically opened during logging.
532
542
IMGUI_API voidLogToTTY(int max_depth = -1); // start logging to tty
ImGuiTabBarFlags_Reorderable = 1 << 0, // Allow manually dragging tabs to re-order them + New tabs are appended at the end of list
778
+
ImGuiTabBarFlags_AutoSelectNewTabs = 1 << 1, // Automatically select new tabs when they appear
779
+
ImGuiTabBarFlags_NoCloseWithMiddleMouseButton = 1 << 2, // Disable behavior of closing tabs (that are submitted with p_open != NULL) with middle mouse button. You can still repro this behavior on user's side with if (IsItemHovered() && IsMouseClicked(2)) *p_open = false.
ImGuiTabItemFlags_UnsavedDocument = 1 << 0, // Append '*' to title without affecting the ID, as a convenience to avoid using the ### operator. Also: tab is selected on closure and closure is deferred by one frame to allow code to undo it without flicker.
793
+
ImGuiTabItemFlags_SetSelected = 1 << 1, // Trigger flag to programatically make the tab selected when calling BeginTabItem()
794
+
ImGuiTabItemFlags_NoCloseWithMiddleMouseButton = 1 << 2, // Disable behavior of closing tabs (that are submitted with p_open != NULL) with middle mouse button. You can still repro this behavior on user's side with if (IsItemHovered() && IsMouseClicked(2)) *p_open = false.
795
+
ImGuiTabItemFlags_NoPushId = 1 << 3// Don't call PushID(tab->ID)/PopID() on BeginTabItem()/EndTabItem()
float ScrollbarRounding; // Radius of grab corners for scrollbar.
1115
1156
float GrabMinSize; // Minimum width/height of a grab box for slider/scrollbar.
1116
1157
float GrabRounding; // Radius of grabs corners rounding. Set to 0.0f to have rectangular slider grabs.
1158
+
float TabRounding; // Radius of upper corners of a tab. Set to 0.0f to have rectangular tabs.
1159
+
float TabBorderSize; // Thickness of border around tabs.
1117
1160
ImVec2 ButtonTextAlign; // Alignment of button text when button is larger than text. Defaults to (0.5f,0.5f) for horizontally+vertically centered.
1118
1161
ImVec2 DisplayWindowPadding; // Window position are clamped to be visible within the display area by at least this amount. Only applies to regular windows.
1119
1162
ImVec2 DisplaySafeAreaPadding; // If you cannot see the edges of your screen (e.g. on a TV) increase the safe area padding. Apply to popups/tooltips as well regular windows. NB: Prefer configuring your TV sets correctly!
0 commit comments