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


#include "Slate/CommonBtn/SCsdkBaseBtn.h"
#include "SlateOptMacros.h"
#include "Blueprint/UserWidget.h"
#include "Widget/CommonBtn/CsdkCommonBtns.h"

BEGIN_SLATE_FUNCTION_BUILD_OPTIMIZATION

void SCsdkBaseBtn::Construct(const FArguments& InArgs)
{
	OnClicked =InArgs._OnClicked;
	SlotWidget = InArgs._SlotWidget;
	
	ChildSlot
	[
	
		SAssignNew(MyButton,SButton)
		.ContentPadding(FMargin{})
		.OnClicked(this,&SCsdkBaseBtn::OnButtonClicked)
		.ButtonStyle( &FCoreStyle::Get(),"NoBorder")
		[
			SlotWidget.ToSharedRef()
		]
	];

	MyButton->SetBorderBackgroundColor(FLinearColor{0,0,0,0 });
}

FReply SCsdkBaseBtn::OnButtonClicked()
{
	if(OnClicked.IsBound())
	{
		return  OnClicked.Execute();
	}
	return FReply::Unhandled();
}

END_SLATE_FUNCTION_BUILD_OPTIMIZATION


