home *** CD-ROM | disk | FTP | other *** search
- #ifndef _ISCROLL_
- #define _ISCROLL_
- /*******************************************************************************
- * FILE NAME: Iscroll.hpp *
- * *
- * DESCRIPTION: *
- * Declaration of the class(es): *
- * Iscroll - This class creates and manages the scroll bar control window. *
- * *
- * COPYRIGHT: *
- * Licensed Materials - Property of IBM *
- * (C) Copyright IBM Corporation 1992, 1993 *
- * All Rights Reserved *
- * US Government Users Restricted Rights - Use, duplication, or disclosure *
- * restricted by GSA ADP Schedule Contract with IBM Corp. *
- * *
- * $Log: R:/IBMCLASS/IBASECTL/VCS/ISCROLL.HPV $
- //
- // Rev 1.4 25 Oct 1992 17:06:02 nunn
- //changed library name to ICLUI
- //
- // Rev 1.3 25 Oct 1992 15:36:10 tsuji
- //Update example, add IWindow::visible to default style.
- //
- // Rev 1.2 25 Oct 1992 10:56:52 boezeman
- //Add documentation and converted file to skeleton.hpp format.
-
- Rev 1.2 25 Sep 1992 21:22:06 KKL
- Update for OS/2 2.0
- Rev 1.1 ?? ??? ???? ??:??:?? Tim Hertz
- Initial design and code V2.0
- *******************************************************************************/
- #ifndef _ICONTROL_
- #include <icontrol.hpp>
- #endif
-
- // Forward declarations for other classes:
- class IScrollBar;
- class IWindow;
- class IRectangle;
- class IRange;
-
- class IScrollBar : public IControl {
- /*******************************************************************************
- * This class creates and manages the scroll bar control window. *
- * *
- * EXAMPLE: *
- * To create the scroll bar: *
- * pvsb = new IScrollBar(ID_MYVERTSCROLL, *
- * this, *
- * IRectangle(0,45, 20,200), *
- * IRange(1,20), *
- * 5); *
- * pvsb->setLineSize(1); *
- * Then to catch the scroll messages, add: *
- * MyScrollHandler sbh = new MyScrollHandler(); *
- * pvsb->addHandler(this); *
- * Finally, to process the scroll messages: *
- * Boolean MyScrollHandler::pageUp(IScrollEvent& evt) *
- * { *
- * // Scroll the information in the related window *
- * // *
- * // Call the scroll bar's moveSliderTo function to update its *
- * // slider (thumb) position *
- * return true; *
- * } *
- *******************************************************************************/
- typedef IControl
- Inherited;
- public:
- INESTEDBITFLAGCLASSDEF1(Style, IScrollBar, IWindow);
- static const Style
- autoTrack,
- horizontal,
- vertical;
-
- static const unsigned long
- sysVScrollBarWidth,
- sysHScrollBarHeight,
- sysVScrollBarArrowHeight,
- sysHScrollBarArrowWidth,
- sysVScrollSliderHeight,
- sysHScrollSliderWidth;
-
- /*------------------------ CONSTRUCTORS/DESTRUCTORS ----------------------------
- | There are 4 ways to construct instances of this class: |
- | 1. default |
- | 2. Creates a scroll bar with slider range and position |
- | 3. From a Dialog Template |
- | 4. From a Window |
- ------------------------------------------------------------------------------*/
- IScrollBar(unsigned long winId, const IWindow* parent,
- const IWindow* owner, const IRectangle& rect,
- Style style = (IWindow::visible | vertical | autoTrack));
-
- IScrollBar(unsigned long winId, const IWindow* parent,
- const IWindow* owner, const IRectangle& rect,
- const IRange& minMaxScrollUnit,
- unsigned long sliderUnit,
- unsigned long sliderPos = 1,
- Style style = (IWindow::visible | vertical | autoTrack));
-
- IScrollBar(unsigned long winId, const IWindow* parent);
- IScrollBar(IWindowHandle handle);
-
- /*-------------------------------- STYLES --------------------------------------
- | These functions provide means of getting and setting the scroll bar styles |
- | isHorizontal - Returns true if the scroll bar has the horizontal style.|
- | isVertical - Returns true if the scroll bar has the vertical style. |
- | isAutoTrack - Returns true if the scroll bar has the autotrack style. |
- | enableAutoTrack - Enables autotrack style for the scroll bar. |
- | disableAutoTrack - Disables autotrack style for the scroll bar. |
- ------------------------------------------------------------------------------*/
- Boolean
- isHorizontal() const,
- isVertical() const,
- isAutoTrack() const;
- void
- enableAutoTrack(),
- disableAutoTrack();
- /*-------------------------------- MISCELLANEOUS OPERATIONS --------------------
- | moveSliderTo - Move the scroll bar slider to the position given. |
- | setSliderUnit - Sets the slider size. |
- | setScrollUnit - Sets the range the scroll bar represents. |
- | setLineUnit - Sets the line size. |
- | scrollUnit - Returns the range that the scroll bar represents. |
- | sliderPosition - Returns the current position of the slider. |
- | sliderUnit - Returns the slider size. |
- | lineUnit - Returns the line size. The line size must be set using the|
- | setLineUnit to be accurate. |
- ------------------------------------------------------------------------------*/
- void
- moveSliderTo(unsigned long position = 1),
- setSliderUnit(unsigned long sliderUnit),
- setScrollUnit(const IRange& minMaxScrollUnit),
- setLineUnit(unsigned long value = 1);
- IRange
- scrollUnit() const;
- unsigned long
- sliderPosition() const,
- sliderUnit() const,
- lineUnit() const;
-
- private:
- /*--------------------------------- PRIVATE ----------------------------------*/
- unsigned long
- ulClLineUnit;
- };
-
- INESTEDBITFLAGCLASSFUNCS(Style, IScrollBar);
-
- /*--------------------------------- INLINES ----------------------------------*/
- inline void IScrollBar::setLineUnit(unsigned long ulLineUnit)
- /***************************************************************/
- /* Set line scroll value. */
- /***************************************************************/
- { ulClLineUnit = ulLineUnit; }
-
- inline unsigned long IScrollBar::lineUnit() const
- /***************************************************************/
- /* Return line scroll value. */
- /***************************************************************/
- { return ulClLineUnit; }
- #endif /* _ISCROLL_ */