Re: Cell Draw
Re: Cell Draw
- Subject: Re: Cell Draw
- From: malcom <email@hidden>
- Date: Wed, 26 Oct 2005 15:51:16 +0200
'doh!!!!
thanks a lot Hans :) It now works well!
2005/10/26, Hans Gidlof <email@hidden>:
> Hello
>
> - (void)drawWithFrame:(NSRect)cellFrame inView:(NSView
> *)controlView {
> // [controlView lockFocus];
>
>
>
>
>
> float xDelta = 10.0;
> // ICON DRAWING
> NSSize imageSize;
> NSRect imageFrame;
>
>
> imageSize = [image size];
> NSDivideRect(cellFrame, &imageFrame, &cellFrame, 3 + imageSize.width,
> NSMinXEdge);
> if ([self drawsBackground]) {
> [[self backgroundColor] set];
> NSRectFill(imageFrame);
> }
> imageFrame.origin.x += 3;
> imageFrame.size = imageSize;
>
>
> imageFrame.origin.y += (cellFrame.size.height - imageFrame.size.height +
> 6);
> [image compositeToPoint:imageFrame.origin
> operation:NSCompositeSourceOver];
>
>
> // TEXT DRAW
> // CELL HIGHLIGHTED: NEED TO DRAW TEXT IN WHITE
> if ([self cellAttribute:NSCellHighlighted]) {
>
> // OBS you have to adjust to cellframe
> [_title drawInRect:NSMakeRect(cellFrame.origin.x + xDelta,
> cellFrame.origin.y + 2, 120, 40) withAttributes: _high_attrTitle];
> [_subtitle drawInRect:NSMakeRect(cellFrame.origin.x + xDelta,
> cellFrame.origin.y + 14, 50, 40) withAttributes: _high_subTitle];
> } else { // CELL NOT HIGHLIGHTED: NEED TO DRAW TEXT IN BLACK
> [_title drawInRect:NSMakeRect(cellFrame.origin.x + xDelta,
> cellFrame.origin.y + 2, 120, 40) withAttributes: _attrTitle];
> [_subtitle drawInRect:NSMakeRect(cellFrame.origin.x + xDelta,
> cellFrame.origin.y + 14, 50, 40) withAttributes: _attrSubtitle];
> }
>
>
> // [super drawWithFrame:cellFrame inView:controlView];
> // [controlView unlockFocus];
> }
>
>
--
www.malcom-mac.com
mac/win/linux custom software development
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden