// Copyright (c) Microsoft Corporation. 
// Licensed under the MIT license.

#include "SVisibilityButton.h"

void SVisibilityButton::Construct(const FArguments& InArgs)
{
	SButton::Construct(SButton::FArguments()
		.ContentPadding(InArgs._ContentPadding)
		.ButtonStyle(InArgs._ButtonStyle)
		.HAlign(InArgs._HAlign)
		.VAlign(InArgs._VAlign)
		.OnClicked(InArgs._OnClicked)
		.OnHovered(InArgs._OnHovered)
		.OnUnhovered(InArgs._OnUnhovered)
		[
			InArgs._Content.Widget
		]
	);

	OnRightClicked = InArgs._OnRightClicked;
}

FReply SVisibilityButton::OnMouseButtonUp(const FGeometry& MyGeometry, const FPointerEvent& MouseEvent)
{
	if (MouseEvent.GetEffectingButton() == EKeys::RightMouseButton)
	{
		if (OnRightClicked.IsBound())
		{
			OnRightClicked.Execute();
		}
	}

	return SButton::OnMouseButtonUp(MyGeometry, MouseEvent);
}
