ftp.nice.ch/peanuts/GeneralData/Documents/openstep/OpenStepSpec_rtf.tar.gz#/OpenStepSpec_rtf/ApplicationKit/Classes/NSScroller.rtf

This is NSScroller.rtf in view mode; [Download] [Up]

paperh18648 margl-907 margr0 margt0 margb0 fi0 ri0 ql sb0 f1 fs24 Copyright f3 'e3f1 1994 by NeXT Computer, Inc.  All Rights Reserved.

s4 li100 fi0 ri1007 ql f0 b fs36 fs100 
fs36 NSScroller 
pard s11 li2872 fi-2771 ri1007 ql tx2872 f1 b0 fs28 fs48 
fs28 f0 b fs24 Inherits From:tab b0 fs28 f1 NSControl : NSView : NSResponder : NSObject
fs20 
fs28 s6 f0 b fs24 Conforms To:tab b0 fs28 f1 NSCoding (NSResponder)
fi0 NSObject (NSObject)
fs20 
fs28 s7 fi-2771 f0 b fs24 Declared In:tab b0 fs28 f1 AppKit/NSScroller.h 
fs20 
fs28 pard s16 li100 fi0 ri1007 ql f0 b fs28 fs20 
fs28 Class Description
fs14 
fs28 pard s1 li477 fi0 ri1007 ql tx2494 tx2872 tx3250 f1 b0 fs2 
fs28 The NSScroller class defines a control that'27s used by an NSScrollView object to position a document that'27s too large to be displayed in its entirety within an NSView. An NSScroller is typically represented on the screen by a bar, a knob, and two scroll buttons, although it may contain only some of these. The knob indicates both the position within the document and the amount displayed relative to the size of the document. The bar is the rectangular region that the knob slides within. The scroll buttons allow the user to scroll in small increments by clicking, or in large increments by Alternate-clicking. In discussions of the NSScroller class, a small increment is referred to as a 'aaline increment'ba (even if the NSScroller is oriented horizontally), and a large increment is referred to as a 'aapage increment,'ba although a page increment actually advances the document by one windowful. When you create an NSScroller, you can specify either a vertical or a horizontal orientation.
fs16 
fs28 As an NSControl, an NSScroller handles mouse events and sends action messages to its target (usually its parent NSScrollView) to implement user-controlled scrolling. The NSScroller must also respond to messages from an NSScrollView to represent changes in document positioning.
fs16 
fs28 NSScroller is a public class primarily for programmers who decide not to use an NSScrollView but want to present a consistent user interface. Its use is not encouraged except in cases where the porting of an existing application is made more straightforward. In these situations, you initialize a newly created NSScroller by calling b initWithFrame:b0 . Then, you use b setTarget:b0  (NSControl) to set the object that will receive messages from the NSScroller, and you use b setAction:b0  (NSControl) to specify the message that will be sent to the target by the NSScroller. When your target receives a message from the NSScroller, it will probably need to query the NSScroller using the b hitPartb0  and b floatValueb0  (NSControl) methods to determine what action to take.
fs16 
fs28 The NSScroller class has several constants referring to the parts of an NSScroller. A scroll button with an up arrow (or left arrow, if the NSScroller is oriented horizontally) is known as a 'aadecrement line'ba button if it receives a normal click, and as a 'aadecrement page'ba button if it receives an Alternate-click. Similarly, a scroll button with a down or right arrow functions as both an 'aaincrement line'ba button and an 'aaincrement page'ba button. The constants defining the parts of an NSScroller are as follows:
fs16 
fs28 pard s19 li854 fi0 ri1007 ql tx4509 tx10180 f0 b fs24 Constanttab Refers To
fs6 
fs24 s17 f1 b0 fs28 NSScrollerNoParttab No part of the NSScroller
fi0 NSScrollerKnobtab The knob
fi0 NSScrollerDecrementPagetab The button that decrements a windowful (up or left arrow)
fi0 NSScrollerIncrementPagetab The button that increments a windowful (down or right arrow)
fi0 NSScrollerDecrementLinetab The button that decrements a windowful (up or left arrow)
fi0 NSScrollerIncrementLinetab The button that increments a windowful (down or right arrow)
fi0 NSScrollerKnobSlot tab The bar
fs6 
fs28 pard s1 li477 fi0 ri1007 ql tx2494 tx2872 tx3250 fs10 
fs28 The following constants are used in the b setArrowsPosition:b0  method to set the position of the scroll buttons within the scroller:
fs16 
fs28 pard s19 li854 fi0 ri1007 ql tx4509 tx10180 f0 b fs24 Constanttab Meaning
fs6 
fs24 s17 f1 b0 fs28 NSScrollerArrowsMaxEndtab Scroll buttons are placed at the bottom or right end of the scroller.
fi0 NSScrollerArrowsMinEndtab Scroll buttons are placed at the top or left part of the scroller.
fi0 NSScrollerArrowsNonetab The scroller doesn'27t have scroll buttons.
fs6 
fs28 pard s1 li477 fi0 ri1007 ql tx2494 tx2872 tx3250 fs10 
fs28 An NSScroller can be made too small for all its parts to be displayed. Theb  usablePartsb0  method returns one of the following constants to indicate whether such a condition is present:
fs16 
fs28 pard s19 li854 fi0 ri1007 ql tx4509 tx10180 f0 b fs24 Constanttab Meaning
fs6 
fs24 s17 f1 b0 fs28 NSNoScrollerPartstab Scroller has no usable parts, only the bar.
fi0 NSOnlyScrollerArrowstab Scroller has only scroll buttons.
fi0 NSAllScrollerPartstab Scroller has all parts.
fs6 
fs28 pard s1 li477 fi0 ri1007 ql tx2494 tx2872 tx3250 fs10 
fs28 The following constants are used as values for the first argument of the b drawArrow:highlight:b0  method, to indicate which scroll button is to be drawn:
fs16 
fs28 pard s19 li854 fi0 ri1007 ql tx4509 tx10180 f0 b fs24 Constanttab Meaning
fs6 
fs24 s17 f1 b0 fs28 NSScrollerIncrementArrowtab The scroll button that scrolls forward.
fi0 NSScrollerDecrementArrowtab The scroll button that scrolls backward.
fs6 
fs28 fi0 
fs6 
fs28 pard s16 li100 fi0 ri1007 ql f0 b fs36 
fs28 Laying out the NSScroller 
fs14 
fs28 pard s8 li7029 fi-6552 ri1007 ql tx6652 tx7030 f1 b0 fs2 
fs28 fi-6552 + (float)b scrollerWidthtab b0 Returns the width of the scoller, a constant value.
fi-6552 fs16 
fs28 fi-6552 {f3 -} (NSScrollArrowPosition)b arrowsPositiontab b0 Returns the position of scroll arrows in the NSScroller.
fi-6552 fs16 
fs28 fi-6552 {f3 -} (void)b checkSpaceForPartsb0 tab Checks for room for knob and scroll buttons.
fi-6552 fs16 
fs28 fi-6552 {f3 -} (NSRect)b rectForPart:b0 (NSScrollerPart)i partCodei0 tab Gets the rectangle that encloses i partCodei0 .
fi-6552 fs16 
fs28 fi-6552 {f3 -} (void)b setArrowsPosition:b0 (NSScrollArrowPosition)i where
s9 li7030 fi-6553 fi-5796 i0 tab Sets position of scroll arrows in the NSScroller.
s8 li7029 fi-5794 fi-6552 fs16 
fs28 fi-6552 {f3 -} (NSUsableScrollerParts)b usablePartstab b0 Indicates which parts of the scroller can be displayed, given the NSScroller'27s current size.
pard s16 li100 fi0 ri1007 ql f0 b fs48 
fs28 Setting the NSScroller'27s Values
fs14 
fs28 pard s8 li7029 fi-6552 ri1007 ql tx6652 tx7030 f1 b0 fs2 
fs28 fi-6552 {f3 -} (float)b knobProportiontab b0 Returns the ratio of the knob'27s length to the NSScroller'27s length.tab  
fi-6552 fs16 
fs28 fi-6552 {f3 -} (void)b setFloatValue:b0 (float)i aFloati0 tab  Sets the NSScroller'27s value, repositioning the 
s9 li7030 fi-6553 fi-5796 b knobProportion:b0 (float)i ratioi0  tab tab  knob according to i aFloati0  and resizing it according to i ratioi0 . Both argumentsi  i0 are clipped to the range from 0.0 to 1.0, inclusive.
pard s16 li100 fi0 ri1007 ql f0 b fs48 
fs28 Displaying 
fs14 
fs28 pard s8 li7029 fi-6552 ri1007 ql tx6652 tx7030 f1 b0 fs2 
fs28 fi-6552 {f3 -} (void)b drawArrow:b0 (NSScrollerArrow)i whichButtoni0 tab  
s9 li7030 fi-6553 fi-5796 b highlight:b0 (BOOL)i flagi0 tab Draws highlighted and unhighlighted arrows.
s8 li7029 fi-5794 fi-6552 fs16 
fs28 fi-6552 {f3 -} (void)b drawKnobb0 tab Draws the knob.
fi-6552 fs16 
fs28 fi-6552 {f3 -} (void)b drawPartsb0 tab Caches bitmaps for knob and scroll arrows.
fi-6552 fs16 
fs28 fi-6552 {f3 -} (void)b highlight:b0 (BOOL)i flagi0 tab Highlights scroll button that'27s under mouse.
pard s16 li100 fi0 ri1007 ql f0 b fs48 
fs28 Handling Events 
fs14 
fs28 pard s8 li7029 fi-6552 ri1007 ql tx6652 tx7030 f1 b0 fs2 
fs28 fi-6552 {f3 -} (NSScrollerPart)b hitPartb0 tab Returns the part of the NSScroller object that received mouse-down.
fi-6552 fs16 
fs28 fi-6552 {f3 -} (NSScrollerPart)b testPart:b0 (NSPoint)i thePointi0 tab Returns the part of the NSScroller that'27s under i thePointi0 . 
fi-6552 fs16 
fs28 fi-6552 {f3 -} (void)b trackKnob:b0 (NSEvent *)i theEventi0 tab Invoked in response to mouse-down events on the knob.
fi-6552 fs16 
fs28 fi-6552 {f3 -} (void)b trackScrollButtons:b0 (NSEvent *)i theEventi0 tab Invoked in response to mouse-down events on buttons.
fi-6552 fs16 
fs28 fi-6552 
}

These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.