1
0
mirror of https://github.com/ocornut/imgui.git synced 2024-11-12 02:00:58 +01:00

Internals: Moved selectable flags to avoid collision with public flags + rewrote some tests so we can consistently grep for (held && hovered)

This commit is contained in:
omar 2018-07-08 18:23:12 +02:00
parent a33f0d1f7f
commit 64938178b7
2 changed files with 8 additions and 8 deletions

View File

@ -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)

View File

@ -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_