* Headers/AppKit/NSPopover.h,

* Source/NSPopover.m: Adjust to GNUstep coding standards.
        * Source/externs.m: Move new strings to here.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@36555 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
fredkiefer 2013-04-21 21:32:36 +00:00
parent 3cc92bfaf3
commit 8c6a5ecaac
4 changed files with 73 additions and 62 deletions

View file

@ -1,3 +1,9 @@
2013-04-21 Fred Kiefer <FredKiefer@gmx.de>
* 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 <FredKiefer@gmx.de> 2013-04-21 Fred Kiefer <FredKiefer@gmx.de>
* Headers/AppKit/AppKit.h: Add NSCollectionView.h and NSCollectionViewItem.h. * Headers/AppKit/AppKit.h: Add NSCollectionView.h and NSCollectionViewItem.h.

View file

@ -106,13 +106,16 @@ typedef NSInteger NSPopoverBehavior;
@protocol NSPopoverDelegate @protocol NSPopoverDelegate
#ifdef __OBJC2__ #ifdef __OBJC2__
@optional @optional
#else
@end
@interface NSObject (NSPopoverDelegate)
#endif
- (NSWindow *)detachableWindowForPopover:(NSPopover *)popover; - (NSWindow *)detachableWindowForPopover:(NSPopover *)popover;
- (void)popoverDidClose:(NSNotification *)notification; - (void)popoverDidClose:(NSNotification *)notification;
- (void)popoverDidShow:(NSNotification *)notification; - (void)popoverDidShow:(NSNotification *)notification;
- (void)popoverShouldClose:(NSNotification *)notification; - (void)popoverShouldClose:(NSNotification *)notification;
- (void)popoverWillClose:(NSNotification *)notification; - (void)popoverWillClose:(NSNotification *)notification;
- (void)popoverWillShow:(NSNotification *)notification; - (void)popoverWillShow:(NSNotification *)notification;
#endif
@end @end
#endif #endif

View file

@ -27,161 +27,152 @@
Boston, MA 02110-1301, USA. Boston, MA 02110-1301, USA.
*/ */
#include <Foundation/NSArchiver.h> #import <Foundation/NSArchiver.h>
#include <Foundation/NSKeyedArchiver.h> #import <Foundation/NSKeyedArchiver.h>
#include <Foundation/NSNotification.h> #import <Foundation/NSNotification.h>
#include <AppKit/NSPopover.h>
#include <AppKit/NSViewController.h>
#include <AppKit/NSView.h>
/* Keys */ #import "AppKit/NSPopover.h"
NSString *NSPopoverCloseReasonKey = @"NSPopoverCloseReasonKey"; #import "AppKit/NSViewController.h"
NSString *NSPopoverCloseReasonStandard = @"NSPopoverCloseReasonStandard"; #import "AppKit/NSView.h"
NSString *NSPopoverCloseReasonDetachToWindow = @"NSPopoverCloseReasonDetachToWindow";
/* Notifications */
NSString *NSPopoverWillShowNotification = @"NSPopoverWillShowNotification";
NSString *NSPopoverDidShowNotification = @"NSPopoverDidShowNotification";
NSString *NSPopoverWillCloseNotification = @"NSPopoverWillCloseNotification";
NSString *NSPopoverDidCloseNotification = @"NSPopoverDidCloseNotification";
/* Class */ /* Class */
@implementation NSPopover @implementation NSPopover
/* Properties */ /* Properties */
- (void)setAnimates:(BOOL)flag - (void) setAnimates: (BOOL)flag
{ {
_animates = flag; _animates = flag;
} }
- (BOOL)animates - (BOOL) animates
{ {
return _animates; return _animates;
} }
- (void)setAppearance: (NSPopoverAppearance)value - (void) setAppearance: (NSPopoverAppearance)value
{ {
_appearance = value; _appearance = value;
} }
- (NSPopoverAppearance)appearance - (NSPopoverAppearance) appearance
{ {
return _appearance; return _appearance;
} }
- (void)setBehavior:(NSPopoverBehavior)value - (void) setBehavior: (NSPopoverBehavior)value
{ {
_behavior = value; _behavior = value;
} }
- (NSPopoverBehavior)behavior - (NSPopoverBehavior) behavior
{ {
return _behavior; return _behavior;
} }
- (void)setContentSize:(NSSize)value - (void) setContentSize: (NSSize)value
{ {
_contentSize = value; _contentSize = value;
} }
- (NSSize)contentSize - (NSSize) contentSize
{ {
return _contentSize; return _contentSize;
} }
- (void)setContentViewController:(NSViewController *)controller - (void) setContentViewController: (NSViewController *)controller
{ {
ASSIGN(_contentViewController,controller); ASSIGN(_contentViewController, controller);
} }
- (NSViewController *)contentViewController - (NSViewController *) contentViewController
{ {
return _contentViewController; return _contentViewController;
} }
- (void)setDelegate:(id<NSPopoverDelegate>)value - (void) setDelegate: (id<NSPopoverDelegate>)value
{ {
_delegate = value; _delegate = value;
} }
- (id<NSPopoverDelegate>)delegate - (id<NSPopoverDelegate>) delegate
{ {
return _delegate; return _delegate;
} }
- (void)setPositioningRect:(NSRect)value - (void) setPositioningRect: (NSRect)value
{ {
_positioningRect = value; _positioningRect = value;
} }
- (NSRect)positioningRect - (NSRect) positioningRect
{ {
return _positioningRect; return _positioningRect;
} }
- (BOOL)isShown - (BOOL) isShown
{ {
return _shown; return _shown;
} }
/* Methods */ /* Methods */
- (void)close - (void) close
{ {
} }
- (IBAction)performClose:(id)sender - (IBAction) performClose: (id)sender
{ {
} }
- (void)showRelativeToRect:(NSRect)positioningRect - (void) showRelativeToRect: (NSRect)positioningRect
ofView:(NSView *)positioningView ofView: (NSView *)positioningView
preferredEdge:(NSRectEdge)preferredEdge preferredEdge: (NSRectEdge)preferredEdge
{ {
// NSLog(@"Test..."); // 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"]; _appearance = [coder decodeIntForKey: @"NSAppearance"];
_behavior = [coder decodeIntForKey:@"NSBehavior"]; _behavior = [coder decodeIntForKey: @"NSBehavior"];
_animates = [coder decodeBoolForKey:@"NSAnimates"]; _animates = [coder decodeBoolForKey: @"NSAnimates"];
_contentSize.width = [coder decodeDoubleForKey:@"NSContentWidth"]; _contentSize.width = [coder decodeDoubleForKey: @"NSContentWidth"];
_contentSize.height = [coder decodeDoubleForKey:@"NSContentHeight"]; _contentSize.height = [coder decodeDoubleForKey: @"NSContentHeight"];
} }
else else
{ {
[coder decodeValueOfObjCType:@encode(NSInteger) at:&_appearance]; [coder decodeValueOfObjCType: @encode(NSInteger) at: &_appearance];
[coder decodeValueOfObjCType:@encode(NSInteger) at:&_behavior]; [coder decodeValueOfObjCType: @encode(NSInteger) at: &_behavior];
[coder decodeValueOfObjCType:@encode(BOOL) at:&_animates]; [coder decodeValueOfObjCType: @encode(BOOL) at: &_animates];
[coder decodeValueOfObjCType:@encode(CGFloat) at:&_contentSize.width]; [coder decodeValueOfObjCType: @encode(CGFloat) at: &_contentSize.width];
[coder decodeValueOfObjCType:@encode(CGFloat) at:&_contentSize.height]; [coder decodeValueOfObjCType: @encode(CGFloat) at: &_contentSize.height];
} }
} }
return self; return self;
} }
- (void)encodeWithCoder:(NSCoder *)coder - (void) encodeWithCoder: (NSCoder *)coder
{ {
[super encodeWithCoder:coder]; [super encodeWithCoder:coder];
if(YES == [coder allowsKeyedCoding]) if (YES == [coder allowsKeyedCoding])
{ {
[coder encodeInt:_appearance forKey:@"NSAppearance"]; [coder encodeInt: _appearance forKey: @"NSAppearance"];
[coder encodeInt:_behavior forKey:@"NSBehavior"]; [coder encodeInt: _behavior forKey: @"NSBehavior"];
[coder encodeBool:_animates forKey:@"NSAnimates"]; [coder encodeBool: _animates forKey: @"NSAnimates"];
[coder encodeDouble:_contentSize.width forKey:@"NSContentWidth"]; [coder encodeDouble: _contentSize.width forKey: @"NSContentWidth"];
[coder encodeDouble:_contentSize.height forKey:@"NSContentHeight"]; [coder encodeDouble: _contentSize.height forKey: @"NSContentHeight"];
} }
else else
{ {
[coder encodeValueOfObjCType:@encode(NSInteger) at:&_appearance]; [coder encodeValueOfObjCType: @encode(NSInteger) at: &_appearance];
[coder encodeValueOfObjCType:@encode(NSInteger) at:&_behavior]; [coder encodeValueOfObjCType: @encode(NSInteger) at: &_behavior];
[coder encodeValueOfObjCType:@encode(BOOL) at:&_animates]; [coder encodeValueOfObjCType: @encode(BOOL) at: &_animates];
[coder encodeValueOfObjCType:@encode(CGFloat) at:&_contentSize.width]; [coder encodeValueOfObjCType: @encode(CGFloat) at: &_contentSize.width];
[coder encodeValueOfObjCType:@encode(CGFloat) at:&_contentSize.height]; [coder encodeValueOfObjCType: @encode(CGFloat) at: &_contentSize.height];
} }
} }
@end @end

View file

@ -434,6 +434,17 @@ NSString* const NSMenuDidChangeItemNotification = @"MenuDidChangeItem";
NSString *NSPopUpButtonWillPopUpNotification = @"PopUpButtonWillPopUp"; NSString *NSPopUpButtonWillPopUpNotification = @"PopUpButtonWillPopUp";
NSString *NSPopUpButtonCellWillPopUpNotification = @"PopUpButtonCellWillPopUp"; 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 // NSTable notifications
NSString *NSTableViewSelectionDidChangeNotification = @"TableViewSelectionDidChange"; NSString *NSTableViewSelectionDidChangeNotification = @"TableViewSelectionDidChange";
NSString *NSTableViewColumnDidMoveNotification = @"TableViewColumnDidMove"; NSString *NSTableViewColumnDidMoveNotification = @"TableViewColumnDidMove";