CoreImage effect loads only with OS X 10.4.0 through 10.4.5. It crashes 10.4.6 currently.
[ITKit.git] / ITTextFieldCell.m
old mode 100755 (executable)
new mode 100644 (file)
index 00d54f6..2dbc30c
 #import "ITTextFieldCell.h"
 #import "ITTextFieldCell.h"
-#import <CoreGraphics/CoreGraphics.h>
 #import "ITCoreGraphicsHacks.h"
 #import "ITCoreGraphicsHacks.h"
-
-
-/*************************************************************************/
-#pragma mark -
-#pragma mark IMPLEMENTATION
-/*************************************************************************/
+#import <ApplicationServices/ApplicationServices.h>
 
 @implementation ITTextFieldCell
 
 
 @implementation ITTextFieldCell
 
-/*************************************************************************/
-#pragma mark -
-#pragma mark INITIALIZATION METHODS
-/*************************************************************************/
-
-- (id)initTextCell:(NSString *)string;
-{
-    if ( ( self = [super initTextCell:string] ) ) {
-        castsShadow      = NO;
-        shadowElevation  = 45.0;
-        shadowAzimuth    = 90.0;
-        shadowAmbient    = 0.15;
-        shadowHeight     = 1.00;
-        shadowRadius     = 4.00;
-        shadowSaturation = 1.2;
-    }
-
-    return self;
+- (id)initTextCell:(NSString *)string {
+       if ((self = [super initTextCell:string])) {
+               castsShadow = NO;
+               shadowElevation = 45.0;
+               shadowAzimuth = 90.0;
+               shadowAmbient = 0.15;
+               shadowHeight = 1.00;
+               shadowRadius = 4.00;
+               shadowSaturation = 1.0;
+       }
+       return self;
 }
 
 }
 
-- (id)initWithCoder:(NSCoder *)coder
-{
-    if ( ( self = [super initWithCoder:coder] ) ) {        
-        castsShadow      = NO;
-        shadowElevation  = 45.0;
-        shadowAzimuth    = 90.0;
-        shadowAmbient    = 0.15;
-        shadowHeight     = 1.00;
-        shadowRadius     = 4.00;
-        shadowSaturation = 1.0;
-    }
-    
-    return self;
+- (id)initWithCoder:(NSCoder *)coder {
+       if ((self = [super initWithCoder:coder])) {             
+               castsShadow = NO;
+               shadowElevation = 45.0;
+               shadowAzimuth = 90.0;
+               shadowAmbient = 0.15;
+               shadowHeight = 1.00;
+               shadowRadius = 4.00;
+               shadowSaturation = 1.0;
+       }
+       return self;
 }
 
 }
 
-
-/*************************************************************************/
-#pragma mark -
-#pragma mark DRAWING METHODS
-/*************************************************************************/
-
-- (void)drawWithFrame:(NSRect)rect inView:(NSView *)controlView
-{
-    CGSGenericObj        style = nil;
-    CGShadowStyle        shadow;
-
-    if ( castsShadow ) { 
-//      Create the shadow style to use for drawing the string
-        shadow.version    = 0;
-        shadow.elevation  = shadowElevation;
-        shadow.azimuth    = shadowAzimuth;
-        shadow.ambient    = shadowAmbient;
-        shadow.height     = shadowHeight;
-        shadow.radius     = shadowRadius;
-        shadow.saturation = shadowSaturation;
-        style = CGStyleCreateShadow(&shadow);
-        
-        // Set the context for drawing the string
-        [NSGraphicsContext saveGraphicsState];
-        CGContextSetStyle([[NSGraphicsContext currentContext] graphicsPort], style);
-    }
-    
-    // Draw the string
-    [super drawWithFrame:rect inView:controlView];
-    
-
-    if ( castsShadow ) { 
-        // Restore the old context
-        [NSGraphicsContext restoreGraphicsState];
-        CGStyleRelease(style);
-    }
+- (void)drawWithFrame:(NSRect)rect inView:(NSView *)controlView {
+       CGSGenericObj style = nil;
+       CGShadowStyle shadow;
+       
+       if ( castsShadow ) { 
+               // Create the shadow style to use for drawing the string
+               shadow.version = 0;
+               shadow.elevation = shadowElevation;
+               shadow.azimuth = shadowAzimuth;
+               shadow.ambient = shadowAmbient;
+               shadow.height = shadowHeight;
+               shadow.radius = shadowRadius;
+               shadow.saturation = shadowSaturation;
+               style = CGStyleCreateShadow(&shadow);
+               
+               // Set the context for drawing the string
+               [NSGraphicsContext saveGraphicsState];
+               CGContextSetStyle([[NSGraphicsContext currentContext] graphicsPort], style);
+       }
+       
+       // Draw the string
+       [super drawWithFrame:rect inView:controlView];
+       
+       if (castsShadow) { 
+               // Restore the old context
+               [NSGraphicsContext restoreGraphicsState];
+               CGStyleRelease(style);
+       }
 }
 
 }
 
-
-
-/*************************************************************************/
-#pragma mark -
-#pragma mark ACCESSOR METHODS
-/*************************************************************************/
-
-- (BOOL)castsShadow;
-{
-    return castsShadow;
+- (BOOL)castsShadow {
+       return castsShadow;
 }
 
 }
 
-- (void)setCastsShadow:(BOOL)newSetting;
-{
-    castsShadow = newSetting;
-    [[self controlView] setNeedsDisplay:YES];
+- (void)setCastsShadow:(BOOL)newSetting {
+       castsShadow = newSetting;
+       [[self controlView] setNeedsDisplay:YES];
 }
 
 }
 
-- (float)shadowElevation;
-{
-    return shadowElevation;
+- (float)shadowElevation {
+       return shadowElevation;
 }
 
 }
 
-- (void)setShadowElevation:(float)newElevation;
-{
-    shadowElevation = newElevation;
-    [[self controlView] setNeedsDisplay:YES];
+- (void)setShadowElevation:(float)newElevation {
+       shadowElevation = newElevation;
+       [[self controlView] setNeedsDisplay:YES];
 }
 
 }
 
-- (float)shadowAzimuth;
-{
-    return shadowAzimuth;
+- (float)shadowAzimuth {
+       return shadowAzimuth;
 }
 
 }
 
-- (void)setShadowAzimuth:(float)newAzimuth;
-{
-    shadowAzimuth = newAzimuth;
-    [[self controlView] setNeedsDisplay:YES];
+- (void)setShadowAzimuth:(float)newAzimuth {
+       shadowAzimuth = newAzimuth;
+       [[self controlView] setNeedsDisplay:YES];
 }
 
 }
 
-- (float)shadowAmbient;
-{
-    return shadowAmbient;
+- (float)shadowAmbient {
+       return shadowAmbient;
 }
 
 }
 
-- (void)setShadowAmbient:(float)newAmbient;
-{
-    shadowAmbient = newAmbient;
-    [[self controlView] setNeedsDisplay:YES];
+- (void)setShadowAmbient:(float)newAmbient {
+       shadowAmbient = newAmbient;
+       [[self controlView] setNeedsDisplay:YES];
 }
 
 }
 
-- (float)shadowHeight;
-{
-    return shadowHeight;
+- (float)shadowHeight {
+       return shadowHeight;
 }
 
 }
 
-- (void)setShadowHeight:(float)newHeight;
-{
-    shadowHeight = newHeight;
-    [[self controlView] setNeedsDisplay:YES];
+- (void)setShadowHeight:(float)newHeight {
+       shadowHeight = newHeight;
+       [[self controlView] setNeedsDisplay:YES];
 }
 
 }
 
-- (float)shadowRadius;
-{
-    return shadowRadius;
+- (float)shadowRadius {
+       return shadowRadius;
 }
 
 }
 
-- (void)setShadowRadius:(float)newRadius;
-{
-    shadowRadius = newRadius;
-    [[self controlView] setNeedsDisplay:YES];
+- (void)setShadowRadius:(float)newRadius {
+       shadowRadius = newRadius;
+       [[self controlView] setNeedsDisplay:YES];
 }
 
 }
 
-- (float)shadowSaturation;
-{
-    return shadowSaturation;
+- (float)shadowSaturation {
+       return shadowSaturation;
 }
 
 }
 
-- (void)setShadowSaturation:(float)newSaturation;
-{
-    shadowSaturation = newSaturation;
-    [[self controlView] setNeedsDisplay:YES];
+- (void)setShadowSaturation:(float)newSaturation {
+       shadowSaturation = newSaturation;
+       [[self controlView] setNeedsDisplay:YES];
 }
 
 }
 
-
-@end
+@end
\ No newline at end of file