#include "UIButton_Base.h"

#include "UI/UIStyleRow.h"
#include "UI/UIStyleTokens.h"
#include "Engine/DataTable.h"

const FUIStyle* UUIButton_Base::GetActiveUIStyle(FName ThemeId) const
{
	const UDataTable* DT = LoadObject<UDataTable>(nullptr,
		TEXT("/Game/ZMMO/Data/UI/DT_UI_Styles.DT_UI_Styles"));
	if (!DT)
	{
		return nullptr;
	}

	if (const FUIStyleRow* Row = DT->FindRow<FUIStyleRow>(
		ThemeId, TEXT("UUIButton_Base::GetActiveUIStyle"), false))
	{
		return &Row->Style;
	}
	return nullptr;
}

const FUIStyleButton* UUIButton_Base::GetActiveButtonStyle(FName ThemeId) const
{
	const FUIStyle* UIStyle = GetActiveUIStyle(ThemeId);
	return UIStyle ? &UIStyle->Button : nullptr;
}
