ftp.nice.ch/pub/next/tools/dock/Locus.1.0.NI.bs.tar.gz#/Locus/Source/ActivatorBarView.m

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

/*
	Copyright 1993  Jeremy Slade.

	You are free to use all or any parts of the Locus project
	however you wish, just give credit where credit is due.
	The author (Jeremy Slade) shall not be held responsible
	for any damages that result out of use or misuse of any
	part of this project.

*/

/*
	Project: Locus

	File: ActivatorBarView.m

	Description: See ActivatorBarView.h

	Original Author: Jeremy Slade

	Revision History:
		Created
			V.101	JGS Tue Feb  2 18:47:52 GMT-0700 1993

*/


#import "ActivatorBarView.h"

#import "ActivatorBar.h"
#import "Globals.h"
#import "PSWraps.h"

#import <dpsclient/psops.h>


@implementation ActivatorBarView


+ initialize
{
	[self setVersion:ActivatorBarView_VERSION];
	return ( self );
}



- initFrame:(const NXRect *)rect
{
	[super initFrame:rect];
	
	// Set the default fill and border colors:
	fillColor = NX_COLORWHITE;
	borderColor = NX_COLORBLACK;
	
	return ( self );
}



- setColor:(NXColor)color
/*
	Set the view's fill color -- the color used to fill the interior
*/
{
	fillColor = color;
	if ( vFlags.disableAutodisplay ) [self setNeedsDisplay:YES];
		else [self display];
	return ( self );
}



- setBorderColor:(NXColor)color
/*
	Set the view's border color -- the color used to draw the border
*/
{
	borderColor = color;
	if ( vFlags.disableAutodisplay ) [self setNeedsDisplay:YES];
		else [self display];
	return ( self );
}



- drawSelf:(const NXRect *)rects :(int)rectCount
/*
	Draw the view -- fills the entire view with the border color, then draws a rectangle inside using the fill color that is 1 pixel shorter on each side.
*/
{
	NXRect rect = bounds;
		
	// Draw border using borderColor
	NXSetColor ( borderColor );
	NXRectFill ( &rect );
	
	// Fill interior with fillColor;
	rect.origin.x += 1;
	rect.origin.y += 1;
	rect.size.width -= 2;
	rect.size.height -= 2;
	NXSetColor ( fillColor );
	NXRectFill ( &rect );
	
	return ( self );
}



- mouseDown:(NXEvent *)event
/*
	Trap mouseDown: events (if it is a single-click) and tell our window (an ActivatorBar) that we were hit.
*/
{
	// Only send barHit: on single mouse-click
	if ( event->data.mouse.click == 1 )
		[window tryToPerform:@selector(barHit:) with:self];
	return ( self );
}



@end

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