mirror of
https://github.com/ocornut/imgui.git
synced 2026-01-11 00:04:24 +00:00
Handle SameLine () with Separator ()
This commit is contained in:
parent
fbf45ad149
commit
7a6c25d95c
1 changed files with 6 additions and 1 deletions
|
|
@ -1465,15 +1465,20 @@ void ImGui::Separator()
|
||||||
if (window->SkipItems)
|
if (window->SkipItems)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
bool same_line = window->DC.IsSameLine;
|
||||||
|
|
||||||
// Those flags should eventually be configurable by the user
|
// Those flags should eventually be configurable by the user
|
||||||
// FIXME: We cannot g.Style.SeparatorTextBorderSize for thickness as it relates to SeparatorText() which is a decorated separator, not defaulting to 1.0f.
|
// FIXME: We cannot g.Style.SeparatorTextBorderSize for thickness as it relates to SeparatorText() which is a decorated separator, not defaulting to 1.0f.
|
||||||
ImGuiSeparatorFlags flags = (window->DC.LayoutType == ImGuiLayoutType_Horizontal) ? ImGuiSeparatorFlags_Vertical : ImGuiSeparatorFlags_Horizontal;
|
ImGuiSeparatorFlags flags = (window->DC.LayoutType == ImGuiLayoutType_Horizontal || same_line) ? ImGuiSeparatorFlags_Vertical : ImGuiSeparatorFlags_Horizontal;
|
||||||
|
|
||||||
// Only applies to legacy Columns() api as they relied on Separator() a lot.
|
// Only applies to legacy Columns() api as they relied on Separator() a lot.
|
||||||
if (window->DC.CurrentColumns)
|
if (window->DC.CurrentColumns)
|
||||||
flags |= ImGuiSeparatorFlags_SpanAllColumns;
|
flags |= ImGuiSeparatorFlags_SpanAllColumns;
|
||||||
|
|
||||||
SeparatorEx(flags, 1.0f);
|
SeparatorEx(flags, 1.0f);
|
||||||
|
|
||||||
|
if (same_line)
|
||||||
|
SameLine ();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ImGui::SeparatorTextEx(ImGuiID id, const char* label, const char* label_end, float extra_w)
|
void ImGui::SeparatorTextEx(ImGuiID id, const char* label, const char* label_end, float extra_w)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue