#include <OMKGenericKeyExtension.h>
Inheritance diagram for OMK::Inp::GenericKeyExtension< OwnerClass >:
Protected Member Functions | |
bool | pressFct (Event *event) |
The call back method associated with the event listener for press. | |
bool | releaseFct (Event *event) |
The call back method associated with the event listener for release. | |
virtual void | action () |
The method to overwrite for press action. | |
virtual void | actionRelease () |
The method to overwrite for release action. | |
Configuration loaders | |
virtual bool | loadExtensionParameters (const ConfigurationParameterDescriptor *node) |
Configuration parameters loader of Extension. | |
Protected Attributes | |
EventListener * | _eventListenerPress |
The event listener which receives the key press event. | |
EventListener * | _eventListenerRelease |
The event listener which receives the key release event. | |
const std::string | _defaultKey |
The default key. |
myObject { Class MyObject ... Extensions { boundingBox { Class BoundingBox Key f3 // the default is given in the constructor VisuName visualisation // the default is "visualisation" needed to create the key listener ActionOn Press // or Release or Both, by default it is Press } ... } } *
the_sender_object->sendEvent( "myObject", OMK::Inp::KeyListener::getKeyPressCode( "f3" ) ) ;
Definition at line 61 of file OMKGenericKeyExtension.h.
OMK::Inp::GenericKeyExtension< OwnerClass >::GenericKeyExtension | ( | ExtensibleSimulatedObject * | owner, | |
const Name & | id, | |||
bool | registerExtension, | |||
const std::string & | defaultKey | |||
) | [inline, protected] |
Constructor.
It is protected, because it is only called by the friend creator.
Definition at line 69 of file OMKGenericKeyExtension.h.
00070 : ExtensionT< OwnerClass >( owner, id ), 00071 _eventListenerPress( 0 ), 00072 _eventListenerRelease( 0 ), 00073 _defaultKey( defaultKey ) 00074 { 00075 }
virtual OMK::Inp::GenericKeyExtension< OwnerClass >::~GenericKeyExtension | ( | ) | [inline, virtual] |
Definition at line 77 of file OMKGenericKeyExtension.h.
00078 { 00079 delete _eventListenerPress ; 00080 delete _eventListenerRelease ; 00081 }
OMK::Inp::GenericKeyExtension< OwnerClass >::GenericKeyExtension | ( | ExtensibleSimulatedObject * | owner, | |
const Name & | id, | |||
bool | registerExtension, | |||
const std::string & | defaultKey | |||
) | [inline, protected] |
Constructor.
It is protected, because it is only called by the friend creator.
Definition at line 69 of file OMKGenericKeyExtension.h.
00070 : ExtensionT< OwnerClass >( owner, id ), 00071 _eventListenerPress( 0 ), 00072 _eventListenerRelease( 0 ), 00073 _defaultKey( defaultKey ) 00074 { 00075 }
virtual OMK::Inp::GenericKeyExtension< OwnerClass >::~GenericKeyExtension | ( | ) | [inline, virtual] |
Definition at line 77 of file OMKGenericKeyExtension.h.
00078 { 00079 delete _eventListenerPress ; 00080 delete _eventListenerRelease ; 00081 }
virtual bool OMK::Inp::GenericKeyExtension< OwnerClass >::loadExtensionParameters | ( | const ConfigurationParameterDescriptor * | node | ) | [inline, protected, virtual] |
Configuration parameters loader of Extension.
Retrieves the key (by default it is B), then creates the event listener and the key listener for the defined key.
Reimplemented from OMK::Extension.
Reimplemented in OMK::Inp::DebugOverlayExtension, OMK::Inp::KeyEmitterExtension, OMK::Inp::KeyEmitterExtensionT< T, ModelType >, OMK::Inp::OverlayExtension, and OMK::Inp::PlusMinusExtension< T >.
Definition at line 96 of file OMKGenericKeyExtension.h.
Referenced by OMK::Inp::PlusMinusExtension< T >::loadExtensionParameters().
00097 { 00098 bool ok = true ; 00099 std::string key( _defaultKey ) ; 00100 ParametersAccessor::get( node, "Key", key ) ; 00101 std::string visuName( "visualisation" ) ; 00102 ok = ok && ParametersAccessor::get( node, "VisuName", visuName, _owner ) ; 00103 // What kind of action 00104 bool press = true ; 00105 bool release = false ; 00106 std::string actionOn ; 00107 if( ParametersAccessor::get( node, "ActionOn", actionOn ) ) 00108 { 00109 std::transform( actionOn.begin(), actionOn.end(), actionOn.begin(), toupper ) ; 00110 press = ( actionOn == "PRESS" ) || ( actionOn == "BOTH" ) ; 00111 release = ( actionOn == "RELEASE" ) || ( actionOn == "BOTH" ) ; 00112 } 00113 // initialisation of the listeners 00114 if( ok && press ) 00115 { 00116 _eventListenerPress = new EventListenerCallBack< GenericKeyExtension< OwnerClass > > 00117 ( *_owner, this, 00118 (typename EventListenerCallBack< GenericKeyExtension< OwnerClass > >::CallBackFct)&GenericKeyExtension< OwnerClass >::pressFct, 00119 OMK::Inp::KeyListener::getKeyPressCode( key ) ) ; 00120 _owner->sendValuedEvent( visuName, OMK::Inp::InputExtension::ADD_KEY, OMK::Inp::AddInputKeyPrm( key, _owner->getName() ) ) ; 00121 } 00122 if( ok && release ) 00123 { 00124 _eventListenerRelease = new EventListenerCallBack< GenericKeyExtension< OwnerClass > > 00125 ( *_owner, this, 00126 (typename EventListenerCallBack< GenericKeyExtension< OwnerClass > >::CallBackFct)&GenericKeyExtension< OwnerClass >::releaseFct, 00127 OMK::Inp::KeyListener::getKeyReleaseCode( key ) ) ; 00128 _owner->sendValuedEvent( visuName, OMK::Inp::InputExtension::ADD_KEY, OMK::Inp::AddInputKeyPrm( key, _owner->getName() ) ) ; 00129 } 00130 return ok ; 00131 }
bool OMK::Inp::GenericKeyExtension< OwnerClass >::pressFct | ( | Event * | event | ) | [inline, protected] |
The call back method associated with the event listener for press.
Definition at line 151 of file OMKGenericKeyExtension.h.
00152 { 00153 action() ; 00154 // Returns false because may be another key listener wants to see the event 00155 return false ; 00156 }
bool OMK::Inp::GenericKeyExtension< OwnerClass >::releaseFct | ( | Event * | event | ) | [inline, protected] |
The call back method associated with the event listener for release.
Definition at line 158 of file OMKGenericKeyExtension.h.
00159 { 00160 actionRelease() ; 00161 // Returns false because may be another key listener wants to see the event 00162 return false ; 00163 }
virtual void OMK::Inp::GenericKeyExtension< OwnerClass >::action | ( | ) | [inline, protected, virtual] |
The method to overwrite for press action.
Reimplemented in OMK::Inp::BoundingBoxExtension, OMK::Inp::DebugOverlayExtension, OMK::Inp::KeyEmitterExtension, OMK::Inp::KeyEmitterExtensionT< T, ModelType >, OMK::Inp::OverlayExtension, OMK::Inp::PlusMinusExtension< T >, and OMK::Inp::SceneDetailsExtension.
Definition at line 165 of file OMKGenericKeyExtension.h.
Referenced by OMK::Inp::GenericKeyExtension< OMK::ExtensibleSimulatedObject >::pressFct().
virtual void OMK::Inp::GenericKeyExtension< OwnerClass >::actionRelease | ( | ) | [inline, protected, virtual] |
The method to overwrite for release action.
Reimplemented in OMK::Inp::PlusMinusExtension< T >.
Definition at line 167 of file OMKGenericKeyExtension.h.
Referenced by OMK::Inp::GenericKeyExtension< OMK::ExtensibleSimulatedObject >::releaseFct().
EventListener* OMK::Inp::GenericKeyExtension< OwnerClass >::_eventListenerPress [protected] |
The event listener which receives the key press event.
It is created in the loadExtensionParameters method, it is a EventListenerCallBack which is associated with the callBackFct method.
Definition at line 142 of file OMKGenericKeyExtension.h.
Referenced by OMK::Inp::PlusMinusExtension< T >::actionRelease(), OMK::Inp::GenericKeyExtension< OMK::ExtensibleSimulatedObject >::loadExtensionParameters(), and OMK::Inp::GenericKeyExtension< OMK::ExtensibleSimulatedObject >::~GenericKeyExtension().
EventListener* OMK::Inp::GenericKeyExtension< OwnerClass >::_eventListenerRelease [protected] |
The event listener which receives the key release event.
It is created in the loadExtensionParameters method, it is a EventListenerCallBack which is associated with the callBackFct method.
Definition at line 147 of file OMKGenericKeyExtension.h.
Referenced by OMK::Inp::PlusMinusExtension< T >::action(), OMK::Inp::GenericKeyExtension< OMK::ExtensibleSimulatedObject >::loadExtensionParameters(), and OMK::Inp::GenericKeyExtension< OMK::ExtensibleSimulatedObject >::~GenericKeyExtension().
const std::string OMK::Inp::GenericKeyExtension< OwnerClass >::_defaultKey [protected] |
The default key.
Definition at line 149 of file OMKGenericKeyExtension.h.
Referenced by OMK::Inp::GenericKeyExtension< OMK::ExtensibleSimulatedObject >::loadExtensionParameters().
Documentation generated on Mon Jun 9 11:46:04 2008 |
Generated with doxygen by Dimitri van Heesch , 1997-2007 |