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

Method BringToFront

src/SFGUI/Desktop.cpp:189–209  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

187}
188
189void Desktop::BringToFront( std::shared_ptr<const Widget> child ) {
190 WidgetsList::iterator iter( std::find( m_children.begin(), m_children.end(), child ) );
191
192 if( iter == m_children.end() || iter == m_children.begin() ) {
193 return;
194 }
195
196 if( child->GetAllocation().contains( sf::Vector2f( m_last_mouse_pos ) ) ) {
197 SendFakeMouseMoveEvent( m_children.front() );
198 }
199
200 Widget::Ptr ptr( *iter );
201 m_children.erase( iter );
202 m_children.push_front( ptr );
203
204 RecalculateWidgetLevels();
205
206 if( child->GetAllocation().contains( sf::Vector2f( m_last_mouse_pos ) ) ) {
207 SendFakeMouseMoveEvent( ptr, m_last_mouse_pos.x, m_last_mouse_pos.y );
208 }
209}
210
211void Desktop::SendFakeMouseMoveEvent( std::shared_ptr<Widget> widget, int x, int y ) const {
212 widget->HandleEvent( sf::Event::MouseMoved{ { x, y } } );

Callers 1

mainFunction · 0.80

Calls 1

endMethod · 0.80

Tested by

no test coverage detected