//-----------------------------------------------------------------------------
// File			: ToolsAVP_Entity_MotionTrackerBlip.h
// Author		: Gareth Thomas
// Created		: 18 / 12 / 2007
// Copyright (c) 2007 Rebellion. All rights reserved.
//-----------------------------------------------------------------------------

//-----------------------------------------------------------------------------
// Begin File Wrapper
#ifdef ASURA_USE_PRAGMA_ONCE
#pragma once
#endif
#ifndef __TOOLSAVP_ENTITY_MOTIONTRACKERBLIP_H___
#define __TOOLSAVP_ENTITY_MOTIONTRACKERBLIP_H___ 1
// End File Wrapper
//-----------------------------------------------------------------------------

//-----------------------------------------------------------------------------
// Includes
//-----------------------------------------------------------------------------
#include "Core/Asura.h"

#include "Entity/Locations/Tools_Entity_Node.h"

//-----------------------------------------------------------------------------
// Forward Declarations
//-----------------------------------------------------------------------------
class AVP_ServerEntity_MotionTrackerBlip;

//-----------------------------------------------------------------------------
// Class		: ToolsAVP_Entity_MotionTrackerBlip
// Author		: Gareth Thomas
// Created		: 05 / 02 / 2009
// Description	: 
//-----------------------------------------------------------------------------
class ToolsAVP_Entity_MotionTrackerBlip : public Tools_Entity_Node
{

public:

	// Public Construction / Deconstruction functions...
	ToolsAVP_Entity_MotionTrackerBlip					( Asura_Entity* pxEntity );
	virtual ~ToolsAVP_Entity_MotionTrackerBlip			( void );

	// Public Static functions...
	static void				Create						( void );
	static Tools_Object*	Create						( Asura_Entity* pxEntity );
	static Tools_Object*	CreateAndReturn				( void );
	static void				Project_Create				( void );

	// Public Overridden Virtual Functions...
	virtual bool			IsBaseOrDerivativeOf		( int iToolsObjectType ) const;
	virtual bool			CanBeCopied					( void ) const								{ return true; }
	virtual Tools_Object*	CreateObjectOfThisType		( void ) const;
	virtual const char*		GetTypeDescription			( void )									{ return ( "MotyionTrackerBlip" ); }
	virtual void			OnSelection					( void );
	virtual void			OnDeselection				( void );
	virtual void			AddOverlayControls			( class Asura_Overlay* pxOverlay,class Asura_Vector_2& xOffset );
	virtual bool			GetParameter				( Asura_Hash_ID uParamID, Tools_Parameter* pxParam ) const;
	virtual bool			SetParameter				( Asura_Hash_ID uParamID, const Tools_Parameter* pxParam );
	virtual void			Render						( void );
	virtual void			UpdateWhileSelected			( void );

	static const Asura_Hashed_List<ToolsAVP_Entity_MotionTrackerBlip>* GetList(void)			{ return &s_xList;}
	static ToolsAVP_Entity_MotionTrackerBlip* FindEntity( Asura_Guid uGuid )					{ return s_xList.FindEntity( uGuid ); }

private:

	typedef Tools_Entity_Node PARENT;

	AVP_ServerEntity_MotionTrackerBlip* pxGameEntity;

	bool m_bChanged;

	static Asura_Hashed_List<ToolsAVP_Entity_MotionTrackerBlip>		s_xList;
	static ToolsAVP_Entity_MotionTrackerBlip*						s_pxSelectedMotionTrackerBlip;

	static void SelectStartNode( void );
	static void SetSelectedStartNode( Asura_Guid uGuid );
	static void ClearStartNode( void );
};

class ToolsAVP_MTBChooseObject : public Tools_ChooseObject
{
public:

	ToolsAVP_MTBChooseObject( void( *pfnOnChosen )( Asura_Guid ) )
	: m_pfnOnChosen( pfnOnChosen )
	{
	}

	void SetCallbackFn( void( *pfnOnChosen )( Asura_Guid uGuid ), int iUserData ) { m_pfnOnChosen = pfnOnChosen; }

	virtual bool CanBeSelected( Tools_Object* pxObject );

	virtual void ObjectSelected( Tools_Object* pxObject )
	{
		const Asura_Guid uObjectGuid = pxObject ? pxObject->GetGuid() : ASURA_GUID_UNREGISTERED;

		if ( m_pfnOnChosen )
		{
			m_pfnOnChosen( uObjectGuid );
		}
	}

	virtual void OnFinish() { delete this; }

private:
	void ( *m_pfnOnChosen )( Asura_Guid uGuid );
};

#endif // __TOOLSAVP_ENTITY_MOTIONTRACKERBLIP_H___