ftp.nice.ch/pub/next/developer/resources/classes/Rubberview.s.tar.gz#/Rubberview/Rubberband.rtf

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

Release 1.0, Mouthing Flowers, No Rights Reserved.










Rubberband

INHERITS FROM	Object

DECLARED IN	Rubberband.h



CLASS DESCRIPTION

Rubberband implements an interactive "rubberband rectangle" graphical selection tool.  It uses the postscript functions in /usr/lib/NextStep/windowPackage.ps to achieve the same effect as the window manager does when resizing standard windows.

Possible bugs:  Untested with non-default View and Window coordinate transformations.



INSTANCE VARIABLES

Inherited from Object	Class	isa;


Declared in Rubberband	NXRect 	currentRect;
	NXRect	 boundsRect; 
	id 	myView;
	struct {
unsigned char  	pivot:1 ;
unsigned char  	inclusive:1 ;
unsigned char  	useBounds:1 ;
	}	flags; 	

currentRect	The rubberband's rectangle, in window coordinatess

boundsRect	The bounds constraining the rubberband rectangle, in window coordinates

myView	View within which rubberband is drawn

flags.pivot	Indicates stretch type.

flags.inclusive	Indicates whether rectangle includes pixels under its sides.

flags.useBounds	Indicates whether to use boundsRect.



METHOD TYPES

Initializing a new Rubberband	- init	
	- initWithView :
	
Assigning a view	- setView :				
Stretching the Rubberband	- doStretch :

Setting the parameters	- setBounds :
	- setCurrentRectToBounds
	- setPivot :
	- setInclusive:	
	
Getting the parameters	- currentRect :
	- bounds :
	
Archiving	none implemented




INSTANCE METHODS


bounds :
	- bounds :(NXRect *)aRect 
	
Returns in aRect the rectangle constraining the movement of the rubberband.   Value is returned in aView coordinates and reflects value set by setBounds:.  Returns self.

See also: - setBounds:

currentRect :
	-  currentRect :(NXRect *)aRect 
	
Returns in aRect the current boundaries of the rubberband rectangle.  Call this after calling doStretch to get the results of the user's action.  Value is returned in aView coordinates and reflects value set by setInclusive:.  Returns self.

See also: - setInclusive:

doStretch:
	- doStretch :(NXEvent *)event

This is where the action is.  While mouse is held down the rubberband will stretch.  Call this when receiving the initial mouseDown: message, passing along event as the event of the initial mousedown.  Returns self.

init:
- init:

Initializes the rubberband, but you must call setView: to complete the initialization.  Returns self.

See also:  - initWithView:, -setView:


initWithView:
- initWithView:aView

Preferred initialization method.  Calls setView:.  The rubberband's bounds is set to the bounds of aView.  Returns self.

See also:  - init:

setBounds :
	- setBounds :(const NXRect *)aRect
	
Sets the rectangle within which movement of the rectangle is constrained.  Turns on flags.useBounds.  aRect should be given in myView coordinates.  If aRect is NULL, turns off flags.useBounds.  Returns self.

setCurrentRectToBounds
	- setCurrentRectToBounds 
	
Sets the boundsRect equal to currentRect.  Turns on flags.useBounds.  Returns self.

setPivot :
	- (int) setPivot :(int)pivot 
	
Sets the way in which the rubberband stretches as the mouse is moved.  Can be either:

RB_CORNER	:  point of initial mouse click defines one corner of rubberband.
RB_CENTER	:  point of initial mouse click defines center of rubberband.

Returns previous pivot.

setInclusive :
	- (BOOL) setInclusive :(BOOL)onoff 
	
Set whether rectangle returned by currentRect: includes pixels under the rubberband sides.  Returns previous value.

See also: - currentRect:

setView:
- setView: aView

Makes aView the view into which the rubberband will be drawn.  The rubberband's bounds is set to the bounds aView.  Returns previous view.

See also:  - init:


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