49 lines
1.0 KiB
C++
49 lines
1.0 KiB
C++
// Fill out your copyright notice in the Description page of Project Settings.
|
|
|
|
|
|
#include "CustomizationCategoryWidget.h"
|
|
|
|
#include "Components/Border.h"
|
|
#include "Components/Button.h"
|
|
#include "Components/TextBlock.h"
|
|
|
|
void UCustomizationCategoryWidget::NativeOnInitialized()
|
|
{
|
|
Super::NativeOnInitialized();
|
|
|
|
if (CategoryButton)
|
|
{
|
|
CategoryButton->OnClicked.AddDynamic(this, &UCustomizationCategoryWidget::HandleButtonClicked);
|
|
}
|
|
|
|
SetSelected(false);
|
|
}
|
|
|
|
void UCustomizationCategoryWidget::Setup(int32 InIndex, const FText& InLabel)
|
|
{
|
|
CategoryIndex = InIndex;
|
|
|
|
if (CategoryLabel)
|
|
{
|
|
CategoryLabel->SetText(InLabel);
|
|
}
|
|
}
|
|
|
|
void UCustomizationCategoryWidget::SetSelected(bool bInSelected)
|
|
{
|
|
if (CategoryLabel)
|
|
{
|
|
CategoryLabel->SetColorAndOpacity(FSlateColor(bInSelected ? SelectedLabelColor : UnselectedLabelColor));
|
|
}
|
|
|
|
if (SelectionBorder)
|
|
{
|
|
SelectionBorder->SetBrushColor(bInSelected ? SelectedBorderColor : UnselectedBorderColor);
|
|
}
|
|
}
|
|
|
|
void UCustomizationCategoryWidget::HandleButtonClicked()
|
|
{
|
|
OnCategoryClicked.Broadcast(CategoryIndex);
|
|
}
|