mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-04-23 07:00:46 +00:00
Fixup notifications
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@3729 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
21b416bf32
commit
9fd1de051c
3 changed files with 43 additions and 2 deletions
|
@ -1,3 +1,10 @@
|
|||
Wed Feb 17 4:06:00 1999 Richard Frith-Macdonald <richard@brainstorm.co.uk>
|
||||
|
||||
* Source/NSApplication.m: ([-setDelegate:]) remove old delegate as
|
||||
observer of application notifications.
|
||||
* Source/NSWindow.m: ([-setDelegate:]) add delegate as observer for
|
||||
window notifications.
|
||||
|
||||
Tue Feb 16 17:06:00 1999 Richard Frith-Macdonald <richard@brainstorm.co.uk>
|
||||
|
||||
Additions provided by mgiddings@ypc.net -
|
||||
|
|
|
@ -1649,6 +1649,8 @@ BOOL done = NO;
|
|||
{
|
||||
NSNotificationCenter* nc = [NSNotificationCenter defaultCenter];
|
||||
|
||||
if (delegate)
|
||||
[nc removeObserver: delegate name: nil object: self];
|
||||
delegate = anObject;
|
||||
|
||||
#define SET_DELEGATE_NOTIFICATION(notif_name) \
|
||||
|
|
|
@ -1180,8 +1180,40 @@ id result = nil;
|
|||
//
|
||||
// Assigning a delegate
|
||||
//
|
||||
- delegate { return delegate; }
|
||||
- (void)setDelegate:anObject { delegate = anObject; }
|
||||
- (id) delegate
|
||||
{
|
||||
return delegate;
|
||||
}
|
||||
|
||||
- (void) setDelegate: (id)anObject
|
||||
{
|
||||
NSNotificationCenter *nc = [NSNotificationCenter defaultCenter];
|
||||
|
||||
if (delegate)
|
||||
[nc removeObserver: delegate name: nil object: self];
|
||||
delegate = anObject;
|
||||
|
||||
#define SET_DELEGATE_NOTIFICATION(notif_name) \
|
||||
if ([delegate respondsToSelector:@selector(window##notif_name:)]) \
|
||||
[nc addObserver:delegate \
|
||||
selector:@selector(window##notif_name:) \
|
||||
name:NSWindow##notif_name##Notification object:self]
|
||||
|
||||
SET_DELEGATE_NOTIFICATION(DidBecomeKey);
|
||||
SET_DELEGATE_NOTIFICATION(DidBecomeMain);
|
||||
SET_DELEGATE_NOTIFICATION(DidChangeScreen);
|
||||
SET_DELEGATE_NOTIFICATION(DidDeminiaturize);
|
||||
SET_DELEGATE_NOTIFICATION(DidExpose);
|
||||
SET_DELEGATE_NOTIFICATION(DidMiniaturize);
|
||||
SET_DELEGATE_NOTIFICATION(DidMove);
|
||||
SET_DELEGATE_NOTIFICATION(DidResignKey);
|
||||
SET_DELEGATE_NOTIFICATION(DidResignMain);
|
||||
SET_DELEGATE_NOTIFICATION(DidResize);
|
||||
SET_DELEGATE_NOTIFICATION(DidUpdate);
|
||||
SET_DELEGATE_NOTIFICATION(WillClose);
|
||||
SET_DELEGATE_NOTIFICATION(WillMiniaturize);
|
||||
SET_DELEGATE_NOTIFICATION(WillMove);
|
||||
}
|
||||
|
||||
//
|
||||
// Implemented by the delegate
|
||||
|
|
Loading…
Reference in a new issue