home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / VSCPPv8.zip / VACPP / IBMCPP / samples / IOC / BIGCPP / BIGCPP.HPP < prev    next >
Text File  |  1995-01-20  |  7KB  |  177 lines

  1. #ifndef BIGCPP_HPP
  2. #define BIGCPP_HPP
  3. /******************************************************************************/
  4. /* Big C Plus Plus Sample Program                                             */
  5. /*                                                                            */
  6. /* COPYRIGHT: Copyright (C) International Business Machines Corp., 1992,1993. */
  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 <idrawcv.hpp>
  20. #include <igraphic.hpp>
  21. #include <igpyline.hpp>
  22. #include <isizehdr.hpp>
  23.  
  24. class MainWindow;
  25.  
  26. //**************************************************************************
  27. // Class:   ICPlusPlus                                                     *
  28. //                                                                         *
  29. // Purpose: Draw a big C Plus Plus                                         *
  30. //                                                                         *
  31. //**************************************************************************
  32. class ICPlusPlus : public IGraphic {
  33. typedef IGraphic
  34.   Inherited;
  35.  
  36. public:
  37.  
  38.   ICPlusPlus        ( const IRectangle& rectangle      );
  39. virtual
  40.   ~ICPlusPlus       ( );
  41.  
  42. ICPlusPlus
  43.   &drawOn           ( IGraphicContext&  graphicContext );
  44.  
  45. ICPlusPlus
  46.   &setEnclosingRect ( const IRectangle& rectangle      );
  47. IRectangle
  48.   enclosingRect     ( ) const;
  49.  
  50. private:
  51. ICPlusPlus
  52.   &draw( IGraphicContext&,
  53.          IGraphicBundle::DrawOperation );
  54.  
  55. IRectangle
  56.   fRect;
  57. };
  58.  
  59. //**************************************************************************
  60. // The border class is derived from an IGraphic.
  61. //
  62. // Normally the border would be placed inside the perimeter of the
  63. // drawing area and also around the outside of another graphic object.
  64. //
  65. // Borders can be raised or depressed. Raised draws the top and left
  66. // sides lighter in shade than the bottom and right. Depressed draws the top
  67. // and left darker than the bottom and right. The light source is from the top
  68. // left.
  69. //
  70. // The border is comprised of two polygons, one for the top and left sides
  71. // and one for the bottom and right sides.
  72. //**************************************************************************
  73.  
  74. class IGBorder : public IGraphic {
  75. typedef IGraphic
  76.   Inherited;
  77.  
  78. public:
  79. /*------------------------ Constructors/Destructor -----------------------------
  80. | You can construct objects of this class from an IRectangle object specifying |
  81. | the location and size of the border, a value indicating the thickness of the |
  82. | border, an optional boolean indicating whether you want the border drawn     |
  83. | inside or outside of the rectangle and an optional boolean indicating        |
  84. | to raise or depress the border.                                              |
  85. ------------------------------------------------------------------------------*/
  86.  
  87.   IGBorder          ( const IRectangle& rectangle,
  88.                       unsigned long     thickness,
  89.                       Boolean           outside = true,
  90.                       Boolean           raised  = true );
  91.  
  92. virtual
  93.   ~IGBorder ( );
  94.  
  95. IGBorder
  96.   &drawOn           ( IGraphicContext&  graphicContext );
  97.  
  98. IGBorder
  99.   &setEnclosingRect ( const IRectangle& rectangle      );
  100. IRectangle
  101.   enclosingRect     ( ) const;
  102.  
  103. IGBorder
  104.   &setThickness     ( unsigned long     thickness      );
  105. unsigned long
  106.   thickness         ( ) const;
  107.  
  108. private:
  109. IGPolygon
  110.   fTopBorder,
  111.   fBottomBorder;
  112. unsigned long
  113.   fThickness;
  114. Boolean
  115.   fOutside,
  116.   fRaised;
  117. };
  118.  
  119. //**************************************************************************
  120. // Class:   ResizeHandler                                                  *
  121. //                                                                         *
  122. // Purpose: Route resize events to the MainWindow                          *
  123. //                                                                         *
  124. //**************************************************************************
  125. class ResizeHandler : public IResizeHandler {
  126. typedef IResizeHandler
  127.   Inherited;
  128.  
  129. public:
  130.   ResizeHandler  ( MainWindow& mainWindow );
  131.  
  132. virtual
  133.   ~ResizeHandler ( );
  134.  
  135. protected:
  136. /*----------------------------- Event Processing -------------------------------
  137. | This function must be supplied by a derived class to process a resizing      |
  138. | event.                                                                       |
  139. |   windowResize - Implemented by a derived class to handle a resizing event.  |
  140. ------------------------------------------------------------------------------*/
  141. virtual Boolean
  142.   windowResize   ( IResizeEvent& event );
  143.  
  144. private:
  145. MainWindow
  146.   &fMainWindow;
  147. };
  148.  
  149. //**************************************************************************
  150. // Class:   MainWindow                                                     *
  151. //                                                                         *
  152. // Purpose: Main Window for Big C Plus Plus sample application             *
  153. //          It is a subclass of IFrameWindow                               *
  154. //                                                                         *
  155. //**************************************************************************
  156. class MainWindow : public IFrameWindow
  157. {
  158. public:                               //Define the Public Information
  159.  
  160.   MainWindow      ( unsigned long windowIdentifier ); //Constructor for this class
  161.  
  162. virtual
  163.   ~MainWindow     ( );
  164.  
  165. MainWindow
  166.   &resizeGraphics ( const ISize& size );
  167.  
  168. protected:
  169.  
  170. private:
  171.   IDrawingCanvas drawingCanvas;
  172.   ICPlusPlus     bigC;
  173.   IGBorder       border;
  174.   ResizeHandler  resizeHandler;
  175. };
  176. #endif
  177.