|
@@ -2177,19 +2177,16 @@ static void ShowDemoWindowWidgets(ImGuiDemoWindowData* demo_data)
|
|
|
if (ImGui::TreeNode("Color/Picker Widgets"))
|
|
|
{
|
|
|
static ImVec4 color = ImVec4(114.0f / 255.0f, 144.0f / 255.0f, 154.0f / 255.0f, 200.0f / 255.0f);
|
|
|
+ static ImGuiColorEditFlags base_flags = ImGuiColorEditFlags_None;
|
|
|
|
|
|
- static bool alpha_preview = true;
|
|
|
- static bool alpha_half_preview = false;
|
|
|
- static bool drag_and_drop = true;
|
|
|
- static bool options_menu = true;
|
|
|
- static bool hdr = false;
|
|
|
ImGui::SeparatorText("Options");
|
|
|
- ImGui::Checkbox("With Alpha Preview", &alpha_preview);
|
|
|
- ImGui::Checkbox("With Half Alpha Preview", &alpha_half_preview);
|
|
|
- ImGui::Checkbox("With Drag and Drop", &drag_and_drop);
|
|
|
- ImGui::Checkbox("With Options Menu", &options_menu); ImGui::SameLine(); HelpMarker("Right-click on the individual color widget to show options.");
|
|
|
- ImGui::Checkbox("With HDR", &hdr); ImGui::SameLine(); HelpMarker("Currently all this does is to lift the 0..1 limits on dragging widgets.");
|
|
|
- ImGuiColorEditFlags misc_flags = (hdr ? ImGuiColorEditFlags_HDR : 0) | (drag_and_drop ? 0 : ImGuiColorEditFlags_NoDragDrop) | (alpha_half_preview ? ImGuiColorEditFlags_AlphaPreviewHalf : (alpha_preview ? ImGuiColorEditFlags_AlphaPreview : 0)) | (options_menu ? 0 : ImGuiColorEditFlags_NoOptions);
|
|
|
+ ImGui::CheckboxFlags("ImGuiColorEditFlags_NoAlpha", &base_flags, ImGuiColorEditFlags_NoAlpha);
|
|
|
+ ImGui::CheckboxFlags("ImGuiColorEditFlags_AlphaOpaque", &base_flags, ImGuiColorEditFlags_AlphaOpaque);
|
|
|
+ ImGui::CheckboxFlags("ImGuiColorEditFlags_AlphaNoBg", &base_flags, ImGuiColorEditFlags_AlphaNoBg);
|
|
|
+ ImGui::CheckboxFlags("ImGuiColorEditFlags_AlphaPreviewHalf", &base_flags, ImGuiColorEditFlags_AlphaPreviewHalf);
|
|
|
+ ImGui::CheckboxFlags("ImGuiColorEditFlags_NoDragDrop", &base_flags, ImGuiColorEditFlags_NoDragDrop);
|
|
|
+ ImGui::CheckboxFlags("ImGuiColorEditFlags_NoOptions", &base_flags, ImGuiColorEditFlags_NoOptions); ImGui::SameLine(); HelpMarker("Right-click on the individual color widget to show options.");
|
|
|
+ ImGui::CheckboxFlags("ImGuiColorEditFlags_HDR", &base_flags, ImGuiColorEditFlags_HDR); ImGui::SameLine(); HelpMarker("Currently all this does is to lift the 0..1 limits on dragging widgets.");
|
|
|
|
|
|
IMGUI_DEMO_MARKER("Widgets/Color/ColorEdit");
|
|
|
ImGui::SeparatorText("Inline color editor");
|
|
@@ -2197,15 +2194,15 @@ static void ShowDemoWindowWidgets(ImGuiDemoWindowData* demo_data)
|
|
|
ImGui::SameLine(); HelpMarker(
|
|
|
"Click on the color square to open a color picker.\n"
|
|
|
"CTRL+click on individual component to input value.\n");
|
|
|
- ImGui::ColorEdit3("MyColor##1", (float*)&color, misc_flags);
|
|
|
+ ImGui::ColorEdit3("MyColor##1", (float*)&color, base_flags);
|
|
|
|
|
|
IMGUI_DEMO_MARKER("Widgets/Color/ColorEdit (HSV, with Alpha)");
|
|
|
ImGui::Text("Color widget HSV with Alpha:");
|
|
|
- ImGui::ColorEdit4("MyColor##2", (float*)&color, ImGuiColorEditFlags_DisplayHSV | misc_flags);
|
|
|
+ ImGui::ColorEdit4("MyColor##2", (float*)&color, ImGuiColorEditFlags_DisplayHSV | base_flags);
|
|
|
|
|
|
IMGUI_DEMO_MARKER("Widgets/Color/ColorEdit (float display)");
|
|
|
ImGui::Text("Color widget with Float Display:");
|
|
|
- ImGui::ColorEdit4("MyColor##2f", (float*)&color, ImGuiColorEditFlags_Float | misc_flags);
|
|
|
+ ImGui::ColorEdit4("MyColor##2f", (float*)&color, ImGuiColorEditFlags_Float | base_flags);
|
|
|
|
|
|
IMGUI_DEMO_MARKER("Widgets/Color/ColorButton (with Picker)");
|
|
|
ImGui::Text("Color button with Picker:");
|
|
@@ -2213,7 +2210,7 @@ static void ShowDemoWindowWidgets(ImGuiDemoWindowData* demo_data)
|
|
|
"With the ImGuiColorEditFlags_NoInputs flag you can hide all the slider/text inputs.\n"
|
|
|
"With the ImGuiColorEditFlags_NoLabel flag you can pass a non-empty label which will only "
|
|
|
"be used for the tooltip and picker popup.");
|
|
|
- ImGui::ColorEdit4("MyColor##3", (float*)&color, ImGuiColorEditFlags_NoInputs | ImGuiColorEditFlags_NoLabel | misc_flags);
|
|
|
+ ImGui::ColorEdit4("MyColor##3", (float*)&color, ImGuiColorEditFlags_NoInputs | ImGuiColorEditFlags_NoLabel | base_flags);
|
|
|
|
|
|
IMGUI_DEMO_MARKER("Widgets/Color/ColorButton (with custom Picker popup)");
|
|
|
ImGui::Text("Color button with Custom Picker Popup:");
|
|
@@ -2233,7 +2230,7 @@ static void ShowDemoWindowWidgets(ImGuiDemoWindowData* demo_data)
|
|
|
}
|
|
|
|
|
|
static ImVec4 backup_color;
|
|
|
- bool open_popup = ImGui::ColorButton("MyColor##3b", color, misc_flags);
|
|
|
+ bool open_popup = ImGui::ColorButton("MyColor##3b", color, base_flags);
|
|
|
ImGui::SameLine(0, ImGui::GetStyle().ItemInnerSpacing.x);
|
|
|
open_popup |= ImGui::Button("Palette");
|
|
|
if (open_popup)
|
|
@@ -2245,7 +2242,7 @@ static void ShowDemoWindowWidgets(ImGuiDemoWindowData* demo_data)
|
|
|
{
|
|
|
ImGui::Text("MY CUSTOM COLOR PICKER WITH AN AMAZING PALETTE!");
|
|
|
ImGui::Separator();
|
|
|
- ImGui::ColorPicker4("##picker", (float*)&color, misc_flags | ImGuiColorEditFlags_NoSidePreview | ImGuiColorEditFlags_NoSmallPreview);
|
|
|
+ ImGui::ColorPicker4("##picker", (float*)&color, base_flags | ImGuiColorEditFlags_NoSidePreview | ImGuiColorEditFlags_NoSmallPreview);
|
|
|
ImGui::SameLine();
|
|
|
|
|
|
ImGui::BeginGroup(); // Lock X position
|
|
@@ -2287,40 +2284,42 @@ static void ShowDemoWindowWidgets(ImGuiDemoWindowData* demo_data)
|
|
|
ImGui::Text("Color button only:");
|
|
|
static bool no_border = false;
|
|
|
ImGui::Checkbox("ImGuiColorEditFlags_NoBorder", &no_border);
|
|
|
- ImGui::ColorButton("MyColor##3c", *(ImVec4*)&color, misc_flags | (no_border ? ImGuiColorEditFlags_NoBorder : 0), ImVec2(80, 80));
|
|
|
+ ImGui::ColorButton("MyColor##3c", *(ImVec4*)&color, base_flags | (no_border ? ImGuiColorEditFlags_NoBorder : 0), ImVec2(80, 80));
|
|
|
|
|
|
IMGUI_DEMO_MARKER("Widgets/Color/ColorPicker");
|
|
|
ImGui::SeparatorText("Color picker");
|
|
|
- static bool alpha = true;
|
|
|
- static bool alpha_bar = true;
|
|
|
- static bool side_preview = true;
|
|
|
+
|
|
|
static bool ref_color = false;
|
|
|
static ImVec4 ref_color_v(1.0f, 0.0f, 1.0f, 0.5f);
|
|
|
- static int display_mode = 0;
|
|
|
static int picker_mode = 0;
|
|
|
- ImGui::Checkbox("With Alpha", &alpha);
|
|
|
- ImGui::Checkbox("With Alpha Bar", &alpha_bar);
|
|
|
- ImGui::Checkbox("With Side Preview", &side_preview);
|
|
|
- if (side_preview)
|
|
|
+ static int display_mode = 0;
|
|
|
+ static ImGuiColorEditFlags color_picker_flags = ImGuiColorEditFlags_AlphaBar;
|
|
|
+
|
|
|
+ ImGui::PushID("Color picker");
|
|
|
+ ImGui::CheckboxFlags("ImGuiColorEditFlags_NoAlpha", &color_picker_flags, ImGuiColorEditFlags_NoAlpha);
|
|
|
+ ImGui::CheckboxFlags("ImGuiColorEditFlags_AlphaBar", &color_picker_flags, ImGuiColorEditFlags_AlphaBar);
|
|
|
+ ImGui::CheckboxFlags("ImGuiColorEditFlags_NoSidePreview", &color_picker_flags, ImGuiColorEditFlags_NoSidePreview);
|
|
|
+ if (color_picker_flags & ImGuiColorEditFlags_NoSidePreview)
|
|
|
{
|
|
|
ImGui::SameLine();
|
|
|
ImGui::Checkbox("With Ref Color", &ref_color);
|
|
|
if (ref_color)
|
|
|
{
|
|
|
ImGui::SameLine();
|
|
|
- ImGui::ColorEdit4("##RefColor", &ref_color_v.x, ImGuiColorEditFlags_NoInputs | misc_flags);
|
|
|
+ ImGui::ColorEdit4("##RefColor", &ref_color_v.x, ImGuiColorEditFlags_NoInputs | base_flags);
|
|
|
}
|
|
|
}
|
|
|
- ImGui::Combo("Display Mode", &display_mode, "Auto/Current\0None\0RGB Only\0HSV Only\0Hex Only\0");
|
|
|
+
|
|
|
+ ImGui::Combo("Picker Mode", &picker_mode, "Auto/Current\0ImGuiColorEditFlags_PickerHueBar\0ImGuiColorEditFlags_PickerHueWheel\0");
|
|
|
+ ImGui::SameLine(); HelpMarker("When not specified explicitly, user can right-click the picker to change mode.");
|
|
|
+
|
|
|
+ ImGui::Combo("Display Mode", &display_mode, "Auto/Current\0ImGuiColorEditFlags_NoInputs\0ImGuiColorEditFlags_DisplayRGB\0ImGuiColorEditFlags_DisplayHSV\0ImGuiColorEditFlags_DisplayHex\0");
|
|
|
ImGui::SameLine(); HelpMarker(
|
|
|
"ColorEdit defaults to displaying RGB inputs if you don't specify a display mode, "
|
|
|
"but the user can change it with a right-click on those inputs.\n\nColorPicker defaults to displaying RGB+HSV+Hex "
|
|
|
"if you don't specify a display mode.\n\nYou can change the defaults using SetColorEditOptions().");
|
|
|
- ImGui::SameLine(); HelpMarker("When not specified explicitly (Auto/Current mode), user can right-click the picker to change mode.");
|
|
|
- ImGuiColorEditFlags flags = misc_flags;
|
|
|
- if (!alpha) flags |= ImGuiColorEditFlags_NoAlpha; // This is by default if you call ColorPicker3() instead of ColorPicker4()
|
|
|
- if (alpha_bar) flags |= ImGuiColorEditFlags_AlphaBar;
|
|
|
- if (!side_preview) flags |= ImGuiColorEditFlags_NoSidePreview;
|
|
|
+
|
|
|
+ ImGuiColorEditFlags flags = base_flags | color_picker_flags;
|
|
|
if (picker_mode == 1) flags |= ImGuiColorEditFlags_PickerHueBar;
|
|
|
if (picker_mode == 2) flags |= ImGuiColorEditFlags_PickerHueWheel;
|
|
|
if (display_mode == 1) flags |= ImGuiColorEditFlags_NoInputs; // Disable all RGB/HSV/Hex displays
|
|
@@ -2349,6 +2348,7 @@ static void ShowDemoWindowWidgets(ImGuiDemoWindowData* demo_data)
|
|
|
ImGui::SameLine();
|
|
|
ImGui::SetNextItemWidth(w);
|
|
|
ImGui::ColorPicker3("##MyColor##6", (float*)&color, ImGuiColorEditFlags_PickerHueWheel | ImGuiColorEditFlags_NoSidePreview | ImGuiColorEditFlags_NoInputs | ImGuiColorEditFlags_NoAlpha);
|
|
|
+ ImGui::PopID();
|
|
|
|
|
|
// HSV encoded support (to avoid RGB<>HSV round trips and singularities when S==0 or V==0)
|
|
|
static ImVec4 color_hsv(0.23f, 1.0f, 1.0f, 1.0f); // Stored as HSV!
|
|
@@ -7483,6 +7483,8 @@ static void ShowDemoWindowInputs()
|
|
|
ImGui::Text("Mouse down:");
|
|
|
for (int i = 0; i < IM_ARRAYSIZE(io.MouseDown); i++) if (ImGui::IsMouseDown(i)) { ImGui::SameLine(); ImGui::Text("b%d (%.02f secs)", i, io.MouseDownDuration[i]); }
|
|
|
ImGui::Text("Mouse wheel: %.1f", io.MouseWheel);
|
|
|
+ ImGui::Text("Mouse clicked count:");
|
|
|
+ for (int i = 0; i < IM_ARRAYSIZE(io.MouseDown); i++) if (io.MouseClickedCount[i] > 0) { ImGui::SameLine(); ImGui::Text("b%d: %d", i, io.MouseClickedCount[i]); }
|
|
|
|
|
|
// We iterate both legacy native range and named ImGuiKey ranges. This is a little unusual/odd but this allows
|
|
|
// displaying the data for old/new backends.
|
|
@@ -8062,7 +8064,7 @@ void ImGui::ShowStyleEditor(ImGuiStyle* ref)
|
|
|
ImGui::SliderFloat("FrameBorderSize", &style.FrameBorderSize, 0.0f, 1.0f, "%.0f");
|
|
|
ImGui::SliderFloat("TabBorderSize", &style.TabBorderSize, 0.0f, 1.0f, "%.0f");
|
|
|
ImGui::SliderFloat("TabBarBorderSize", &style.TabBarBorderSize, 0.0f, 2.0f, "%.0f");
|
|
|
- ImGui::SliderFloat("TabBarOverlineSize", &style.TabBarOverlineSize, 0.0f, 2.0f, "%.0f");
|
|
|
+ ImGui::SliderFloat("TabBarOverlineSize", &style.TabBarOverlineSize, 0.0f, 3.0f, "%.0f");
|
|
|
ImGui::SameLine(); HelpMarker("Overline is only drawn over the selected tab when ImGuiTabBarFlags_DrawSelectedOverline is set.");
|
|
|
|
|
|
ImGui::SeparatorText("Rounding");
|
|
@@ -8145,9 +8147,9 @@ void ImGui::ShowStyleEditor(ImGuiStyle* ref)
|
|
|
filter.Draw("Filter colors", ImGui::GetFontSize() * 16);
|
|
|
|
|
|
static ImGuiColorEditFlags alpha_flags = 0;
|
|
|
- if (ImGui::RadioButton("Opaque", alpha_flags == ImGuiColorEditFlags_None)) { alpha_flags = ImGuiColorEditFlags_None; } ImGui::SameLine();
|
|
|
- if (ImGui::RadioButton("Alpha", alpha_flags == ImGuiColorEditFlags_AlphaPreview)) { alpha_flags = ImGuiColorEditFlags_AlphaPreview; } ImGui::SameLine();
|
|
|
- if (ImGui::RadioButton("Both", alpha_flags == ImGuiColorEditFlags_AlphaPreviewHalf)) { alpha_flags = ImGuiColorEditFlags_AlphaPreviewHalf; } ImGui::SameLine();
|
|
|
+ if (ImGui::RadioButton("Opaque", alpha_flags == ImGuiColorEditFlags_AlphaOpaque)) { alpha_flags = ImGuiColorEditFlags_AlphaOpaque; } ImGui::SameLine();
|
|
|
+ if (ImGui::RadioButton("Alpha", alpha_flags == ImGuiColorEditFlags_None)) { alpha_flags = ImGuiColorEditFlags_None; } ImGui::SameLine();
|
|
|
+ if (ImGui::RadioButton("Both", alpha_flags == ImGuiColorEditFlags_AlphaPreviewHalf)) { alpha_flags = ImGuiColorEditFlags_AlphaPreviewHalf; } ImGui::SameLine();
|
|
|
HelpMarker(
|
|
|
"In the color list:\n"
|
|
|
"Left-click on color square to open color picker,\n"
|