| 123 | } |
| 124 | |
| 125 | void Widget::SetAllocation( const sf::FloatRect& rect ) { |
| 126 | sf::FloatRect oldallocation( m_allocation ); |
| 127 | |
| 128 | // Make sure allocation is pixel-aligned. |
| 129 | m_allocation.position.x = std::floor( rect.position.x + .5f ); |
| 130 | m_allocation.position.y = std::floor( rect.position.y + .5f ); |
| 131 | m_allocation.size.x = std::floor( rect.size.x + .5f ); |
| 132 | m_allocation.size.y = std::floor( rect.size.y + .5f ); |
| 133 | |
| 134 | if( |
| 135 | oldallocation.position.y == m_allocation.position.y && |
| 136 | oldallocation.position.x == m_allocation.position.x && |
| 137 | oldallocation.size.x == m_allocation.size.x && |
| 138 | oldallocation.size.y == m_allocation.size.y |
| 139 | ) { |
| 140 | // Nothing even changed. Save the hierarchy the trouble. |
| 141 | return; |
| 142 | } |
| 143 | |
| 144 | if( ( oldallocation.position.y != m_allocation.position.y ) || ( oldallocation.position.x != m_allocation.position.x ) ) { |
| 145 | HandlePositionChange(); |
| 146 | HandleAbsolutePositionChange(); |
| 147 | } |
| 148 | |
| 149 | if( ( oldallocation.size.x != m_allocation.size.x ) || ( oldallocation.size.y != m_allocation.size.y ) ) { |
| 150 | HandleSizeChange(); |
| 151 | |
| 152 | Invalidate(); |
| 153 | |
| 154 | GetSignals().Emit( OnSizeAllocate ); |
| 155 | } |
| 156 | } |
| 157 | |
| 158 | void Widget::RequestResize() { |
| 159 | m_requisition = CalculateRequisition(); |
no test coverage detected