Files
UnrealEngineUWP/Engine/Source/Developer/AutomationDriver/Private/LocateBy.cpp
bryan sefcik a3dddc6630 Pass 1 on Developer include fixes:
Removed redundant private include paths from build.cs files.
Fixed include paths to be relative to the private or public folders.
Hid or removed includes that reached into other private module folders.
Updated PublicInclude paths when necessary.

#jira
#preflight 631e281694758d0bf2ea1399

[CL 21960082 by bryan sefcik in ue5-main branch]
2022-09-11 18:32:18 -04:00

122 lines
4.2 KiB
C++

// Copyright Epic Games, Inc. All Rights Reserved.
#include "LocateBy.h"
#include "Locators/SlateWidgetLocatorByDelegate.h"
#include "Locators/SlateWidgetLocatorByPath.h"
#include "AutomationDriverTypeDefs.h"
#include "Framework/Application/SlateApplication.h"
TSharedRef<IElementLocator, ESPMode::ThreadSafe> By::Delegate(const FLocateSlateWidgetElementDelegate& Value)
{
return FSlateWidgetLocatorByDelegateFactory::Create(Value);
}
TSharedRef<IElementLocator, ESPMode::ThreadSafe> By::Delegate(const FLocateSlateWidgetPathElementDelegate& Value)
{
return FSlateWidgetLocatorByDelegateFactory::Create(Value);
}
TSharedRef<IElementLocator, ESPMode::ThreadSafe> By::WidgetLambda(const TFunction<void(TArray<TSharedRef<SWidget>>&)>& Value)
{
return FSlateWidgetLocatorByDelegateFactory::Create(FLocateSlateWidgetElementDelegate::CreateLambda(Value));
}
TSharedRef<IElementLocator, ESPMode::ThreadSafe> By::WidgetPathLambda(const TFunction<void(TArray<FWidgetPath>&)>& Value)
{
return FSlateWidgetLocatorByDelegateFactory::Create(FLocateSlateWidgetPathElementDelegate::CreateLambda(Value));
}
TSharedRef<IElementLocator, ESPMode::ThreadSafe> By::Id(const FString& Value)
{
return FSlateWidgetLocatorByPathFactory::Create(TEXT("#") + Value);
}
TSharedRef<IElementLocator, ESPMode::ThreadSafe> By::Id(const FDriverElementRef& Root, const FString& Value)
{
return FSlateWidgetLocatorByPathFactory::Create(Root, TEXT("#") + Value);
}
TSharedRef<IElementLocator, ESPMode::ThreadSafe> By::Id(const FName& Value)
{
return FSlateWidgetLocatorByPathFactory::Create(TEXT("#") + Value.ToString());
}
TSharedRef<IElementLocator, ESPMode::ThreadSafe> By::Id(const FDriverElementRef& Root, const FName& Value)
{
return FSlateWidgetLocatorByPathFactory::Create(Root, TEXT("#") + Value.ToString());
}
TSharedRef<IElementLocator, ESPMode::ThreadSafe> By::Id(const TCHAR* Value)
{
return FSlateWidgetLocatorByPathFactory::Create(FString(TEXT("#")) + Value);
}
TSharedRef<IElementLocator, ESPMode::ThreadSafe> By::Id(const FDriverElementRef& Root, const TCHAR* Value)
{
return FSlateWidgetLocatorByPathFactory::Create(Root, FString(TEXT("#")) + Value);
}
TSharedRef<IElementLocator, ESPMode::ThreadSafe> By::Id(const char* Value)
{
return FSlateWidgetLocatorByPathFactory::Create(FString(TEXT("#")) + Value);
}
TSharedRef<IElementLocator, ESPMode::ThreadSafe> By::Id(const FDriverElementRef& Root, const char* Value)
{
return FSlateWidgetLocatorByPathFactory::Create(Root, FString(TEXT("#")) + Value);
}
TSharedRef<IElementLocator, ESPMode::ThreadSafe> By::Path(const FString& Value)
{
return FSlateWidgetLocatorByPathFactory::Create(Value);
}
TSharedRef<IElementLocator, ESPMode::ThreadSafe> By::Path(const FDriverElementRef& Root, const FString& Value)
{
return FSlateWidgetLocatorByPathFactory::Create(Root, Value);
}
TSharedRef<IElementLocator, ESPMode::ThreadSafe> By::Path(const FName& Value)
{
return FSlateWidgetLocatorByPathFactory::Create(Value.ToString());
}
TSharedRef<IElementLocator, ESPMode::ThreadSafe> By::Path(const FDriverElementRef& Root, const FName& Value)
{
return FSlateWidgetLocatorByPathFactory::Create(Root, Value.ToString());
}
TSharedRef<IElementLocator, ESPMode::ThreadSafe> By::Path(const TCHAR* Value)
{
return FSlateWidgetLocatorByPathFactory::Create(Value);
}
TSharedRef<IElementLocator, ESPMode::ThreadSafe> By::Path(const FDriverElementRef& Root, const TCHAR* Value)
{
return FSlateWidgetLocatorByPathFactory::Create(Root, Value);
}
TSharedRef<IElementLocator, ESPMode::ThreadSafe> By::Path(const char* Value)
{
return FSlateWidgetLocatorByPathFactory::Create(Value);
}
TSharedRef<IElementLocator, ESPMode::ThreadSafe> By::Path(const FDriverElementRef& Root, const char* Value)
{
return FSlateWidgetLocatorByPathFactory::Create(Root, Value);
}
TSharedRef<IElementLocator, ESPMode::ThreadSafe> By::Cursor()
{
return By::WidgetPathLambda([](TArray<FWidgetPath>& OutWidgetPaths) -> void {
TArray<TSharedRef<SWindow>> Windows;
FSlateApplication::Get().GetAllVisibleWindowsOrdered(Windows);
FWidgetPath WidgetPath = FSlateApplication::Get().LocateWindowUnderMouse(FSlateApplication::Get().GetCursorPos(), Windows);
if (WidgetPath.IsValid())
{
OutWidgetPaths.Add(WidgetPath);
}
});
}