///////////////////////////////////////////////////////
| 196 | |
| 197 | //////////////////////////////////////////////////////////// |
| 198 | void WindowBase::setSize(Vector2u size) |
| 199 | { |
| 200 | if (m_impl) |
| 201 | { |
| 202 | // Constrain requested size within minimum and maximum bounds |
| 203 | const auto minimumSize = m_impl->getMinimumSize().value_or(Vector2u()); |
| 204 | const auto maximumSize = m_impl->getMaximumSize().value_or( |
| 205 | Vector2u(std::numeric_limits<unsigned int>::max(), std::numeric_limits<unsigned int>::max())); |
| 206 | const auto width = std::clamp(size.x, minimumSize.x, maximumSize.x); |
| 207 | const auto height = std::clamp(size.y, minimumSize.y, maximumSize.y); |
| 208 | |
| 209 | // Do nothing if requested size matches current size |
| 210 | const Vector2u clampedSize(width, height); |
| 211 | if (clampedSize == m_size) |
| 212 | return; |
| 213 | |
| 214 | m_impl->setSize(clampedSize); |
| 215 | |
| 216 | // Cache the new size |
| 217 | m_size = clampedSize; |
| 218 | |
| 219 | // Notify the derived class |
| 220 | onResize(); |
| 221 | } |
| 222 | } |
| 223 | |
| 224 | |
| 225 | //////////////////////////////////////////////////////////// |
nothing calls this directly
no test coverage detected