csutil/csbaseeventh.h
Go to the documentation of this file.00001 /* 00002 Copyright (C) 2003 by Odes B. Boatwright. 00003 00004 This library is free software; you can redistribute it and/or 00005 modify it under the terms of the GNU Library General Public 00006 License as published by the Free Software Foundation; either 00007 version 2 of the License, or (at your option) any later version. 00008 00009 This library 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 GNU 00012 Library General Public License for more details. 00013 00014 You should have received a copy of the GNU Library General Public 00015 License along with this library; if not, write to the Free 00016 Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 00017 */ 00018 00019 #ifndef __CS_CSBASEEVENTH_H__ 00020 #define __CS_CSBASEEVENTH_H__ 00021 00022 #include "csextern.h" 00023 00030 #include <iutil/event.h> 00031 #include <iutil/eventh.h> 00032 #include <iutil/eventq.h> 00033 #include <iutil/objreg.h> 00034 00035 #include <limits.h> 00036 00037 // Max event type (in event type enumeration) that will be handled. 00038 #define _CSBASEEVENT_MAXARRAYINDEX csevFrameStart 00039 00052 class CS_CSUTIL_EXPORT csBaseEventHandler : public iEventHandler 00053 { 00054 private: 00055 csRef<iEventQueue> queue; 00056 00057 protected: 00067 csBaseEventHandler (); 00068 00069 public: 00071 virtual ~csBaseEventHandler (); 00072 00073 protected: 00074 SCF_DECLARE_IBASE; 00075 00076 public: 00086 bool RegisterQueue (iObjectRegistry* registry, 00087 unsigned int trigger = UINT_MAX); 00088 00097 bool RegisterQueue (iEventQueue* queue, unsigned int trigger = UINT_MAX); 00098 00099 private: 00100 // This contains an array of trigger functions which are used to dispatch 00101 // events based on event type. 00102 static bool (csBaseEventHandler::*pmfnTriggers[ 00103 _CSBASEEVENT_MAXARRAYINDEX+1])(iEvent &event); 00104 00105 private: 00112 virtual bool HandleEvent (iEvent &event); 00113 00114 protected: 00131 virtual bool OnBroadcast (iEvent &event); 00132 00134 virtual bool OnCommand (iEvent &event); 00135 00137 virtual bool OnJoystickMove (iEvent &event); 00138 00142 virtual bool OnJoystickDown (iEvent &event); 00143 00145 virtual bool OnJoystickUp (iEvent &event); 00146 00148 virtual bool OnKeyboard (iEvent &event); 00149 00151 virtual bool OnMouseMove (iEvent &event); 00152 00154 virtual bool OnMouseDown (iEvent &event); 00155 00157 virtual bool OnMouseUp (iEvent &event); 00158 00160 virtual bool OnMouseClick (iEvent &event); 00161 00166 virtual bool OnMouseDoubleClick (iEvent &event); 00167 00174 virtual bool OnUnhandledEvent (iEvent &event); 00175 00177 virtual void PreProcessFrame (); 00178 00180 virtual void ProcessFrame (); 00181 00183 virtual void PostProcessFrame (); 00184 00186 virtual void FinishFrame (); 00187 }; 00188 00191 #endif //__CS_CSBASEEVENTH_H__
Generated for Crystal Space by doxygen 1.2.18