|
@@ -1,4 +1,4 @@
|
|
|
-// dear imgui, v1.89.7
|
|
|
+// dear imgui, v1.89.8 WIP
|
|
|
// (demo code)
|
|
|
|
|
|
// Help:
|
|
@@ -1321,16 +1321,16 @@ static void ShowDemoWindowWidgets()
|
|
|
IMGUI_DEMO_MARKER("Widgets/Selectables/Basic");
|
|
|
if (ImGui::TreeNode("Basic"))
|
|
|
{
|
|
|
- static bool selection[5] = { false, true, false, false, false };
|
|
|
+ static bool selection[5] = { false, true, false, false };
|
|
|
ImGui::Selectable("1. I am selectable", &selection[0]);
|
|
|
ImGui::Selectable("2. I am selectable", &selection[1]);
|
|
|
- ImGui::Text("(I am not selectable)");
|
|
|
- ImGui::Selectable("4. I am selectable", &selection[3]);
|
|
|
- if (ImGui::Selectable("5. I am double clickable", selection[4], ImGuiSelectableFlags_AllowDoubleClick))
|
|
|
+ ImGui::Selectable("3. I am selectable", &selection[2]);
|
|
|
+ if (ImGui::Selectable("4. I am double clickable", selection[3], ImGuiSelectableFlags_AllowDoubleClick))
|
|
|
if (ImGui::IsMouseDoubleClicked(0))
|
|
|
- selection[4] = !selection[4];
|
|
|
+ selection[3] = !selection[3];
|
|
|
ImGui::TreePop();
|
|
|
}
|
|
|
+
|
|
|
IMGUI_DEMO_MARKER("Widgets/Selectables/Single Selection");
|
|
|
if (ImGui::TreeNode("Selection State: Single Selection"))
|
|
|
{
|
|
@@ -1362,17 +1362,18 @@ static void ShowDemoWindowWidgets()
|
|
|
}
|
|
|
ImGui::TreePop();
|
|
|
}
|
|
|
- IMGUI_DEMO_MARKER("Widgets/Selectables/Rendering more text into the same line");
|
|
|
- if (ImGui::TreeNode("Rendering more text into the same line"))
|
|
|
+ IMGUI_DEMO_MARKER("Widgets/Selectables/Rendering more items on the same line");
|
|
|
+ if (ImGui::TreeNode("Rendering more items on the same line"))
|
|
|
{
|
|
|
- // Using the Selectable() override that takes "bool* p_selected" parameter,
|
|
|
- // this function toggle your bool value automatically.
|
|
|
+ // (1) Using SetNextItemAllowOverlap()
|
|
|
+ // (2) Using the Selectable() override that takes "bool* p_selected" parameter, the bool value is toggled automatically.
|
|
|
static bool selected[3] = { false, false, false };
|
|
|
- ImGui::Selectable("main.c", &selected[0]); ImGui::SameLine(300); ImGui::Text(" 2,345 bytes");
|
|
|
- ImGui::Selectable("Hello.cpp", &selected[1]); ImGui::SameLine(300); ImGui::Text("12,345 bytes");
|
|
|
- ImGui::Selectable("Hello.h", &selected[2]); ImGui::SameLine(300); ImGui::Text(" 2,345 bytes");
|
|
|
+ ImGui::SetNextItemAllowOverlap(); ImGui::Selectable("main.c", &selected[0]); ImGui::SameLine(); ImGui::SmallButton("Link 1");
|
|
|
+ ImGui::SetNextItemAllowOverlap(); ImGui::Selectable("Hello.cpp", &selected[1]); ImGui::SameLine(); ImGui::SmallButton("Link 2");
|
|
|
+ ImGui::SetNextItemAllowOverlap(); ImGui::Selectable("Hello.h", &selected[2]); ImGui::SameLine(); ImGui::SmallButton("Link 3");
|
|
|
ImGui::TreePop();
|
|
|
}
|
|
|
+
|
|
|
IMGUI_DEMO_MARKER("Widgets/Selectables/In columns");
|
|
|
if (ImGui::TreeNode("In columns"))
|
|
|
{
|
|
@@ -1408,6 +1409,7 @@ static void ShowDemoWindowWidgets()
|
|
|
}
|
|
|
ImGui::TreePop();
|
|
|
}
|
|
|
+
|
|
|
IMGUI_DEMO_MARKER("Widgets/Selectables/Grid");
|
|
|
if (ImGui::TreeNode("Grid"))
|
|
|
{
|
|
@@ -1541,6 +1543,7 @@ static void ShowDemoWindowWidgets()
|
|
|
ImGui::TreePop();
|
|
|
}
|
|
|
|
|
|
+ IMGUI_DEMO_MARKER("Widgets/Text Input/Completion, History, Edit Callbacks");
|
|
|
if (ImGui::TreeNode("Completion, History, Edit Callbacks"))
|
|
|
{
|
|
|
struct Funcs
|
|
@@ -1640,6 +1643,18 @@ static void ShowDemoWindowWidgets()
|
|
|
ImGui::TreePop();
|
|
|
}
|
|
|
|
|
|
+ IMGUI_DEMO_MARKER("Widgets/Text Input/Miscellaneous");
|
|
|
+ if (ImGui::TreeNode("Miscellaneous"))
|
|
|
+ {
|
|
|
+ static char buf1[16];
|
|
|
+ static ImGuiInputTextFlags flags = ImGuiInputTextFlags_EscapeClearsAll;
|
|
|
+ ImGui::CheckboxFlags("ImGuiInputTextFlags_EscapeClearsAll", &flags, ImGuiInputTextFlags_EscapeClearsAll);
|
|
|
+ ImGui::CheckboxFlags("ImGuiInputTextFlags_ReadOnly", &flags, ImGuiInputTextFlags_ReadOnly);
|
|
|
+ ImGui::CheckboxFlags("ImGuiInputTextFlags_NoUndoRedo", &flags, ImGuiInputTextFlags_NoUndoRedo);
|
|
|
+ ImGui::InputText("Hello", buf1, IM_ARRAYSIZE(buf1), flags);
|
|
|
+ ImGui::TreePop();
|
|
|
+ }
|
|
|
+
|
|
|
ImGui::TreePop();
|
|
|
}
|
|
|
|
|
@@ -2869,11 +2884,11 @@ static void ShowDemoWindowLayout()
|
|
|
// Text
|
|
|
IMGUI_DEMO_MARKER("Layout/Basic Horizontal Layout/SameLine");
|
|
|
ImGui::Text("Two items: Hello"); ImGui::SameLine();
|
|
|
- ImGui::TextColored(ImVec4(1,1,0,1), "Sailor");
|
|
|
+ ImGui::TextColored(ImVec4(1, 1, 0, 1), "Sailor");
|
|
|
|
|
|
// Adjust spacing
|
|
|
ImGui::Text("More spacing: Hello"); ImGui::SameLine(0, 20);
|
|
|
- ImGui::TextColored(ImVec4(1,1,0,1), "Sailor");
|
|
|
+ ImGui::TextColored(ImVec4(1, 1, 0, 1), "Sailor");
|
|
|
|
|
|
// Button
|
|
|
ImGui::AlignTextToFramePadding();
|
|
@@ -3471,6 +3486,36 @@ static void ShowDemoWindowLayout()
|
|
|
|
|
|
ImGui::TreePop();
|
|
|
}
|
|
|
+
|
|
|
+ IMGUI_DEMO_MARKER("Layout/Overlap Mode");
|
|
|
+ if (ImGui::TreeNode("Overlap Mode"))
|
|
|
+ {
|
|
|
+ static bool enable_allow_overlap = true;
|
|
|
+
|
|
|
+ HelpMarker(
|
|
|
+ "Hit-testing is by default performed in item submission order, which generally is perceived as 'back-to-front'.\n\n"
|
|
|
+ "By using SetNextItemAllowOverlap() you can notify that an item may be overlapped by another. Doing so alters the hovering logic: items using AllowOverlap mode requires an extra frame to accept hovered state.");
|
|
|
+ ImGui::Checkbox("Enable AllowOverlap", &enable_allow_overlap);
|
|
|
+
|
|
|
+ ImVec2 button1_pos = ImGui::GetCursorScreenPos();
|
|
|
+ ImVec2 button2_pos = ImVec2(button1_pos.x + 50.0f, button1_pos.y + 50.0f);
|
|
|
+ if (enable_allow_overlap)
|
|
|
+ ImGui::SetNextItemAllowOverlap();
|
|
|
+ ImGui::Button("Button 1", ImVec2(80, 80));
|
|
|
+ ImGui::SetCursorScreenPos(button2_pos);
|
|
|
+ ImGui::Button("Button 2", ImVec2(80, 80));
|
|
|
+
|
|
|
+ // This is typically used with width-spanning items.
|
|
|
+ // (note that Selectable() has a dedicated flag ImGuiSelectableFlags_AllowOverlap, which is a shortcut
|
|
|
+ // for using SetNextItemAllowOverlap(). For demo purpose we use SetNextItemAllowOverlap() here.)
|
|
|
+ if (enable_allow_overlap)
|
|
|
+ ImGui::SetNextItemAllowOverlap();
|
|
|
+ ImGui::Selectable("Some Selectable", false);
|
|
|
+ ImGui::SameLine();
|
|
|
+ ImGui::SmallButton("++");
|
|
|
+
|
|
|
+ ImGui::TreePop();
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
static void ShowDemoWindowPopups()
|