20
20
21
21
#define LOCTEXT_NAMESPACE " FFactionTableCustomization"
22
22
23
- const FName FFactionTableCustomization::ColumnSelect (" Select" );
24
23
const FName FFactionTableCustomization::ColumnId (" Id" );
25
24
const FName FFactionTableCustomization::ColumnColor (" Color" );
26
25
const FName FFactionTableCustomization::ColumnDelete (" Delete" );
@@ -53,39 +52,32 @@ class SFactionViewItem : public SMultiColumnTableRow<FFactionViewItemPtr>
53
52
/* * Overridden from SMultiColumnTableRow. Generates a widget for this column of the list view. */
54
53
virtual TSharedRef<SWidget> GenerateWidgetForColumn (const FName& Column) override
55
54
{
56
- if (Column == FFactionTableCustomization::ColumnSelect )
55
+ if (Column == FFactionTableCustomization::ColumnDelete )
57
56
{
58
- return SNew (STextBlock).Text (LOCTEXT (" FactionColumnSelect_Value" , " ⊙" ));
57
+ return SNew (SButton)
58
+ .VAlign (VAlign_Center)
59
+ .HAlign (HAlign_Center)
60
+ .ContentPadding (FMargin{0 , 1 , 0 , 0 })
61
+ .ButtonStyle (FEditorStyle::Get (), " HoverHintOnly" )
62
+ .ForegroundColor (FEditorStyle::GetSlateColor (" DefaultForeground" ))
63
+ .OnClicked (Customization.Pin ().Get (), &FFactionTableCustomization::OnDeleteFaction, Item)
64
+ [
65
+ SNew (STextBlock)
66
+ .Font (FEditorStyle::Get ().GetFontStyle (" FontAwesome.10" ))
67
+ .Text (FText::FromString (FString (TEXT (" \xf057 " ))) /* fa-times-circle*/ )
68
+ ];
59
69
}
60
70
else if (Column == FFactionTableCustomization::ColumnColor)
61
- {
62
- return SNew (SFactionColor, Item->GetColorProperty ());
63
- }
64
- else if (Column == FFactionTableCustomization::ColumnDelete)
65
71
{
66
72
return SNew (SBox)
67
- .Padding (1 )
68
- .MinDesiredWidth (22 .f )
73
+ .Padding (FMargin{ 5 , 3 })
69
74
[
70
- SNew (SButton)
71
- .HAlign (HAlign_Center)
72
- .VAlign (VAlign_Center)
73
- .ContentPadding (2 )
74
- .ButtonStyle (FEditorStyle::Get (), " HoverHintOnly" )
75
- .ForegroundColor (FEditorStyle::GetSlateColor (" DefaultForeground" ))
76
- .OnClicked (Customization.Pin ().Get (), &FFactionTableCustomization::OnDeleteFaction, Item)
77
- [
78
- SNew (STextBlock)
79
- .Font (FEditorStyle::Get ().GetFontStyle (" FontAwesome.10" ))
80
- // .Text(LOCTEXT("Relations_Delete", "✖"))
81
- .Text (FText::FromString (FString (TEXT (" \xf057 " ))) /* fa-times-circle*/ )
82
- ]
75
+ SNew (SFactionColor, Item->GetColorProperty ())
83
76
];
84
77
}
85
78
86
79
return SNew (SBox)
87
- .Padding (FMargin{ 5 .0f , 3 .f })
88
- .MinDesiredHeight (25 .f )
80
+ .Padding (FMargin{ 5 , 0 })
89
81
[
90
82
SAssignNew (IdNameSwitcher, SWidgetSwitcher)
91
83
+ SWidgetSwitcher::Slot ()
@@ -244,18 +236,18 @@ void FFactionTableCustomization::CustomizeHeader(TSharedRef<IPropertyHandle> Str
244
236
245
237
void FFactionTableCustomization::CustomizeChildren (TSharedRef<IPropertyHandle> StructPropertyHandle, IDetailChildrenBuilder& StructBuilder, IPropertyTypeCustomizationUtils& StructCustomizationUtils)
246
238
{
247
-
248
239
TSharedRef<SScrollBar> VerticalScrollBar = SNew (SScrollBar)
249
240
.Orientation (Orient_Vertical)
250
241
.Thickness (FVector2D (8 .0f , 8 .0f ));
251
242
252
243
TSharedRef<SHeaderRow> ListHeaderRow = SNew (SHeaderRow)
253
- + SHeaderRow::Column (ColumnSelect).HAlignCell (HAlign_Center)
254
- .VAlignCell (VAlign_Center)
244
+ + SHeaderRow::Column (ColumnDelete)
245
+ .HAlignCell (HAlign_Fill)
246
+ .VAlignCell (VAlign_Fill)
255
247
.VAlignHeader (VAlign_Center)
256
- .FixedWidth (20 .f )
248
+ .FixedWidth (22 .f )
257
249
[
258
- SNew (STextBlock).Text (LOCTEXT (" FactionColumnSelect " , " " ))
250
+ SNew (STextBlock).Text (LOCTEXT (" FactionColumnDelete " , " " ))
259
251
]
260
252
+ SHeaderRow::Column (ColumnId)
261
253
.HAlignCell (HAlign_Fill)
@@ -266,15 +258,16 @@ void FFactionTableCustomization::CustomizeChildren(TSharedRef<IPropertyHandle> S
266
258
[
267
259
SNew (SHorizontalBox)
268
260
+ SHorizontalBox::Slot ()
269
- .Padding (2 , 0 )
261
+ .Padding (5 , 0 )
270
262
.HAlign (HAlign_Left)
271
263
[
272
264
SNew (STextBlock)
273
- .Text (LOCTEXT (" FactionColumnTitle" , " Faction Id" ))
265
+ .Text (LOCTEXT (" FactionColumnId" , " Faction Id" ))
266
+ .ToolTipText (LOCTEXT (" FactionColumnIdTooltip" , " A faction's Id serves as its unique identifier. For setting a name use the Display Name" ))
274
267
]
275
268
+ SHorizontalBox::Slot ()
276
269
.HAlign (HAlign_Right)
277
- .Padding (4 , 0 )
270
+ .Padding (5 , 0 )
278
271
[
279
272
SNew (SBox)
280
273
.MaxDesiredHeight (20 .f )
@@ -287,22 +280,13 @@ void FFactionTableCustomization::CustomizeChildren(TSharedRef<IPropertyHandle> S
287
280
]
288
281
]
289
282
+ SHeaderRow::Column (ColumnColor)
290
- .HAlignCell (HAlign_Right )
283
+ .HAlignCell (HAlign_Center )
291
284
.VAlignCell (VAlign_Center)
292
285
.VAlignHeader (VAlign_Center)
293
- .FixedWidth (60 .f )
294
- .HeaderContentPadding (FMargin (0 , 3 ))
286
+ .FixedWidth (70 .f )
287
+ .HeaderContentPadding (FMargin (5 , 3 ))
295
288
[
296
289
SNew (STextBlock).Text (LOCTEXT (" FactionColumnColor" , " Color" ))
297
- ]
298
- + SHeaderRow::Column (ColumnDelete)
299
- .HAlignCell (HAlign_Right)
300
- .VAlignCell (VAlign_Center)
301
- .VAlignHeader (VAlign_Center)
302
- .FixedWidth (22 .f )
303
- .HeaderContentPadding (FMargin (0 , 3 ))
304
- [
305
- SNew (STextBlock).Text (LOCTEXT (" FactionColumnDelete" , " " ))
306
290
];
307
291
308
292
ListView = SNew (SListView<FFactionViewItemPtr>)
@@ -321,7 +305,7 @@ void FFactionTableCustomization::CustomizeChildren(TSharedRef<IPropertyHandle> S
321
305
.VAlign (VAlign_Top)
322
306
[
323
307
SNew (SBox)
324
- .Padding (FMargin{0 ,10 ,0 ,20 })
308
+ .Padding (FMargin{ 0 ,10 ,0 ,20 })
325
309
.VAlign (VAlign_Fill)
326
310
[
327
311
SNew (SHorizontalBox)
@@ -349,14 +333,18 @@ void FFactionTableCustomization::CustomizeChildren(TSharedRef<IPropertyHandle> S
349
333
.HAlign (HAlign_Fill)
350
334
[
351
335
SNew (SBox)
352
- .Padding (FMargin{ 10 , 10 , 10 , 10 } )
336
+ .Padding (10 )
353
337
.MinDesiredHeight (180 .f )
354
338
[
355
339
SAssignNew (FactionInfoContainer, SVerticalBox)
356
340
]
357
341
];
358
- }
359
342
343
+ if (!CurrentSelection.IsValid () && AvailableFactions.Num () > 0 )
344
+ {
345
+ SetSelection (AvailableFactions[0 ]);
346
+ }
347
+ }
360
348
361
349
FFactionTableCustomization::~FFactionTableCustomization ()
362
350
{
0 commit comments