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

Function SearchContainerForId

src/SFGUI/Widget.cpp:636–658  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

634}
635
636Widget::Ptr SearchContainerForId( Container::PtrConst container, const std::string& id ) {
637 if( !container ) {
638 return Widget::Ptr();
639 }
640
641 for( const auto& child : container->GetChildren() ) {
642 if( child->GetId() == id ) {
643 return child;
644 }
645
646 auto child_container = std::dynamic_pointer_cast<Container>( child );
647
648 if( child_container ) {
649 auto widget = SearchContainerForId( child_container, id );
650
651 if( widget ) {
652 return widget;
653 }
654 }
655 }
656
657 return Widget::Ptr();
658}
659
660Widget::Ptr Widget::GetWidgetById( const std::string& id ) {
661 for( const auto& root_widget : root_widgets ) {

Callers 1

GetWidgetByIdMethod · 0.85

Calls 1

GetIdMethod · 0.80

Tested by

no test coverage detected