home *** CD-ROM | disk | FTP | other *** search
/ Power GUI Programming with VisualAge C++ / powergui.iso / trialva / ibmcppw / include / ivport.hpp < prev    next >
Encoding:
C/C++ Source or Header  |  1996-02-22  |  4.9 KB  |  150 lines

  1. #ifndef _IVPORT_
  2.   #define _IVPORT_
  3. /*******************************************************************************
  4. * FILE NAME: ivport.hpp                                                        *
  5. *                                                                              *
  6. * DESCRIPTION:                                                                 *
  7. *   Declaration of the classes:                                                *
  8. *     IViewPort                                                                *
  9. *                                                                              *
  10. * COPYRIGHT:                                                                   *
  11. *   IBM Open Class Library                                                     *
  12. *   (C) Copyright International Business Machines Corporation 1992, 1996       *
  13. *   Licensed Material - Program-Property of IBM - All Rights Reserved.         *
  14. *   US Government Users Restricted Rights - Use, duplication, or disclosure    *
  15. *   restricted by GSA ADP Schedule Contract with IBM Corp.                     *
  16. *                                                                              *
  17. *******************************************************************************/
  18. #include <icanvas.hpp>
  19. #include <inotify.hpp>
  20. #include <ipoint.hpp>
  21. #include <irect.hpp>
  22.  
  23. class IColor;
  24. class IScrollBar;
  25. class IViewPortData;
  26. class IViewRectangle;
  27. class IWindowHandle;
  28.  
  29. #pragma pack(4)
  30.  
  31. class IViewPort : public ICanvas {
  32. typedef ICanvas
  33.   Inherited;
  34. public:
  35. class Style;
  36.  
  37. /*------------------------------- Constructors -------------------------------*/
  38.   IViewPort ( unsigned long     windowIdentifier,
  39.               IWindow*          parent,
  40.               IWindow*          owner,
  41.               const IRectangle& initialSize = IRectangle(),
  42.               const Style&      style = defaultStyle() );
  43.  
  44. virtual
  45.  ~IViewPort ( );
  46.  
  47. /*---------------------------------- Styles ----------------------------------*/
  48. INESTEDBITFLAGCLASSDEF2(Style, IViewPort, IWindow, ICanvas);
  49. static const Style
  50.   IC_IMPORTU alwaysHorizontalScrollBar,
  51.   IC_IMPORTU asNeededHorizontalScrollBar,
  52.   IC_IMPORTU noHorizontalScrollBar,
  53.   IC_IMPORTU alwaysVerticalScrollBar,
  54.   IC_IMPORTU asNeededVerticalScrollBar,
  55.   IC_IMPORTU noVerticalScrollBar,
  56.   IC_IMPORTU noViewWindowFill,
  57.   IC_IMPORTU classDefaultStyle;
  58. static const Style
  59.   IC_IMPORTU expandableViewWindow;
  60. static Style
  61.   defaultStyle      ( );
  62. static void
  63.   setDefaultStyle   ( const Style&    style );
  64.  
  65. virtual unsigned long
  66.   convertToGUIStyle ( const IBitFlag& style,
  67.                       Boolean         extendedOnly = false ) const;
  68.  
  69. /*----------------------------- Child Scroll Bars ----------------------------*/
  70. IScrollBar
  71.  *horizontalScrollBar ( ) const,
  72.  *verticalScrollBar   ( ) const;
  73.  
  74. /*----------------------------- View Window ----------------------------------*/
  75. virtual IWindowHandle
  76.   viewWindow               ( );
  77. virtual IRectangle
  78.   viewWindowDrawRectangle  ( ) const;
  79. virtual IViewPort
  80.  &scrollViewVerticallyTo   ( unsigned long topOffset ),
  81.  &scrollViewHorizontallyTo ( unsigned long leftOffset );
  82. virtual IViewPort
  83.  &setViewWindowSize        ( const ISize& size );
  84. virtual ISize
  85.   viewWindowSize           ( ) const;
  86.  
  87. /*----------------------------- Layout Support -------------------------------*/
  88. virtual IViewPort
  89.  &setLayoutDistorted ( unsigned long layoutAttributeOn,
  90.                        unsigned long layoutAttributeOff );
  91.  
  92. /*---------------------------- Notification Members --------------------------*/
  93. static INotificationId const
  94.   IC_IMPORTU viewWindowSizeId;
  95.  
  96. protected:
  97. /*----------------------------- Layout Support -------------------------------*/
  98. virtual ISize
  99.   calcMinimumSize ( ) const;
  100. virtual IViewPort
  101.  &layout          ( );
  102.  
  103. /*------------------------------ View Window ---------------------------------*/
  104. virtual IViewPort
  105.  &setupScrollBars     ( ),
  106.  &positionViewWindow  ( const IWindowHandle& viewWindow,
  107.                         const IRectangle& viewRectangle ),
  108.  &setTopLeftViewPoint ( const IPoint& topLeft );
  109.  
  110. IPoint
  111.   topLeftViewPoint    ( ) const;
  112.  
  113. private:
  114. /*----------------------------- Hidden Members -------------------------------*/
  115.   IViewPort ( const IViewPort& viewPort );
  116. IViewPort
  117.  &operator= ( const IViewPort& viewPort );
  118.  
  119. /*--------------------------------- Private ----------------------------------*/
  120. static Style
  121.   currentDefaultStyle;
  122. IPoint
  123.   ptClTopLeftView;
  124. IScrollBar
  125.  *psbClVert,
  126.  *psbClHorz;
  127. IViewRectangle
  128.  *pcvClViewRect;
  129. ISize
  130.   sizClViewWindow;
  131.  
  132. enum Flag { initialized=1, resizeHandlerAdded=2, scrollHandlerAdded=4,
  133.             keyboardHandlerAdded=8, paintHandlerAdded=16,
  134.             rectanglePaintHandlerAdded=32, useMinimumSizeView=64 };
  135. unsigned long
  136.   ulClFlag;
  137.  
  138. IViewPortData
  139.  *fViewPortData;
  140.  
  141. }; // IViewPort
  142.  
  143. INESTEDBITFLAGCLASSFUNCS(Style, IViewPort);
  144.  
  145. #pragma pack()
  146.  
  147.   #include <ivport.inl>
  148.  
  149. #endif /* _IVPORT_ */
  150.