Cut5/Source/Cut5/Widgets/SCustomInputResource.cpp
2023-07-19 19:07:10 +08:00

56 lines
1.3 KiB
C++

// Fill out your copyright notice in the Description page of Project Settings.
#include "SCustomInputResource.h"
#include "DefineGlobal.h"
#include "SlateOptMacros.h"
BEGIN_SLATE_FUNCTION_BUILD_OPTIMIZATION
void SCustomInputResource::Construct(const FArguments& InArgs)
{
PropertyData = InArgs._PropertyData;
VideoCapture = InArgs._VideoCapture;
ChildSlot
[
SNew(SBox)
.WidthOverride(100)
.HeightOverride(100)
[
SNew(SOverlay)
+ SOverlay::Slot()
.HAlign(HAlign_Fill)
.VAlign(VAlign_Fill)
[
SNew(SButton)
]
+ SOverlay::Slot()
.HAlign(HAlign_Fill)
.VAlign(VAlign_Fill)
[
SNew(SImage)
]
]
];
}
FReply SCustomInputResource::OnMouseButtonDown(const FGeometry& MyGeometry, const FPointerEvent& MouseEvent)
{
return FReply::Handled().DetectDrag(SharedThis(this), EKeys::LeftMouseButton);
}
FReply SCustomInputResource::OnDragDetected(const FGeometry& MyGeometry, const FPointerEvent& MouseEvent)
{
const TSharedPtr<FTrackClipDragOperation> Operation = MakeShared<FTrackClipDragOperation>();
Operation->TimelinePropertyData = &PropertyData;
Operation->DraggingWidget = SharedThis(this);
Operation->Type = FCutDragDropBase::EType::TrackClip;
Operation->VideoCapture = &VideoCapture;
return FReply::Handled().BeginDragDrop(Operation.ToSharedRef());
}
END_SLATE_FUNCTION_BUILD_OPTIMIZATION