//
// Tools_GUIMenu_Widget_Numeric.h
//
// Created by Steven Keen - 21/02/2007
// 
// Copyright (C) 2007 Rebellion (Derby), All Rights Reserved.
//

#ifdef ASURA_USE_PRAGMA_ONCE
    #pragma once
#endif

#ifndef _TOOLS_GUIMENU_WIDGET_NUMERIC_H_
#define _TOOLS_GUIMENU_WIDGET_NUMERIC_H_
#ifdef ASURA_USE_GUI_MENU_SYSTEM

#include "Tools_GUIMenu_Widget_Base.h"
#include "GUIMenu/Asura_GUIMenu_Widget_Numeric.h"
#include "GUIMenu/Asura_GUIMenu_Menu_Page.h"

class Tools_GUIMenu_Widget_Numeric : public Tools_GUIMenu_Widget_Base
{
typedef Tools_GUIMenu_Widget_Base PARENT;

public :
	Tools_GUIMenu_Widget_Numeric(Asura_GUIMenu_Widget_Numeric* pxAsuraProgressBar,Tools_GUIMenu_Root* pxToolsParent);

	virtual void Update( void);
	virtual void InitialiseNewItem();
	virtual void AddToPreviewOverlay() const;

protected:
	virtual void AddOverlayControls(Asura_Overlay* pxOverlay,Asura_Vector_2& xOffset);
	void		 AddRangeOverlayControls(Asura_Overlay* pxOverlay,Asura_Vector_2& xOffset);
	virtual void UpdateReferences(Asura_Hash_ID uOldID,Asura_Hash_ID uNewID, bool bPostCopy);
//	virtual void UpdateOverlayControls(Asura_Overlay* pxOverlay);
	virtual u_int GetFlagsToEdit() const;
	virtual const char* GetLocalDataFlagName(u_int uFlagValue) const;
	virtual void Copy(const Tools_GUIMenu_Root* pxSource);
	
private:

	void UpdateFromConsoleVarIfRequired();
	
	#define OVERLAY_BOOL_CALLBACK(__FnName)\
	static bool __FnName(int iThis){return ((Tools_GUIMenu_Widget_Numeric*)iThis)->__FnName();}\
	bool __FnName();

	OVERLAY_BOOL_CALLBACK(CanEditMinimum)
	OVERLAY_BOOL_CALLBACK(CanEditMaximum)
	OVERLAY_BOOL_CALLBACK(CanEditStep)
	OVERLAY_BOOL_CALLBACK(CanEditFeedback)
	OVERLAY_BOOL_CALLBACK(CanEditFlash)
	OVERLAY_BOOL_CALLBACK(CanEditInputRepeat)

	#undef OVERLAY_BOOL_CALLBACK

private :
	Asura_GUIMenu_Widget_Numeric*		m_pxAsuraNumeric;

	float								m_fEditMin;
	float								m_fEditMax;
	float								m_fEditStep;

	int									m_iEditMin;
	int									m_iEditMax;
	int									m_iEditStep;

	bool								m_bChangedMin;
	bool								m_bChangedMax;
	bool								m_bChangedStep;
	bool								m_bChangedConsoleVar;
	bool								m_bChangedUseConsoleVarMinAndMax;

	int									m_iTextOutputTypeIndex;
	bool								m_bTextOutputTypeChanged;

	u_int								m_uPrecision;
	bool								m_bChangedPrecision;

	Asura_RGBA							m_xFlashColour;
	bool								m_bFlashColourChanged;

	float								m_fFlashTime;
	bool								m_bFlashTimeChanged;

	float								m_fInitialRepeatDelay;
	float								m_fSecondaryRepeatDelay;
	bool								m_bInputDelayChanged;
};




#endif //ASURA_USE_GUI_MENU_SYSTEM
#endif //_TOOLS_GUIMENU_WIDGET_NUMERIC_H_
