| 1417 | } |
| 1418 | |
| 1419 | bool RadioButtonWithoutCheckBox(const std::string & label, bool active, ImVec2 size_arg) |
| 1420 | { |
| 1421 | ImGuiWindow * window = ImGui::GetCurrentWindow(); |
| 1422 | if (window->SkipItems) |
| 1423 | return false; |
| 1424 | |
| 1425 | ImGuiContext & g = *GImGui; |
| 1426 | const ImGuiStyle & style = g.Style; |
| 1427 | const ImGuiID id = window->GetID(label.c_str()); |
| 1428 | const ImVec2 label_size = ImGui::CalcTextSize(label.c_str(), NULL, true); |
| 1429 | |
| 1430 | const ImVec2 pos = window->DC.CursorPos; |
| 1431 | |
| 1432 | ImVec2 size = ImGui::CalcItemSize(size_arg, label_size.x + style.FramePadding.x * 2.0f, label_size.y + style.FramePadding.y * 2.0f); |
| 1433 | |
| 1434 | const ImRect bb(pos, pos + size); |
| 1435 | ImGui::ItemSize(bb, style.FramePadding.y); |
| 1436 | if (!ImGui::ItemAdd(bb, id)) |
| 1437 | return false; |
| 1438 | |
| 1439 | bool hovered, held; |
| 1440 | bool pressed = ImGui::ButtonBehavior(bb, id, &hovered, &held); |
| 1441 | |
| 1442 | ImGuiCol_ col; |
| 1443 | if ((held && hovered) || active) |
| 1444 | col = ImGuiCol_ButtonActive; |
| 1445 | else if (hovered) |
| 1446 | col = ImGuiCol_ButtonHovered; |
| 1447 | else |
| 1448 | col = ImGuiCol_Button; |
| 1449 | |
| 1450 | ImGui::RenderNavHighlight(bb, id); |
| 1451 | ImGui::RenderFrame(bb.Min, bb.Max, ImGui::GetColorU32(col), true, style.FrameRounding); |
| 1452 | |
| 1453 | ImVec2 TextAlign{0, 0.5f}; |
| 1454 | ImGui::RenderTextClipped(bb.Min + style.FramePadding, bb.Max - style.FramePadding, label.c_str(), NULL, &label_size, TextAlign, &bb); |
| 1455 | |
| 1456 | IMGUI_TEST_ENGINE_ITEM_INFO(id, label.c_str(), g.LastItemData.StatusFlags); |
| 1457 | return pressed; |
| 1458 | } |
nothing calls this directly
no outgoing calls
no test coverage detected