Main Page | Class Hierarchy | Alphabetical List | Class List | File List | Class Members

CEvent.cpp

00001 /*
00002  * synergy -- mouse and keyboard sharing utility
00003  * Copyright (C) 2004 Chris Schoeneman
00004  * 
00005  * This package is free software; you can redistribute it and/or
00006  * modify it under the terms of the GNU General Public License
00007  * found in the file COPYING that should have accompanied this file.
00008  * 
00009  * This package is distributed in the hope that it will be useful,
00010  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012  * GNU General Public License for more details.
00013  */
00014 
00015 #include "CEvent.h"
00016 #include "CEventQueue.h"
00017 
00018 //
00019 // CEvent
00020 //
00021 
00022 CEvent::CEvent() :
00023     m_type(kUnknown),
00024     m_target(NULL),
00025     m_data(NULL),
00026     m_flags(0)
00027 {
00028     // do nothing
00029 }
00030 
00031 CEvent::CEvent(Type type, void* target, void* data, Flags flags) :
00032     m_type(type),
00033     m_target(target),
00034     m_data(data),
00035     m_flags(flags)
00036 {
00037     // do nothing
00038 }
00039 
00040 CEvent::Type
00041 CEvent::getType() const
00042 {
00043     return m_type;
00044 }
00045 
00046 void*
00047 CEvent::getTarget() const
00048 {
00049     return m_target;
00050 }
00051 
00052 void*
00053 CEvent::getData() const
00054 {
00055     return m_data;
00056 }
00057 
00058 CEvent::Flags
00059 CEvent::getFlags() const
00060 {
00061     return m_flags;
00062 }
00063 
00064 CEvent::Type
00065 CEvent::registerType(const char* name)
00066 {
00067     return EVENTQUEUE->registerType(name);
00068 }
00069 
00070 CEvent::Type
00071 CEvent::registerTypeOnce(Type& type, const char* name)
00072 {
00073     return EVENTQUEUE->registerTypeOnce(type, name);
00074 }
00075 
00076 const char*
00077 CEvent::getTypeName(Type type)
00078 {
00079     return EVENTQUEUE->getTypeName(type);
00080 }
00081 
00082 void
00083 CEvent::deleteData(const CEvent& event)
00084 {
00085     switch (event.getType()) {
00086     case kUnknown:
00087     case kQuit:
00088     case kSystem:
00089     case kTimer:
00090         break;
00091 
00092     default:
00093         if ((event.getFlags() & kDontFreeData) == 0) {
00094             free(event.getData());
00095         }
00096         break;
00097     }
00098 }

Generated on Fri Nov 6 00:21:13 2009 for synergy-plus by  doxygen 1.3.9.1