52 lines
1.0 KiB
C++
52 lines
1.0 KiB
C++
// Copyright Epic Games, Inc. All Rights Reserved.
|
|
|
|
#include "LyraButtonBase.h"
|
|
#include "CommonActionWidget.h"
|
|
|
|
void ULyraButtonBase::NativePreConstruct()
|
|
{
|
|
Super::NativePreConstruct();
|
|
|
|
UpdateButtonStyle();
|
|
RefreshButtonText();
|
|
}
|
|
|
|
void ULyraButtonBase::UpdateInputActionWidget()
|
|
{
|
|
Super::UpdateInputActionWidget();
|
|
|
|
UpdateButtonStyle();
|
|
RefreshButtonText();
|
|
}
|
|
|
|
void ULyraButtonBase::SetButtonText(const FText& InText)
|
|
{
|
|
bOverride_ButtonText = InText.IsEmpty();
|
|
ButtonText = InText;
|
|
RefreshButtonText();
|
|
}
|
|
|
|
void ULyraButtonBase::RefreshButtonText()
|
|
{
|
|
if (bOverride_ButtonText || ButtonText.IsEmpty())
|
|
{
|
|
if (InputActionWidget)
|
|
{
|
|
const FText ActionDisplayText = InputActionWidget->GetDisplayText();
|
|
if (!ActionDisplayText.IsEmpty())
|
|
{
|
|
UpdateButtonText(ActionDisplayText);
|
|
return;
|
|
}
|
|
}
|
|
}
|
|
|
|
UpdateButtonText(ButtonText);
|
|
}
|
|
|
|
void ULyraButtonBase::OnInputMethodChanged(ECommonInputType CurrentInputType)
|
|
{
|
|
Super::OnInputMethodChanged(CurrentInputType);
|
|
|
|
UpdateButtonStyle();
|
|
} |