4 * Scroll bar ancestor class.
6 * Portable Windows Library
8 * Copyright (c) 1993-1998 Equivalence Pty. Ltd.
10 * The contents of this file are subject to the Mozilla Public License
11 * Version 1.0 (the "License"); you may not use this file except in
12 * compliance with the License. You may obtain a copy of the License at
13 * http://www.mozilla.org/MPL/
15 * Software distributed under the License is distributed on an "AS IS"
16 * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
17 * the License for the specific language governing rights and limitations
20 * The Original Code is Portable Windows Library.
22 * The Initial Developer of the Original Code is Equivalence Pty. Ltd.
24 * Portions are Copyright (C) 1993 Free Software Foundation, Inc.
25 * All Rights Reserved.
27 * Contributor(s): ______________________________________.
30 * Revision 1.20 2001/05/22 12:49:33 robertj
31 * Did some seriously wierd rewrite of platform headers to eliminate the
32 * stupid GNU compiler warning about braces not matching.
34 * Revision 1.19 1999/03/10 03:49:53 robertj
35 * More documentation adjustments.
37 * Revision 1.18 1999/03/09 08:01:50 robertj
38 * Changed comments for doc++ support (more to come).
40 * Revision 1.17 1999/02/16 08:08:46 robertj
41 * MSVC 6.0 compatibility changes.
43 * Revision 1.16 1998/09/23 06:28:58 robertj
44 * Added open source copyright license.
46 * Revision 1.15 1995/03/14 12:42:32 robertj
47 * Updated documentation to use HTML codes.
49 * Revision 1.14 1995/02/19 04:19:18 robertj
50 * Added dynamically linked command processing.
52 * Revision 1.13 1995/02/05 00:50:17 robertj
53 * Had to change variable name "small" for MSVC 2.0
55 * Revision 1.12 1994/12/21 11:53:28 robertj
56 * Documentation and variable normalisation.
58 * Revision 1.11 1994/10/30 11:47:05 robertj
59 * Changed mechanism for doing notification callback functions.
61 * Revision 1.10 1994/08/23 11:32:52 robertj
64 * Revision 1.9 1994/08/22 00:46:48 robertj
65 * Added pragma fro GNU C++ compiler.
67 * Revision 1.8 1994/06/25 11:55:15 robertj
68 * Unix version synchronisation.
70 * Revision 1.7 1994/03/07 07:38:19 robertj
71 * Major enhancementsacross the board.
73 * Revision 1.6 1994/01/15 02:50:29 robertj
74 * Moved control contructors to common and added a platform dependent Construct() function.
76 * Revision 1.5 1994/01/03 04:42:23 robertj
77 * Mass changes to common container classes and interactors etc etc etc.
79 * Revision 1.4 1993/09/27 16:35:25 robertj
80 * Removed special constructor for dialog resource loading.
82 * Revision 1.3 1993/08/20 21:26:09 robertj
83 * Added control notification codes.
85 * Revision 1.2 1993/07/14 12:49:16 robertj
98 /**A scroll bar control for visually setting an integer value.
100 The exact appearance of a scroll bar is platform dependent. However certain
101 functionality exists for all platforms. These are that the scroll bar allows
102 values between a minimum and maximum to be set via small nudges (typically
103 a up or down arrow), large nudges (typically the page up or down area to
104 either side of the thumb) or by explicitly setting a value (typically by
107 This is an abstract class combining the common functionality of
108 \Ref{PHorizontalScrollBar} and \Ref{PVerticalScrollBar} controls.
110 class PScrollBar
: public PControl
112 PCLASSINFO(PScrollBar
, PControl
);
115 /**Create a new scroll bar control with the specified default parameters
116 for controlling the scroll bars operation.
119 PInteractor
* parent
, /// Interactor into which the control is placed.
120 PSCROLLBAR_VALUE max
, /// Maximum value for scroll bar.
121 PSCROLLBAR_VALUE min
, /// Minimum value for scroll bar.
122 PSCROLLBAR_VALUE val
, /// Initial value for scroll bar.
123 PSCROLLBAR_VALUE sml
, /// Amount to move with the nudge button.
124 PSCROLLBAR_VALUE lge
/// Amount to move with the paging area.
127 PInteractor
* parent
, /// Interactor into which the control is placed.
128 const PNotifier
& func
, /// Function to call when changes state.
129 PSCROLLBAR_VALUE max
, /// Maximum value for scroll bar.
130 PSCROLLBAR_VALUE min
, /// Minimum value for scroll bar.
131 PSCROLLBAR_VALUE val
, /// Initial value for scroll bar.
132 PSCROLLBAR_VALUE sml
, /// Amount to move with the nudge button.
133 PSCROLLBAR_VALUE lge
/// Amount to move with the paging area.
136 /** Create control from interactor layout with the specified control ID. */
138 PInteractorLayout
* parent
, /// Interactor into which the box is placed.
139 PRESOURCE_ID ctlID
, /// Identifier for the control in the layout.
140 const PNotifier
& notify
, /// Function to call when changes state.
141 PSCROLLBAR_VALUE
* valuePtr
/// Variable to change to the scrollbar value.
144 /** Destroy the scroll bar. */
145 virtual ~PScrollBar();
148 /**@name PNotifier codes */
149 /**Codes passed to the notification function on changes of state.
151 A change to a scroll bar may proceed for some time, for example if the
152 mouse button is pressed in the down arrow and held down. An auto-repeat
153 would occur to continually change the scroll bar value until it is
157 /** A scroll bar value change operation has been ended by the user. */
158 EndTrack
= NotifyChange
,
159 /** A scroll bar value change operation has been initiated by the user. */
161 /** A scroll bar value change operation is in progress by the user. */
166 /**@name Overrides from class PControl */
167 /**This function transfers the value of the control to or from the variable
168 pointed to by the value pointer member variable.
170 virtual void TransferValue(
172 /**Transfer value option. When this is -1 when the function transfers
173 the value from the value pointer into the control. This is called in
174 \Ref{PDialog::OnInit()} function. When option is zero then the
175 function transfers the value from the control to the value pointer
176 variable. This is called just before the callback function every time
177 the scroll bar value changes.
182 /**@name New functions for class */
183 /**Set the current thumb position of the scroll bar. If the
184 #redraw# parameter is TRUE then this will be updated on the
185 screen immediately (within OS constraints).
188 PSCROLLBAR_VALUE val
, /// New value for scroll bar.
189 BOOL redraw
= TRUE
/// Whether to update the screen.
192 /**Get the current thumb position of the scroll bar.
195 current scroll bar value.
197 PSCROLLBAR_VALUE
GetValue() const;
199 /**Get the current value pointer associated with the control. The variable
200 pointed to by this is autamatically updated with the current value of
204 value pointer associated with the control.
206 PSCROLLBAR_VALUE
* GetValuePointer() const;
208 /**Set the current value pointer associated with the control. The variable
209 pointed to by this is autamatically updated with the current value of
212 void SetValuePointer(
213 PSCROLLBAR_VALUE
* ptr
//New value pointer to associate with the control.
217 /**Set the maximum thumb position of the scroll bar. If the
218 #redraw# parameter is TRUE then this will be updated on the
219 screen immediately (within OS constraints).
222 PSCROLLBAR_VALUE val
, /// New maximum value for the scroll bar.
223 BOOL redraw
= TRUE
/// Whether to update the screen.
226 /**Get the maximum thumb position of the scroll bar.
229 current scroll bar maximum.
231 PSCROLLBAR_VALUE
GetMaximum() const;
233 /**Set the minimum thumb position of the scroll bar. If the
234 #redraw# parameter is TRUE then this will be updated on the
235 screen immediately (within OS constraints).
238 PSCROLLBAR_VALUE val
, /// New minimum value for the scroll bar.
239 BOOL redraw
= TRUE
/// Whether to update the screen.
242 /**Get the minimum thumb position of the scroll bar.
245 current scroll bar minimum.
247 PSCROLLBAR_VALUE
GetMinimum() const;
249 /**Set the the amount by which the up and down arrows will move the thumb
250 each time the are clicked. The up and down arrow keys do the same thing
251 if the scroll bar has the focus.
254 PSCROLLBAR_VALUE val
/// New nudge value for small increments.
257 /**Get the the amount by with the up and down arrows will move the thumb.
262 PSCROLLBAR_VALUE
GetSmallNudge() const;
264 /**Set the the amount by which clicking above or below the thumb will move
265 it. The page up and page down keys do the same thing if the scroll bar
269 PSCROLLBAR_VALUE val
/// New nudge value for large increments.
272 /**Get the the amount by which clicking above or below the thumb will
278 PSCROLLBAR_VALUE
GetLargeNudge() const;
282 /**@name Member variables */
283 PSCROLLBAR_VALUE minimum
;
284 PSCROLLBAR_VALUE maximum
;
285 PSCROLLBAR_VALUE value
;
286 PSCROLLBAR_VALUE smallNudge
;
287 PSCROLLBAR_VALUE largeNudge
;
288 /* Small and large nudge amounts. */
292 // New functions for class
294 // Common constructor code
297 // Include platform dependent part of class
298 #include <pwlib/scrollb.h>
302 // End Of File ///////////////////////////////////////////////////////////////