home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / ocl_ani2.zip / ocl_ani2.hpp < prev    next >
Text File  |  1997-07-06  |  4KB  |  85 lines

  1. /* Stéphane Charette, stephane@venus.ubishops.ca
  2.  * IBM Open Class Library Animation Sample #2
  3.  * (using Visual Age C++ v3.0 with OS/2 v4.0)
  4.  * 1997July06
  5.  */
  6.  
  7. /* IBM OCL includes */
  8. #include <iapp.hpp>        // IApplication
  9. #include <icmdevt.hpp>     // ICommandEvent
  10. #include <icmdhdr.hpp>     // ICommandHandler
  11. #include <icolor.hpp>      // IColor
  12. #include <ictlevt.hpp>     // IControlEvent
  13. #include <idrawcv.hpp>     // IDrawingCanvas
  14. #include <iframe.hpp>      // IFrameWindow
  15. #include <iframevt.hpp>    // IFrameEvent
  16. #include <iframhdr.hpp>    // IFrameHandler
  17. #include <igbitmap.hpp>    // IGBitmap
  18. #include <iglist.hpp>      // IGList
  19. #include <igrafctx.hpp>    // IGraphicContext
  20. #include <imousevt.hpp>    // IMouseClickEvent
  21. #include <imoushdr.hpp>    // IMouseHandler
  22. #include <ipopmenu.hpp>    // IPopUpMenu
  23. #include <itimer.hpp>      // ITimerMemberFn0
  24.  
  25. /* local includes */
  26. #define INCL_WINWINDOWMGR  // WinInvalidateRect()
  27. #include <os2.h>           // standard OS/2 include
  28. #include <math.h>          // sqrt()
  29. #include "ocl_ani2.h"      // #defines
  30.  
  31. /* class prototypes */
  32. class Application;
  33. class Person;
  34.  
  35.  
  36. // class used to encapsulate the frame, client canvas, etc...
  37. class Application :                    // inherit from...
  38.    public IFrameWindow,                // ...IFrameWindow...
  39.    public ICommandHandler,             // ...ICommandHandler...
  40.    public IFrameHandler,               // ...IFrameHandler...
  41.    public IMouseHandler,               // ...IMouseHandler...
  42.    public IGList                       // ...and IGList
  43. {
  44.    public:
  45.       // declare constructor and destructor for class
  46.       Application( void );
  47.       ~Application( void );
  48.       void resetAttributes( void );    // used to reset local vars
  49.    protected:
  50.       // declare protected class variables
  51.       IDrawingCanvas canvas;                    // drawing canvas
  52.       IPointerHandle mouseMovePtrHandle;        // pointer to use when moving
  53.       IPoint         mouseClickPosition;        // location of last mouseclick
  54.       Boolean        mouseMoveInProgress;       // move operation in progress?
  55.       unsigned long  mouseClickBitmapOffset;    // IGBitmap offset into IGList
  56.  
  57.       // declare overloaded functions that were inherited from...
  58.       Boolean command( ICommandEvent &event );           // ...ICommandHandler
  59.       Boolean deactivated( IFrameEvent &event );         // ...IFrameHandler
  60.       Boolean mouseClicked( IMouseClickEvent &event );   // ...IMouseHandler
  61.       Boolean mousePointerChange( IMousePointerEvent &event ); // ...IMouse...
  62. };
  63.  
  64.  
  65. // class used to encapsulate the "people" objects
  66. class Person :                         // inherit from...
  67.    public IGBitmap                     // ...IGBitmap
  68. {
  69.    public:
  70.       // declare public class variables
  71.       unsigned long bitmapId;          // bitmap id (needed when cloning)
  72.       double moveX;                    // x location used when moving
  73.       double moveY;                    // y location used when moving
  74.       double moveDX;                   // delta used when moving
  75.       double moveDY;                   // delta used when moving
  76.       int    moveCount;                // how many steps left to move
  77.       IPoint moveDestination;          // final destination used when moving
  78.       ITimer *moveTimer;               // timer used when moving
  79.       IWindowHandle canvasHandle;      // needed when we invalidate canvas
  80.       // declare constructor and destructor for class
  81.       Person( int rcId, IWindowHandle handle );
  82.       ~Person( void );
  83.       void animateMove( void );        // called by timer to redraw person
  84. };
  85.