ftp.nice.ch/pub/next/developer/objc/appkit/NMK.s.tar.gz#/NMK/Recorders/MenuCellCover.m

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

/***** MenuCellCover.m -- MenuCellCover object implementation
	NeXTstep Measurement Kit
	by Alex Meyer <ameyer@phoenix.Princeton.EDU>
	for computer science senior thesis
	24 April 1992 -- created from ButtonCellCover.m
*****/

#import <sys/time.h>
#import <appkit/Application.h>
#import "RMenuVars.h"
#import "MenuCellCover.h"

#define VARSNAME ("MenuVars")

#define MICRO (1000000.0)
#define DOUBLETIME(stv) ((double) (((unsigned long) (stv).tv_sec) \
	+ (((unsigned long) (stv).tv_usec) / MICRO)))

@implementation MenuCellCover

- makeVarsRect:(const NXRect *)rect
{
	id vars;

	vars = [RMenuVars alloc];
	[vars initString:contents
		tag:tag
		rect:rect];
	NXNameObject(VARSNAME,vars,self);
	return (vars);
}



- (BOOL)trackMouse:(NXEvent *)theEvent
	inRect:(const NXRect *)cellFrame
	ofView:controlView
{
	id vars;
	BOOL res;
	double time0,time1;
	struct timeval start,finish;
	struct timezone zone;

	gettimeofday(&start,&zone);
	res = [super trackMouse:theEvent
		inRect:cellFrame
		ofView:controlView];
	gettimeofday(&finish,&zone);
	time0 = DOUBLETIME(start);
	time1 = DOUBLETIME(finish);
	vars = NXGetNamedObject(VARSNAME,self);
	if (!(vars))
		vars = [self makeVarsRect:cellFrame];
	[vars incHits];
	if (!(res))
		[vars incCancel];
	[vars timeFrom:time0
		to:time1];
	return (res);
}

@end

#undef DOUBLETIME
#undef MICRO
#undef VARSNAME

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