MCPcopy Create free account
hub / github.com/TankOs/SFGUI / RequestResize

Method RequestResize

src/SFGUI/Widget.cpp:158–189  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

156}
157
158void 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
192const sf::FloatRect& Widget::GetAllocation() const {

Callers 3

CreateMethod · 0.80
CreateMethod · 0.80

Calls 1

EmitMethod · 0.80

Tested by

no test coverage detected