MouseSenderAgent.h

Go to the documentation of this file.
00001 /*
00002  * This file is part of Micole Architecture
00003  *
00004  * Copyright (C) 2007 Micole partners
00005  *
00006  * Micole Architecture is free software: you can redistribute it 
00007  * and/or modify it under the terms of the GNU Lesser General 
00008  * Public License as published by the Free Software Foundation, 
00009  * either version 3 of the License, or (at your option) any 
00010  * later version.
00011  *
00012  * Micole Architecture is distributed in the hope that it will be 
00013  * useful, * but WITHOUT ANY WARRANTY; without even the implied 
00014  * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
00015  * PURPOSE.  See the GNU Lesser General Public License for more 
00016  * details.
00017  *
00018  * You should have received a copy of the GNU Lesser General Public
00019  * License along with Micole Architecture.  If not, see
00020  * <http://www.gnu.org/licenses/>.
00021  */
00022 
00023 #ifndef MouseSenderAgent_H
00024 #define MouseSenderAgent_H
00025 
00041 #include <ctime>
00042 #include <Mouse.h>
00043 using namespace Reachin;
00044 
00045 #include "MicoleAgentThread.h"
00046 #include "micolelib.h"
00047 
00068 class MICOLELIB_API MouseSenderAgent : public MicoleAgentThread
00069 {
00070 public:
00071         MouseSenderAgent(int coord_interval=4);
00072         ~MouseSenderAgent();
00073         void setCoordinateUpdateInterval(int interval); // 0 - no coordinates
00074         void run();
00075 
00076         auto_ptr< SFVec3f > mouse_coordinates;
00077 
00078 private:
00079 
00080         int _coordUpdInterval;
00081 
00082         struct MouseMoveListener : public  EvaldFField<MouseMoveListener, SFVec2f, SFVec2f> 
00083         {
00084                 public:
00085                         MouseMoveListener();
00086                         void evaluate(SFVec2f *coord);
00087                         MouseSenderAgent *_mssa;
00088                         
00089                 private:
00090                         DWORD _mtime;
00091         };
00092 
00093         struct MouseButtonListener : public Dependent<EvaldFField<MouseButtonListener, SFBool, SFBool> >
00094         {
00095                 public:
00096                         MouseButtonListener(string button);
00097                         void evaluate(SFBool *lbutton);
00098                         void sendCoordinates( string state );
00099                         MouseSenderAgent *_mssa;
00100                         auto_ptr< SFBool > m_button;
00101                         auto_ptr< SFVec2f > mouse_coordinates;
00102                         string m_strButton;
00103         };
00104 
00105         auto_ptr< MouseMoveListener > _mouseMoveListener;
00106         auto_ptr< MouseButtonListener > _leftMouseButtonListener;
00107         auto_ptr< MouseButtonListener > _rightMouseButtonListener;
00108         auto_ptr< Mouse > _mouse;
00109 };
00110  // end of INPUT // end of MOUSE
00113 
00114 #endif

Generated on Tue Oct 16 17:10:43 2007 for Micole by  doxygen 1.4.7