// © 2025 Naked People Team. All Rights Reserved.


#include "TextButton.h"

#include "CommonTextBlock.h"

void UTextButton::SetIsActive(const bool Value)
{
	IsActive = Value;
	
	GetSingleMaterialStyleMID()->SetScalarParameterValue(TEXT("Selected"), Value ? 1.0f : 0.0f);
}

void UTextButton::NativePreConstruct()
{
	Super::NativePreConstruct();
	
	TextBlock->SetText(Text);
}

void UTextButton::NativeOnCurrentTextStyleChanged()
{
	Super::NativeOnCurrentTextStyleChanged();
	
	TextBlock->SetStyle(GetCurrentTextStyleClass());
}

void UTextButton::NativeOnHovered()
{
	Super::NativeOnHovered();
	
	GetSingleMaterialStyleMID()->SetScalarParameterValue(TEXT("Hovered"), 1.0f);
}

void UTextButton::NativeOnUnhovered()
{
	Super::NativeOnUnhovered();
	
	GetSingleMaterialStyleMID()->SetScalarParameterValue(TEXT("Hovered"), 0.0f);
}
