Merge branch 'master' into docking

# Conflicts:
#	backends/imgui_impl_dx10.cpp
#	backends/imgui_impl_dx12.cpp
#	backends/imgui_impl_metal.mm
#	backends/imgui_impl_metal4.mm
#	backends/imgui_impl_opengl2.cpp
#	backends/imgui_impl_opengl3.cpp
#	backends/imgui_impl_sdlgpu3.cpp
#	backends/imgui_impl_vulkan.cpp
#	imgui.cpp
This commit is contained in:
ocornut
2026-09-07 19:52:24 +02:00
18 changed files with 295 additions and 106 deletions

View File

@@ -87,6 +87,7 @@ Index of this file:
// [SECTION] DemoWindowWidgetsImages()
// [SECTION] DemoWindowWidgetsListBoxes()
// [SECTION] DemoWindowWidgetsLiveEdit()
// [SECTION] DemoWindowWidgetsMixedValues()
// [SECTION] DemoWindowWidgetsMultiComponents()
// [SECTION] DemoWindowWidgetsPlotting()
// [SECTION] DemoWindowWidgetsProgressBars()
@@ -2091,7 +2092,7 @@ static void DemoWindowWidgetsLiveEdit(ImGuiDemoWindowData* demo_data)
{
if (ImGui::TreeNode("Live Edit Flags"))
{
IMGUI_DEMO_MARKER("Widgets/Live Edit Flgs");
IMGUI_DEMO_MARKER("Widgets/Live Edit Flags");
ImGui::TextWrapped("Select whether to apply keyboard edits to backing variables _while_ typing.");
@@ -2121,6 +2122,61 @@ static void DemoWindowWidgetsLiveEdit(ImGuiDemoWindowData* demo_data)
}
}
//-----------------------------------------------------------------------------
// [SECTION] DemoWindowWidgetsMixedValues()
//-----------------------------------------------------------------------------
static void DemoWindowWidgetsMixedValues()
{
if (ImGui::TreeNode("Mixed Values"))
{
// This is designed for advanced property editors which are generally reusable and data-driven.
HelpMarker("Using ImGuiItemFlags_MixedValue.");
static float items[3] = { 12.0f, 0.0f, 0.0f };
float* item_ref = &items[0];
ImGui::SeparatorText("Scalar/Text Widgets");
const bool is_mixed = memcmp(&items[0], &items[1], sizeof(float)) != 0 || memcmp(&items[0], &items[2], sizeof(float)) != 0;
// Demonstrate Drags, Sliders, Inputs
ImGui::PushItemFlag(ImGuiItemFlags_MixedValue, is_mixed);
bool edited = false;
edited |= ImGui::DragFloat("DragFloat", item_ref);
edited |= ImGui::SliderFloat("SliderFloat", item_ref, 0.0f, 100.0f);
edited |= ImGui::InputFloat("InputFloat", item_ref, 1.0f);
if (edited)
for (float& item : items)
if (&item != item_ref)
item = *item_ref;
ImGui::PopItemFlag();
ImGui::Text("Underlying data:");
ImGui::InputFloat("item 0 (ref)", &items[0]);
ImGui::InputFloat("item 1", &items[1]);
ImGui::InputFloat("item 2", &items[2]);
// Demonstrate Checkbox(), RadioButton(), Combo(), ColorEdit4()
ImGui::SeparatorText("Others Widgets");
ImGui::Text("(note: edits are not applied in this demo)"); // <-- Would need more state tracking.
bool b_on = true, b_off = false;
ImGui::Checkbox("Checkbox On", &b_on);
ImGui::Checkbox("Checkbox Off", &b_off);
ImGui::PushItemFlag(ImGuiItemFlags_MixedValue, true);
ImGui::Checkbox("Checkbox Mixed", &b_off);
ImGui::RadioButton("RadioButton Mixed", true);
ImGui::SameLine();
ImGui::RadioButton("RadioButton Mixed##2", true); // Showing 2 radio buttons makes the example more clear
int combo_idx = 0;
ImGui::Combo("Combo", &combo_idx, "One\0Two\0Three\0");
ImVec4 color(0.5f, 0.5f, 0.5f, 0.5f);
ImGui::ColorEdit4("ColorEdit4", &color.x);
ImGui::PopItemFlag();
ImGui::TreePop();
}
}
//-----------------------------------------------------------------------------
// [SECTION] DemoWindowWidgetsMultiComponents()
//-----------------------------------------------------------------------------
@@ -2301,12 +2357,14 @@ static void DemoWindowWidgetsQueryingStatuses()
};
static int item_type = 4;
static bool item_disabled = false;
static bool item_mixedvalue = false;
static bool liveedit_flags_override = false;
static ImGuiItemFlags liveedit_flags = 0;
ImGui::Combo("Item Type", &item_type, item_names, IM_COUNTOF(item_names), IM_COUNTOF(item_names));
ImGui::SameLine();
HelpMarker("Testing how various types of items are interacting with the IsItemXXX functions. Note that the bool return value of most ImGui function is generally equivalent to calling ImGui::IsItemHovered().");
ImGui::Checkbox("Item Disabled", &item_disabled);
ImGui::Checkbox("Item MixedValue", &item_mixedvalue);
ImGui::Checkbox("Override LiveEdit:", &liveedit_flags_override);
ImGui::SameLine();
if (!liveedit_flags_override)
@@ -2331,6 +2389,8 @@ static void DemoWindowWidgetsQueryingStatuses()
static char str[16] = {};
if (item_disabled)
ImGui::BeginDisabled(true);
if (item_mixedvalue)
ImGui::PushItemFlag(ImGuiItemFlags_MixedValue, true);
if (item_type == 0) { ImGui::Text("ITEM: Text"); } // Testing text items with no identifier/interaction
if (item_type == 1) { ret = ImGui::Button("ITEM: Button"); } // Testing button
if (item_type == 2) { ImGui::PushItemFlag(ImGuiItemFlags_ButtonRepeat, true); ret = ImGui::Button("ITEM: Button"); ImGui::PopItemFlag(); } // Testing button (with repeater)
@@ -2414,6 +2474,8 @@ static void DemoWindowWidgetsQueryingStatuses()
ImGui::PopItemFlag();
ImGui::PopItemFlag();
}
if (item_mixedvalue)
ImGui::PopItemFlag();
if (item_disabled)
ImGui::EndDisabled();
@@ -4591,6 +4653,7 @@ static void DemoWindowWidgets(ImGuiDemoWindowData* demo_data)
DemoWindowWidgetsImages();
DemoWindowWidgetsListBoxes();
DemoWindowWidgetsLiveEdit(demo_data);
DemoWindowWidgetsMixedValues();
DemoWindowWidgetsMultiComponents();
DemoWindowWidgetsPlotting();
DemoWindowWidgetsProgressBars();