diff --git a/ChangeLog b/ChangeLog index 0967cd056..894f55e33 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +1999-12-07 Adam Fedor + + * Source/NSColorWell.m: Added ([+cellClass]) to set cell class to + NSActionCell so that setTarget: and setAction: methods at least + don't raise an exception. Modified ([-drawRect:]) to conform to + OpenStep 4.2 behavior. (Patch from Jonathan Gapen + ). + + * Source/NSColor.m (-set): Set the alpha coverage. + Tue Dec 7 10:50:00 1999 Richard Frith-Macdonald * Source/NSButtonCell.m: ([-drawInteriorWithFrame:inView:]) fix code diff --git a/Source/NSColor.m b/Source/NSColor.m index 5a20a19ce..37e7562fc 100644 --- a/Source/NSColor.m +++ b/Source/NSColor.m @@ -1078,6 +1078,7 @@ static NSMutableDictionary *colorStrings = nil; NSDebugLLog(@"NSColor", @"Gray %f\n", white_component); PSsetgray(white_component); } + PSsetalpha(alpha_component); } // diff --git a/Source/NSColorWell.m b/Source/NSColorWell.m index 521929dbd..5e9e6c7ca 100644 --- a/Source/NSColorWell.m +++ b/Source/NSColorWell.m @@ -29,6 +29,7 @@ */ #include +#include #include #include #include @@ -45,6 +46,15 @@ [self setVersion: 1]; } +// FIXME: This is a hack. An NSColorWell shouldn't need an associated +// cell, but without one the setTarget: and setAction: methods get passed +// to an NSCell object by the superclass (NSControl). NSCell raises an +// exception on these methods, but NSActionCell actually implements them. ++ (Class)cellClass +{ + return [NSActionCell class]; +} + // // Instance methods // @@ -89,13 +99,20 @@ [[NSColor controlColor] set]; NSRectFill(NSIntersectionRect(aRect, rect)); - /* - * Draw inner frame. - */ aRect = NSInsetRect(aRect, 5.0, 5.0); - NSDrawGrayBezel(aRect, rect); - - aRect = NSInsetRect(aRect, 2.0, 2.0); + + /* + * OpenStep 4.2 behavior is to omit the inner border for + * non-enabled NSColorWell objects. + */ + if ([self isEnabled]) + { + /* + * Draw inner frame. + */ + NSDrawGrayBezel(aRect, rect); + aRect = NSInsetRect(aRect, 2.0, 2.0); + } } else aRect = NSInsetRect(aRect, 9.0, 9.0); @@ -145,6 +162,7 @@ - (void)setColor: (NSColor *)color { ASSIGN(the_color, color); + [self display]; } - (void)takeColorFrom: (id)sender