Version: latest
Branch: docking
Back-ends: any
Compiler: any
Operating System: any
This is a follow-up to my previous issue #4850.
Attached is a patch to prevent the separator line under the tab-bar from being drawn in case the user doesn't want it.
And also adds the option to the imgui_demo.
Please consider for inclusion.
Thanks for ImGui!
Regards.

diff --git a/imgui.h b/imgui.h
index ceb3b086d..ace89ebc1 100644
--- a/imgui.h
+++ b/imgui.h
@@ -1144,6 +1144,7 @@ enum ImGuiTabBarFlags_
ImGuiTabBarFlags_NoTooltip = 1 << 5, // Disable tooltips when hovering a tab
ImGuiTabBarFlags_FittingPolicyResizeDown = 1 << 6, // Resize tabs when they don't fit
ImGuiTabBarFlags_FittingPolicyScroll = 1 << 7, // Add scroll buttons when tabs don't fit
+ ImGuiTabBarFlags_NoBaseSeparator = 1 << 8, // Disable drawing the separator line at the base of tabs
ImGuiTabBarFlags_FittingPolicyMask_ = ImGuiTabBarFlags_FittingPolicyResizeDown | ImGuiTabBarFlags_FittingPolicyScroll,
ImGuiTabBarFlags_FittingPolicyDefault_ = ImGuiTabBarFlags_FittingPolicyResizeDown
};
diff --git a/imgui_demo.cpp b/imgui_demo.cpp
index 5d6779e9a..24b4c6e30 100644
--- a/imgui_demo.cpp
+++ b/imgui_demo.cpp
@@ -1592,6 +1592,7 @@ static void ShowDemoWindowWidgets()
tab_bar_flags &= ~(ImGuiTabBarFlags_FittingPolicyMask_ ^ ImGuiTabBarFlags_FittingPolicyResizeDown);
if (ImGui::CheckboxFlags("ImGuiTabBarFlags_FittingPolicyScroll", &tab_bar_flags, ImGuiTabBarFlags_FittingPolicyScroll))
tab_bar_flags &= ~(ImGuiTabBarFlags_FittingPolicyMask_ ^ ImGuiTabBarFlags_FittingPolicyScroll);
+ ImGui::CheckboxFlags("ImGuiTabBarFlags_NoBaseSeparator", &tab_bar_flags, ImGuiTabBarFlags_NoBaseSeparator);
// Tab Bar
const char* names[4] = { "Artichoke", "Beetroot", "Celery", "Daikon" };
@@ -1644,6 +1645,7 @@ static void ShowDemoWindowWidgets()
tab_bar_flags &= ~(ImGuiTabBarFlags_FittingPolicyMask_ ^ ImGuiTabBarFlags_FittingPolicyResizeDown);
if (ImGui::CheckboxFlags("ImGuiTabBarFlags_FittingPolicyScroll", &tab_bar_flags, ImGuiTabBarFlags_FittingPolicyScroll))
tab_bar_flags &= ~(ImGuiTabBarFlags_FittingPolicyMask_ ^ ImGuiTabBarFlags_FittingPolicyScroll);
+ ImGui::CheckboxFlags("ImGuiTabBarFlags_NoBaseSeparator", &tab_bar_flags, ImGuiTabBarFlags_NoBaseSeparator);
if (ImGui::BeginTabBar("MyTabBar", tab_bar_flags))
{
diff --git a/imgui_widgets.cpp b/imgui_widgets.cpp
index 89e3681e4..213b26632 100644
--- a/imgui_widgets.cpp
+++ b/imgui_widgets.cpp
@@ -7333,20 +7333,24 @@ bool ImGui::BeginTabBarEx(ImGuiTabBar* tab_bar, const ImRect& tab_bar_bb, ImG
window->DC.CursorPos = ImVec2(tab_bar->BarRect.Min.x, tab_bar->BarRect.Max.y + tab_bar->ItemSpacingY);
// Draw separator
- const ImU32 col = GetColorU32((flags & ImGuiTabBarFlags_IsFocused) ? ImGuiCol_TabActive : ImGuiCol_TabUnfocusedActive);
- const float y = tab_bar->BarRect.Max.y - 1.0f;
- if (dock_node != NULL)
+ if ((flags & ImGuiTabBarFlags_NoBaseSeparator) == 0)
{
- const float separator_min_x = dock_node->Pos.x + window->WindowBorderSize;
- const float separator_max_x = dock_node->Pos.x + dock_node->Size.x - window->WindowBorderSize;
- window->DrawList->AddLine(ImVec2(separator_min_x, y), ImVec2(separator_max_x, y), col, 1.0f);
- }
- else
- {
- const float separator_min_x = tab_bar->BarRect.Min.x - IM_FLOOR(window->WindowPadding.x * 0.5f);
- const float separator_max_x = tab_bar->BarRect.Max.x + IM_FLOOR(window->WindowPadding.x * 0.5f);
- window->DrawList->AddLine(ImVec2(separator_min_x, y), ImVec2(separator_max_x, y), col, 1.0f);
+ const ImU32 col = GetColorU32((flags & ImGuiTabBarFlags_IsFocused) ? ImGuiCol_TabActive : ImGuiCol_TabUnfocusedActive);
+ const float y = tab_bar->BarRect.Max.y - 1.0f;
+ if (dock_node != NULL)
+ {
+ const float separator_min_x = dock_node->Pos.x + window->WindowBorderSize;
+ const float separator_max_x = dock_node->Pos.x + dock_node->Size.x - window->WindowBorderSize;
+ window->DrawList->AddLine(ImVec2(separator_min_x, y), ImVec2(separator_max_x, y), col, 1.0f);
+ }
+ else
+ {
+ const float separator_min_x = tab_bar->BarRect.Min.x - IM_FLOOR(window->WindowPadding.x * 0.5f);
+ const float separator_max_x = tab_bar->BarRect.Max.x + IM_FLOOR(window->WindowPadding.x * 0.5f);
+ window->DrawList->AddLine(ImVec2(separator_min_x, y), ImVec2(separator_max_x, y), col, 1.0f);
+ }
}
+
return true;
}
Version: latest
Branch: docking
Back-ends: any
Compiler: any
Operating System: any
This is a follow-up to my previous issue #4850.
Attached is a patch to prevent the separator line under the tab-bar from being drawn in case the user doesn't want it.
And also adds the option to the imgui_demo.
Please consider for inclusion.
Thanks for ImGui!
Regards.