Main Page | Modules | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members | Related Pages
cstimer.h
Go to the documentation of this file.00001 /* 00002 Crystal Space Windowing System: timer class 00003 Copyright (C) 1998,1999 by Andrew Zabolotny <bit@eltech.ru> 00004 Copyright (C) 2002 by Mat Sutcliffe <oktal@gmx.co.uk> 00005 00006 This library is free software; you can redistribute it and/or 00007 modify it under the terms of the GNU Library General Public 00008 License as published by the Free Software Foundation; either 00009 version 2 of the License, or (at your option) any later version. 00010 00011 This library is distributed in the hope that it will be useful, 00012 but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00014 Library General Public License for more details. 00015 00016 You should have received a copy of the GNU Library General Public 00017 License along with this library; if not, write to the Free 00018 Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 00019 */ 00020 00021 #ifndef __CS_CSTIMER_H__ 00022 #define __CS_CSTIMER_H__ 00023 00024 #include "cscomp.h" 00025 00034 #include "csextern.h" 00035 00037 enum 00038 { 00047 cscmdTimerPulse = 0x00000300 00048 }; 00049 00050 #include "iutil/event.h" 00051 #include "csutil/csevent.h" 00052 struct iEventHandler; 00053 struct iEventQueue; 00054 struct iEventOutlet; 00055 00062 class CS_CSWS_EXPORT csTimer : public csComponent 00063 { 00065 unsigned timeout; 00067 unsigned start; 00069 unsigned pausetime; 00071 bool Stopped; 00072 00073 iEventHandler *eventh; 00074 iEventOutlet *evento; 00075 void Init (unsigned iPeriod); 00076 struct csTimerEvent : public csEvent 00077 { 00078 SCF_DECLARE_IBASE; 00079 csTimerEvent () { SCF_CONSTRUCT_IBASE(0); } 00080 virtual ~csTimerEvent() { SCF_DESTRUCT_IBASE(); } 00081 } TimerEvent; 00082 00083 public: 00085 csTimer (csComponent *iParent, unsigned iPeriod); 00086 csTimer (iEventHandler *iParent, unsigned iPeriod, void *iInfo = 0); 00087 csTimer (iEventQueue *iParent, unsigned iPeriod, void *iInfo = 0); 00088 00090 virtual bool HandleEvent (iEvent &Event); 00091 00093 void Stop (); 00094 00096 void Restart (); 00097 00099 void Pause (unsigned iPause); 00100 00102 bool Running () { return !Stopped; } 00103 }; 00104 00107 #endif // __CS_CSTIMER_H__
Generated for Crystal Space by doxygen 1.3.9.1