Browse Subversion Repository
Annotation of /XspfManager/XspfMShadowImageCell.m
Parent Directory
| Revision Log
Revision 516 -
( hide annotations)
( download)
Wed Jan 26 13:16:38 2011 UTC
(13 years, 2 months ago)
by masakih
File size: 1111 byte(s)
[New] XspfMShadowImageCellを追加。
XspfMShadowImageCellを使用するように変更。
| 1 |
masakih |
516 |
// |
| 2 |
|
|
// XspfMShadowImageCell.m |
| 3 |
|
|
// XspfManager |
| 4 |
|
|
// |
| 5 |
|
|
// Created by Hori,Masaki on 11/01/26. |
| 6 |
|
|
// Copyright 2011 masakih. All rights reserved. |
| 7 |
|
|
// |
| 8 |
|
|
|
| 9 |
|
|
#import "XspfMShadowImageCell.h" |
| 10 |
|
|
|
| 11 |
|
|
@interface NSImageCell (CocoaPrivate) |
| 12 |
|
|
- (NSRect)_imageRectForDrawing:(id)fp8 inFrame:(NSRect)fp12 inView:(id)fp28; |
| 13 |
|
|
@end |
| 14 |
|
|
|
| 15 |
|
|
@implementation XspfMShadowImageCell |
| 16 |
|
|
static inline NSRect enabledImageFrame(NSRect original) |
| 17 |
|
|
{ |
| 18 |
|
|
original = NSInsetRect(original, 5, 5); |
| 19 |
|
|
return NSOffsetRect(original, -1, 2); |
| 20 |
|
|
} |
| 21 |
|
|
|
| 22 |
|
|
- (void)drawWithFrame:(NSRect)cellFrame inView:(NSView *)controlView; |
| 23 |
|
|
{ |
| 24 |
|
|
[NSGraphicsContext saveGraphicsState]; |
| 25 |
|
|
|
| 26 |
|
|
cellFrame = enabledImageFrame(cellFrame); |
| 27 |
|
|
|
| 28 |
|
|
NSShadow *shadow = [[[NSShadow alloc] init] autorelease]; |
| 29 |
|
|
[shadow setShadowOffset:NSMakeSize(2.8, -2.8)]; |
| 30 |
|
|
[shadow setShadowBlurRadius:5.6]; |
| 31 |
|
|
[shadow setShadowColor:[NSColor darkGrayColor]]; |
| 32 |
|
|
[shadow set]; |
| 33 |
|
|
|
| 34 |
|
|
NSRect imageRect = [self _imageRectForDrawing:[self image] inFrame:cellFrame inView:controlView]; |
| 35 |
|
|
[[NSColor whiteColor] set]; |
| 36 |
|
|
NSRectFill(imageRect); |
| 37 |
|
|
|
| 38 |
|
|
[NSGraphicsContext restoreGraphicsState]; |
| 39 |
|
|
|
| 40 |
|
|
[self drawInteriorWithFrame:cellFrame inView:controlView]; |
| 41 |
|
|
} |
| 42 |
|
|
|
| 43 |
|
|
@end |
|