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

Method GetWidgetsByClass

src/SFGUI/Widget.cpp:710–734  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

708}
709
710Widget::WidgetsList Widget::GetWidgetsByClass( const std::string& class_name ) {
711 WidgetsList result;
712
713 for( const auto& root_widget : root_widgets ) {
714 if( root_widget->GetClass() == class_name ) {
715 result.push_back( root_widget->shared_from_this() );
716 }
717
718 auto container = std::dynamic_pointer_cast<Container>(
719 root_widget->shared_from_this()
720 );
721
722 if( container ) {
723 auto container_result = SearchContainerForClass( container, class_name );
724
725 // Splice the 2 vectors.
726 if( !container_result.empty() ) {
727 result.reserve( container_result.size() );
728 result.insert( result.end(), container_result.begin(), container_result.end() );
729 }
730 }
731 }
732
733 return result;
734}
735
736void Widget::HandleMouseMoveEvent( int /*x*/, int /*y*/ ) {
737}

Callers

nothing calls this directly

Calls 5

SearchContainerForClassFunction · 0.85
GetClassMethod · 0.80
emptyMethod · 0.80
sizeMethod · 0.80
endMethod · 0.80

Tested by

no test coverage detected