home *** CD-ROM | disk | FTP | other *** search
-
- #import "ConnectBrowserCell.h"
-
- @implementation ConnectBrowserCell
-
- - initTextCell:(const char *)aString
- {
- if ([super initTextCell:aString] == nil)
- return nil;
- branchImage = nil;
- branchImageH = nil;
- return self;
- }
-
- - setBranchImage:image
- {
- branchImage = image;
- return self;
- }
-
- - setBranchImageH:image
- {
- branchImageH = image;
- return self;
- }
-
- - branchImage
- {
- return branchImage;
- }
-
- - branchImageH
- {
- return branchImageH;
- }
-
- - drawInside:(const NXRect *)cellFrame inView:aView
- {
- [super drawInside:cellFrame inView:aView];
- [self drawImage:cellFrame inView:aView usingImage:
- (branchImageH!=nil && [self state]) ? branchImageH:branchImage];
-
- return self;
- }
-
- - drawSelf:(const NXRect *)cellFrame inView:aView
- {
- [self drawInside:cellFrame inView:aView];
- return self;
- }
-
- - highlight:(const NXRect *)cellFrame inView:aView lit:(BOOL)lit
- {
- [super highlight:cellFrame inView:aView lit:lit];
- if (lit)
- [self drawImage:cellFrame inView:aView usingImage:
- (branchImageH==nil)?branchImage:branchImageH];
-
- return self;
- }
-
- - drawImage:(const NXRect *)cellFrame inView:aView usingImage:image
- {
- NXRect bounds;
- NXPoint point;
-
- if (image != nil)
- {
- point.x = point.y = 0;
- [image getSize:&bounds.size];
- if (bounds.size.height > cellFrame->size.height)
- bounds.size.height = cellFrame->size.height;
- point.y = cellFrame->origin.y + cellFrame->size.height -
- (cellFrame->size.height-bounds.size.height)/2;
- if (bounds.size.width > cellFrame->size.width)
- {
- bounds.size.width = cellFrame->size.width;
- point.x = 0;
- }
- else
- {
- point.x = cellFrame->size.width-bounds.size.width;
- if (bounds.size.width < 20)
- point.x -= (20-bounds.size.width)/2;
- }
- // [image composite:NX_COPY fromRect:&bounds toPoint:&point];
- [image composite:NX_COPY toPoint:&point];
- }
-
- return self;
- }
-
- @end
-