ftp.nice.ch/pub/next/developer/resources/classes/misckit/MiscKit.1.10.0.s.gnutar.gz#/MiscKit/Palettes/MiscArrowButtonPalette/MiscArrowButton.subproj/MiscArrowButton.m

This is MiscArrowButton.m in view mode; [Download] [Up]

// Copyright (C) 1995 Robert Todd Thomas
// Use is governed by the MiscKit license

/******************************************************************
 * CLASS:		MiscArrowButton
 *
 *	See the header for more information on this class.
 *
 * This object is included in the MiscKit by permission from the author
 * and its use is governed by the MiscKit license, found in the file
 * "LICENSE.rtf" in the MiscKit distribution.  Please refer to that file
 * for a list of all applicable permissions and restrictions.
 *******************************************************************/

#import "MiscArrowButtonCell.h"
#import "MiscArrowButton.h"

static id  myStoredCellClass;

 
@implementation MiscArrowButton

+ initialize
{
	myStoredCellClass = [MiscArrowButtonCell class];
	return self;
}



+ setCellClass: classId
{
	myStoredCellClass = classId;
	return self;
}



- init
{
  NXRect frameRect;

	// create some frame since none was specified
	  
  	NXSetRect (&frameRect, 10.0, 10.0, 125.0, 25.0);
	
	return [self initFrame: (const NXRect *)&frameRect title: "Left" 
			altTitle: "Right" tag: 0 target: nil action: NULL key: 0 
			enabled: YES];
}



- initFrame: (const NXRect *)frameRect
{
	return [self initFrame: frameRect title: "Left" altTitle: "Right"
			tag: 0 target: nil action: NULL key: 0 enabled: YES];
}



// The button class's designated initializer for text buttons, which
// now should just call mine (see next method).
 
- initFrame:(const NXRect *)frameRect title:(const char *)aString
		tag:(int)anInt target:anObject action:(SEL)aSelector
		key:(unsigned short)charCode enabled:(BOOL)flag
{
	return [self initFrame: frameRect title: aString altTitle: "Right"
			tag: anInt target: anObject action: aSelector 
			key: charCode enabled: flag];
}



// The designated initializer that merely adds the capability to set
// the altTitle (text on the right side of the arrow) while initializing
// the button.

- initFrame:(const NXRect *)frameRect title:(const char *)aString
		altTitle: (const char *)altString tag:(int)anInt 
		target:anObject action:(SEL)aSelector
		key:(unsigned short)charCode enabled:(BOOL)flag
{
	[super initFrame: frameRect title: aString tag: anInt target: anObject
			action: aSelector key: charCode enabled: flag];

	[self setAltTitle: altString];
	[self setType: NX_TOGGLE];
    [ [self setCell: [ [myStoredCellClass alloc] init] ] free];
	
	return self;
}



// Used to set arrow alignment. (In previous versions, setAlignment was used
// but I realized that I also needed those methods). Sorry for any 
// inconvenience.

- setArrowAlignment: (int)alignment
{
	[ [self cell] setArrowAlignment: alignment];
	return self;
}



- (int)arrowAlignment
{
	return [ [self cell] arrowAlignment];
}

@end


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