40 lines
1.2 KiB
C++

// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "CoreMinimal.h"
#include "Blueprint/UserWidget.h"
#include "DragableUserWidget.generated.h"
/**
*
*/
UCLASS()
class PROJECTFISH_API UDragableUserWidget : public UUserWidget
{
GENERATED_BODY()
public:
UFUNCTION(BlueprintCallable, Category = "Dragable Widget")
void SetWidgetDragable(bool Dragable);
UFUNCTION(BlueprintCallable, Category = "Dragable Widget")
void BeginDrag(const FGeometry& InGeometry);
UFUNCTION(BlueprintCallable, Category = "Dragable Widget")
void EndDrag();
UFUNCTION(BlueprintImplementableEvent, Category = "Dragable Widget")
void OnMouseButtonDownWhenDragging(const FPointerEvent& PointerEvent);
// virtual FReply NativeOnMouseButtonDown( const FGeometry& InGeometry, const FPointerEvent& InMouseEvent ) override;
// virtual FReply NativeOnMouseButtonUp( const FGeometry& InGeometry, const FPointerEvent& InMouseEvent ) override;
// virtual FReply NativeOnMouseMove( const FGeometry& InGeometry, const FPointerEvent& InMouseEvent ) override;
protected:
UPROPERTY(BlueprintReadWrite, EditAnywhere, meta = (ExposeOnSpawn = true))
bool bDragable;
UPROPERTY(BlueprintReadOnly)
bool bDraging;
FVector2D OriginWidgetScreenPos;
};