mirror of
https://github.com/ocornut/imgui.git
synced 2026-01-17 01:04:19 +00:00
MenuItem(): checkmark render in disabled color when disabled
This commit is contained in:
parent
be7621f7c5
commit
c5149cd53c
2 changed files with 3 additions and 3 deletions
|
|
@ -8364,7 +8364,7 @@ bool ImGui::MenuItem(const char* label, const char* shortcut, bool selected, boo
|
|||
float w = window->MenuColumns.DeclColumns(label_size.x, shortcut_size.x, (float)(int)(g.FontSize * 1.20f)); // Feedback for next frame
|
||||
float extra_w = ImMax(0.0f, ImGui::GetContentRegionAvail().x - w);
|
||||
|
||||
bool pressed = ImGui::Selectable(label, false, ImGuiSelectableFlags_MenuItem | ImGuiSelectableFlags_DrawFillAvailWidth | (!enabled ? ImGuiSelectableFlags_Disabled : 0), ImVec2(w, 0.0f));
|
||||
bool pressed = ImGui::Selectable(label, false, ImGuiSelectableFlags_MenuItem | ImGuiSelectableFlags_DrawFillAvailWidth | (enabled ? 0 : ImGuiSelectableFlags_Disabled), ImVec2(w, 0.0f));
|
||||
if (shortcut_size.x > 0.0f)
|
||||
{
|
||||
ImGui::PushStyleColor(ImGuiCol_Text, g.Style.Colors[ImGuiCol_TextDisabled]);
|
||||
|
|
@ -8373,7 +8373,7 @@ bool ImGui::MenuItem(const char* label, const char* shortcut, bool selected, boo
|
|||
}
|
||||
|
||||
if (selected)
|
||||
RenderCheckMark(pos + ImVec2(window->MenuColumns.Pos[2] + extra_w + g.FontSize * 0.20f, 0.0f), GetColorU32(ImGuiCol_Text));
|
||||
RenderCheckMark(pos + ImVec2(window->MenuColumns.Pos[2] + extra_w + g.FontSize * 0.20f, 0.0f), GetColorU32(enabled ? ImGuiCol_Text : ImGuiCol_TextDisabled));
|
||||
|
||||
return pressed;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue