#import <dpsclient/psops.h>
#import <appkit/graphics.h>
#import <appkit/Font.h>
#import <appkit/Text.h>
#import <objc/hashtable.h>
#import <objc/List.h>
#import <string.h>

#import "ListCell.h"

extern free();

@implementation ListCell
- init
{
  [super init];
  controlDragEnabled=NO;
  return self;
}

- setFont:fontObj
{
    [super setFont:fontObj];
    NXTextFontInfo(support, &ascender, &descender, &lineHeight);
    return self;
}    

- drawInside:(const NXRect *)cellFrame inView:controlView
{
  NXRect	rectArray[2];
    
  /* draw the two dark gray lines above and below the cell */
    if (cFlags1.state || cFlags1.highlighted) {

	NXSetRect(&(rectArray[0]), NX_X(cellFrame), NX_Y(cellFrame),
		NX_WIDTH(cellFrame), 1.0);
	NXSetRect(&(rectArray[1]), NX_X(cellFrame), NX_MAXY(cellFrame) - 1.0,
		NX_WIDTH(cellFrame), 1.0);

      /* using NXRectFillList is faster than separate calls to NXRectFill */
	NXRectFillList(rectArray, 2);
    }

    return self;
}

- setControlDragEnabled:(BOOL) aBool
{ controlDragEnabled=aBool; return self; }
  
- (BOOL)controlDragEnabled { return controlDragEnabled; }
@end
