![]() |
Public API Reference |
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 00028 #include <iutil/event.h> 00029 #include <iutil/eventh.h> 00030 #include <iutil/eventq.h> 00031 #include <iutil/objreg.h> 00032 00033 #include <limits.h> 00034 00035 // Max event type (in event type enumeration) that will be handled. 00036 #define _CSBASEEVENT_MAXARRAYINDEX csevNetwork 00037 00051 class csBaseEventHandler : public iEventHandler 00052 { 00053 private: 00054 csRef<iEventQueue> queue; 00055 00056 protected: 00066 csBaseEventHandler (); 00067 00068 public: 00070 virtual ~csBaseEventHandler (); 00071 00072 protected: 00073 SCF_DECLARE_IBASE; 00074 00075 public: 00085 bool RegisterQueue (iObjectRegistry* registry, unsigned int trigger = UINT_MAX); 00094 bool RegisterQueue (iEventQueue* queue, unsigned int trigger = -1); 00095 00096 private: 00097 // This contains an array of trigger functions which are used to dispatch 00098 // events based on event type. 00099 static bool 00100 (csBaseEventHandler::*pmfnTriggers[_CSBASEEVENT_MAXARRAYINDEX+1])(iEvent &event); 00101 00102 private: 00109 virtual bool HandleEvent (iEvent &event); 00110 00111 protected: 00128 virtual bool OnBroadcast (iEvent &event); 00129 00131 virtual bool OnCommand (iEvent &event); 00132 00134 virtual bool OnJoystickMove (iEvent &event); 00135 00137 virtual bool OnJoystickDown (iEvent &event); 00138 00140 virtual bool OnJoystickUp (iEvent &event); 00141 00143 virtual bool OnKeyDown (iEvent &event); 00144 00146 virtual bool OnKeyUp (iEvent &event); 00147 00149 virtual bool OnMouseMove (iEvent &event); 00150 00152 virtual bool OnMouseDown (iEvent &event); 00153 00155 virtual bool OnMouseUp (iEvent &event); 00156 00158 virtual bool OnMouseClick (iEvent &event); 00159 00161 virtual bool OnMouseDoubleClick (iEvent &event); 00162 00164 virtual bool OnNetwork (iEvent &event); 00165 00172 virtual bool OnUnhandledEvent (iEvent &event); 00173 00175 virtual void PreProcessFrame (); 00176 00178 virtual void ProcessFrame (); 00179 00181 virtual void PostProcessFrame (); 00182 00184 virtual void FinishFrame (); 00185 }; 00186 00189 #endif //__CS_CSBASEEVENTH_H__