From 64938178b726e68d008e3326b16a7da33db4cf3e Mon Sep 17 00:00:00 2001 From: omar Date: Sun, 8 Jul 2018 18:23:12 +0200 Subject: [PATCH] Internals: Moved selectable flags to avoid collision with public flags + rewrote some tests so we can consistently grep for (held && hovered) --- imgui.cpp | 6 +++--- imgui_internal.h | 10 +++++----- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/imgui.cpp b/imgui.cpp index 4205d655a..36d9ff415 100644 --- a/imgui.cpp +++ b/imgui.cpp @@ -8107,7 +8107,7 @@ bool ImGui::ButtonEx(const char* label, const ImVec2& size_arg, ImGuiButtonFlags MarkItemValueChanged(id); // Render - const ImU32 col = GetColorU32((hovered && held) ? ImGuiCol_ButtonActive : hovered ? ImGuiCol_ButtonHovered : ImGuiCol_Button); + const ImU32 col = GetColorU32((held && hovered) ? ImGuiCol_ButtonActive : hovered ? ImGuiCol_ButtonHovered : ImGuiCol_Button); RenderNavHighlight(bb, id); RenderFrame(bb.Min, bb.Max, col, true, style.FrameRounding); RenderTextClipped(bb.Min + style.FramePadding, bb.Max - style.FramePadding, label, NULL, &label_size, style.ButtonTextAlign, &bb); @@ -8156,7 +8156,7 @@ bool ImGui::ArrowButtonEx(const char* str_id, ImGuiDir dir, ImVec2 size, ImGuiBu bool pressed = ButtonBehavior(bb, id, &hovered, &held, flags); // Render - const ImU32 col = GetColorU32((hovered && held) ? ImGuiCol_ButtonActive : hovered ? ImGuiCol_ButtonHovered : ImGuiCol_Button); + const ImU32 col = GetColorU32((held && hovered) ? ImGuiCol_ButtonActive : hovered ? ImGuiCol_ButtonHovered : ImGuiCol_Button); RenderNavHighlight(bb, id); RenderFrame(bb.Min, bb.Max, col, true, g.Style.FrameRounding); RenderArrow(bb.Min + ImVec2(ImMax(0.0f, size.x - g.FontSize - g.Style.FramePadding.x), ImMax(0.0f, size.y - g.FontSize - g.Style.FramePadding.y)), dir); @@ -8275,7 +8275,7 @@ bool ImGui::ImageButton(ImTextureID user_texture_id, const ImVec2& size, const I bool pressed = ButtonBehavior(bb, id, &hovered, &held); // Render - const ImU32 col = GetColorU32((hovered && held) ? ImGuiCol_ButtonActive : hovered ? ImGuiCol_ButtonHovered : ImGuiCol_Button); + const ImU32 col = GetColorU32((held && hovered) ? ImGuiCol_ButtonActive : hovered ? ImGuiCol_ButtonHovered : ImGuiCol_Button); RenderNavHighlight(bb, id); RenderFrame(bb.Min, bb.Max, col, true, ImClamp((float)ImMin(padding.x, padding.y), 0.0f, style.FrameRounding)); if (bg_col.w > 0.0f) diff --git a/imgui_internal.h b/imgui_internal.h index d47370423..91661e04b 100644 --- a/imgui_internal.h +++ b/imgui_internal.h @@ -237,11 +237,11 @@ enum ImGuiColumnsFlags_ enum ImGuiSelectableFlagsPrivate_ { // NB: need to be in sync with last value of ImGuiSelectableFlags_ - ImGuiSelectableFlags_NoHoldingActiveID = 1 << 3, - ImGuiSelectableFlags_PressedOnClick = 1 << 4, - ImGuiSelectableFlags_PressedOnRelease = 1 << 5, - ImGuiSelectableFlags_Disabled = 1 << 6, - ImGuiSelectableFlags_DrawFillAvailWidth = 1 << 7 + ImGuiSelectableFlags_NoHoldingActiveID = 1 << 10, + ImGuiSelectableFlags_PressedOnClick = 1 << 11, + ImGuiSelectableFlags_PressedOnRelease = 1 << 12, + ImGuiSelectableFlags_Disabled = 1 << 13, + ImGuiSelectableFlags_DrawFillAvailWidth = 1 << 14 }; enum ImGuiSeparatorFlags_