#include namespace XCEngine { namespace UI { namespace Widgets { bool UISelectionModel::HasSelection() const { return !m_selectedId.empty(); } const std::string& UISelectionModel::GetSelectedId() const { return m_selectedId; } bool UISelectionModel::IsSelected(std::string_view id) const { return !m_selectedId.empty() && m_selectedId == id; } bool UISelectionModel::SetSelection(std::string selectionId) { if (m_selectedId == selectionId) { return false; } m_selectedId = std::move(selectionId); return true; } bool UISelectionModel::ClearSelection() { if (m_selectedId.empty()) { return false; } m_selectedId.clear(); return true; } bool UISelectionModel::ToggleSelection(std::string selectionId) { if (m_selectedId == selectionId) { m_selectedId.clear(); return true; } m_selectedId = std::move(selectionId); return true; } } // namespace Widgets } // namespace UI } // namespace XCEngine