| 680 | } |
| 681 | |
| 682 | Widget::WidgetsList SearchContainerForClass( Container::PtrConst container, const std::string& class_name ) { |
| 683 | Widget::WidgetsList result; |
| 684 | |
| 685 | if( !container ) { |
| 686 | return result; |
| 687 | } |
| 688 | |
| 689 | for( const auto& child : container->GetChildren() ) { |
| 690 | if( child->GetClass() == class_name ) { |
| 691 | result.push_back( child ); |
| 692 | } |
| 693 | |
| 694 | auto child_container = std::dynamic_pointer_cast<Container>( child ); |
| 695 | |
| 696 | if( child_container ) { |
| 697 | auto child_result = SearchContainerForClass( child_container, class_name ); |
| 698 | |
| 699 | // Splice the 2 vectors. |
| 700 | if( !child_result.empty() ) { |
| 701 | result.reserve( child_result.size() ); |
| 702 | result.insert( result.end(), child_result.begin(), child_result.end() ); |
| 703 | } |
| 704 | } |
| 705 | } |
| 706 | |
| 707 | return result; |
| 708 | } |
| 709 | |
| 710 | Widget::WidgetsList Widget::GetWidgetsByClass( const std::string& class_name ) { |
| 711 | WidgetsList result; |
no test coverage detected