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

#pragma once

#include "CoreMinimal.h"
#include "SCompoundWidget.h"
#include "SLeafWidget.h"

enum class EVolumeMeterMode
{
	Linear,
	Decibel
};

/**
 * 
 */
class ARONA_API SVolumeMeterBar : public SLeafWidget
{
public:
	SLATE_BEGIN_ARGS(SVolumeMeterBar):
	_Mode(EVolumeMeterMode::Decibel),
	_Width(20),
	_MinValue(-100),
	_MaxValue(10)
		{
		}
	
	SLATE_ATTRIBUTE(TArray<float>, MeterValue)
	SLATE_ARGUMENT(EVolumeMeterMode, Mode)
	SLATE_ARGUMENT(float, Width)
	SLATE_ARGUMENT(float, MinValue)
	SLATE_ARGUMENT(float, MaxValue)
	
	SLATE_END_ARGS()

	/** Constructs this widget with InArgs */
	void Construct(const FArguments& InArgs);
	
	virtual int32 OnPaint(const FPaintArgs& Args, const FGeometry& AllottedGeometry, const FSlateRect& MyCullingRect, FSlateWindowElementList& OutDrawElements, int32 LayerId, const FWidgetStyle& InWidgetStyle, bool bParentEnabled) const override;
	virtual FVector2D ComputeDesiredSize(float LayoutScaleMultiplier) const override;
private:
	float Width;
	TAttribute<TArray<float>> MeterValue;
	EVolumeMeterMode Mode;
	
	float MinValue = -100;
	float MaxValue = 10;
};