OMKInputExtension.cpp

Go to the documentation of this file.
00001 /************************************************************************/
00002 /* This file is part of openMask(c) INRIA, CNRS, Universite de Rennes 1 */
00003 /* 1993-2002, thereinafter the Software                                 */
00004 /*                                                                      */
00005 /* The Software has been developped within the Siames Project.          */
00006 /* INRIA, the University of Rennes 1 and CNRS jointly hold intellectual */
00007 /* property rights                                                      */
00008 /*                                                                      */
00009 /* The Software has been registered with the Agence pour la Protection  */
00010 /* des Programmes (APP) under registration number                       */
00011 /* IDDN.FR.001.510008.00.S.P.2001.000.41200                             */
00012 /*                                                                      */
00013 /* This file may be distributed under the terms of the Q Public License */
00014 /* version 1.0 as defined by Trolltech AS of Norway and appearing in    */
00015 /* the file LICENSE.QPL included in the packaging of this file.         */
00016 /*                                                                      */
00017 /* Licensees holding valid specific licenses issued by INRIA, CNRS or   */
00018 /* Universite Rennes 1 for the software may use this file in            */
00019 /* acordance with that specific license                                 */
00020 /************************************************************************/
00021 #include "OMKInputExtension.h"
00022 #include "OMKExtension.inl"
00023 #include "OMKInputListener.h"
00024 #include "OMKAddInputListenerPrm.h"
00025 #include "OMKAddInputKeyPrm.h"
00026 #include "OMKMultipleConfigurationParameter.h"
00027 #include "OMKParametersAccessor.inl"
00028 #include "OMKEscListener.h"
00029 #include "OMKKeyListener.h"
00030 #include "OMKParametersAccessor.h"
00031 
00032 using namespace OMK ;
00033 using namespace OMK::Vis ;
00034 using namespace OMK::Inp ;
00035 EventIdentifier InputExtension::ADD_INPUT( "add input listener" ) ;
00036 EventIdentifier InputExtension::REMOVE_INPUT( "remove input listener" ) ;
00037 EventIdentifier InputExtension::ADD_KEY( "add key listener" ) ;
00038 //-------------------------------------------------------------------------
00039 REGISTER_EXTENSION_FACTORY( InputExtension, "InputExtension" ) ;
00040 
00041 //-------------------------------------------------------------------------
00042 // constructor
00043 //-------------------------------------------------------------------------
00044 InputExtension::InputExtension( ExtensibleSimulatedObject* owner, const Name& id, bool registerExtension )
00045 : ExtensionT< OMK::Vis::OgreVis >( owner, id, registerExtension ),
00046   _inputSystem( 0 ),
00047   _keyboard( 0 ),
00048   _mouse( 0 ),
00049   _inputCreatorListener( 0 ),
00050   _currentWidth (800),
00051   _currentHeight(600),
00052   _window (0)
00053 {
00054 }
00055 //-------------------------------------------------------------------------
00056 bool InputExtension::loadExtensionParameters( const ConfigurationParameterDescriptor * node ) 
00057 {
00058   // Init input devices
00059   createOISInputSystem(node) ;
00060   initOIS() ;
00061 
00062   //Insertion in OpenMASK event processing
00063   _inputCreatorListener = new InputCreatorListener( _owner, this ) ;
00064   _owner->addEventListener( *_inputCreatorListener ) ;
00065 
00066   // creation of the input listeners defined
00067   // Retrieve the extension fields to create the extensions which defined a "Class"
00068   if( node )
00069   {
00070     int nbItems = node->getNumberOfSubItems() ;
00071     for( int i = 0 ; i < nbItems ; ++i )
00072     { 
00073       // Retrieves parameters sets for each extension
00074       std::string id( static_cast<const MultipleConfigurationParameter *>( node )->getNameOfSubDescriptor( i ) ) ;
00075       if( "ExitOnEsc" == id )
00076       {
00077         // For exit on escape
00078         bool exitOnEsc = false ;
00079         ParametersAccessor::get( node, "ExitOnEsc", exitOnEsc ) ;
00080         if( exitOnEsc )
00081         {
00082           Name id( "exitOnEsc" ) ;
00083           addListener( Name( id ), new EscListener( _owner, id ) ) ;
00084         }
00085       }
00086       if( "Keys" == id )
00087       {
00088         const ConfigurationParameterDescriptor * keyParam = node->getSubDescriptorByPosition( i ) ;
00089         int nbKeys = keyParam->getNumberOfSubItems() ;
00090         for( int k = 0 ; k < nbKeys ; ++k )
00091         { 
00092           std::string key( static_cast<const MultipleConfigurationParameter *>( keyParam )->getNameOfSubDescriptor( k ) ) ;
00093           addListener( Name( "Key_" + key ), new OMK::Inp::KeyListener( _owner, key, keyParam ) ) ;
00094         }
00095       }
00096       else
00097       {
00098         const ConfigurationParameterDescriptor * inputParam = node->getSubDescriptorByPosition( i ) ;
00099         // Try to retrieve the class id to create the extension
00100         Name classId ;
00101         if( ParametersAccessor::get( inputParam, "Class", classId ) )
00102         { // ClassId is ok => Create the extension
00103           addListener( Name( id ), classId, inputParam ) ;
00104         }
00105       }
00106     }
00107   }
00108 
00109   return true ;
00110 }
00111 
00112 //-------------------------------------------------------------------------
00113 // overwrite this method if you use something else than Ogre
00114 // and change the Type use for the father ExtensionT<> 
00115 void InputExtension::createOISInputSystem(const ConfigurationParameterDescriptor* node)
00116 {
00117   OMASSERTM( _owner, "Must have a valid visualisation object !" ) ;
00118   OMASSERTM( _owner->touchRoot().getAutoCreatedWindow(), "Must have a valid visualisation window !" ) ;
00119   OMASSERTM( !_inputSystem && !_keyboard && !_mouse && _joysticks.empty(), "Must uninitialized !" ) ;
00120   OIS::ParamList paramList ;
00121   // Setup basic variables
00122   // Get window handle
00123   size_t theWindow = 0;
00124   _owner->touchRoot().getAutoCreatedWindow()->getCustomAttribute( "WINDOW", &theWindow );
00125 #if defined WIN32
00126   // Uncomment these two lines to allow users to switch keyboards via the language bar
00127   paramList.insert(std::make_pair( std::string( "w32_keyboard" ), std::string( "DISCL_FOREGROUND" ) ) );
00128   paramList.insert(std::make_pair( std::string( "w32_keyboard" ), std::string( "DISCL_NONEXCLUSIVE" ) ) );
00129 
00130 #elif defined OIS_LINUX_PLATFORM
00131   paramList.insert( std::make_pair( std::string( "XAutoRepeatOn" ), std::string( "true") ) );    
00132   paramList.insert( std::make_pair( std::string( "x11_mouse_hide" ), std::string( "false" ) ) ); 
00133   paramList.insert( std::make_pair( std::string( "x11_mouse_grab" ), std::string( "false" ) ) ); 
00134 
00135   std::string grabKeyboard ="false";
00136   ParametersAccessor::get ( node, "x11_keyboard_grab", grabKeyboard);
00137   OMASSERTM( (grabKeyboard == "false") || (grabKeyboard == "true"),
00138       " parameter x11_keyboard_grab must be true or false"); 
00139   paramList.insert( std::make_pair( std::string( "x11_keyboard_grab" ),grabKeyboard ) );         
00140 #endif
00141   // Fill parameter list
00142   std::ostringstream theWindowStr;
00143   theWindowStr << theWindow ;
00144   paramList.insert( std::make_pair( std::string( "WINDOW" ), theWindowStr.str() ) );
00145 
00146   // Create inputsystem
00147   _inputSystem = OIS::InputManager::createInputSystem( paramList );
00148 }
00149 //-------------------------------------------------------------------------
00150 void InputExtension::initOIS() 
00151 {
00152   OMASSERT( _inputSystem && "Must initialized !" ) ;
00153   // If possible create a buffered keyboard
00154  if( 0 < _inputSystem->numKeyboards() )
00155 // Future OIS Version
00156 //  if( 0 < _inputSystem->getNumberOfDevices(OIS::OISKeyboard) )
00157   {
00158     _keyboard = static_cast<OIS::Keyboard*>( _inputSystem->createInputObject( OIS::OISKeyboard, true ) );
00159     _keyboard->setEventCallback( this );
00160   }
00161   else
00162   {
00163     OMTRACEID(OMK_DEBUG_INP_EXT, ">>>No keyboard to listen !" << std::endl ) ;
00164   }
00165 
00166   // If possible create a buffered mouse
00167   if( 0 < _inputSystem->numMice() )
00168 // Future OIS Version
00169 //  if( 0 < _inputSystem->getNumberOfDevices(OIS::OISMouse) )
00170   {
00171     _mouse = static_cast< OIS::Mouse* >( _inputSystem->createInputObject( OIS::OISMouse, true ) );
00172     _mouse->setEventCallback( this );
00173 
00174     // Get window size
00175     unsigned int width, height, depth;
00176     int left, top;
00177     _window = _owner->touchRoot().getAutoCreatedWindow();
00178     OMASSERT ( _window && "No RenderWindow" );
00179     _window->getMetrics( width, height, depth, left, top );
00180 
00181     // Set mouse region 
00182     setWindowExtents( width, height );
00183   }
00184   else
00185   {
00186     OMTRACEID(OMK_DEBUG_INP_EXT, ">>>No mouse to listen !" << std::endl ) ;
00187   }
00188 
00189   // If possible create all joysticks in buffered mode
00190   if( 0 < _inputSystem->numJoySticks() ) 
00191  // Future OIS Version
00192  //    if( 0 < _inputSystem->getNumberOfDevices(OIS::OISJoyStick) ) 
00193   {
00194   _joysticks.resize( _inputSystem->numJoySticks() );
00195  // Future OIS Version
00196 //  _joysticks.resize( _inputSystem->getNumberOfDevices(OIS::OISJoyStick) );
00197     for( std::vector< OIS::JoyStick* >::iterator i = _joysticks.begin() ;
00198          i != _joysticks.end() ; 
00199          ++i ) 
00200     {
00201       (*i) = static_cast< OIS::JoyStick* >( _inputSystem->createInputObject( OIS::OISJoyStick, true ) );
00202       (*i)->setEventCallback( this );
00203     }
00204   }
00205   else
00206   {
00207     OMTRACEID(OMK_DEBUG_INP_EXT, ">>>No joystick to listen !" << std::endl ) ;
00208   }
00209 }
00210 
00211 //-------------------------------------------------------------------------
00212 InputExtension::~InputExtension()
00213 {
00214   if( _inputSystem ) 
00215   {
00216     if( _keyboard ) 
00217     {
00218       _inputSystem->destroyInputObject( _keyboard );
00219       _keyboard = 0;
00220     }
00221 
00222     if( _mouse ) 
00223     {
00224       _inputSystem->destroyInputObject( _mouse );
00225       _mouse = 0;
00226     }
00227 
00228     if( 0 < _joysticks.size() ) 
00229     {
00230       for( std::vector< OIS::JoyStick* >::iterator i = _joysticks.begin() ; 
00231           i != _joysticks.end(); 
00232           ++i ) 
00233       {
00234         _inputSystem->destroyInputObject( *i );
00235       }
00236 
00237       _joysticks.clear();
00238     }
00239 
00240     OIS::InputManager::destroyInputSystem( _inputSystem ) ;
00241     _inputSystem = 0 ;
00242 
00243     // Delete all the registered listener
00244     for( std::map< Name, InputListener* >::iterator i = _inputListeners.begin() ;
00245          i != _inputListeners.end() ;
00246          i++  ) 
00247     {
00248         delete i->second ;
00249     }
00250     // Clear Listeners
00251     _keyListeners.clear();
00252     _mouseListeners.clear();
00253     _joystickListeners.clear();
00254   }
00255 
00256   // Remove the event listener
00257   delete _inputCreatorListener ;
00258 }
00259 
00260 
00261 //-------------------------------------------------------------------------
00262 void InputExtension::preComputeParameters() 
00263 {
00264   // Need to capture devices every compute
00265   capture() ;
00266   //Update Mouse
00267   if ( _mouse  && 
00268       (  ( _window->getWidth() != _currentWidth ) 
00269       || (_window->getHeight() != _currentHeight ) ) )
00270     setWindowExtents ( _window->getWidth(), _window->getHeight());
00271 }
00272 
00273 //-------------------------------------------------------------------------
00274 void InputExtension::capture() 
00275 {
00276   // Capture/update each device
00277   if( _keyboard ) 
00278   {
00279     _keyboard->capture() ;
00280   }
00281   if( _mouse ) 
00282   {
00283     _mouse->capture() ;
00284   }
00285   for( std::vector< OIS::JoyStick* >::iterator i = _joysticks.begin() ;
00286        i != _joysticks.end() ; 
00287        ++i ) 
00288   {
00289     (*i)->capture() ;
00290   }
00291 }
00292 
00293 //-----------------------------------------------------------------------------
00294 void InputExtension::setWindowExtents( int width, int height ) 
00295 {
00296   const OIS::MouseState &mouseState = _mouse->getMouseState();
00297   mouseState.width  = width;
00298   mouseState.height = height;
00299   _currentWidth = width;
00300   _currentHeight = height;
00301 }
00302 
00303 
00304 
00305 //-------------------------------------------------------------------------
00306 bool InputExtension::keyPressed( const OIS::KeyEvent &e ) 
00307 {
00308   for( std::map< Name, OIS::KeyListener* >::iterator i = _keyListeners.begin(); 
00309        i != _keyListeners.end() ; 
00310        ++i ) 
00311   {
00312     i->second->keyPressed( e );
00313   }
00314 
00315   return true;
00316 }
00317 
00318 //-------------------------------------------------------------------------
00319 bool InputExtension::keyReleased( const OIS::KeyEvent &e ) 
00320 {
00321   for( std::map< Name, OIS::KeyListener* >::iterator i = _keyListeners.begin(); 
00322        i != _keyListeners.end() ; 
00323        ++i ) 
00324   {
00325     i->second->keyReleased( e );
00326   }
00327 
00328   return true;
00329 }
00330 
00331 //-------------------------------------------------------------------------
00332 bool InputExtension::mouseMoved( const OIS::MouseEvent &e ) 
00333 {
00334   for( std::map< Name, OIS::MouseListener* >::iterator i = _mouseListeners.begin(); 
00335        i != _mouseListeners.end() ; 
00336        ++i ) 
00337   {
00338     i->second->mouseMoved( e );
00339   }
00340 
00341   return true;
00342 }
00343 
00344 //-------------------------------------------------------------------------
00345 bool InputExtension::mousePressed( const OIS::MouseEvent &e, OIS::MouseButtonID id ) 
00346 {
00347   for( std::map< Name, OIS::MouseListener* >::iterator i = _mouseListeners.begin(); 
00348        i != _mouseListeners.end() ; 
00349        ++i ) 
00350   {
00351     i->second->mousePressed( e, id );
00352   }
00353 
00354   return true;
00355 }
00356 
00357 //-------------------------------------------------------------------------
00358 bool InputExtension::mouseReleased( const OIS::MouseEvent &e, OIS::MouseButtonID id ) 
00359 {
00360   for( std::map< Name, OIS::MouseListener* >::iterator i = _mouseListeners.begin(); 
00361        i != _mouseListeners.end() ; 
00362        ++i ) 
00363   {
00364     i->second->mouseReleased( e, id );
00365   }
00366 
00367   return true;
00368 }
00369 
00370 //-------------------------------------------------------------------------
00371 bool InputExtension::povMoved( const OIS::JoyStickEvent &e, int pov ) 
00372 {
00373   for( std::map< Name, OIS::JoyStickListener* >::iterator i = _joystickListeners.begin(); 
00374        i != _joystickListeners.end() ; 
00375        ++i ) 
00376   {
00377     i->second->povMoved( e, pov );
00378   }
00379 
00380   return true;
00381 }
00382 
00383 //-------------------------------------------------------------------------
00384 bool InputExtension::axisMoved( const OIS::JoyStickEvent &e, int axis ) 
00385 {
00386   for( std::map< Name, OIS::JoyStickListener* >::iterator i = _joystickListeners.begin(); 
00387        i != _joystickListeners.end() ; 
00388        ++i ) 
00389   {
00390     i->second->axisMoved( e, axis );
00391   }
00392 
00393   return true;
00394 }
00395 
00396 //-------------------------------------------------------------------------
00397 bool InputExtension::sliderMoved( const OIS::JoyStickEvent &e, int sliderID ) 
00398 {
00399   for( std::map< Name, OIS::JoyStickListener* >::iterator i = _joystickListeners.begin(); 
00400        i != _joystickListeners.end() ; 
00401        ++i ) 
00402   {
00403     i->second->sliderMoved( e, sliderID );
00404   }
00405 
00406   return true;
00407 }
00408 
00409 //-------------------------------------------------------------------------
00410 bool InputExtension::buttonPressed( const OIS::JoyStickEvent &e, int button ) 
00411 {
00412   for( std::map< Name, OIS::JoyStickListener* >::iterator i = _joystickListeners.begin(); 
00413        i != _joystickListeners.end() ; 
00414        ++i ) 
00415   {
00416     i->second->buttonPressed( e, button );
00417   }
00418 
00419   return true;
00420 }
00421 
00422 //-------------------------------------------------------------------------
00423 bool InputExtension::buttonReleased( const OIS::JoyStickEvent &e, int button ) 
00424 {
00425   for( std::map< Name, OIS::JoyStickListener* >::iterator i = _joystickListeners.begin(); 
00426        i != _joystickListeners.end() ; 
00427        ++i ) 
00428   {
00429     i->second->buttonReleased( e, button );
00430   }
00431 
00432   return true;
00433 }
00434 
00435 //-------------------------------------------------------------------------
00436 bool InputExtension::addKeyListener( const AddInputKeyPrm& prm ) 
00437 {
00438   return addKeyListener( prm.getKey(), prm.getListeningObjectId() ) ;
00439 }
00440 //-------------------------------------------------------------------------
00441 bool InputExtension::addKeyListener( const std::string& key,
00442                                      const Name& listeningObject ) 
00443 {
00444   // return value
00445   bool ok = false ;
00446   
00447   Name listenerId( "Key_" + key ) ;
00448   std::map< Name, InputListener* >::iterator i = _inputListeners.find( listenerId );
00449   OMK::Inp::KeyListener* keyListener = 0 ;
00450   if( i == _inputListeners.end() ) 
00451   {
00452     // not yet implemented
00453     keyListener = new OMK::Inp::KeyListener( _owner, key, 0 ) ;
00454     addListener( listenerId, keyListener ) ;
00455   }
00456   else
00457   {
00458     // Already created
00459     keyListener = dynamic_cast< OMK::Inp::KeyListener* >( i->second ) ;
00460   }
00461   // Appends the object to the listener
00462   keyListener->addListeningObject( listeningObject ) ;
00463 
00464   return ok ;
00465 }
00466 //-------------------------------------------------------------------------
00467 bool InputExtension::addListener( const AddInputListenerPrm& prm ) 
00468 {
00469   return addListener( prm.getListenerId(),
00470                       prm.getClassId(),
00471                       prm.getConfigParam() );
00472 }
00473 //-------------------------------------------------------------------------
00474 bool InputExtension::addListener( const Name& id, 
00475                                   const Name& classId, 
00476                                   const ConfigurationParameterDescriptor* configParam ) 
00477 {
00478   // Creates the listener
00479   return addListener( id, InputListenerFactory::getInstance().create( classId )( _owner, id, configParam ) ) ;
00480 }
00481 //-------------------------------------------------------------------------
00482 bool InputExtension::addListener( const Name& id, InputListener *listener ) 
00483 {
00484   std::ostringstream errorMsg ;
00485   // return value
00486   bool ok = false ; // Will be ok, if at least one listener (keyboard, mouse or joystick) can be registered
00487   // Add the new input listener to the visualisation
00488   if( listener )
00489   { 
00490     std::map< Name, InputListener* >::iterator i = _inputListeners.find( id );
00491     if( i == _inputListeners.end() ) 
00492     { 
00493       // It is a really new item, adds it in the main list
00494       _inputListeners[ id ] = listener ;
00495       
00496       //Is it a keyboard listener ?
00497       if( _keyboard ) 
00498       { 
00499         OIS::KeyListener* keyListener = dynamic_cast< OIS::KeyListener* >( listener ) ;
00500         if( keyListener )
00501         {
00502           _keyListeners[ id ] = keyListener ;
00503           ok = true ;
00504         }
00505       }
00506       else
00507       {
00508         errorMsg << "Unable to register the keyboard listener \"" << id << "\" because there is no keyboard" << std::endl ;
00509       }
00510 
00511       //Is it a mouse listener ?
00512       if( _mouse ) 
00513       { 
00514         OIS::MouseListener* mouseListener = dynamic_cast< OIS::MouseListener* >( listener ) ;
00515         if( mouseListener )
00516         {
00517           _mouseListeners[ id ] = mouseListener ;
00518           ok = true ;
00519         }
00520       }
00521       else
00522       {
00523         errorMsg << "Unable to register the mouse listener \"" << id << "\" because there is no mouse" << std::endl;
00524       }
00525 
00526       //Is it a joystick listener ?
00527       if( 0 < _joysticks.size() ) 
00528       {
00529         OIS::JoyStickListener* joystickListener = dynamic_cast< OIS::JoyStickListener* >( listener ) ;
00530         if( joystickListener )
00531         {
00532           _joystickListeners[ id ] = joystickListener ;
00533           ok = true ;
00534         }
00535       }
00536       else
00537       {
00538         errorMsg << "Unable to register the joystick listener listener \"" << id << "\" because there is no joystickListener" << std::endl;
00539       }
00540     }
00541     else 
00542     {
00543       // Duplicate Item
00544       errorMsg << "The listener \"" << id<< "\" is a duplicate one" << std::endl ;
00545     }
00546   }
00547   else
00548   {
00549     errorMsg << "Unable to create the input listener \"" << id << "\"" << std::endl ;
00550   }
00551   // Unable to process event => error message
00552   if( !ok )
00553   {
00554     OMTRACEID(OMK_DEBUG_INP_EXT, "Error for " << OMK::debugMsg( _owner ) << std::endl
00555                         << ">>> " << errorMsg.str() ) ; 
00556     delete listener ;
00557   }
00558   return ok ;
00559 }
00560  
00561 //-------------------------------------------------------------------------
00562 bool InputExtension::removeListener( const Name& id ) 
00563 {
00564   bool ok = false ;
00565   std::map< Name, InputListener* >::iterator i = _inputListeners.find( id );
00566   if( i != _inputListeners.end() ) 
00567   { 
00568     _inputListeners.erase( i ) ;
00569     // remove form keyboard listener list
00570     std::map< Name, OIS::KeyListener* >::iterator ik = _keyListeners.find( id );
00571     if( ik != _keyListeners.end() ) _keyListeners.erase( ik ) ;
00572     // remove form mouse listener list
00573     std::map< Name, OIS::MouseListener* >::iterator im = _mouseListeners.find( id );
00574     if( im != _mouseListeners.end() ) _mouseListeners.erase( im ) ;
00575     // remove form joystick listener list
00576     std::map< Name, OIS::JoyStickListener* >::iterator ij = _joystickListeners.find( id );
00577     if( ij != _joystickListeners.end() ) _joystickListeners.erase( ij ) ;
00578 
00579     // delete the listener
00580     delete i->second ;
00581   }
00582   else
00583   {
00584           OMTRACEID(OMK_DEBUG_INP_EXT, "Error for " << OMK::debugMsg( _owner ) << std::endl
00585                         << ">>> Unable to remove \"" << id << "\", this listener is not registered." << std::endl ) ; 
00586   }
00587   return ok ;
00588 }
00589 
00590 //-------------------------------------------------------------------------
00591 
00592 //-------------------------------------------------------------------------
00593 // InputCreatorListener
00594 //-------------------------------------------------------------------------
00595 InputCreatorListener::InputCreatorListener( OMK::Vis::OgreVis* owner, InputExtension* inputExtension ) 
00596 : EventListener( *owner ),
00597   _inputExtension( inputExtension )
00598 {
00599 }
00600 //-------------------------------------------------------------------------
00601 InputCreatorListener::~InputCreatorListener()
00602 {
00603 }
00604 //-------------------------------------------------------------------------
00605 void InputCreatorListener::registerEvents()
00606 {
00607   _owner.registerEventListenerForEvent( *this, InputExtension::ADD_INPUT ) ;
00608   _owner.registerEventListenerForEvent( *this, InputExtension::REMOVE_INPUT ) ;
00609   _owner.registerEventListenerForEvent( *this, InputExtension::ADD_KEY ) ;
00610 }
00611 //-------------------------------------------------------------------------
00612 bool InputCreatorListener::processEvent( Event * e ) 
00613 {
00614   OMTRACEID(OMK_DEBUG_INP_EXT, ">>>eventId  \"" << e->eventId.getString()<< "\"" << std::endl ) ;
00615   // Return value
00616   bool ok = false ;
00617 
00618   if( e->eventId == InputExtension::ADD_INPUT )
00619   { // Add a new partner
00620           ok = _inputExtension->addListener( dynamic_cast< ValuedEvent< AddInputListenerPrm > * >( e )->value ) ;
00621   }
00622   else if( e->eventId == InputExtension::REMOVE_INPUT )
00623   { // Add a new partner
00624           ok = _inputExtension->removeListener( dynamic_cast< ValuedEvent< Name > * >( e )->value ) ;
00625   }
00626   else if( e->eventId == InputExtension::ADD_KEY )
00627   { // Add a new partner
00628           ok = _inputExtension->addKeyListener( dynamic_cast< ValuedEvent< AddInputKeyPrm > * >( e )->value ) ;
00629   }
00630 
00631   return ok ;
00632 }

logo OpenMask

Documentation generated on Mon Jun 9 11:45:56 2008

Generated with doxygen by Dimitri van Heesch ,   1997-2007