Files
Naked-Desire/Source/NakedDesire/UI/Menu/ConfirmModalWidget.h
T
2026-06-05 20:00:33 +03:00

52 lines
1.3 KiB
C++

// © 2025 Naked People Team. All Rights Reserved.
#pragma once
#include "CoreMinimal.h"
#include "CommonActivatableWidget.h"
#include "ConfirmModalWidget.generated.h"
class UButton;
class UTextBlock;
// Reusable yes/no confirmation popup. Pushed onto a stack by the menu that owns it;
// the opener calls Setup() for the copy and binds OnConfirmed / OnCancelled to react.
UCLASS(Abstract)
class NAKEDDESIRE_API UConfirmModalWidget : public UCommonActivatableWidget
{
GENERATED_BODY()
public:
// Sets the popup copy. Safe to call before the widget tree exists (cached and applied on activate).
void Setup(const FText& InTitle, const FText& InMessage);
// C++-only result events — the opener binds whichever it cares about.
DECLARE_MULTICAST_DELEGATE(FOnConfirmModalResult);
FOnConfirmModalResult OnConfirmed;
FOnConfirmModalResult OnCancelled;
protected:
virtual void NativeOnActivated() override;
private:
UPROPERTY(meta = (BindWidget))
TObjectPtr<UButton> ConfirmButton;
UPROPERTY(meta = (BindWidget))
TObjectPtr<UButton> CancelButton;
UPROPERTY(meta = (BindWidgetOptional))
TObjectPtr<UTextBlock> TitleText;
UPROPERTY(meta = (BindWidgetOptional))
TObjectPtr<UTextBlock> MessageText;
FText PendingTitle;
FText PendingMessage;
UFUNCTION()
void HandleConfirmClicked();
UFUNCTION()
void HandleCancelClicked();
};