/ Source / ReasonablePlanningAIEditor / Private / StateKeyValueReferenceCustom.cpp
StateKeyValueReferenceCustom.cpp
 1  // Copyright (C) 2025 Radaway Software LLC. All Rights Reserved.
 2  
 3  #include "StateKeyValueReferenceCustom.h"
 4  #include "Core/RpaiTypes.h"
 5  #include "PropertyEditing.h"
 6  #include "PropertyCustomizationHelpers.h"
 7  
 8  TSharedRef<IPropertyTypeCustomization> StateKeyValueReferenceCustom::MakeInstance()
 9  {
10      return MakeShareable(new StateKeyValueReferenceCustom);
11  }
12  
13  void StateKeyValueReferenceCustom::CustomizeHeader(TSharedRef<IPropertyHandle> StructPropertyHandle, FDetailWidgetRow& HeaderRow, IPropertyTypeCustomizationUtils& StructCustomizationUtils)
14  {
15     TSharedPtr<IPropertyHandle> StateNamePropertyHandle = StructPropertyHandle->GetChildHandle(GET_MEMBER_NAME_CHECKED(FStateKeyValueReference, StateKeyName));
16     TSharedPtr<IPropertyHandle> StateTypePropertyHandle = StructPropertyHandle->GetChildHandle(GET_MEMBER_NAME_CHECKED(FStateKeyValueReference, ExpectedValueType));
17     check(StateNamePropertyHandle.IsValid());
18     check(StateTypePropertyHandle.IsValid());
19  
20     HeaderRow
21     .NameContent()
22        [
23           StructPropertyHandle->CreatePropertyNameWidget()
24        ]
25     .ValueContent()
26     .HAlign(EHorizontalAlignment::HAlign_Fill)
27        [
28           SNew(SHorizontalBox)
29           + SHorizontalBox::Slot()
30           .FillWidth(1)
31           .MaxWidth(64.0f)
32           [
33              StateNamePropertyHandle->CreatePropertyValueWidget()
34           ]
35           + SHorizontalBox::Slot()
36           .AutoWidth()
37           .Padding(4.0f, 0.0f)
38           [
39              StateTypePropertyHandle->CreatePropertyValueWidget()
40           ]
41        ];
42  }
43  
44  void StateKeyValueReferenceCustom::CustomizeChildren(TSharedRef<IPropertyHandle> StructPropertyHandle, IDetailChildrenBuilder& StructBuilder, IPropertyTypeCustomizationUtils& StructCustomizationUtils)
45  {
46     //Noop
47  }