mirror of
https://github.com/Drezil/imgui.git
synced 2025-07-04 12:08:47 +02:00
Merge branch 'master' into navigation
This commit is contained in:
@ -160,7 +160,7 @@ void ImGui::ShowDemoWindow(bool* p_open)
|
||||
if (show_app_about)
|
||||
{
|
||||
ImGui::Begin("About Dear ImGui", &show_app_about, ImGuiWindowFlags_AlwaysAutoResize);
|
||||
ImGui::Text("dear imgui, %s", ImGui::GetVersion());
|
||||
ImGui::Text("Dear ImGui, %s", ImGui::GetVersion());
|
||||
ImGui::Separator();
|
||||
ImGui::Text("By Omar Cornut and all dear imgui contributors.");
|
||||
ImGui::Text("Dear ImGui is licensed under the MIT License, see LICENSE for more information.");
|
||||
@ -416,7 +416,7 @@ void ImGui::ShowDemoWindow(bool* p_open)
|
||||
{
|
||||
ImGui::Text("blah blah");
|
||||
ImGui::SameLine();
|
||||
if (ImGui::SmallButton("print")) printf("Child %d pressed", i);
|
||||
if (ImGui::SmallButton("button")) { };
|
||||
ImGui::TreePop();
|
||||
}
|
||||
ImGui::TreePop();
|
||||
@ -612,24 +612,58 @@ void ImGui::ShowDemoWindow(bool* p_open)
|
||||
|
||||
if (ImGui::TreeNode("Selectables"))
|
||||
{
|
||||
// Selectable() has 2 overloads:
|
||||
// - The one taking "bool selected" as a read-only selection information. When Selectable() has been clicked is returns true and you can alter selection state accordingly.
|
||||
// - The one taking "bool* p_selected" as a read-write selection information (convenient in some cases)
|
||||
// The earlier is more flexible, as in real application your selection may be stored in a different manner (in flags within objects, as an external list, etc).
|
||||
if (ImGui::TreeNode("Basic"))
|
||||
{
|
||||
static bool selected[4] = { false, true, false, false };
|
||||
ImGui::Selectable("1. I am selectable", &selected[0]);
|
||||
ImGui::Selectable("2. I am selectable", &selected[1]);
|
||||
static bool selection[5] = { false, true, false, false, false };
|
||||
ImGui::Selectable("1. I am selectable", &selection[0]);
|
||||
ImGui::Selectable("2. I am selectable", &selection[1]);
|
||||
ImGui::Text("3. I am not selectable");
|
||||
ImGui::Selectable("4. I am selectable", &selected[2]);
|
||||
if (ImGui::Selectable("5. I am double clickable", selected[3], ImGuiSelectableFlags_AllowDoubleClick))
|
||||
ImGui::Selectable("4. I am selectable", &selection[3]);
|
||||
if (ImGui::Selectable("5. I am double clickable", selection[4], ImGuiSelectableFlags_AllowDoubleClick))
|
||||
if (ImGui::IsMouseDoubleClicked(0))
|
||||
selected[3] = !selected[3];
|
||||
selection[4] = !selection[4];
|
||||
ImGui::TreePop();
|
||||
}
|
||||
if (ImGui::TreeNode("Rendering more text into the same block"))
|
||||
if (ImGui::TreeNode("Selection State: Single Selection"))
|
||||
{
|
||||
static int selected = -1;
|
||||
for (int n = 0; n < 5; n++)
|
||||
{
|
||||
char buf[32];
|
||||
sprintf(buf, "Object %d", n);
|
||||
if (ImGui::Selectable(buf, selected == n))
|
||||
selected = n;
|
||||
}
|
||||
ImGui::TreePop();
|
||||
}
|
||||
if (ImGui::TreeNode("Selection State: Multiple Selection"))
|
||||
{
|
||||
ShowHelpMarker("Hold CTRL and click to select multiple items.");
|
||||
static bool selection[5] = { false, false, false, false, false };
|
||||
for (int n = 0; n < 5; n++)
|
||||
{
|
||||
char buf[32];
|
||||
sprintf(buf, "Object %d", n);
|
||||
if (ImGui::Selectable(buf, selection[n]))
|
||||
{
|
||||
if (!ImGui::GetIO().KeyCtrl) // Clear selection when CTRL is not held
|
||||
memset(selection, 0, sizeof(selection));
|
||||
selection[n] ^= 1;
|
||||
}
|
||||
}
|
||||
ImGui::TreePop();
|
||||
}
|
||||
if (ImGui::TreeNode("Rendering more text into the same line"))
|
||||
{
|
||||
// Using the Selectable() override that takes "bool* p_selected" parameter and toggle your booleans automatically.
|
||||
static bool selected[3] = { false, false, false };
|
||||
ImGui::Selectable("main.c", &selected[0]); ImGui::SameLine(300); ImGui::Text(" 2,345 bytes");
|
||||
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::Selectable("Hello.h", &selected[2]); ImGui::SameLine(300); ImGui::Text(" 2,345 bytes");
|
||||
ImGui::TreePop();
|
||||
}
|
||||
if (ImGui::TreeNode("In columns"))
|
||||
@ -776,14 +810,14 @@ void ImGui::ShowDemoWindow(bool* p_open)
|
||||
{
|
||||
static ImVec4 color = ImColor(114, 144, 154, 200);
|
||||
|
||||
static bool hdr = false;
|
||||
static bool alpha_preview = true;
|
||||
static bool alpha_half_preview = false;
|
||||
static bool options_menu = true;
|
||||
ImGui::Checkbox("With HDR", &hdr); ImGui::SameLine(); ShowHelpMarker("Currently all this does is to lift the 0..1 limits on dragging widgets.");
|
||||
static bool hdr = false;
|
||||
ImGui::Checkbox("With Alpha Preview", &alpha_preview);
|
||||
ImGui::Checkbox("With Half Alpha Preview", &alpha_half_preview);
|
||||
ImGui::Checkbox("With Options Menu", &options_menu); ImGui::SameLine(); ShowHelpMarker("Right-click on the individual color widget to show options.");
|
||||
ImGui::Checkbox("With HDR", &hdr); ImGui::SameLine(); ShowHelpMarker("Currently all this does is to lift the 0..1 limits on dragging widgets.");
|
||||
int misc_flags = (hdr ? ImGuiColorEditFlags_HDR : 0) | (alpha_half_preview ? ImGuiColorEditFlags_AlphaPreviewHalf : (alpha_preview ? ImGuiColorEditFlags_AlphaPreview : 0)) | (options_menu ? 0 : ImGuiColorEditFlags_NoOptions);
|
||||
|
||||
ImGui::Text("Color widget:");
|
||||
|
Reference in New Issue
Block a user