| 156 | } |
| 157 | |
| 158 | void Widget::RequestResize() { |
| 159 | m_requisition = CalculateRequisition(); |
| 160 | |
| 161 | if( m_custom_requisition ) { |
| 162 | if( m_custom_requisition->x > 0.f ) { |
| 163 | m_requisition.x = std::max( m_custom_requisition->x, m_requisition.x ); |
| 164 | } |
| 165 | |
| 166 | if( m_custom_requisition->y > 0.f ) { |
| 167 | m_requisition.y = std::max( m_custom_requisition->y, m_requisition.y ); |
| 168 | } |
| 169 | } |
| 170 | |
| 171 | HandleRequisitionChange(); |
| 172 | |
| 173 | auto parent = m_parent.lock(); |
| 174 | |
| 175 | // Notify observers. |
| 176 | GetSignals().Emit( OnSizeRequest ); |
| 177 | |
| 178 | if( parent ) { |
| 179 | parent->RequestResize(); |
| 180 | } |
| 181 | else { |
| 182 | sf::FloatRect allocation( |
| 183 | GetAllocation().position, |
| 184 | { std::max( GetAllocation().size.x, m_requisition.x ), std::max( GetAllocation().size.y, m_requisition.y ) } |
| 185 | ); |
| 186 | |
| 187 | SetAllocation( allocation ); |
| 188 | } |
| 189 | } |
| 190 | |
| 191 | |
| 192 | const sf::FloatRect& Widget::GetAllocation() const { |
no test coverage detected