00001 /* 00002 * synergy -- mouse and keyboard sharing utility 00003 * Copyright (C) 2012 Bolton Software Ltd. 00004 * Copyright (C) 2004 Chris Schoeneman 00005 * 00006 * This package is free software; you can redistribute it and/or 00007 * modify it under the terms of the GNU General Public License 00008 * found in the file COPYING that should have accompanied this file. 00009 * 00010 * This package is distributed in the hope that it will be useful, 00011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00013 * GNU General Public License for more details. 00014 * 00015 * You should have received a copy of the GNU General Public License 00016 * along with this program. If not, see <http://www.gnu.org/licenses/>. 00017 */ 00018 00019 #ifndef IEVENTQUEUE_H 00020 #define IEVENTQUEUE_H 00021 00022 #include "IInterface.h" 00023 #include "CEvent.h" 00024 #include "CString.h" 00025 00026 #define EVENTQUEUE IEventQueue::getInstance() 00027 00028 class IEventJob; 00029 class IEventQueueBuffer; 00030 00031 // Opaque type for timer info. This is defined by subclasses of 00032 // IEventQueueBuffer. 00033 class CEventQueueTimer; 00034 00036 00042 class IEventQueue : public IInterface { 00043 public: 00044 class CTimerEvent { 00045 public: 00046 CEventQueueTimer* m_timer; 00047 UInt32 m_count; 00048 }; 00049 00051 00052 00054 00057 virtual void loop() = 0; 00058 00060 00064 virtual void adoptBuffer(IEventQueueBuffer*) = 0; 00065 00067 00072 virtual bool getEvent(CEvent& event, double timeout = -1.0) = 0; 00073 00075 00079 virtual bool dispatchEvent(const CEvent& event) = 0; 00080 00082 00085 virtual void addEvent(const CEvent& event) = 0; 00086 00088 00103 virtual CEventQueueTimer* 00104 newTimer(double duration, void* target) = 0; 00105 00107 00117 virtual CEventQueueTimer* 00118 newOneShotTimer(double duration, 00119 void* target) = 0; 00120 00122 00126 virtual void deleteTimer(CEventQueueTimer*) = 0; 00127 00129 00136 virtual void adoptHandler(CEvent::Type type, 00137 void* target, IEventJob* handler) = 0; 00138 00140 00144 virtual void removeHandler(CEvent::Type type, void* target) = 0; 00145 00147 00150 virtual void removeHandlers(void* target) = 0; 00151 00153 00156 virtual CEvent::Type 00157 registerType(const char* name) = 0; 00158 00160 00165 virtual CEvent::Type 00166 registerTypeOnce(CEvent::Type& type, 00167 const char* name) = 0; 00168 00170 00171 00172 00174 00178 virtual bool isEmpty() const = 0; 00179 00181 00185 virtual IEventJob* getHandler(CEvent::Type type, void* target) const = 0; 00186 00188 00192 virtual const char* getTypeName(CEvent::Type type) = 0; 00193 00195 00198 virtual CEvent::Type getRegisteredType(const CString& name) const = 0; 00199 00201 00204 static void* getSystemTarget(); 00205 00207 00210 static IEventQueue* getInstance(); 00211 00213 00214 protected: 00216 00217 00219 00222 static void setInstance(IEventQueue*); 00223 00225 00226 private: 00227 static IEventQueue* s_instance; 00228 }; 00229 00230 #endif
1.7.1