// Copyright Epic Games, Inc. All Rights Reserved. #pragma once #include "CoreMinimal.h" #include "Input/DragAndDrop.h" #include "DragAndDrop/DecoratedDragDropOp.h" class FCompositeDragDropOp : public FDecoratedDragDropOp { public: DRAG_DROP_OPERATOR_TYPE(FCompositeDragDropOp, FDecoratedDragDropOp) FCompositeDragDropOp() : FDecoratedDragDropOp() {} void AddSubOp(const TSharedPtr& SubOp) { check(!SubOp->IsOfType()); SubOps.Add(SubOp); } template TSharedPtr HasSubOp() { for (auto& SubOp : SubOps) { if (SubOp->IsOfType()) { return true; } } return false; } template TSharedPtr GetSubOp() { for (auto& SubOp : SubOps) { if (SubOp->IsOfType()) { return StaticCastSharedPtr(SubOp); } } return nullptr; } template const TSharedPtr GetSubOp() const { for (const auto& SubOp : SubOps) { if (SubOp->IsOfType()) { return StaticCastSharedPtr(SubOp); } } return nullptr; } virtual void ResetToDefaultToolTip() override { FDecoratedDragDropOp::ResetToDefaultToolTip(); for (const auto& SubOp : SubOps) { if (SubOp->IsOfType()) { auto DecoratedSubOp = StaticCastSharedPtr(SubOp); if (DecoratedSubOp.IsValid()) { DecoratedSubOp->ResetToDefaultToolTip(); } } } } private: TSharedPtr GetSubOpPtr(const FString& TypeId) const { for (const auto& SubOp : SubOps) { if (SubOp->IsOfTypeImpl(TypeId)) { return SubOp; } } return nullptr; } protected: TArray> SubOps; };