ImGuiContext& g = *GImGui;
const ImGuiStyle& style = g.Style;
const ImGuiID id = window->GetID(label);
const ImVec2 label_size = CalcTextSize(label, NULL, true);
const float w = CalcItemWidth();
const float distance = 258.f;
const float square_sz = GetFrameHeight();
const ImVec2 pos = window->DC.CursorPos;
const ImRect total_bb(pos, pos + ImVec2(230, 0) + ImVec2(square_sz + (label_size.x > 0.0f ? style.ItemInnerSpacing.x + label_size.x : 0.0f), label_size.y + style.FramePadding.y * 2.0f));
ItemSize(total_bb, style.FramePadding.y);
if (!ItemAdd(total_bb, id))
return false;
bool hovered, held;
bool pressed = ButtonBehavior(total_bb, id, &hovered, &held);
if (ImGui::IsItemClicked())
*v = !*v;
const ImRect check_bb(pos, pos + ImVec2(square_sz, square_sz));
RenderNavHighlight(total_bb, id);
static std::map<ImGuiID, float> nameanim_animation;
auto it_nameanim = nameanim_animation.find(id);
if (it_nameanim == nameanim_animation.end())
{
nameanim_animation.insert({ id, 0.f });
it_nameanim = nameanim_animation.find(id);
}
it_nameanim->second = ImLerp(it_nameanim->second, *v ? 1.f : 0.f, g.IO.DeltaTime * 8.f);
it_nameanim->second *= style.Alpha;
window->DrawList->AddRectFilled(check_bb.Min + ImVec2(4 + distance, 8), check_bb.Max + ImVec2(9 + distance, -11), ImColor(0.10f, 0.10f, 0.10f, 1.00f - it_nameanim->second), 10);
window->DrawList->AddRectFilled(check_bb.Min + ImVec2(5 + distance, 9), check_bb.Max + ImVec2(it_nameanim->second * 11 + distance - 7, -12), ImColor(accent_color[0] / 2, accent_color[1] / 2, accent_color[2] / 2, it_nameanim->second), 10);
window->DrawList->AddCircleFilled(ImVec2(check_bb.Min.x + distance + 13 + it_nameanim->second * 15, check_bb.Min.y + 12), 9.f, ImColor(34 / 255.f, 37 / 255.f, 43 / 255.f, 1.00f), 24);
if (label_size.x > 0.0f) RenderText(ImVec2(check_bb.Max.x + style.ItemInnerSpacing.x - 30, check_bb.Min.y + style.FramePadding.y - 4.0f), label);
IMGUI_TEST_ENGINE_ITEM_INFO(id, label, window->DC.ItemFlags | ImGuiItemStatusFlags_Checkable | (*v ? ImGuiItemStatusFlags_Checked : 0));
return pressed;