UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
WidgetPath.inl
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2
3#pragma once
4
7class FWidgetPath;
8struct EVisibility;
9
10
22template<typename MatchRuleType>
23bool FWidgetPath::SearchForWidgetRecursively( const MatchRuleType& MatchRule, const FArrangedWidget& InCandidate, FArrangedChildren& OutReversedPath, EVisibility VisibilityFilter, EWidgetPathSearchPurpose SearchPurpose )
24{
25 // If we are searching in order to move focus and we want to find a visible widget but the current widget is disabled, we do not want to search through it's children.
26 if (SearchPurpose == EWidgetPathSearchPurpose::FocusHandling && VisibilityFilter == EVisibility::Visible && !InCandidate.Widget->IsEnabled())
27 {
28 return false;
29 }
30
31 const bool bAllow3DWidgets = true;
33 FArrangedChildren ArrangedChildren(VisibilityFilter, bAllow3DWidgets);
34 InCandidate.Widget->ArrangeChildren( InCandidate.Geometry, ArrangedChildren, bUpdateVisibilityAttributes );
35
36 for( int32 ChildIndex = 0; ChildIndex < ArrangedChildren.Num(); ++ChildIndex )
37 {
38 const FArrangedWidget& SomeChild = ArrangedChildren[ChildIndex];
39 if ( MatchRule.IsMatch(SomeChild.Widget) )
40 {
41 OutReversedPath.AddWidget( SomeChild );
42 return true;
43 }
44 else if ( SearchForWidgetRecursively( MatchRule, SomeChild, OutReversedPath, VisibilityFilter, SearchPurpose) )
45 {
46 OutReversedPath.AddWidget( SomeChild );
47 return true;
48 }
49 }
50
51 return false;
52}
53
55template<typename MatchRuleType>
56bool FWidgetPath::SearchForWidgetRecursively_Reverse( const MatchRuleType& MatchRule, const FArrangedWidget& InCandidate, FArrangedChildren& OutReversedPath, EVisibility VisibilityFilter, EWidgetPathSearchPurpose SearchPurpose )
57{
58 // If we are searching in order to move focus and we want to find a visible widget but the current widget is disabled, we do not want to search through it's children.
59 if (SearchPurpose == EWidgetPathSearchPurpose::FocusHandling && VisibilityFilter == EVisibility::Visible && !InCandidate.Widget->IsEnabled())
60 {
61 return false;
62 }
63
64 const bool bAllow3DWidgets = true;
66 FArrangedChildren ArrangedChildren(VisibilityFilter, bAllow3DWidgets);
67 InCandidate.Widget->ArrangeChildren( InCandidate.Geometry, ArrangedChildren, bUpdateVisibilityAttributes );
68
69 for( int32 ChildIndex = ArrangedChildren.Num()-1; ChildIndex >=0 ; --ChildIndex )
70 {
71 const FArrangedWidget& SomeChild = ArrangedChildren[ChildIndex];
72 if ( MatchRule.IsMatch(SomeChild.Widget) )
73 {
74 OutReversedPath.AddWidget( SomeChild );
75 return true;
76 }
77 else if ( SearchForWidgetRecursively_Reverse( MatchRule, SomeChild, OutReversedPath, VisibilityFilter, SearchPurpose) )
78 {
79 OutReversedPath.AddWidget( SomeChild );
80 return true;
81 }
82 }
83
84 return false;
85}
FPlatformTypes::int32 int32
A 32-bit signed integer.
Definition Platform.h:1125
UE_FORCEINLINE_HINT TSharedRef< CastToType, Mode > StaticCastSharedRef(TSharedRef< CastFromType, Mode > const &InSharedRef)
Definition SharedPointer.h:127
EWidgetPathSearchPurpose
Definition WidgetPath.h:16
Definition ArrangedChildren.h:15
Definition ArrangedWidget.h:18
Definition WidgetPath.h:51
@ false
Definition radaudio_common.h:23
Definition Visibility.h:12
static SLATECORE_API const EVisibility Visible
Definition Visibility.h:14