//////////////////////////////////////////////////////////////////////////////
//
// Tools_GUIMenu_CommandConsole.h
//
// Copyright (c) 2007 Rebellion. All rights reserved.
//
// Description:
//
//     Tools interface for GUIMenu command console interaction
//
//////////////////////////////////////////////////////////////////////////////

// B E G I N   F I L E   W R A P P E R ///////////////////////////////////////

#ifdef ASURA_USE_PRAGMA_ONCE
    #pragma once
#endif

#ifndef TOOLS_GUIMENU_COMMANDCONSOLE_H___
#define TOOLS_GUIMENU_COMMANDCONSOLE_H___ 1

#include "Interface/Asura_Dialog.h"

class Asura_GUIMenu_ConsoleVar;


//drop down list for selecting console var/command (based on Tools_SoundFilename_Dialog)
class Tools_GUIMenu_ConsoleVarOrCmd_Dialog : public Asura_DropDown_List_Dialog
{
public :
	Tools_GUIMenu_ConsoleVarOrCmd_Dialog(const char* szLabel, const Asura_Vector_2& xOffset,Asura_String* pxConsoleVar,int iType,const char* szBaseHelpText,bool* pbModified);
	~Tools_GUIMenu_ConsoleVarOrCmd_Dialog();


protected:
	void PerFrameUpdate();
	void UpdateHelpText();

	static void OnSelectionChanged(int iThis){((Tools_GUIMenu_ConsoleVarOrCmd_Dialog*)iThis)->OnSelectionChanged();}
	void OnSelectionChanged();

	void UpdateConsoleVarList();
	virtual void PopulateList() = 0;
	void DeleteConsoleVarList();

	Asura_String* m_pxConsoleVar;
	int m_iType;
	bool* m_pbModified;

	Asura_String m_xConsoleVarBackup;
	bool m_bSelectionChanged;

	int m_iSelectedIndex;
	bool m_bInitialised;

	u_int m_uConsoleVarListSize;
	const char** m_pszConsoleVarList;
	class Asura_StringTree* m_pxConsoleVarTree;

	Asura_String m_xBaseHelpText;

	//for determining validity of current list
	int m_iListValidID;
	static int s_iListValidID;

};

class Tools_GUIMenu_ConsoleVar_Dialog : public Tools_GUIMenu_ConsoleVarOrCmd_Dialog
{
public:
	Tools_GUIMenu_ConsoleVar_Dialog(const Asura_Vector_2& xOffset,const char* szLabel,Asura_GUIMenu_ConsoleVar* pxVar,u_int uType,const char* szBaseHelpText,bool* pbModified);

protected:
	virtual void PopulateList();
	virtual void PerFrameUpdate();

	Asura_GUIMenu_ConsoleVar* m_pxVar;

};

class Tools_GUIMenu_ConsoleCmd_Dialog : public Tools_GUIMenu_ConsoleVarOrCmd_Dialog
{
public:
	Tools_GUIMenu_ConsoleCmd_Dialog(const Asura_Vector_2& xOffset,const char* szLabel,Asura_String* pxConsoleVar,u_int uType,const char* szBaseHelpText,bool* pbModified)
		:Tools_GUIMenu_ConsoleVarOrCmd_Dialog(szLabel,xOffset,pxConsoleVar,uType,szBaseHelpText,pbModified)
	{}

protected:
	virtual void PopulateList();
};

//Dialog for selecting a widget hash for a condition var
class Tools_GUIMenu_ConditionVar_Widget_Dialog : public Asura_Function_Dialog
{
public	:
	Tools_GUIMenu_ConditionVar_Widget_Dialog(const Asura_Vector_2& xOffset,Asura_String* pxValue,bool* pbChanged);

	void SetWidgetHash(Asura_Hash_ID uHash);
private :
	virtual void PerFrameUpdate();

	void UpdateWidgetLabel();


	static void OnClicked(int iThis){((Tools_GUIMenu_ConditionVar_Widget_Dialog*)iThis)->OnClicked();}
	void OnClicked();

	Asura_String* m_pxValue;
	Asura_String m_xValueBackup;
	bool* m_pbChanged;
};

class Tools_GUIMenu_ConditionVar_Page_Dialog : public Asura_Function_Dialog
{
public:
	Tools_GUIMenu_ConditionVar_Page_Dialog(const Asura_Vector_2& xOffset,Asura_String* pxValue,bool* pbChanged);
	
	void SetWidgetHash(Asura_Hash_ID uHash);
private:
	virtual void PerFrameUpdate();	

	void UpdatePageLabel();

	static void OnClicked(int iThis){((Tools_GUIMenu_ConditionVar_Page_Dialog*)iThis)->OnClicked();}
	void OnClicked();

	Asura_String* m_pxValue;
	Asura_String m_xValueBackup;
	bool* m_pbChanged;
};

// E N D   F I L E   W R A P P E R ///////////////////////////////////////////

#endif // #ifndef TOOLS_GUIMENU_COMMANDCONSOLE_H___
