diff --git a/ChangeLog b/ChangeLog index 409053152..0557a81ed 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2007-07-23 Fred Kiefer + + * Headers/AppKit/NSCell.h, + * Source/NSCell.m, + * Source/NSActionCell.m (-setControlView:): Add MacOSX 10.4 method. + * Headers/AppKit/NSAlert.h, + * Source/NSAlert.m (+alertWithError:): Add MacOSX 10.4 method. + 2007-07-18 Fred Kiefer * Headers/AppKit/NSPrintInfo.h, diff --git a/Headers/AppKit/NSAlert.h b/Headers/AppKit/NSAlert.h index 081eee8b0..0813298c5 100644 --- a/Headers/AppKit/NSAlert.h +++ b/Headers/AppKit/NSAlert.h @@ -33,12 +33,15 @@ #include @class NSArray; +@class NSError; @class NSString; @class NSMutableArray; @class NSButton; @class NSImage; @class NSWindow; +#if OS_API_VERSION(MAC_OS_X_VERSION_10_3, GS_API_LATEST) + typedef enum _NSAlertStyle { NSWarningAlertStyle = 0, NSInformationalAlertStyle = 1, @@ -66,6 +69,9 @@ enum { int _result; } +#if OS_API_VERSION(MAC_OS_X_VERSION_10_4, GS_API_LATEST) ++ (NSAlert *) alertWithError: (NSError *)error; +#endif + (NSAlert *) alertWithMessageText: (NSString *)messageTitle defaultButton: (NSString *)defaultButtonTitle alternateButton: (NSString *)alternateButtonTitle @@ -109,4 +115,5 @@ enum { @end #endif +#endif /* MAC_OS_X_VERSION_10_3 */ #endif /* _GNUstep_H_NSAlert */ diff --git a/Headers/AppKit/NSCell.h b/Headers/AppKit/NSCell.h index 33f7d3efa..4e8f34519 100644 --- a/Headers/AppKit/NSCell.h +++ b/Headers/AppKit/NSCell.h @@ -441,6 +441,10 @@ enum { - (void)setControlTint:(NSControlTint)controlTint; - (NSControlTint)controlTint; #endif +#if OS_API_VERSION(MAC_OS_X_VERSION_10_4, GS_API_LATEST) +- (void)setControlView:(NSView*)view; +#endif + // // Editing Text diff --git a/Source/NSActionCell.m b/Source/NSActionCell.m index dab0ec05d..a33f074cb 100644 --- a/Source/NSActionCell.m +++ b/Source/NSActionCell.m @@ -269,6 +269,13 @@ static Class controlClass; return _control_view; } +/** + * Set the control view of the receiver. + */ +- (void) setControlView: (NSView*)view +{ + _control_view = view; +} - (void) drawWithFrame: (NSRect)cellFrame inView: (NSView*)controlView { diff --git a/Source/NSAlert.m b/Source/NSAlert.m index b95e0bc31..0014708e7 100644 --- a/Source/NSAlert.m +++ b/Source/NSAlert.m @@ -37,6 +37,7 @@ #include #include +#include #include #include "AppKit/NSAlert.h" #include "AppKit/NSApplication.h" @@ -1384,6 +1385,20 @@ void NSBeginInformationalAlertSheet(NSString *title, } } ++ (NSAlert *) alertWithError: (NSError *)error +{ + NSArray *options; + unsigned int count; + + options = [error localizedRecoveryOptions]; + count = [options count]; + return [self alertWithMessageText: [error localizedDescription] + defaultButton: (count > 0) ? [options objectAtIndex: 0] : nil + alternateButton: (count > 1) ? [options objectAtIndex: 1] : nil + otherButton: (count > 2) ? [options objectAtIndex: 2] : nil + informativeTextWithFormat: [error localizedRecoverySuggestion]]; +} + + (NSAlert *) alertWithMessageText: (NSString *)messageTitle defaultButton: (NSString *)defaultButtonTitle alternateButton: (NSString *)alternateButtonTitle diff --git a/Source/NSCell.m b/Source/NSCell.m index ed1db4dee..ca8546da7 100644 --- a/Source/NSCell.m +++ b/Source/NSCell.m @@ -1908,7 +1908,7 @@ static NSColor *shadowCol; return _cell.control_tint; } -/**

This method is used by subclasses to specified the control view. +/**

This method is used by subclasses to get the control view. This method returns nil.

*/ - (NSView*) controlView @@ -1916,6 +1916,13 @@ static NSColor *shadowCol; return nil; } +/**

This method is used by subclasses to specify the control view.

+ */ +- (void) setControlView: (NSView*)view +{ + // Do nothing +} + /**

This drawing is minimal and with no background, * to make it easier for subclass to customize drawing.

*/