// Fill out your copyright notice in the Description page of Project Settings.


#include "AIGCStyle.h"

#include "Interfaces/IPluginManager.h"
#include "Styling/SlateStyle.h"
#include "Styling/SlateStyleMacros.h"
#include "Styling/SlateStyleRegistry.h"

#define RootToContentDir Style->RootToContentDir
TSharedPtr<FSlateStyleSet> FAIGCStyle::StyleInstance = nullptr;
void FAIGCStyle::Initialize()
{
	if (!StyleInstance.IsValid())
	{
		StyleInstance = Create();
		FSlateStyleRegistry::RegisterSlateStyle(*StyleInstance);
	}
}

void FAIGCStyle::Shutdown()
{
	FSlateStyleRegistry::UnRegisterSlateStyle(*StyleInstance);
	ensure(StyleInstance.IsUnique());
	StyleInstance.Reset();
}

void FAIGCStyle::ReloadTextures()
{
	if (FSlateApplication::IsInitialized())
	{
		FSlateApplication::Get().GetRenderer()->ReloadTextureResources();
	}
}

const ISlateStyle& FAIGCStyle::Get()
{
	return *StyleInstance;
}

FName FAIGCStyle::GetStyleSetName()
{
	static FName StyleSetName(TEXT("AIGCStyle"));
	return StyleSetName;
}

TSharedRef<class FSlateStyleSet> FAIGCStyle::Create()
{
	TSharedRef< FSlateStyleSet > Style = MakeShareable(new FSlateStyleSet("AIGCStyle"));
	Style->SetContentRoot(IPluginManager::Get().FindPlugin("AIGC")->GetBaseDir() / TEXT("Resources"));

	Style->Set("AIGCStyle.AIChat", new IMAGE_BRUSH(TEXT("deepseek"), FVector2D(128.0, 128.0)));

	return Style;
}
