#pragma once
#include "guielement.h"
#include "Image.h"

class GAMEGUI_API Slider : public GUIElement
{
	Image*	m_pBar;
	Image*	m_pNob;

	bool	m_bDragNob;
	float	m_DragOffset; //xoffset form cursor to nob for dragging

	float m_NobOffset;
	int m_Value;
	int m_Min;
	int m_Max;

	void SetImagePos(void);
	void SetNobPos(void);

	static void OnNobMouseDown(GUIElement* const sender, const GUIEVENT evnt, void* pData);

protected:
	virtual ~Slider(void);

public:
	Slider(MenuManager* const pManager, const DWORD id);

	virtual void OnUpdate(void);
	virtual void SetSize(const float xl, const float yl);
	
	void SetSliderSize(const float sliderheight, const float nobxl, const float nobyl, const float nobsideoffset);
	void SetTexture(DXTexture* const bar, DXTexture* const nob) { m_pBar->SetTexture(bar); m_pNob->SetTexture(nob); }
	void SetAlphaBlend(const bool ab) { m_pBar->SetAlphaBlend(ab); m_pNob->SetAlphaBlend(ab); }
	void SetRange(const int min, const int max);
	void SetValue(const int value);
	int GetValue(void) const { return m_Value; }
};
