home *** CD-ROM | disk | FTP | other *** search
- /* %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- % Copyright (C) 1994, by WATCOM International Inc. All rights %
- % reserved. No part of this software may be reproduced or %
- % used in any form or by any means - graphic, electronic or %
- % mechanical, including photocopying, recording, taping or %
- % information storage and retrieval systems - except with the %
- % written permission of WATCOM International Inc. %
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- */
-
- /*************************************************************************
- *
- * WTimer -- Wrapper for the Windows 95 Timer control.
- *
- * Events:
- *
- * Timer --
- *
- *************************************************************************/
-
- #ifndef _WTIMER_HPP_INCLUDED
- #define _WTIMER_HPP_INCLUDED
-
- #ifndef _WNO_PRAGMA_PUSH
- #pragma pack(push,8);
- #pragma enum int;
- #endif
-
- #ifndef _WWINDOW_HPP_INCLUDED
- # include "wwindow.hpp"
- #endif
- #ifndef _WSEMAPHR_HPP_INCLUDED
- # include "wsemaphr.hpp"
- #endif
-
- class WTimer;
-
- struct WTimerEventData : public WEventData {
- WDWord systemTime;
- };
-
- class WCMCLASS WTimer : public WEventGenerator {
- WDeclareSubclass( WTimer, WEventGenerator );
-
- public:
-
- /**********************************************************
- * Constructors and Destructors
- *********************************************************/
-
- WTimer();
-
- ~WTimer();
-
- /**********************************************************
- * Properties
- *********************************************************/
-
- // TickCount
- //
- // Returns the number of milliseconds since the system
- // was started.
-
- static WDWord GetTickCount();
-
- /**********************************************************
- * Methods
- *********************************************************/
-
- // Start
- //
- // Start the timer. The timer will tick with the given
- // interval. If count is 0, the timer will tick continuously
- // until stopped, otherwise it will only tick the given
- // number of times.
-
- WBool Start( WDWord interval, WInt tickCount=0 );
-
- // Stop
- //
- // Stop a currently running timer.
-
- WBool Stop();
-
- // Tick
- //
- // Call the timer's event handler as if a tick had occurred.
- // If 0 is passed for the tickTime, the current time is
- // used.
-
- WBool Tick( WDWord tickTime=0 );
-
- /**********************************************************
- * Data members
- *********************************************************/
-
- private:
- WInt _id;
- WInt _count;
- WCallbackProc _procInst;
- };
-
- #ifndef _WNO_PRAGMA_PUSH
- #pragma enum pop;
- #pragma pack(pop);
- #endif
-
- #endif // _WTIMER_HPP_INCLUDED
-