home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / toolba.zip / ATIMEHDR.HPP < prev    next >
Text File  |  1994-09-16  |  4KB  |  76 lines

  1. /************************************************************************
  2. * ATimeHdr.hpp - timer class header                                     *
  3. * --------------------------------------------------------------------- *
  4. * Override IHandler class in order to provide support for a timer       *
  5. * message.                                                              *
  6. * --------------------------------------------------------------------- *
  7. * Overridden methods:                                                   *
  8. *                                                                       *
  9. * Boolean dispatchHandlerEvent -    process messages to the window      *
  10. *                                   being handled.  The method is       *
  11. *                                   overridden in order to intercept    *
  12. *                                   the timer message specifically.     *
  13. *                                                                       *
  14. * IHandler &handleEventsFor -       start handling timer events for a   *
  15. *                                   specified window.  If the timeout   *
  16. *                                   value has been set start the timer. *
  17. *                                                                       *
  18. * IHandler &stopHandlingEventsFor - stop handling timer events.  If the *
  19. *                                   timer is running stop the timer.    *
  20. *                                                                       *
  21. * New methods: -------------------------------------------------------- *
  22. *                                                                       *
  23. * void setId -                      set the timer id.  If this is not   *
  24. *                                   set and the timer is started, a     *
  25. *                                   value will be selected.             *
  26. *                                                                       *
  27. * unsigned int id -                 return the timer id.  If the timer  *
  28. *                                   id is not set, return zero.         *
  29. *                                                                       *
  30. * void setTimeout -                 set the timer timeout value.  A     *
  31. *                                   value of zero will stop the timer.  *
  32. *                                   A non-zero value after              *
  33. *                                   handleEventsFor() has been invoked  *
  34. *                                   will restart a stopped timer.       *
  35. *                                                                       *
  36. * unsigned int timeout -            return the timeout value.           *
  37. *                                                                       *
  38. * Protected methods: -------------------------------------------------- *
  39. *                                                                       *
  40. * Boolean tick -                    process timer message.              *
  41. *                                                                       *
  42. ************************************************************************/
  43.  
  44. #ifndef _ATIMEHDR_HPP
  45. #define _ATIMEHDR_HPP
  46.  
  47. #include <ihandler.hpp>
  48. #include <ihandle.hpp>
  49.  
  50. class ATimeHandler : public IHandler
  51. {
  52. public:
  53.    ATimeHandler();
  54.  
  55.    Boolean dispatchHandlerEvent( IEvent &evt );
  56.    IHandler &handleEventsFor( IWindow *window );
  57.    IHandler &stopHandlingEventsFor( IWindow *window );
  58.  
  59.    void  setId( unsigned int id );
  60.    unsigned int id();
  61.    void  setTimeout( unsigned int timeout );
  62.    unsigned int timeout();
  63.  
  64. protected:
  65.    virtual Boolean tick( IEvent &evt );
  66.  
  67. private:
  68.    unsigned int   timerId;
  69.    unsigned int   timerDelay;
  70.    Boolean        timerRunning;
  71.    Boolean        generateId;
  72.    IWindowHandle  hwndWindow;
  73. };
  74.  
  75. #endif /* _ATIMEHDR_HPP_ not defined */
  76.