// ------------------------------------------------------------------------
/*
	author: Jaap Suter
   
	Copyright (C) Electronic Arts Canada Inc. 2002.  All rights reserved.	
*/
// ------------------------------------------------------------------------

/*! \file */

#ifndef REVEAL_BOUND_CONTEXT_H
#define REVEAL_BOUND_CONTEXT_H

#include <stddef.h>
#include <assert.h>
#include <math.h>

#include "reveal/context/context.h"

namespace Reveal {
	namespace Context {

// ------------------------------------------------------------------------------
/*!
	\brief This is a context-sensitive menu bound to a type T. This menu will work 
		   for multiple instances of type T, by using the SetObject function to set the
		   current instance the menu applies to;
*/
// ------------------------------------------------------------------------------
template < class T >
class BoundContext : public Context
{
public:
	BoundContext( const char* rootName ) : Context( rootName ), mObject( 0 ) {}

	//! Sets the current object the menu refers to;
	void SetObject( T& t ) { mObject = &t; }

	//! Retuns the current object the menu refers to;
	T*   GetObject() { return mObject; }

private:
	T* mObject;
};

	} // Namespace Context;
} // Namespace Reveal;

#endif
