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

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

#import "MiscFormFieldCell.h"
#import "MiscFormField.h"

#define FORM_FIELD_CELL_CURRENT_VERSION 1


@implementation MiscFormFieldCell
+ initialize
{	if(self == [MiscFormFieldCell class])
	{	[self setVersion:FORM_FIELD_CELL_CURRENT_VERSION];
	
	}

	return self;
}

- initFormCell:(const char*) text andMask:(const char*) mask
						 andControlString:(const char*) theControlString
						   andValidString:(const char*) theValidString
								 andBlank:(char)bc
{	if (!(self=[super initTextCell:text])) return self;
	strcpy(template=malloc(strlen(mask)+1),mask);
	strcpy(controlString=malloc(strlen(theControlString)+1),theControlString);
	strcpy(validString=malloc(strlen(theValidString)+1),theValidString);
	
	[[self setBezeled:YES] setBlank:bc];
	return self;
}
- setMask:(const char *) mask
{	strcpy(template=realloc(template,strlen(mask)+1),mask);
	[[self controlView] setMask:template];
	return self;
}
- setValidString:(const char *) str
{	strcpy(validString=realloc(validString,strlen(str)+1), str);
	[[self controlView] setValidString:validString];
	return self;
}
- setModifyString:(const char *) theControlString
{	strcpy(controlString=realloc(controlString,
								 strlen(theControlString)+1),
								 theControlString);
	[[self controlView] setModifyString:controlString];
	return self;
}
- setBlank:(char) bc
{	blankchar=bc;
	[[self controlView] setBlankchar:blankchar];
	return self;
}

- drawInside:(const NXRect *)cellFrame inView:controlView
{	NXRect	lr=*cellFrame;
	[super drawInside:cellFrame inView:controlView];
	[controlView getBounds:&lr];
	[controlView displayInRect:&lr];
	return self;
}

- setGrid:(BOOL)flag
{	fFlags.drawGrid=flag;
	return self;
}
- setOverwrite:(BOOL)flag
{	fFlags.overwrite=flag;
	return self;
}
-(BOOL)grid
{	return fFlags.drawGrid;
}
-(BOOL)overwrite
{	return fFlags.overwrite;
}
- (BOOL)beepWhenRight
{	return fFlags.beepWhenRight;
}
- setBeepWhenRight:(BOOL)aBeepWhenRight
{	fFlags.beepWhenRight=aBeepWhenRight;
	return self;
}

- (BOOL)escClearLine
{	return fFlags.escClearLine;
}
- setEscClearLine:(BOOL)aEscClearLine
{	fFlags.escClearLine=aEscClearLine;
	return self;
}
-(BOOL) specialKeybindings
{	return fFlags.specialKeybindings;
}
- setSpecialKeybindings:(BOOL)flag
{	fFlags.specialKeybindings=flag;
	return self;
}
-(BOOL) isEnabled
{	return !fFlags.disabled;
}
- setEnabled:(BOOL)flag
{	fFlags.disabled=!flag;
	return self;
}

-(unsigned int) flags;
{	return *(unsigned int*)&fFlags;
}
-free
{	free(template),free(controlString);
	[super free];
	return nil;
}

-(const char *) mask
{	return template;
}
-(const char *) modifyString
{	return controlString;
}
-(const char *) validString
{	return validString;
}
-(char) blank
{	return blankchar;
}
- setBackgroundGray:(float)value
{	[super setBackgroundGray:value];
	[[self controlView] setBackgroundGray:value];
	return self;
}
- setTextGray:(float)value
{	[super setTextGray:value];
	[[self controlView] setTextGray:value];
	return self;
}

- setStringValue:(const char*) theVal
{	[super setStringValue:theVal];
	[[self controlView] setValue:theVal];
	return self;
}

#if 0
- endEditing:textObject
{
	if([textObject class] == [Text class])
		return [super endEditing:textObject];
	else
	{	[textObject setDelegate:nil];
		return self;
	}
}
#endif

- read: (NXTypedStream*)stream
{	[super read:stream];
	switch(NXTypedStreamClassVersion(stream, "MiscFormFieldCell"))
	{	case FORM_FIELD_CELL_CURRENT_VERSION:
			NXReadTypes(stream,"***ic",&template,&controlString,&validString,
									   (unsigned int*)&fFlags,&blankchar);
		break;
	}
	return self;
}
- write: (NXTypedStream*)stream
{	[super write:stream];
	NXWriteTypes(stream,"***ic",&template,&controlString,&validString,
								(unsigned int*)&fFlags,&blankchar);
	return self;
}


@end

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