37 lines
1.0 KiB
C++

// ©2022 Batty Bovine Productions, LLC. All Rights Reserved.
#pragma once
#include "CoreMinimal.h"
#include "CommonButtonBase.h"
#include "CommonTextBlock.h"
#include "BugFormButton.generated.h"
UCLASS()
class UNREALZILLA_API UBugFormButton : public UCommonButtonBase
{
GENERATED_BODY()
public:
virtual void NativeConstruct() override { this->SetText(this->CurrentText); }
UFUNCTION(BlueprintCallable)
void SetText(const FText Text) { this->CurrentText = Text.IsEmpty() ? this->DefaultText : Text; this->TextLabel->SetText(this->CurrentText); }
UFUNCTION(BlueprintPure)
FText GetText() const { return this->TextLabel->GetText().EqualTo(this->DefaultText) ? FText::GetEmpty() : this->TextLabel->GetText(); }
protected:
virtual void NativePreConstruct() override { this->TextLabel->SetText(this->DefaultText); }
UPROPERTY(BlueprintReadOnly, meta=(BindWidget))
TObjectPtr<class UCommonTextBlock> TextLabel;
UPROPERTY(BlueprintReadOnly, EditAnywhere)
FText DefaultText;
private:
FText CurrentText;
};