1
0
Fork 0
mirror of https://github.com/ocornut/imgui.git synced 2026-01-27 02:40:05 +00:00

Merge branch 'master' into docking

# Conflicts:
#	backends/imgui_impl_sdlgpu3.cpp
#	backends/imgui_impl_win32.cpp
This commit is contained in:
ocornut 2025-12-03 13:35:35 +01:00
commit 42e91c3155
15 changed files with 211 additions and 71 deletions

View file

@ -2616,7 +2616,7 @@ struct ExampleDualListBox
{
const int* a = (const int*)lhs;
const int* b = (const int*)rhs;
return (*a - *b);
return *a - *b;
}
void SortItems(int n)
{
@ -2949,7 +2949,7 @@ static void DemoWindowWidgetsSelectionAndMultiSelect(ImGuiDemoWindowData* demo_d
const int ITEMS_COUNT = 10000;
ImGui::Text("Selection: %d/%d", selection.Size, ITEMS_COUNT);
if (ImGui::BeginTable("##Basket", 2, ImGuiTableFlags_ScrollY | ImGuiTableFlags_RowBg | ImGuiTableFlags_BordersOuter))
if (ImGui::BeginTable("##Basket", 2, ImGuiTableFlags_ScrollY | ImGuiTableFlags_RowBg | ImGuiTableFlags_BordersOuter, ImVec2(0.0f, ImGui::GetFontSize() * 20)))
{
ImGui::TableSetupColumn("Object");
ImGui::TableSetupColumn("Action");
@ -2970,6 +2970,7 @@ static void DemoWindowWidgetsSelectionAndMultiSelect(ImGuiDemoWindowData* demo_d
{
ImGui::TableNextRow();
ImGui::TableNextColumn();
ImGui::PushID(n);
char label[64];
sprintf(label, "Object %05d: %s", n, ExampleNames[n % IM_ARRAYSIZE(ExampleNames)]);
bool item_is_selected = selection.Contains((ImGuiID)n);
@ -2977,6 +2978,7 @@ static void DemoWindowWidgetsSelectionAndMultiSelect(ImGuiDemoWindowData* demo_d
ImGui::Selectable(label, item_is_selected, ImGuiSelectableFlags_SpanAllColumns | ImGuiSelectableFlags_AllowOverlap);
ImGui::TableNextColumn();
ImGui::SmallButton("hello");
ImGui::PopID();
}
}
@ -4170,6 +4172,7 @@ static void DemoWindowWidgetsTreeNodes()
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_FramePadding", &base_flags, ImGuiTreeNodeFlags_FramePadding);
ImGui::CheckboxFlags("ImGuiTreeNodeFlags_NavLeftJumpsToParent", &base_flags, ImGuiTreeNodeFlags_NavLeftJumpsToParent);
HelpMarker("Default option for DrawLinesXXX is stored in style.TreeLinesFlags");
@ -4834,7 +4837,7 @@ static void DemoWindowLayout()
// Tree
// (here the node appears after a button and has odd intent, so we use ImGuiTreeNodeFlags_DrawLinesNone to disable hierarchy outline)
const float spacing = ImGui::GetStyle().ItemInnerSpacing.x;
ImGui::Button("Button##1");
ImGui::Button("Button##1"); // Will make line higher
ImGui::SameLine(0.0f, spacing);
if (ImGui::TreeNodeEx("Node##1", ImGuiTreeNodeFlags_DrawLinesNone))
{
@ -4844,14 +4847,22 @@ static void DemoWindowLayout()
ImGui::TreePop();
}
const float padding = (float)(int)(ImGui::GetFontSize() * 1.20f); // Large padding
ImGui::PushStyleVarY(ImGuiStyleVar_FramePadding, padding);
ImGui::Button("Button##2");
ImGui::PopStyleVar();
ImGui::SameLine(0.0f, spacing);
if (ImGui::TreeNodeEx("Node##2", ImGuiTreeNodeFlags_DrawLinesNone))
ImGui::TreePop();
// Vertically align text node a bit lower so it'll be vertically centered with upcoming widget.
// Otherwise you can use SmallButton() (smaller fit).
ImGui::AlignTextToFramePadding();
// Common mistake to avoid: if we want to SameLine after TreeNode we need to do it before we add
// other contents below the node.
bool node_open = ImGui::TreeNode("Node##2");
ImGui::SameLine(0.0f, spacing); ImGui::Button("Button##2");
// other contents "inside" the node.
bool node_open = ImGui::TreeNode("Node##3");
ImGui::SameLine(0.0f, spacing); ImGui::Button("Button##3");
if (node_open)
{
// Placeholder tree data
@ -4861,13 +4872,13 @@ static void DemoWindowLayout()
}
// Bullet
ImGui::Button("Button##3");
ImGui::Button("Button##4");
ImGui::SameLine(0.0f, spacing);
ImGui::BulletText("Bullet text");
ImGui::AlignTextToFramePadding();
ImGui::BulletText("Node");
ImGui::SameLine(0.0f, spacing); ImGui::Button("Button##4");
ImGui::SameLine(0.0f, spacing); ImGui::Button("Button##5");
ImGui::Unindent();
}
@ -5631,7 +5642,7 @@ struct MyItem
// qsort() is instable so always return a way to differentiate items.
// Your own compare function may want to avoid fallback on implicit sort specs.
// e.g. a Name compare if it wasn't already part of the sort specs.
return (a->ID - b->ID);
return a->ID - b->ID;
}
};
const ImGuiTableSortSpecs* MyItem::s_current_sort_specs = NULL;
@ -6595,7 +6606,7 @@ static void DemoWindowTables()
ImGui::TableNextColumn();
ImGui::Text("A0 Row 0");
{
float rows_height = TEXT_BASE_HEIGHT * 2;
float rows_height = (TEXT_BASE_HEIGHT * 2.0f) + (ImGui::GetStyle().CellPadding.y * 2.0f);
if (ImGui::BeginTable("table_nested2", 2, ImGuiTableFlags_Borders | ImGuiTableFlags_Resizable | ImGuiTableFlags_Reorderable | ImGuiTableFlags_Hideable))
{
ImGui::TableSetupColumn("B0");
@ -6637,7 +6648,7 @@ static void DemoWindowTables()
{
for (int row = 0; row < 8; row++)
{
float min_row_height = (float)(int)(TEXT_BASE_HEIGHT * 0.30f * row);
float min_row_height = (float)(int)(TEXT_BASE_HEIGHT * 0.30f * row + ImGui::GetStyle().CellPadding.y * 2.0f);
ImGui::TableNextRow(ImGuiTableRowFlags_None, min_row_height);
ImGui::TableNextColumn();
ImGui::Text("min_row_height = %.2f", min_row_height);
@ -6741,9 +6752,10 @@ static void DemoWindowTables()
ImGui::SameLine();
if (ImGui::BeginTable("table3", 3, ImGuiTableFlags_Borders | ImGuiTableFlags_RowBg, ImVec2(TEXT_BASE_WIDTH * 30, 0.0f)))
{
const float rows_height = TEXT_BASE_HEIGHT * 1.5f + ImGui::GetStyle().CellPadding.y * 2.0f;
for (int row = 0; row < 3; row++)
{
ImGui::TableNextRow(0, TEXT_BASE_HEIGHT * 1.5f);
ImGui::TableNextRow(0, rows_height);
for (int column = 0; column < 3; column++)
{
ImGui::TableNextColumn();
@ -10828,7 +10840,7 @@ struct ExampleAsset
if (delta < 0)
return (sort_spec->SortDirection == ImGuiSortDirection_Ascending) ? -1 : +1;
}
return ((int)a->ID - (int)b->ID);
return (int)a->ID - (int)b->ID;
}
};
const ImGuiTableSortSpecs* ExampleAsset::s_current_sort_specs = NULL;