Many many improvements

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@3469 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Richard Frith-MacDonald 1998-12-16 15:21:55 +00:00
parent cd4581d03a
commit 6ee33bb429
8 changed files with 1744 additions and 1443 deletions

View file

@ -1,3 +1,16 @@
Wed Dec 16 15:30:00 1998 Richard Frith-Macdonald <richard@brainstorm.co.uk>
* NSResponder.m: bugfix - now beeps when it can't handle a key down.
* NSPanel.m: Panels are not released when closed.
* NSWindow.m: Removed ([-keyDown:]) - functionality moved to point
where keyDown events are sent to first responder. Fixed code for
setting window titles to work with windows menu. Reinstated hack
to shut down app when window closed and no main menu exists.
* NSMenu.m: Removed redundant action dispatch code - use NSApplication
Send notifications.
* NSApplication.m: Implemented and rewrote loads of methods -
windows menu now supported.
Wed Dec 16 09:22:06 1998 Adam Fedor <fedor@ultra.doc.com>
* Source/NSApplication.m (NSOpenStepRootDirectory): Remove

View file

@ -157,4 +157,7 @@
@end
extern NSString* const NSMenuDidSendActionNotification;
extern NSString* const NSMenuWillSendActionNotification;
#endif // _GNUstep_H_NSMenu

File diff suppressed because it is too large Load diff

View file

@ -30,6 +30,7 @@
#include <Foundation/NSArray.h>
#include <Foundation/NSProcessInfo.h>
#include <Foundation/NSString.h>
#include <Foundation/NSNotification.h>
#include <AppKit/NSMatrix.h>
#include <AppKit/NSApplication.h>
@ -606,89 +607,25 @@ static Class menuCellClass = nil;
[menuCells display];
}
- (void)performActionForItem:(id <NSMenuItem>)cell
- (void) performActionForItem: (id <NSMenuItem>)cell
{
SEL action;
id target;
NSWindow* keyWindow;
NSWindow* mainWindow;
id responder;
id delegate;
id theApp = [NSApplication sharedApplication];
NSNotificationCenter *nc;
NSDictionary *d;
if (![cell isEnabled])
return;
action = [cell action];
/* Search the target */
if ((target = [cell target]) && [target respondsToSelector:action]) {
[target performSelector:action withObject:cell];
return;
}
/* Search the key window's responder chain */
keyWindow = [theApp keyWindow];
responder = [keyWindow firstResponder];
while (responder) {
if ([responder respondsToSelector:action]) {
[responder performSelector:action withObject:cell];
return;
}
responder = [responder nextResponder];
}
/* Search the key window */
if ([keyWindow respondsToSelector:action]) {
[keyWindow performSelector:action withObject:cell];
return;
}
/* Search the key window's delegate */
delegate = [keyWindow delegate];
if ([delegate respondsToSelector:action]) {
[delegate performSelector:action withObject:cell];
return;
}
mainWindow = [theApp mainWindow];
if (mainWindow != keyWindow) {
/* Search the main window's responder chain */
responder = [mainWindow firstResponder];
while (responder) {
if ([responder respondsToSelector:action]) {
[responder performSelector:action withObject:cell];
return;
}
responder = [responder nextResponder];
}
/* Search the main window */
if ([mainWindow respondsToSelector:action]) {
[mainWindow performSelector:action withObject:cell];
return;
}
/* Search the main window's delegate */
delegate = [mainWindow delegate];
if ([delegate respondsToSelector:action]) {
[delegate performSelector:action withObject:cell];
return;
}
}
/* Search the NSApplication object */
if ([theApp respondsToSelector:action]) {
[theApp performSelector:action withObject:cell];
return;
}
/* Search the NSApplication object's delegate */
delegate = [theApp delegate];
if ([delegate respondsToSelector:action]) {
[delegate performSelector:action withObject:cell];
return;
}
nc = [NSNotificationCenter defaultCenter];
d = [NSDictionary dictionaryWithObject: cell forKey: @"MenuItem"];
[nc postNotificationName: NSMenuWillSendActionNotification
object: self
userInfo: d];
[[NSApplication sharedApplication] sendAction: [cell action]
to: [cell target]
from: cell];
[nc postNotificationName: NSMenuDidSendActionNotification
object: self
userInfo: d];
}
- (BOOL)performKeyEquivalent:(NSEvent*)theEvent

View file

@ -73,7 +73,7 @@
//
// Instance methods
//
- init
- (id) init
{
int style = NSTitledWindowMask | NSClosableWindowMask;
@ -83,6 +83,21 @@
defer: NO];
}
- (id) initWithContentRect: (NSRect)contentRect
styleMask: (unsigned int)aStyle
backing: (NSBackingStoreType)bufferingType
defer: (BOOL)flag
screen: (NSScreen*)aScreen
{
self = [super initWithContentRect: contentRect
styleMask: aStyle
backing: bufferingType
defer: flag
screen: aScreen];
[self setReleasedWhenClosed: NO];
return self;
}
//
// If we receive an escape, close.
//

View file

@ -30,6 +30,7 @@
#include <Foundation/NSCoder.h>
#include <AppKit/NSResponder.h>
#include <AppKit/NSGraphics.h>
#include <objc/objc.h>
@implementation NSResponder
@ -193,10 +194,8 @@
- (void)noResponderFor:(SEL)eventSelector
{
// Only beep for key down events
if (eventSelector != @selector(keyDown:))
return;
NSBeep();
if (sel_eq(eventSelector, @selector(keyDown:)))
NSBeep();
}
- (void)rightMouseDown:(NSEvent *)theEvent

File diff suppressed because it is too large Load diff

View file

@ -254,6 +254,10 @@ NSString *NSViewFrameDidChangeNotification
NSString *NSViewBoundsDidChangeNotification
= @"NSViewBoundsDidChangeNotification";
// NSMenu notifications
NSString* const NSMenuDidSendActionNotification = @"MenuDidSendAction";
NSString* const NSMenuWillSendActionNotification = @"MenuWillSendAction";
// NSWindow notifications
NSString *NSWindowDidBecomeKeyNotification = @"WindowDidBecomeKey";
NSString *NSWindowDidBecomeMainNotification = @"WindowDidBecomeMain";