File size: 1,370 Bytes
7fd553e | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 | // Copyright Epic Games, Inc. All Rights Reserved.
#include "LyraListView.h"
#include "LyraWidgetFactory.h"
#include UE_INLINE_GENERATED_CPP_BY_NAME(LyraListView)
#if WITH_EDITOR
#include "Editor/WidgetCompilerLog.h"
#endif
#define LOCTEXT_NAMESPACE "LyraListView"
ULyraListView::ULyraListView(const FObjectInitializer& ObjectInitializer)
: Super(ObjectInitializer)
{
}
#if WITH_EDITOR
void ULyraListView::ValidateCompiledDefaults(IWidgetCompilerLog& InCompileLog) const
{
Super::ValidateCompiledDefaults(InCompileLog);
if (FactoryRules.Num() == 0)
{
InCompileLog.Error(FText::Format(FText::FromString("{0} has no Factory Rules defined, can't create widgets without them."), FText::FromString(GetName())));
}
}
#endif
UUserWidget& ULyraListView::OnGenerateEntryWidgetInternal(UObject* Item, TSubclassOf<UUserWidget> DesiredEntryClass, const TSharedRef<STableViewBase>& OwnerTable)
{
TSubclassOf<UUserWidget> WidgetClass = DesiredEntryClass;
for (const ULyraWidgetFactory* Rule : FactoryRules)
{
if (Rule)
{
if (const TSubclassOf<UUserWidget> EntryClass = Rule->FindWidgetClassForData(Item))
{
WidgetClass = EntryClass;
break;
}
}
}
UUserWidget& EntryWidget = GenerateTypedEntry<UUserWidget>(WidgetClass, OwnerTable);
return EntryWidget;
}
#undef LOCTEXT_NAMESPACE
|