mirror of
https://github.com/ocornut/imgui.git
synced 2026-11-06 06:25:54 +01:00
TreeNode: minor tidying up.
(should have no side-effect)
This commit is contained in:
parent
1069a952e0
commit
80d572ce35
@ -4430,6 +4430,7 @@ static void DemoWindowWidgetsTreeNodes()
|
|||||||
ImGui::CheckboxFlags("ImGuiTreeNodeFlags_Framed", &base_flags, ImGuiTreeNodeFlags_Framed); ImGui::SameLine(); HelpMarker("Draw frame with background (e.g. for CollapsingHeader)");
|
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_FramePadding", &base_flags, ImGuiTreeNodeFlags_FramePadding);
|
||||||
ImGui::CheckboxFlags("ImGuiTreeNodeFlags_NavLeftJumpsToParent", &base_flags, ImGuiTreeNodeFlags_NavLeftJumpsToParent);
|
ImGui::CheckboxFlags("ImGuiTreeNodeFlags_NavLeftJumpsToParent", &base_flags, ImGuiTreeNodeFlags_NavLeftJumpsToParent);
|
||||||
|
ImGui::CheckboxFlags("ImGuiTreeNodeFlags_Bullet", &base_flags, ImGuiTreeNodeFlags_Bullet);
|
||||||
|
|
||||||
HelpMarker("Default option for DrawLinesXXX is stored in style.TreeLinesFlags");
|
HelpMarker("Default option for DrawLinesXXX is stored in style.TreeLinesFlags");
|
||||||
ImGui::CheckboxFlags("ImGuiTreeNodeFlags_DrawLinesNone", &base_flags, ImGuiTreeNodeFlags_DrawLinesNone);
|
ImGui::CheckboxFlags("ImGuiTreeNodeFlags_DrawLinesNone", &base_flags, ImGuiTreeNodeFlags_DrawLinesNone);
|
||||||
|
|||||||
@ -7041,9 +7041,10 @@ bool ImGui::TreeNodeBehavior(ImGuiID id, ImGuiTreeNodeFlags flags, const char* l
|
|||||||
label_end = FindRenderedTextEnd(label);
|
label_end = FindRenderedTextEnd(label);
|
||||||
const ImVec2 label_size = CalcTextSize(label, label_end, false);
|
const ImVec2 label_size = CalcTextSize(label, label_end, false);
|
||||||
|
|
||||||
const float text_offset_x = g.FontSize + (display_frame ? padding.x * 3 : padding.x * 2); // Collapsing arrow width + Spacing
|
const float icon_width = g.FontSize + padding.x * 2;
|
||||||
|
const float text_offset_x = display_frame ? icon_width + padding.x : icon_width; // Collapsing arrow width + Spacing
|
||||||
const float text_offset_y = use_frame_padding ? ImMax(style.FramePadding.y, window->DC.CurrLineTextBaseOffset) : window->DC.CurrLineTextBaseOffset; // Latch before ItemSize changes it
|
const float text_offset_y = use_frame_padding ? ImMax(style.FramePadding.y, window->DC.CurrLineTextBaseOffset) : window->DC.CurrLineTextBaseOffset; // Latch before ItemSize changes it
|
||||||
const float text_width = g.FontSize + label_size.x + padding.x * 2; // Include collapsing arrow
|
const float text_width = icon_width + label_size.x; // Include collapsing arrow
|
||||||
|
|
||||||
const float frame_height = label_size.y + padding.y * 2;
|
const float frame_height = label_size.y + padding.y * 2;
|
||||||
const bool span_all_columns = (flags & ImGuiTreeNodeFlags_SpanAllColumns) != 0 && (g.CurrentTable != NULL);
|
const bool span_all_columns = (flags & ImGuiTreeNodeFlags_SpanAllColumns) != 0 && (g.CurrentTable != NULL);
|
||||||
@ -7076,6 +7077,7 @@ bool ImGui::TreeNodeBehavior(ImGuiID id, ImGuiTreeNodeFlags flags, const char* l
|
|||||||
if (span_all_columns || span_all_columns_label)
|
if (span_all_columns || span_all_columns_label)
|
||||||
{
|
{
|
||||||
// Modify ClipRect for the ItemAdd(), faster than doing a PushColumnsBackground/PushTableBackgroundChannel for every Selectable..
|
// Modify ClipRect for the ItemAdd(), faster than doing a PushColumnsBackground/PushTableBackgroundChannel for every Selectable..
|
||||||
|
// FIXME: Investigate moving this to an item flag, along duplicate code in Selectable(). How to do optimally?
|
||||||
const float backup_clip_rect_min_x = window->ClipRect.Min.x;
|
const float backup_clip_rect_min_x = window->ClipRect.Min.x;
|
||||||
const float backup_clip_rect_max_x = window->ClipRect.Max.x;
|
const float backup_clip_rect_max_x = window->ClipRect.Max.x;
|
||||||
window->ClipRect.Min.x = window->ParentWorkRect.Min.x;
|
window->ClipRect.Min.x = window->ParentWorkRect.Min.x;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user