1
0
Fork 0
mirror of https://github.com/ocornut/imgui.git synced 2026-01-11 00:04:24 +00:00

TreeNode: rename/rework ImGuiNavTreeNodeData system to be usable by more features. (#2920, #1131, #7553)

Reworked to it is easier during TreeNode code to request extra data to be stored.
This commit is contained in:
ocornut 2024-07-03 18:25:01 +02:00
parent 0a73c6ec3f
commit 2d0baaabe6
4 changed files with 57 additions and 32 deletions

View file

@ -953,6 +953,7 @@ static void ShowDemoWindowWidgets()
ImGui::CheckboxFlags("ImGuiTreeNodeFlags_SpanAllColumns", &base_flags, ImGuiTreeNodeFlags_SpanAllColumns); ImGui::SameLine(); HelpMarker("For use in Tables only.");
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_NavLeftJumpsBackHere", &base_flags, ImGuiTreeNodeFlags_NavLeftJumpsBackHere);
ImGui::Checkbox("Align label with current X position", &align_label_with_current_x_position);
ImGui::Checkbox("Test tree node as drag source", &test_drag_and_drop);
ImGui::Text("Hello!");
@ -985,7 +986,7 @@ static void ShowDemoWindowWidgets()
ImGui::Text("This is a drag and drop source");
ImGui::EndDragDropSource();
}
if (i == 2)
if (i == 2 && (base_flags & ImGuiTreeNodeFlags_SpanTextWidth))
{
// Item 2 has an additional inline button to help demonstrate SpanTextWidth.
ImGui::SameLine();
@ -994,6 +995,8 @@ static void ShowDemoWindowWidgets()
if (node_open)
{
ImGui::BulletText("Blah blah\nBlah Blah");
ImGui::SameLine();
ImGui::SmallButton("Button");
ImGui::TreePop();
}
}