scrollb.h
上传用户:hzhsqp
上传日期:2007-01-06
资源大小:1600k
文件大小:10k
- /*
- * scrollb.h
- *
- * Scroll bar ancestor class.
- *
- * Portable Windows Library
- *
- * Copyright (c) 1993-1998 Equivalence Pty. Ltd.
- *
- * The contents of this file are subject to the Mozilla Public License
- * Version 1.0 (the "License"); you may not use this file except in
- * compliance with the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS"
- * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
- * the License for the specific language governing rights and limitations
- * under the License.
- *
- * The Original Code is Portable Windows Library.
- *
- * The Initial Developer of the Original Code is Equivalence Pty. Ltd.
- *
- * Portions are Copyright (C) 1993 Free Software Foundation, Inc.
- * All Rights Reserved.
- *
- * Contributor(s): ______________________________________.
- *
- * $Log: scrollb.h,v $
- * Revision 1.19 1999/03/10 03:49:53 robertj
- * More documentation adjustments.
- *
- * Revision 1.18 1999/03/09 08:01:50 robertj
- * Changed comments for doc++ support (more to come).
- *
- * Revision 1.17 1999/02/16 08:08:46 robertj
- * MSVC 6.0 compatibility changes.
- *
- * Revision 1.16 1998/09/23 06:28:58 robertj
- * Added open source copyright license.
- *
- * Revision 1.15 1995/03/14 12:42:32 robertj
- * Updated documentation to use HTML codes.
- *
- * Revision 1.14 1995/02/19 04:19:18 robertj
- * Added dynamically linked command processing.
- *
- * Revision 1.13 1995/02/05 00:50:17 robertj
- * Had to change variable name "small" for MSVC 2.0
- *
- * Revision 1.12 1994/12/21 11:53:28 robertj
- * Documentation and variable normalisation.
- *
- * Revision 1.11 1994/10/30 11:47:05 robertj
- * Changed mechanism for doing notification callback functions.
- *
- * Revision 1.10 1994/08/23 11:32:52 robertj
- * Oops
- *
- * Revision 1.9 1994/08/22 00:46:48 robertj
- * Added pragma fro GNU C++ compiler.
- *
- * Revision 1.8 1994/06/25 11:55:15 robertj
- * Unix version synchronisation.
- *
- * Revision 1.7 1994/03/07 07:38:19 robertj
- * Major enhancementsacross the board.
- *
- * Revision 1.6 1994/01/15 02:50:29 robertj
- * Moved control contructors to common and added a platform dependent Construct() function.
- *
- * Revision 1.5 1994/01/03 04:42:23 robertj
- * Mass changes to common container classes and interactors etc etc etc.
- *
- * Revision 1.4 1993/09/27 16:35:25 robertj
- * Removed special constructor for dialog resource loading.
- *
- * Revision 1.3 1993/08/20 21:26:09 robertj
- * Added control notification codes.
- *
- * Revision 1.2 1993/07/14 12:49:16 robertj
- * Fixed RCS keywords.
- *
- */
- #define _PSCROLLBAR
- #ifdef __GNUC__
- #pragma interface
- #endif
- /**A scroll bar control for visually setting an integer value.
- The exact appearance of a scroll bar is platform dependent. However certain
- functionality exists for all platforms. These are that the scroll bar allows
- values between a minimum and maximum to be set via small nudges (typically
- a up or down arrow), large nudges (typically the page up or down area to
- either side of the thumb) or by explicitly setting a value (typically by
- dragging the thumb).
- This is an abstract class combining the common functionality of
- Ref{PHorizontalScrollBar} and Ref{PVerticalScrollBar} controls.
- */
- class PScrollBar : public PControl
- {
- PCLASSINFO(PScrollBar, PControl);
- public:
- /**Create a new scroll bar control with the specified default parameters
- for controlling the scroll bars operation.
- */
- PScrollBar(
- PInteractor * parent, /// Interactor into which the control is placed.
- PSCROLLBAR_VALUE max, /// Maximum value for scroll bar.
- PSCROLLBAR_VALUE min, /// Minimum value for scroll bar.
- PSCROLLBAR_VALUE val, /// Initial value for scroll bar.
- PSCROLLBAR_VALUE sml, /// Amount to move with the nudge button.
- PSCROLLBAR_VALUE lge /// Amount to move with the paging area.
- );
- PScrollBar(
- PInteractor * parent, /// Interactor into which the control is placed.
- const PNotifier & func, /// Function to call when changes state.
- PSCROLLBAR_VALUE max, /// Maximum value for scroll bar.
- PSCROLLBAR_VALUE min, /// Minimum value for scroll bar.
- PSCROLLBAR_VALUE val, /// Initial value for scroll bar.
- PSCROLLBAR_VALUE sml, /// Amount to move with the nudge button.
- PSCROLLBAR_VALUE lge /// Amount to move with the paging area.
- );
- /** Create control from interactor layout with the specified control ID. */
- PScrollBar(
- PInteractorLayout * parent, /// Interactor into which the box is placed.
- PRESOURCE_ID ctlID, /// Identifier for the control in the layout.
- const PNotifier & notify, /// Function to call when changes state.
- PSCROLLBAR_VALUE * valuePtr /// Variable to change to the scrollbar value.
- );
- /** Destroy the scroll bar. */
- virtual ~PScrollBar();
- /**@name PNotifier codes */
- /**Codes passed to the notification function on changes of state.
- A change to a scroll bar may proceed for some time, for example if the
- mouse button is pressed in the down arrow and held down. An auto-repeat
- would occur to continually change the scroll bar value until it is
- released.
- */
- enum {
- /** A scroll bar value change operation has been ended by the user. */
- EndTrack = NotifyChange,
- /** A scroll bar value change operation has been initiated by the user. */
- StartTrack,
- /** A scroll bar value change operation is in progress by the user. */
- Tracking
- };
- /**@name Overrides from class PControl */
- /**This function transfers the value of the control to or from the variable
- pointed to by the value pointer member variable.
- */
- virtual void TransferValue(
- int option
- /**Transfer value option. When this is -1 when the function transfers
- the value from the value pointer into the control. This is called in
- Ref{PDialog::OnInit()} function. When option is zero then the
- function transfers the value from the control to the value pointer
- variable. This is called just before the callback function every time
- the scroll bar value changes.
- */
- );
- /**@name New functions for class */
- /**Set the current thumb position of the scroll bar. If the
- #redraw# parameter is TRUE then this will be updated on the
- screen immediately (within OS constraints).
- */
- void SetValue(
- PSCROLLBAR_VALUE val, /// New value for scroll bar.
- BOOL redraw = TRUE /// Whether to update the screen.
- );
- /**Get the current thumb position of the scroll bar.
- @return
- current scroll bar value.
- */
- PSCROLLBAR_VALUE GetValue() const;
- /**Get the current value pointer associated with the control. The variable
- pointed to by this is autamatically updated with the current value of
- the scroll bar.
- @return
- value pointer associated with the control.
- */
- PSCROLLBAR_VALUE * GetValuePointer() const;
- /**Set the current value pointer associated with the control. The variable
- pointed to by this is autamatically updated with the current value of
- the scroll bar.
- */
- void SetValuePointer(
- PSCROLLBAR_VALUE * ptr //New value pointer to associate with the control.
- );
- /**Set the maximum thumb position of the scroll bar. If the
- #redraw# parameter is TRUE then this will be updated on the
- screen immediately (within OS constraints).
- */
- void SetMaximum(
- PSCROLLBAR_VALUE val, /// New maximum value for the scroll bar.
- BOOL redraw = TRUE /// Whether to update the screen.
- );
- /**Get the maximum thumb position of the scroll bar.
- @return
- current scroll bar maximum.
- */
- PSCROLLBAR_VALUE GetMaximum() const;
- /**Set the minimum thumb position of the scroll bar. If the
- #redraw# parameter is TRUE then this will be updated on the
- screen immediately (within OS constraints).
- */
- void SetMinimum(
- PSCROLLBAR_VALUE val, /// New minimum value for the scroll bar.
- BOOL redraw = TRUE /// Whether to update the screen.
- );
- /**Get the minimum thumb position of the scroll bar.
- @return
- current scroll bar minimum.
- */
- PSCROLLBAR_VALUE GetMinimum() const;
- /**Set the the amount by which the up and down arrows will move the thumb
- each time the are clicked. The up and down arrow keys do the same thing
- if the scroll bar has the focus.
- */
- void SetSmallNudge(
- PSCROLLBAR_VALUE val /// New nudge value for small increments.
- );
- /**Get the the amount by with the up and down arrows will move the thumb.
- @return
- small nudge value.
- */
- PSCROLLBAR_VALUE GetSmallNudge() const;
- /**Set the the amount by which clicking above or below the thumb will move
- it. The page up and page down keys do the same thing if the scroll bar
- has the focus.
- */
- void SetLargeNudge(
- PSCROLLBAR_VALUE val /// New nudge value for large increments.
- );
- /**Get the the amount by which clicking above or below the thumb will
- move it.
- @return
- large nudge value.
- */
- PSCROLLBAR_VALUE GetLargeNudge() const;
- protected:
- /**@name Member variables */
- PSCROLLBAR_VALUE minimum;
- PSCROLLBAR_VALUE maximum;
- PSCROLLBAR_VALUE value;
- PSCROLLBAR_VALUE smallNudge;
- PSCROLLBAR_VALUE largeNudge;
- /* Small and large nudge amounts. */
- private:
- // New functions for class
- void Construct();
- // Common constructor code
- #ifdef DOC_PLUS_PLUS
- };
- #endif
- // Class declaration continued in platform specific header file ///////////////