// File: registeredinputfunctor.h
// Created by: <Jörn Reimerdes>
// Created on: 22.03.2005

/**
 * registeredinputfunctor.h - is part of the iwear-framework
 * @file
 * $Id$
 * $Revision$
 * $Author$
 * $Date$
 *
 * This file is part of The iWear Framework.
 * In particular this file is part of the Framework Input Library
 *
 * The iWear Framework is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by the
 * Free Software Foundation as in version 2 of the License.

 * 
 * The iWear Framework is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
 * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
 * more details.
 * 
 * You should have received a copy of the GNU General Public License along with
 * The iWear Framework; if not, write to the Free Software Foundation, Inc., 59
 * Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

#ifndef __REGISTEREDINPUTFUNCTOR_H
#define __REGISTEREDINPUTFUNCTOR_H

#ifndef __UID_H
#include <iwear/uid.h>
#endif

using namespace iwear;

namespace iwear {
namespace input {

template<class T>
class RegisteredInputFunctor
{
public:

    /** Creates a new instance of Registeredinputfunctor objects.
     */
    RegisteredInputFunctor(const uid& application_uid, 
			   T* input_functor,
			   bool call_when_not_active = false)
	: application_uid(&application_uid),
	  input_functor(input_functor),
	  call_when_not_active(call_when_not_active)
    {
    }

    /** Delets the Registeredinputfunctor.
     */
    virtual ~RegisteredInputFunctor( void ){
    }

    /** Gets the uid of the application which created the functor. 
     * @return The applications uid.
     */
    inline const uid* get_application_uid( void ){
	return this->application_uid;
    }

    /** Gets the functor which should be called.
     * @return The special input functor which whould be called.
     */
    inline T* get_functor( void ){
	return this->input_functor;
    }

    /** Gets if the functor should be called even if the application
     * is not active.
     * @return True if the functor should be called even if the
     *  application is not active else false.
     */
    inline bool get_call_when_not_active( void ){
	return call_when_not_active;
    }

protected:

private: 

    /* The applications uid */
    const uid* application_uid;

    /* The input functor which should be called. */
    T* input_functor;

    /* Call functor when the application is not active. */
    bool call_when_not_active;

};

} // input
} // iwear
#endif	//__REGISTEREDINPUTFUNCTOR_H

