mirror of
https://github.com/ocornut/imgui.git
synced 2026-01-11 00:04:24 +00:00
Selectable: added ImGuiSelectableFlags_Highlight flag to highlight items independently from the hovered state. (#7820)
Demo: Make the Widget/List boxes show how to use forced highlighting.
This commit is contained in:
parent
96460a8a12
commit
c7b9256097
4 changed files with 28 additions and 15 deletions
|
|
@ -6894,14 +6894,15 @@ bool ImGui::Selectable(const char* label, bool selected, ImGuiSelectableFlags fl
|
|||
// Render
|
||||
if (is_visible)
|
||||
{
|
||||
if (hovered || selected)
|
||||
const bool highlighted = hovered || (flags & ImGuiSelectableFlags_Highlight);
|
||||
if (highlighted || selected)
|
||||
{
|
||||
// FIXME-MULTISELECT: Styling: Color for 'selected' elements? ImGuiCol_HeaderSelected
|
||||
ImU32 col;
|
||||
if (selected && !hovered)
|
||||
if (selected && !highlighted)
|
||||
col = GetColorU32(ImLerp(GetStyleColorVec4(ImGuiCol_Header), GetStyleColorVec4(ImGuiCol_HeaderHovered), 0.5f));
|
||||
else
|
||||
col = GetColorU32((held && hovered) ? ImGuiCol_HeaderActive : hovered ? ImGuiCol_HeaderHovered : ImGuiCol_Header);
|
||||
col = GetColorU32((held && highlighted) ? ImGuiCol_HeaderActive : highlighted ? ImGuiCol_HeaderHovered : ImGuiCol_Header);
|
||||
RenderFrame(bb.Min, bb.Max, col, false, 0.0f);
|
||||
}
|
||||
if (g.NavId == id)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue