home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / VSCPPv8.zip / VACPP / IBMCPP / samples / IOC / 2D-BMAP / 2D-BMAP.HPP < prev    next >
Text File  |  1995-04-07  |  5KB  |  130 lines

  1. #ifndef BITMAP_HPP
  2. #define BITMAP_HPP
  3. /******************************************************************************/
  4. /* 2D-GRAPHICS BITMAP SAMPLE PROGRAM - Class Header (2d-bmap.hpp)             */
  5. /*                                                                            */
  6. /* COPYRIGHT: Copyright (C) International Business Machines Corp., 1992,1995. */
  7. /*                                                                            */
  8. /* DISCLAIMER OF WARRANTIES:                                                  */
  9. /*   The following [enclosed] code is sample code created by IBM              */
  10. /*   Corporation.  This sample code is not part of any standard IBM product   */
  11. /*   and is provided to you solely for the purpose of assisting you in the    */
  12. /*   development of your applications.  The code is provided "AS IS",         */
  13. /*   without warranty of any kind.  IBM shall not be liable for any damages   */
  14. /*   arising out of your use of the sample code, even if they have been       */
  15. /*   advised of the possibility of such damages.                              */
  16. /******************************************************************************/
  17.  
  18. #include <iframe.hpp>           //Include IFrameWindow Class Header
  19. #include <icmdhdr.hpp>
  20. #include <idrawcv.hpp>
  21. #include <ivport.hpp>
  22. #include <ipainhdr.hpp>
  23. #include <igbitmap.hpp>
  24. #include "2d-bmap.h"
  25.  
  26. //**************************************************************************
  27. // Class:   DrawingAreaPaintHandler                                        *
  28. //                                                                         *
  29. // Purpose: Draw the bitmap.                                               *
  30. //                                                                         *
  31. //**************************************************************************
  32. class DrawingAreaPaintHandler : public IPaintHandler
  33. {
  34. typedef IPaintHandler
  35.   Inherited;
  36.  
  37. protected:
  38.  
  39. virtual Boolean
  40.   paintWindow( IPaintEvent& event );
  41. };
  42.  
  43. //**************************************************************************
  44. // Class:   MainCommandHandler                                             *
  45. //                                                                         *
  46. // Purpose: Handle command events for the bitmap sample program.           *
  47. //                                                                         *
  48. //**************************************************************************
  49. class MainCommandHandler : public ICommandHandler
  50. {
  51. typedef ICommandHandler
  52.   Inherited;
  53.  
  54. protected:
  55.  
  56. virtual Boolean
  57.   command( ICommandEvent& event );
  58. };
  59.  
  60. class DrawingArea : public IDrawingCanvas
  61. {
  62. typedef IDrawingCanvas
  63.   Inherited;
  64.  
  65. public:
  66.  
  67.   DrawingArea( unsigned long id, IWindow* parent, IWindow* owner );
  68. virtual
  69.   ~DrawingArea();
  70.  
  71. DrawingArea
  72.   &loadBitmap( const IString& imageFile );
  73.  
  74. IGBitmap*
  75.   bitmap() const;
  76.  
  77. DrawingArea
  78.   &setClipStyle ( unsigned long style ) { fStyle = style; return *this; }
  79. unsigned long
  80.   clipStyle( ) const { return fStyle; }
  81.  
  82. protected:
  83.  
  84. virtual ISize
  85.   calcMinimumSize     ( ) const;
  86.  
  87. private:
  88.  
  89. DrawingAreaPaintHandler
  90.   drawingAreaPaintHandler;
  91. IGBitmap*
  92.   fBitmap;
  93. unsigned long
  94.   fStyle;
  95. };
  96.  
  97. //**************************************************************************
  98. // Class:   MainWindow                                                     *
  99. //                                                                         *
  100. // Purpose: Main Window for C++ Hello World sample application             *
  101. //          It is a subclass of IFrameWindow                               *
  102. //                                                                         *
  103. //**************************************************************************
  104. class MainWindow : public IFrameWindow
  105. {
  106. typedef IFrameWindow
  107.   Inherited;
  108.  
  109. public:                                     //Define the Public Information
  110.   MainWindow(unsigned long windowId);       //Constructor for this class
  111. virtual
  112.   ~MainWindow();
  113.  
  114. virtual MainWindow
  115.   &loadImageFile( const IString& imageFile );
  116.  
  117. virtual MainWindow
  118.   &modifyBitmap( unsigned long eventId );
  119.  
  120. DrawingArea
  121.   &drawingArea( ) { return fDrawingArea; }
  122.  
  123. private:                                    //Define Private Information
  124.   IViewPort           fViewPort;
  125.   DrawingArea         fDrawingArea;
  126.   MainCommandHandler  fMainCommandHandler;
  127. };
  128.  
  129. #endif
  130.