Add NSWindowDelegate and NSMenuDelegate.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@37094 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Gregory John Casamento 2013-09-17 20:36:25 +00:00
parent 5478f1e00c
commit 61f497d174
3 changed files with 71 additions and 0 deletions

View file

@ -1,3 +1,8 @@
2013-09-17 16:36-EDT Gregory John Casamento <greg.casamento@gmail.com>
* Headers/AppKit/NSMenu.h: Add NSMenuDelegate
* Headers/AppKit/NSWindow.h: Add NSWindowDelegate
2013-09-17 Riccardo Mottola <rm@gnu.org>
* Source/NSAnimation.m

View file

@ -45,6 +45,7 @@
@class NSView;
@class NSWindow;
@class NSMutableArray;
@class NSScreen;
/* ******************* */
/* NSMenuView Protocol */
@ -194,6 +195,63 @@
@end
/**
* The NSMenuDelegate protocol defines optional methods implemented
* by delegates of NSMenu objects.
*/
@protocol NSMenuDelegate <NSObject>
/**
* Allows the delegate to return the target and action for a key-down event.
*/
- (BOOL) menuHasKeyEquivalent: (NSMenu *)menu
forEvent: (NSEvent *)event
target: (id *)target
action: (SEL *)action;
/**
* Invoked on the delegate to allow changes before the menu opens.
*/
- (void) menuWillOpen: (NSMenu *)menu;
/**
* Invoked when the menu is about to be displayed.
*/
- (NSInteger) numberOfItemsInMenu: (NSMenu *)menu;
/**
* Invoked to indicate that the menu is about to be updated.
*/
- (void) menuNeedsUpdate: (NSMenu *)menu;
/**
* Invoked to inform the delegate that the menu did close.
*/
- (void) menuDidClose: (NSMenu *)menu;
/**
* Invoked too notify the delegate that the item will be highlighted.
*/
- (void) menu: (NSMenu *)menu
willHighlightItem: (NSMenuItem *)item;
/**
* Invoked to allow the delegate to update an item before
* it is displayed.
*/
- (BOOL) menu: (NSMenu *)menu
updateItem: (NSMenuItem *)item
atIndex: (NSInteger)index
shouldCancel: (BOOL)shouldCancel;
/**
* Specify a display location for the menu
*/
- (NSRect)confinementRectForMenu: (NSMenu *)menu
onScreen: (NSScreen *)screen;
@end
/** <p>Menus provide the user with a list of actions and/or submenus.
* Submenus themselves are full fledged menus and so a heirarchical
* structure of appears.</p>

View file

@ -825,7 +825,15 @@ PACKAGE_SCOPE
*/
#ifdef GNUSTEP
@protocol NSWindowDelegate <NSObject>
#ifdef __OBJC2__
@optional
#else
@end
@interface NSObject (NSWindowDelegate)
#endif
- (BOOL) windowShouldClose: (id)sender;
#if OS_API_VERSION(GS_API_MACOSX, GS_API_LATEST)
- (void) windowWillBeginSheet: (NSNotification*)aNotification;