Files
UnrealEngineUWP/Engine/Source/Editor/DetailCustomizations/Private/NavLinkStructCustomization.cpp
Ben Marsh 20bf0eb6a1 Updating copyright notices to 2017 (copying from //Tasks/UE4/Dev-Copyright-2017).
#rb none
#lockdown Nick.Penwarden

[CL 3226823 by Ben Marsh in Main branch]
2016-12-08 08:52:44 -05:00

48 lines
1.5 KiB
C++

// Copyright 1998-2017 Epic Games, Inc. All Rights Reserved.
#include "NavLinkStructCustomization.h"
#include "Widgets/Text/STextBlock.h"
#include "IDetailChildrenBuilder.h"
#include "DetailWidgetRow.h"
#include "AI/Navigation/NavLinkDefinition.h"
TSharedRef<IPropertyTypeCustomization> FNavLinkStructCustomization::MakeInstance( )
{
return MakeShareable(new FNavLinkStructCustomization);
}
void FNavLinkStructCustomization::CustomizeHeader( TSharedRef<IPropertyHandle> StructPropertyHandle, class FDetailWidgetRow& HeaderRow, IPropertyTypeCustomizationUtils& StructCustomizationUtils )
{
TSharedPtr<IPropertyHandle> CommentHandle = StructPropertyHandle->GetChildHandle(GET_MEMBER_NAME_CHECKED(FNavigationLinkBase,Description));
FString Desc;
if (CommentHandle.IsValid())
{
CommentHandle->GetValue(Desc);
}
HeaderRow.NameContent()
[
StructPropertyHandle->CreatePropertyNameWidget()
]
.ValueContent()
.MaxDesiredWidth(400.0f)
[
SNew(STextBlock)
.Text(FText::FromString(Desc))
.Font(StructCustomizationUtils.GetRegularFont())
];
}
void FNavLinkStructCustomization::CustomizeChildren(TSharedRef<class IPropertyHandle> StructPropertyHandle, class IDetailChildrenBuilder& StructBuilder, IPropertyTypeCustomizationUtils& StructCustomizationUtils)
{
uint32 NumChildProps = 0;
StructPropertyHandle->GetNumChildren(NumChildProps);
for (uint32 Idx = 0; Idx < NumChildProps; Idx++)
{
TSharedPtr<IPropertyHandle> PropHandle = StructPropertyHandle->GetChildHandle(Idx);
StructBuilder.AddChildProperty(PropHandle.ToSharedRef());
}
}