This is ActionLine.h in view mode; [Download] [Up]
/*---------------------------------------------------------------------------------
An abstract class for lines.
This holds the basic ivars, which subclasses use to draw; eg, the existence
of line ending arrows, the width of the line, etc.
This could be drawn at any angle without a whole lot of trouble, but right
now there are four subclasses for horizontal, vertical,uphill, and downhill
lines.
This is a subclass of Button, so we can leverage off button's ability to do
things when clicked upon. This makes the class useful for things like
UI, particularly state diagrams that you move within by clicking on arrows.
This looks a lot better if you have your Edit width set to 120 or so and
have tab stops every 2 chars.
HISTORY
9Mar93 DM New
22Mar93 DM Works with color instead of just greyscale; additional subclasses
---------------------------------------------------------------------------------*/
#define HIT_TOLERANCE 2.0 // How close a mouseclick has to be
#import <appkit/Control.h>
#import <appkit/Button.h>
#import <appkit/NXColorWell.h>
@interface ActionLine:Button
{
float lineWidth; // how wide theline is
NXColor enabledColor; // What color it is when enabled
NXColor disabledColor; // what color it is when disabled
BOOL endArrow; // YES=> draw an arrow at end of the line
BOOL startArrow; // YES=> draw an arrow at start of the line
}
+ initialize;
-initFrame:(NXRect*)theFrame // Designated initializer for buttons
title:(const char *)aString
tag:(int)anInt
target:anObject
action:(SEL)aSelector
key:(unsigned short)charCode
enabled:(BOOL)flag;
- (const char *)inspectorName; // RETURN: our inspector's class name
- setLineWidth:(float)pLineWidth; // INPUT: the desired line width
- setEnabledColor:(NXColor)pLineColor; // INPUT: the desired color for the enabled state
- setDisabledColor:(NXColor)pLineColor; // INPUT: the desired color for the disabled state
- setEndArrow:(BOOL)pOn; // INPUT: end arrow YES=>draw one NO=>dont
- setStartArrow:(BOOL)pOn; // INPUT: start arrow YES=>draw one NO=>don't
- (float)lineWidth; // RETURN: the line width
- (NXColor)enabledColor; // RETURN: the line color when enabled
- (NXColor)disabledColor; // RETURN: the line color when disabled
- (BOOL)endArrow; // RETURN: arrow drawn YES=> it is
- (BOOL)startArrow; // RETURN: arrow drawn YES=> it is
- passOnEvent:(NXEvent*)theEvent; // Pass on the event if the mouseDown missed the line
- read:(NXTypedStream*)stream; // Archiving (needed to get things dragged
- write:(NXTypedStream*)stream; // correctly from IB.)
@end
These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.