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

  1. #ifndef _ISCROLL_
  2.   #define _ISCROLL_
  3. /*******************************************************************************
  4. * FILE NAME: iscroll.hpp                                                       *
  5. *                                                                              *
  6. * DESCRIPTION:                                                                 *
  7. *   Declaration of the classes:                                                *
  8. *    IScrollBar                                                                *
  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 <icontrol.hpp>
  19. #include <irect.hpp>
  20.  
  21. class IRange;
  22. class IWindowHandle;
  23. class IScrollBarData;
  24. class IColor;
  25. class ISize;
  26.  
  27. #pragma pack(4)
  28.  
  29. class IScrollBar : public IControl {
  30. typedef IControl
  31.   Inherited;
  32.  
  33. public:
  34. class Style;
  35. /*------------------------------- Constructors -------------------------------*/
  36.   IScrollBar ( unsigned long     id,
  37.                IWindow*          parent,
  38.                IWindow*          owner,
  39.                const IRectangle& initial = IRectangle(),
  40.                const Style&      style = defaultStyle() );
  41.  
  42.   IScrollBar ( unsigned long     id,
  43.                IWindow*          parent,
  44.                IWindow*          owner,
  45.                const IRange&     scrollableItems,
  46.                unsigned long     visibleItemCount,
  47.                unsigned long     scrollBoxPosition = 1,
  48.                const IRectangle& initial = IRectangle(),
  49.                const Style&      style = defaultStyle() );
  50.  
  51.   IScrollBar ( unsigned long     id,
  52.                IWindow*          parent );
  53.  
  54.   IScrollBar ( const IWindowHandle& handle );
  55.  
  56. virtual
  57.  ~IScrollBar ( );
  58.  
  59. /*---------------------------------- Styles ----------------------------------*/
  60. INESTEDBITFLAGCLASSDEF2(Style, IScrollBar, IWindow, IControl);
  61. static const Style
  62.   IC_IMPORTU horizontal,
  63.   IC_IMPORTU vertical,
  64.   IC_IMPORTU classDefaultStyle;
  65.  
  66. static Style
  67.   defaultStyle      ( );
  68.  
  69. static void
  70.   setDefaultStyle   ( const Style&    style );
  71.  
  72. virtual unsigned long
  73.   convertToGUIStyle ( const IBitFlag& style,
  74.                       Boolean         extendedOnly = false ) const;
  75.  
  76. /*------------------------------ System Values -------------------------------*/
  77. static unsigned long
  78.   systemScrollBarWidth     ( Boolean verticalScrollBar = true ),
  79.   systemScrollBoxLength    ( Boolean verticalScrollBar = true ),
  80.   systemScrollButtonLength ( Boolean verticalScrollBar = true );
  81.  
  82. /*--------------------------- Query Operations -------------------------------*/
  83. Boolean
  84.   isHorizontal ( ) const,
  85.   isVertical   ( ) const;
  86.  
  87. /*------------------------- Manipulation Operations --------------------------*/
  88. virtual IScrollBar
  89.  &setScrollableRange ( const IRange& minMax ),
  90.  &setVisibleCount    ( unsigned long scrollableRangeUnits ),
  91.  &setScrollBar       ( const IRange& scrollableRange,
  92.                        unsigned long visibleCount );
  93. virtual IScrollBar
  94.  &moveScrollBoxTo    ( unsigned long firstItem = 1 );
  95.  
  96.  
  97. virtual IRange
  98.   scrollableRange     ( ) const,
  99.   scrollBoxRange      ( ) const;
  100. virtual unsigned long
  101.   visibleCount        ( ) const,
  102.   scrollBoxPosition   ( ) const;
  103.  
  104.  
  105. /*--------------------------- Scrolling Increment ----------------------------*/
  106. virtual unsigned long
  107.   minScrollIncrement     ( ) const,
  108.   pageScrollIncrement    ( ) const;
  109. virtual IScrollBar
  110.  &setMinScrollIncrement  ( unsigned long scrollableRangeUnits = 1 ),
  111.  &setPageScrollIncrement ( unsigned long scrollableRangeUnits = 0 );
  112.  
  113. /*---------------------------------- Colors ----------------------------------*/
  114. #ifndef IC_WIN_FLAGNOP
  115. virtual IColor
  116.   foregroundColor       () const,
  117.   hiliteForegroundColor () const;
  118. #endif
  119.  
  120. /*-------------------------------- Overrides ---------------------------------*/
  121.  
  122. /*----------------------- Notification Event Descriptions --------------------*/
  123. static INotificationId const
  124.   IC_IMPORTU scrollBoxPositionId;
  125.  
  126. /*----------------------- Observer Notification ------------------------------*/
  127. virtual IScrollBar
  128.  &enableNotification ( Boolean enable=true );
  129.  
  130.  
  131. protected:
  132. /*--------------------------- Protected Overrides ----------------------------*/
  133. virtual ISize
  134.   calcMinimumSize ( ) const;
  135.  
  136. /*---------------------- Event-Handling Implementation -----------------------*/
  137.  
  138.  
  139. private:
  140. /*------------------------------ Hidden Members ------------------------------*/
  141.   IScrollBar            ( const IScrollBar& scrollBar );
  142. IScrollBar
  143.  &operator=             ( const IScrollBar& scrollBar );
  144.  
  145. /*--------------------------------- Private ----------------------------------*/
  146. friend class IScrollBarData;
  147. friend class IScrollBarHandler;
  148.  
  149. void
  150.   initialize( unsigned long     windowId,
  151.               IWindow*          parent,
  152.               IWindow*          owner,
  153.               const IRectangle& initial,
  154.               const IRange&     scrollableItems,
  155.               unsigned long     visibleItemCount,
  156.               unsigned long     scrollBoxPosition,
  157.               const Style&      style );
  158.  
  159. unsigned long
  160.   ulClMinScrollIncrement,
  161.   ulClPageScrollIncrement;
  162.  
  163. void
  164.   initializeControlData ( const IRange& scrollableItems,
  165.                           unsigned long visibleItemCount,
  166.                           struct tagSCROLLINFO* controlData );
  167.  
  168. static Style
  169.   currentDefaultStyle;
  170.  
  171. IScrollBarData
  172.  *fScrollBarData;
  173.  
  174. }; // IScrollBar
  175.  
  176. INESTEDBITFLAGCLASSFUNCS(Style, IScrollBar);
  177.  
  178. #pragma pack()
  179.  
  180.   #include <iscroll.inl>
  181.  
  182. #endif /* _ISCROLL_ */
  183.