Main Page | Modules | Class Hierarchy | Data Structures | File List | Data Fields | Globals | Related Pages

omExecutor.h

Go to the documentation of this file.
00001 
00002 // This code is part of the MaiaProject free software
00003 //
00004 // Keyboard and Mouse Emulator - Virtual keyboard Engine
00005 //
00006 // Copyright (c) 2002-2003 Luca Clivio <luca.clivio@maiaproject.org>
00007 // Tel. +39-347-2538040
00008 // via B.Croce 2, 20037 Paderno Dugnano (Milano) - Italy
00009 //
00010 // Developers:
00011 //    Simone Mangano <simone.mangano@maiaproject.org>
00012 //    Andrea Tosato  <andrea.tosato@maiaproject.org>
00013 //
00014 //  -----------------------------------------------------------------------------
00015 //  This program is free software; This program is free software; 
00016 //  you can redistribute it and/or modify it under the terms of the 
00017 //  GNU General Public License as published by the Free Software Foundation; 
00018 //  either version 2 of the License, or (at your option) any later version.
00019 //  but WITHOUT ANY WARRANTY; without even the implied warranty of                              
00020 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the                                
00021 //  GNU General Public License for more details.                                                
00022 //  You should have received a copy of the GNU General Public License                           
00023 //  along with this program; if not, write to the Free Software                                 
00024 //  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.                                   
00026 
00027 
00028 #ifndef _MaiaExecuteAction_
00029 #define _MaiaExecuteAction_
00030 
00031 #include <wx/wx.h>
00032 #include <iostream>
00033 #include <algorithm>
00034 #include <cctype>
00035 #include <sstream>
00036 
00037 
00038 #include <openmaia/omcommon.h>
00039 
00040 #include <openmaia/omObject.h>
00041 #include <openmaia/omConnector.h>
00042 #include <openmaia/omFunctions.h>
00043 
00044 
00045 
00046 #include <omemukeys.h>
00047 
00048 
00049 // constants
00050 
00051 #define MOUSE_TIMER_ID 1
00052 #define MOUSE_MOVEMENT_TIMER 100
00053 
00054 
00055 
00056 
00057 
00064 class omExecutor: public omObject, public wxEvtHandler
00065 {
00066  public:
00067   // general methods
00068   omExecutor() ;
00069   void Stop() ;    // stop timers
00070   void Start() ;   // start timers if needed
00071 
00072   // emulate pression of char keys
00073   void RenderString( wxString) ;
00074   void PressKey( long) ;    // emulate special key press
00075   void ReleaseKey( long) ;  // emulate special key release
00076   // emulate mouse movements in x,y directions
00077   bool MoveMouse( wxString, wxString ) ;     // parameter passed by wxString "dx,dy"
00078   bool MoveMouse( int, int ) ;   // the right function
00079   void ClickMouse( int ) ;   // click a button of a mouse
00080   void DragOrDropMouse( int ) ;   // drag and then drop the mouse button
00081 
00082   
00083  protected:
00084   // variables
00085   void *sdData ;   
00086   long maiaKeyCode[MAXMAIACODES] ;  
00087 
00088   // variables used in mouse simulations
00089   int dxMouseMovement ;        
00090   int dyMouseMovement ;        
00091   bool isMouseInMovement ;     
00092   wxTimer mouseTimer ;         
00093   bool isMouseButtonPressed[MAXMOUSEBUTTONS] ;  
00094   
00095   // private functions
00096   void OnMouseTimer(wxTimerEvent ) ;   
00097 
00098   // system dependent functions
00099   void SDConstructor() ;      
00100   void SDRenderChar(char) ;   
00101   void SDPressKey(long) ;  
00102   void SDReleaseKey(long) ; 
00103   void SDMoveMouse() ;    
00104   void SDPressMouseButton( int but) ;  
00105 
00106   void SDReleaseMouseButton( int but) ; 
00107 
00108 
00109   // Use wx event table to catch timer events
00110   DECLARE_EVENT_TABLE()
00111 
00112 } ;
00113 
00114 
00115 #endif // _MaiaExecuteAction_