diff --git a/ChangeLog b/ChangeLog index ddbdb9cf7..be652940d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2013-04-21 Fred Kiefer + + * Headers/AppKit/NSPopover.h, + * Source/NSPopover.m: Adjust to GNUstep coding standards. + * Source/externs.m: Move new strings to here. + 2013-04-21 Fred Kiefer * Headers/AppKit/AppKit.h: Add NSCollectionView.h and NSCollectionViewItem.h. diff --git a/Headers/AppKit/NSPopover.h b/Headers/AppKit/NSPopover.h index 9bd5197b9..e117ae123 100644 --- a/Headers/AppKit/NSPopover.h +++ b/Headers/AppKit/NSPopover.h @@ -106,13 +106,16 @@ typedef NSInteger NSPopoverBehavior; @protocol NSPopoverDelegate #ifdef __OBJC2__ @optional +#else +@end +@interface NSObject (NSPopoverDelegate) +#endif - (NSWindow *)detachableWindowForPopover:(NSPopover *)popover; - (void)popoverDidClose:(NSNotification *)notification; - (void)popoverDidShow:(NSNotification *)notification; - (void)popoverShouldClose:(NSNotification *)notification; - (void)popoverWillClose:(NSNotification *)notification; - (void)popoverWillShow:(NSNotification *)notification; -#endif @end #endif diff --git a/Source/NSPopover.m b/Source/NSPopover.m index 2f62642c0..d5dad387b 100644 --- a/Source/NSPopover.m +++ b/Source/NSPopover.m @@ -27,161 +27,152 @@ Boston, MA 02110-1301, USA. */ -#include -#include -#include -#include -#include -#include +#import +#import +#import -/* Keys */ -NSString *NSPopoverCloseReasonKey = @"NSPopoverCloseReasonKey"; -NSString *NSPopoverCloseReasonStandard = @"NSPopoverCloseReasonStandard"; -NSString *NSPopoverCloseReasonDetachToWindow = @"NSPopoverCloseReasonDetachToWindow"; +#import "AppKit/NSPopover.h" +#import "AppKit/NSViewController.h" +#import "AppKit/NSView.h" -/* Notifications */ -NSString *NSPopoverWillShowNotification = @"NSPopoverWillShowNotification"; -NSString *NSPopoverDidShowNotification = @"NSPopoverDidShowNotification"; -NSString *NSPopoverWillCloseNotification = @"NSPopoverWillCloseNotification"; -NSString *NSPopoverDidCloseNotification = @"NSPopoverDidCloseNotification"; /* Class */ @implementation NSPopover /* Properties */ -- (void)setAnimates:(BOOL)flag +- (void) setAnimates: (BOOL)flag { _animates = flag; } -- (BOOL)animates +- (BOOL) animates { return _animates; } -- (void)setAppearance: (NSPopoverAppearance)value +- (void) setAppearance: (NSPopoverAppearance)value { _appearance = value; } -- (NSPopoverAppearance)appearance +- (NSPopoverAppearance) appearance { return _appearance; } -- (void)setBehavior:(NSPopoverBehavior)value +- (void) setBehavior: (NSPopoverBehavior)value { _behavior = value; } -- (NSPopoverBehavior)behavior +- (NSPopoverBehavior) behavior { return _behavior; } -- (void)setContentSize:(NSSize)value +- (void) setContentSize: (NSSize)value { _contentSize = value; } -- (NSSize)contentSize +- (NSSize) contentSize { return _contentSize; } -- (void)setContentViewController:(NSViewController *)controller +- (void) setContentViewController: (NSViewController *)controller { - ASSIGN(_contentViewController,controller); + ASSIGN(_contentViewController, controller); } -- (NSViewController *)contentViewController +- (NSViewController *) contentViewController { return _contentViewController; } -- (void)setDelegate:(id)value +- (void) setDelegate: (id)value { _delegate = value; } -- (id)delegate +- (id) delegate { return _delegate; } -- (void)setPositioningRect:(NSRect)value +- (void) setPositioningRect: (NSRect)value { _positioningRect = value; } -- (NSRect)positioningRect +- (NSRect) positioningRect { return _positioningRect; } -- (BOOL)isShown +- (BOOL) isShown { return _shown; } /* Methods */ -- (void)close +- (void) close { } -- (IBAction)performClose:(id)sender +- (IBAction) performClose: (id)sender { } -- (void)showRelativeToRect:(NSRect)positioningRect - ofView:(NSView *)positioningView - preferredEdge:(NSRectEdge)preferredEdge +- (void) showRelativeToRect: (NSRect)positioningRect + ofView: (NSView *)positioningView + preferredEdge: (NSRectEdge)preferredEdge { // NSLog(@"Test..."); } -- (id)initWithCoder:(NSCoder *)coder +- (id) initWithCoder: (NSCoder *)coder { - if(nil != (self = [super initWithCoder:coder])) + if (nil != (self = [super initWithCoder:coder])) { - if(YES == [coder allowsKeyedCoding]) + if (YES == [coder allowsKeyedCoding]) { - _appearance = [coder decodeIntForKey:@"NSAppearance"]; - _behavior = [coder decodeIntForKey:@"NSBehavior"]; - _animates = [coder decodeBoolForKey:@"NSAnimates"]; - _contentSize.width = [coder decodeDoubleForKey:@"NSContentWidth"]; - _contentSize.height = [coder decodeDoubleForKey:@"NSContentHeight"]; + _appearance = [coder decodeIntForKey: @"NSAppearance"]; + _behavior = [coder decodeIntForKey: @"NSBehavior"]; + _animates = [coder decodeBoolForKey: @"NSAnimates"]; + _contentSize.width = [coder decodeDoubleForKey: @"NSContentWidth"]; + _contentSize.height = [coder decodeDoubleForKey: @"NSContentHeight"]; } else { - [coder decodeValueOfObjCType:@encode(NSInteger) at:&_appearance]; - [coder decodeValueOfObjCType:@encode(NSInteger) at:&_behavior]; - [coder decodeValueOfObjCType:@encode(BOOL) at:&_animates]; - [coder decodeValueOfObjCType:@encode(CGFloat) at:&_contentSize.width]; - [coder decodeValueOfObjCType:@encode(CGFloat) at:&_contentSize.height]; + [coder decodeValueOfObjCType: @encode(NSInteger) at: &_appearance]; + [coder decodeValueOfObjCType: @encode(NSInteger) at: &_behavior]; + [coder decodeValueOfObjCType: @encode(BOOL) at: &_animates]; + [coder decodeValueOfObjCType: @encode(CGFloat) at: &_contentSize.width]; + [coder decodeValueOfObjCType: @encode(CGFloat) at: &_contentSize.height]; } } return self; } -- (void)encodeWithCoder:(NSCoder *)coder +- (void) encodeWithCoder: (NSCoder *)coder { [super encodeWithCoder:coder]; - if(YES == [coder allowsKeyedCoding]) + if (YES == [coder allowsKeyedCoding]) { - [coder encodeInt:_appearance forKey:@"NSAppearance"]; - [coder encodeInt:_behavior forKey:@"NSBehavior"]; - [coder encodeBool:_animates forKey:@"NSAnimates"]; - [coder encodeDouble:_contentSize.width forKey:@"NSContentWidth"]; - [coder encodeDouble:_contentSize.height forKey:@"NSContentHeight"]; + [coder encodeInt: _appearance forKey: @"NSAppearance"]; + [coder encodeInt: _behavior forKey: @"NSBehavior"]; + [coder encodeBool: _animates forKey: @"NSAnimates"]; + [coder encodeDouble: _contentSize.width forKey: @"NSContentWidth"]; + [coder encodeDouble: _contentSize.height forKey: @"NSContentHeight"]; } else { - [coder encodeValueOfObjCType:@encode(NSInteger) at:&_appearance]; - [coder encodeValueOfObjCType:@encode(NSInteger) at:&_behavior]; - [coder encodeValueOfObjCType:@encode(BOOL) at:&_animates]; - [coder encodeValueOfObjCType:@encode(CGFloat) at:&_contentSize.width]; - [coder encodeValueOfObjCType:@encode(CGFloat) at:&_contentSize.height]; + [coder encodeValueOfObjCType: @encode(NSInteger) at: &_appearance]; + [coder encodeValueOfObjCType: @encode(NSInteger) at: &_behavior]; + [coder encodeValueOfObjCType: @encode(BOOL) at: &_animates]; + [coder encodeValueOfObjCType: @encode(CGFloat) at: &_contentSize.width]; + [coder encodeValueOfObjCType: @encode(CGFloat) at: &_contentSize.height]; } } @end diff --git a/Source/externs.m b/Source/externs.m index 231f13418..d5b024ba5 100644 --- a/Source/externs.m +++ b/Source/externs.m @@ -434,6 +434,17 @@ NSString* const NSMenuDidChangeItemNotification = @"MenuDidChangeItem"; NSString *NSPopUpButtonWillPopUpNotification = @"PopUpButtonWillPopUp"; NSString *NSPopUpButtonCellWillPopUpNotification = @"PopUpButtonCellWillPopUp"; +// NSPopover notifications +NSString *NSPopoverWillShowNotification = @"NSPopoverWillShowNotification"; +NSString *NSPopoverDidShowNotification = @"NSPopoverDidShowNotification"; +NSString *NSPopoverWillCloseNotification = @"NSPopoverWillCloseNotification"; +NSString *NSPopoverDidCloseNotification = @"NSPopoverDidCloseNotification"; + +// NSPopover keys +NSString *NSPopoverCloseReasonKey = @"NSPopoverCloseReasonKey"; +NSString *NSPopoverCloseReasonStandard = @"NSPopoverCloseReasonStandard"; +NSString *NSPopoverCloseReasonDetachToWindow = @"NSPopoverCloseReasonDetachToWindow"; + // NSTable notifications NSString *NSTableViewSelectionDidChangeNotification = @"TableViewSelectionDidChange"; NSString *NSTableViewColumnDidMoveNotification = @"TableViewColumnDidMove";