|
@@ -1146,8 +1146,8 @@ void ImGui::Bullet()
|
|
// - Dummy()
|
|
// - Dummy()
|
|
// - NewLine()
|
|
// - NewLine()
|
|
// - AlignTextToFramePadding()
|
|
// - AlignTextToFramePadding()
|
|
|
|
+// - SeparatorEx() [Internal]
|
|
// - Separator()
|
|
// - Separator()
|
|
-// - VerticalSeparator() [Internal]
|
|
|
|
// - SplitterBehavior() [Internal]
|
|
// - SplitterBehavior() [Internal]
|
|
//-------------------------------------------------------------------------
|
|
//-------------------------------------------------------------------------
|
|
|
|
|
|
@@ -1198,69 +1198,75 @@ void ImGui::AlignTextToFramePadding()
|
|
}
|
|
}
|
|
|
|
|
|
// Horizontal/vertical separating line
|
|
// Horizontal/vertical separating line
|
|
-void ImGui::Separator()
|
|
|
|
|
|
+void ImGui::SeparatorEx(ImGuiSeparatorFlags flags)
|
|
{
|
|
{
|
|
ImGuiWindow* window = GetCurrentWindow();
|
|
ImGuiWindow* window = GetCurrentWindow();
|
|
if (window->SkipItems)
|
|
if (window->SkipItems)
|
|
return;
|
|
return;
|
|
- ImGuiContext& g = *GImGui;
|
|
|
|
|
|
|
|
- // Those flags should eventually be overrideable by the user
|
|
|
|
- ImGuiSeparatorFlags flags = (window->DC.LayoutType == ImGuiLayoutType_Horizontal) ? ImGuiSeparatorFlags_Vertical : ImGuiSeparatorFlags_Horizontal;
|
|
|
|
|
|
+ ImGuiContext& g = *GImGui;
|
|
IM_ASSERT(ImIsPowerOfTwo(flags & (ImGuiSeparatorFlags_Horizontal | ImGuiSeparatorFlags_Vertical))); // Check that only 1 option is selected
|
|
IM_ASSERT(ImIsPowerOfTwo(flags & (ImGuiSeparatorFlags_Horizontal | ImGuiSeparatorFlags_Vertical))); // Check that only 1 option is selected
|
|
|
|
+
|
|
if (flags & ImGuiSeparatorFlags_Vertical)
|
|
if (flags & ImGuiSeparatorFlags_Vertical)
|
|
{
|
|
{
|
|
- VerticalSeparator();
|
|
|
|
- return;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- // Horizontal Separator
|
|
|
|
- if (window->DC.CurrentColumns)
|
|
|
|
- PushColumnsBackground();
|
|
|
|
-
|
|
|
|
- float x1 = window->Pos.x;
|
|
|
|
- float x2 = window->Pos.x + window->Size.x;
|
|
|
|
- if (!window->DC.GroupStack.empty())
|
|
|
|
- x1 += window->DC.Indent.x;
|
|
|
|
|
|
+ // Vertical separator, for menu bars (use current line height). Not exposed because it is misleading and it doesn't have an effect on regular layout.
|
|
|
|
+ float y1 = window->DC.CursorPos.y;
|
|
|
|
+ float y2 = window->DC.CursorPos.y + window->DC.CurrentLineSize.y;
|
|
|
|
+ const ImRect bb(ImVec2(window->DC.CursorPos.x, y1), ImVec2(window->DC.CursorPos.x + 1.0f, y2));
|
|
|
|
+ ItemSize(ImVec2(1.0f, 0.0f));
|
|
|
|
+ if (!ItemAdd(bb, 0))
|
|
|
|
+ return;
|
|
|
|
|
|
- const ImRect bb(ImVec2(x1, window->DC.CursorPos.y), ImVec2(x2, window->DC.CursorPos.y+1.0f));
|
|
|
|
- ItemSize(ImVec2(0.0f, 1.0f)); // NB: we don't provide our width so that it doesn't get feed back into AutoFit
|
|
|
|
- if (!ItemAdd(bb, 0))
|
|
|
|
- {
|
|
|
|
- if (window->DC.CurrentColumns)
|
|
|
|
- PopColumnsBackground();
|
|
|
|
- return;
|
|
|
|
|
|
+ // Draw
|
|
|
|
+ window->DrawList->AddLine(ImVec2(bb.Min.x, bb.Min.y), ImVec2(bb.Min.x, bb.Max.y), GetColorU32(ImGuiCol_Separator));
|
|
|
|
+ if (g.LogEnabled)
|
|
|
|
+ LogText(" |");
|
|
}
|
|
}
|
|
|
|
+ else if (flags & ImGuiSeparatorFlags_Horizontal)
|
|
|
|
+ {
|
|
|
|
+ // Horizontal Separator
|
|
|
|
+ float x1 = window->Pos.x;
|
|
|
|
+ float x2 = window->Pos.x + window->Size.x;
|
|
|
|
+ if (!window->DC.GroupStack.empty())
|
|
|
|
+ x1 += window->DC.Indent.x;
|
|
|
|
|
|
- window->DrawList->AddLine(bb.Min, ImVec2(bb.Max.x,bb.Min.y), GetColorU32(ImGuiCol_Separator));
|
|
|
|
|
|
+ ImGuiColumns* columns = (flags & ImGuiSeparatorFlags_SpanAllColumns) ? window->DC.CurrentColumns : NULL;
|
|
|
|
+ if (columns)
|
|
|
|
+ PushColumnsBackground();
|
|
|
|
|
|
- if (g.LogEnabled)
|
|
|
|
- LogRenderedText(&bb.Min, "--------------------------------");
|
|
|
|
|
|
+ const ImRect bb(ImVec2(x1, window->DC.CursorPos.y), ImVec2(x2, window->DC.CursorPos.y + 1.0f));
|
|
|
|
+ ItemSize(ImVec2(0.0f, 1.0f)); // NB: we don't provide our width so that it doesn't get feed back into AutoFit
|
|
|
|
+ if (!ItemAdd(bb, 0))
|
|
|
|
+ {
|
|
|
|
+ if (columns)
|
|
|
|
+ PopColumnsBackground();
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
|
|
- if (window->DC.CurrentColumns)
|
|
|
|
- {
|
|
|
|
- PopColumnsBackground();
|
|
|
|
- window->DC.CurrentColumns->LineMinY = window->DC.CursorPos.y;
|
|
|
|
|
|
+ // Draw
|
|
|
|
+ window->DrawList->AddLine(bb.Min, ImVec2(bb.Max.x, bb.Min.y), GetColorU32(ImGuiCol_Separator));
|
|
|
|
+ if (g.LogEnabled)
|
|
|
|
+ LogRenderedText(&bb.Min, "--------------------------------");
|
|
|
|
+
|
|
|
|
+ if (columns)
|
|
|
|
+ {
|
|
|
|
+ PopColumnsBackground();
|
|
|
|
+ columns->LineMinY = window->DC.CursorPos.y;
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
-void ImGui::VerticalSeparator()
|
|
|
|
|
|
+void ImGui::Separator()
|
|
{
|
|
{
|
|
- ImGuiWindow* window = GetCurrentWindow();
|
|
|
|
- if (window->SkipItems)
|
|
|
|
- return;
|
|
|
|
ImGuiContext& g = *GImGui;
|
|
ImGuiContext& g = *GImGui;
|
|
-
|
|
|
|
- float y1 = window->DC.CursorPos.y;
|
|
|
|
- float y2 = window->DC.CursorPos.y + window->DC.CurrentLineSize.y;
|
|
|
|
- const ImRect bb(ImVec2(window->DC.CursorPos.x, y1), ImVec2(window->DC.CursorPos.x + 1.0f, y2));
|
|
|
|
- ItemSize(ImVec2(1.0f, 0.0f));
|
|
|
|
- if (!ItemAdd(bb, 0))
|
|
|
|
|
|
+ ImGuiWindow* window = g.CurrentWindow;
|
|
|
|
+ if (window->SkipItems)
|
|
return;
|
|
return;
|
|
|
|
|
|
- window->DrawList->AddLine(ImVec2(bb.Min.x, bb.Min.y), ImVec2(bb.Min.x, bb.Max.y), GetColorU32(ImGuiCol_Separator));
|
|
|
|
- if (g.LogEnabled)
|
|
|
|
- LogText(" |");
|
|
|
|
|
|
+ // Those flags should eventually be overridable by the user
|
|
|
|
+ ImGuiSeparatorFlags flags = (window->DC.LayoutType == ImGuiLayoutType_Horizontal) ? ImGuiSeparatorFlags_Vertical : ImGuiSeparatorFlags_Horizontal;
|
|
|
|
+ flags |= ImGuiSeparatorFlags_SpanAllColumns;
|
|
|
|
+ SeparatorEx(flags);
|
|
}
|
|
}
|
|
|
|
|
|
// Using 'hover_visibility_delay' allows us to hide the highlight and mouse cursor for a short time, which can be convenient to reduce visual noise.
|
|
// Using 'hover_visibility_delay' allows us to hide the highlight and mouse cursor for a short time, which can be convenient to reduce visual noise.
|