mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-05-31 00:00:47 +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
ed2496a09e
commit
a2f42a39e9
3 changed files with 43 additions and 2 deletions
|
@ -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…
Add table
Add a link
Reference in a new issue