home *** CD-ROM | disk | FTP | other *** search
/ Power GUI Programming with VisualAge C++ / powergui.iso / trialva / ibmcppw / samples / ioc / ownhdr / timehdr.hpp < prev   
Encoding:
C/C++ Source or Header  |  1996-02-22  |  3.9 KB  |  73 lines

  1. /******************************************************************************
  2. * .FILE:         timehdr.hpp                                                  *
  3. *                                                                             *
  4. * .DESCRIPTION:  Create your own time handler : Class Definitions             *
  5. *                                                                             *
  6. * .CLASSES:      ATimeHandler                                                 *
  7. *                                                                             *
  8. * .COPYRIGHT:                                                                 *
  9. *    Licensed Material - Program-Property of IBM                              *
  10. *    (C) Copyright IBM Corp. 1992, 1996 - All Rights Reserved                 *
  11. *                                                                             *
  12. * .DISCLAIMER:                                                                *
  13. *   The following [enclosed] code is sample code created by IBM               *
  14. *   Corporation.  This sample code is not part of any standard IBM product    *
  15. *   and is provided to you solely for the purpose of assisting you in the     *
  16. *   development of your applications.  The code is provided 'AS IS',          *
  17. *   without warranty of any kind.  IBM shall not be liable for any damages    *
  18. *   arising out of your use of the sample code, even if they have been        *
  19. *   advised of the possibility of such damages.                               *
  20. *                                                                             *
  21. * .NOTE: WE RECOMMEND USING A FIXED SPACE FONT TO LOOK AT THE SOURCE          *
  22. *                                                                             *
  23. ******************************************************************************/
  24. #ifndef _ATIMEHDR_
  25. #define _ATIMEHDR_
  26.  
  27. #ifndef _IHANDLER_
  28.   #include <ihandler.hpp>
  29. #endif
  30.  
  31. /**************************************************************************
  32. * Class:   ATimeHandler                                                   *
  33. *                                                                         *
  34. * Purpose: New Handler class that processes timer events.                 *
  35. *                                                                         *
  36. **************************************************************************/
  37. class ATimeHandler : public IHandler
  38. {
  39.   typedef IHandler
  40.     Inherited;
  41.   public:
  42.     ATimeHandler() : timerId(0) { }       //Initialize timerId data member
  43.     virtual ~ATimeHandler() { }
  44.  
  45. /*----------------- Override Public IHandler Functions -------------------|
  46. | These public IHandler functions are overridden to add start and stop    |
  47. |   timer calls, respectively.                                            |
  48. |------------------------------------------------------------------------*/
  49.     virtual ATimeHandler
  50.       &handleEventsFor(IWindow *window),
  51.       &stopHandlingEventsFor(IWindow *window );
  52.  
  53.   protected:
  54. /*------------------- Override Protected IHandler Function ---------------|
  55. | The dispatchHandlerEvent function is overridden to call the tick        |
  56. |   function for processing timer events.                                 |
  57. | The tick function is added in ATimeHandler and should be overridden     |
  58. |   by classes that inherit from ATimeHandler.                            |
  59. |------------------------------------------------------------------------*/
  60.     Boolean
  61.       dispatchHandlerEvent(IEvent& event);
  62.     virtual Boolean
  63.       tick(IEvent& event);
  64.  
  65.   private:
  66. /*--------------------------- Private Data Member ------------------------|
  67. | The timerId private data member is used by the ATimeHandler functions   |
  68. |   to save the ID of the outstanding timer call.                         |
  69. |------------------------------------------------------------------------*/
  70.     unsigned long timerId;
  71. };
  72. #endif
  73.