DIRECTORY GraphicsBasic USING [Color, white], Rope USING [ROPE], ViewerClasses USING [Viewer, ViewerRec], ViewerOps USING [DestroyViewer]; Sliders: CEDAR DEFINITIONS IMPORTS ViewerOps = BEGIN OPEN ViewerClasses; Slider: TYPE = Viewer; -- A slider is a viewer SliderOrientation: TYPE = {horizontal, vertical}; Reason: TYPE = {move, set, abort}; NormalizedSliderValue: TYPE = REAL; -- in range [0.0, 1.0] SliderProc: TYPE = PROCEDURE [slider: Slider, reason: Reason, value: NormalizedSliderValue, clientData: REF ANY _ NIL]; FilterProc: TYPE = PROCEDURE [value: NormalizedSliderValue, clientData: REF ANY] RETURNS [filteredValue: NormalizedSliderValue]; sliderGray: GraphicsBasic.Color = [r: 100, g: 100, b: 100]; Create: PUBLIC PROCEDURE [info: ViewerClasses.ViewerRec _ [], sliderProc: SliderProc _ NIL, filterProc: FilterProc _ NIL, orientation: SliderOrientation _ vertical, foreground: GraphicsBasic.Color _ sliderGray, background: GraphicsBasic.Color _ GraphicsBasic.white, value: NormalizedSliderValue _ 0.0, clientData: REF ANY _ NIL, paint: BOOL _ TRUE] RETURNS [slider: Slider]; GetContents: PUBLIC PROCEDURE [slider: Slider] RETURNS [contents: NormalizedSliderValue]; SetContents: PUBLIC PROCEDURE [slider: Slider, contents: NormalizedSliderValue]; Destroy: PUBLIC PROCEDURE [slider: Slider] = INLINE {ViewerOps.DestroyViewer[slider]}; END. °Sliders.mesa Written by Darlene Plebon on June 22, 1983 11:45 am Last Edited by: Beach, June 22, 1983 6:15 pm Last Edited by: Wyatt, December 1, 1983 11:26 am SliderProc is the type of the client supplied procedure which is called when the slider's value is changed by mouse input. This routine is called on red down, then periodically while the red mouse button is held down provided the mouse coordinates have changed, and upon release of the button. The client procedure is also called on an abort, which occurs when the red button is released while the cursor is outside the slider (off a side of the slider not off one of its ends), or when the yellow or blue mouse button is pressed while red is still down. Driving the cursor off either end of the slider does not cause an abort, but rather sets the slider to its maximum or minimum value as appropriate. "slider" is the slider viewer being updated. "reason" is the reason the client procedure is being called. $Move - new slider value while red down. $Set - red up, new slider value. $Abort - an abort has just occurred causing the slider value to be reset to the value it had prior to red down. "value" is the (new) slider value in the range [0.0, 1.0]. "clientData" is optional information for use by the client. FilterProc is the type of an optional client supplied procedure which is called whenever the slider value is changed by mouse input. This procedure is used to filter the slider value before feedback is provided on the slider. It can be used to make the slider move in discrete jumps, for example. Create creates a slider viewer. "sliderProc" is a client procedure which is called when the slider's value is changed by mouse input. "filterProc" is a client procedure which is called to filter slider value updates. "orientation" is the orientation of the slider. vertical - slide up to increase the value, down to decrease it. horizontal - slide right to increase the value, left to decrease it. "foreground" is the color of the foreground of the slider. "background" is the color of the background of the slider. "value" is the initial value of the slider. Slider values are in the range [0.0, 1.0]. "clientData" is optional information for use by the client. Returned when the client proc is called. GetContents returns the current value of the slider (in the range [0.0, 1.0]). SetContents sets the value of the slider (in the range [0.0, 1.0]). Destroy destroys the specified slider viewer. Κ – "Mesa" style˜Jšœ ™ Jšœ3™3J™,J™0J˜šΟk ˜ Jšœœ˜#Jšœœœ˜Jšœœ˜(Jšœ œ˜ J˜—šœ œ˜Jšœ ˜—J˜Jšœœ˜J˜Jšœœ Οc˜/J˜Jšœœ˜1J˜Jšœœ˜"J˜Jšœœœž˜;J˜š Οn œœ œLœœœ˜wJ˜J™ΐJ™,™