Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions imgui.h
Original file line number Diff line number Diff line change
Expand Up @@ -1309,13 +1309,14 @@ enum ImGuiTreeNodeFlags_
ImGuiTreeNodeFlags_LabelSpanAllColumns = 1 << 15, // Label will span all columns of its container table
//ImGuiTreeNodeFlags_NoScrollOnOpen = 1 << 16, // FIXME: TODO: Disable automatic scroll on TreePop() if node got just open and contents is not visible
ImGuiTreeNodeFlags_NavLeftJumpsToParent = 1 << 17, // Nav: left arrow moves back to parent. This is processed in TreePop() when there's an unfulfilled Left nav request remaining.
ImGuiTreeNodeFlags_NoFrameOuterPadding = 1 << 18, // Don't apply outer padding on the header's frame so that it aligns with the contents.
ImGuiTreeNodeFlags_CollapsingHeader = ImGuiTreeNodeFlags_Framed | ImGuiTreeNodeFlags_NoTreePushOnOpen | ImGuiTreeNodeFlags_NoAutoOpenOnLog,

// [EXPERIMENTAL] Draw lines connecting TreeNode hierarchy. Discuss in GitHub issue #2920.
// Default value is pulled from style.TreeLinesFlags. May be overridden in TreeNode calls.
ImGuiTreeNodeFlags_DrawLinesNone = 1 << 18, // No lines drawn
ImGuiTreeNodeFlags_DrawLinesFull = 1 << 19, // Horizontal lines to child nodes. Vertical line drawn down to TreePop() position: cover full contents. Faster (for large trees).
ImGuiTreeNodeFlags_DrawLinesToNodes = 1 << 20, // Horizontal lines to child nodes. Vertical line drawn down to bottom-most child node. Slower (for large trees).
ImGuiTreeNodeFlags_DrawLinesNone = 1 << 19, // No lines drawn
ImGuiTreeNodeFlags_DrawLinesFull = 1 << 20, // Horizontal lines to child nodes. Vertical line drawn down to TreePop() position: cover full contents. Faster (for large trees).
ImGuiTreeNodeFlags_DrawLinesToNodes = 1 << 21, // Horizontal lines to child nodes. Vertical line drawn down to bottom-most child node. Slower (for large trees).

#ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS
ImGuiTreeNodeFlags_NavLeftJumpsBackHere = ImGuiTreeNodeFlags_NavLeftJumpsToParent, // Renamed in 1.92.0
Expand Down
9 changes: 8 additions & 1 deletion imgui_demo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1057,10 +1057,16 @@ static void DemoWindowWidgetsCollapsingHeaders()
IMGUI_DEMO_MARKER("Widgets/Collapsing Headers");
if (ImGui::TreeNode("Collapsing Headers"))
{
static bool no_outer_padding = false;
ImGuiTreeNodeFlags flags = ImGuiTreeNodeFlags_None;
if (no_outer_padding)
flags |= ImGuiTreeNodeFlags_NoFrameOuterPadding;

static bool closable_group = true;
ImGui::Checkbox("Show 2nd header", &closable_group);
if (ImGui::CollapsingHeader("Header", ImGuiTreeNodeFlags_None))
if (ImGui::CollapsingHeader("Header", flags))
{
ImGui::Checkbox("Remove header outer padding", &no_outer_padding);
ImGui::Text("IsItemHovered: %d", ImGui::IsItemHovered());
for (int i = 0; i < 5; i++)
ImGui::Text("Some content %d", i);
Expand Down Expand Up @@ -4095,6 +4101,7 @@ static void DemoWindowWidgetsTreeNodes()
ImGui::CheckboxFlags("ImGuiTreeNodeFlags_AllowOverlap", &base_flags, ImGuiTreeNodeFlags_AllowOverlap);
ImGui::CheckboxFlags("ImGuiTreeNodeFlags_Framed", &base_flags, ImGuiTreeNodeFlags_Framed); ImGui::SameLine(); HelpMarker("Draw frame with background (e.g. for CollapsingHeader)");
ImGui::CheckboxFlags("ImGuiTreeNodeFlags_FramePadding", &base_flags, ImGuiTreeNodeFlags_FramePadding);
ImGui::CheckboxFlags("ImGuiTreeNodeFlags_NoFrameOuterPadding", &base_flags, ImGuiTreeNodeFlags_NoFrameOuterPadding);
ImGui::CheckboxFlags("ImGuiTreeNodeFlags_NavLeftJumpsToParent", &base_flags, ImGuiTreeNodeFlags_NavLeftJumpsToParent);

HelpMarker("Default option for DrawLinesXXX is stored in style.TreeLinesFlags");
Expand Down
2 changes: 1 addition & 1 deletion imgui_widgets.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6844,7 +6844,7 @@ bool ImGui::TreeNodeBehavior(ImGuiID id, ImGuiTreeNodeFlags flags, const char* l
frame_bb.Min.y = window->DC.CursorPos.y + (text_offset_y - padding.y);
frame_bb.Max.x = span_all_columns ? window->ParentWorkRect.Max.x : (flags & ImGuiTreeNodeFlags_SpanLabelWidth) ? window->DC.CursorPos.x + text_width + padding.x : window->WorkRect.Max.x;
frame_bb.Max.y = window->DC.CursorPos.y + (text_offset_y - padding.y) + frame_height;
if (display_frame)
if (display_frame && !(flags & ImGuiTreeNodeFlags_NoFrameOuterPadding))
{
const float outer_extend = IM_TRUNC(window->WindowPadding.x * 0.5f); // Framed header expand a little outside of current limits
frame_bb.Min.x -= outer_extend;
Expand Down