2014-12-07 19:09:38 -05:00
|
|
|
// Copyright 1998-2015 Epic Games, Inc. All Rights Reserved.
|
2014-11-25 09:36:31 -05:00
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
#include "Kismet2/StructureEditorUtils.h"
|
|
|
|
|
#include "DataTableEditorUtils.h"
|
|
|
|
|
|
|
|
|
|
DECLARE_DELEGATE_OneParam(FOnRowModified, FName /*Row name*/);
|
2014-12-11 10:59:40 -05:00
|
|
|
DECLARE_DELEGATE_OneParam(FOnRowSelected, FName /*Row name*/);
|
2014-11-25 09:36:31 -05:00
|
|
|
|
|
|
|
|
class SRowEditor : public SCompoundWidget
|
2015-04-14 09:30:09 -04:00
|
|
|
, public FNotifyHook
|
2014-11-25 09:36:31 -05:00
|
|
|
, public FStructureEditorUtils::INotifyOnStructChanged
|
|
|
|
|
, public FDataTableEditorUtils::INotifyOnDataTableChanged
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
SLATE_BEGIN_ARGS(SRowEditor) {}
|
|
|
|
|
SLATE_END_ARGS()
|
|
|
|
|
|
|
|
|
|
SRowEditor();
|
|
|
|
|
virtual ~SRowEditor();
|
|
|
|
|
|
2015-04-14 09:30:09 -04:00
|
|
|
// FNotifyHook
|
|
|
|
|
virtual void NotifyPreChange( UProperty* PropertyAboutToChange ) override;
|
|
|
|
|
virtual void NotifyPostChange( const FPropertyChangedEvent& PropertyChangedEvent, UProperty* PropertyThatChanged ) override;
|
|
|
|
|
|
2014-11-25 09:36:31 -05:00
|
|
|
// INotifyOnStructChanged
|
|
|
|
|
virtual void PreChange(const class UUserDefinedStruct* Struct, FStructureEditorUtils::EStructureEditorChangeInfo Info) override;
|
|
|
|
|
virtual void PostChange(const class UUserDefinedStruct* Struct, FStructureEditorUtils::EStructureEditorChangeInfo Info) override;
|
|
|
|
|
|
|
|
|
|
// INotifyOnDataTableChanged
|
|
|
|
|
virtual void PreChange(const UDataTable* Changed, FDataTableEditorUtils::EDataTableChangeInfo Info) override;
|
|
|
|
|
virtual void PostChange(const UDataTable* Changed, FDataTableEditorUtils::EDataTableChangeInfo Info) override;
|
|
|
|
|
|
2014-12-11 10:59:40 -05:00
|
|
|
FOnRowSelected RowSelectedCallback;
|
|
|
|
|
|
2014-11-25 09:36:31 -05:00
|
|
|
private:
|
|
|
|
|
|
|
|
|
|
TArray<TSharedPtr<FName>> CachedRowNames;
|
|
|
|
|
TSharedPtr<FStructOnScope> CurrentRow;
|
|
|
|
|
TAssetPtr<UDataTable> DataTable; // weak obj ptr couldn't handle reimporting
|
|
|
|
|
TSharedPtr<class IStructureDetailsView> StructureDetailsView;
|
|
|
|
|
TSharedPtr<FName> SelectedName;
|
|
|
|
|
TSharedPtr<SComboBox<TSharedPtr<FName>>> RowComboBox;
|
2014-12-15 15:30:22 -05:00
|
|
|
TSharedPtr<SEditableTextBox> RenameTextBox;
|
2014-11-25 09:36:31 -05:00
|
|
|
|
|
|
|
|
void RefreshNameList();
|
|
|
|
|
void CleanBeforeChange();
|
|
|
|
|
void Restore();
|
|
|
|
|
|
|
|
|
|
UScriptStruct* GetScriptStruct() const;
|
|
|
|
|
|
|
|
|
|
FName GetCurrentName() const;
|
|
|
|
|
FText GetCurrentNameAsText() const;
|
|
|
|
|
FString GetStructureDisplayName() const;
|
|
|
|
|
TSharedRef<SWidget> OnGenerateWidget(TSharedPtr<FName> InItem);
|
|
|
|
|
void OnSelectionChanged(TSharedPtr<FName> InItem, ESelectInfo::Type InSeletionInfo);
|
|
|
|
|
|
|
|
|
|
FReply OnAddClicked();
|
|
|
|
|
FReply OnRemoveClicked();
|
2015-03-31 12:04:50 -04:00
|
|
|
FReply OnMoveRowClicked(FDataTableEditorUtils::ERowMoveDirection MoveDirection);
|
|
|
|
|
FReply OnMoveToExtentClicked(FDataTableEditorUtils::ERowMoveDirection MoveDirection);
|
2014-11-25 09:36:31 -05:00
|
|
|
void OnRowRenamed(const FText& Text, ETextCommit::Type CommitType);
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
|
|
void Construct(const FArguments& InArgs, UDataTable* Changed);
|
2014-12-11 10:59:40 -05:00
|
|
|
|
|
|
|
|
void SelectRow(FName Name);
|
2015-04-14 09:30:09 -04:00
|
|
|
|
|
|
|
|
void HandleUndoRedo();
|
|
|
|
|
};
|