ftp.nice.ch/pub/next/developer/objc/fromnext/MiniExamples.91.9.s.tar.gz#/MiniExamples/CellScrollView/FooCell.m

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

/*
 * You may freely copy, distribute, and reuse the code in this example.
 * NeXT disclaims any warranty of any kind, expressed or  implied, as to its
 * fitness for any particular use.
 */


#import "FooCell.h"
#import "FooObject.h"
#import <appkit/Text.h>
#import <dpsclient/psops.h>
#import <objc/hashtable.h>
#import <stdlib.h>
#import <stdio.h>

#define FIELD1_LMARGIN 4.0
#define FIELD2_LMARGIN 54.0

@implementation FooCell

- init
{
  [super init];
  [self setType:NX_TEXTCELL];
  return self;
}

- fooObject
{
  return fooObject;
}

- setFooObject:anObject
{
  fooObject = anObject;
  return self;
}

- setFont:fontObj
{
  [super setFont:fontObj];
  /*
   * save this info so we don't have to look it up every time we draw
   * Note:  support for a TextCell is a font object
   */
  NXTextFontInfo(support, &ascender, &descender, &lineHeight);
  return self;
}    

- drawInside:(const NXRect *)cellFrame inView:controlView
{
  char		buf[100];
  NXCoord	baseX, baseY;

  baseX = NX_X(cellFrame);
  baseY = NX_Y(cellFrame) + lineHeight - descender;
     
  /* erase the cell */
  PSsetgray((cFlags1.state || cFlags1.highlighted) ? NX_WHITE : NX_LTGRAY);
  NXRectFill(cellFrame);

  PSsetgray(NX_BLACK);
  /* draw the start, duration, and mark name in black */
  PSmoveto(baseX + FIELD1_LMARGIN, baseY);
  sprintf(buf,"%d",[fooObject intValue]);
  PSshow(buf);
  PSmoveto(baseX + FIELD2_LMARGIN, baseY);
  PSshow("xyzzy");

  return self;
}

@end

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