mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-04-23 07:00:46 +00:00
Added NSText notifications to delegate
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@8380 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
e594266a93
commit
7427870911
1 changed files with 29 additions and 7 deletions
|
@ -59,10 +59,10 @@ NSRange MakeRangeFromAbs (unsigned a1, unsigned a2)
|
|||
}
|
||||
|
||||
#define SET_DELEGATE_NOTIFICATION(notif_name) \
|
||||
if ([_delegate respondsToSelector: @selector(textView##notif_name: )]) \
|
||||
if ([_delegate respondsToSelector: @selector(text##notif_name: )]) \
|
||||
[nc addObserver: _delegate \
|
||||
selector: @selector(textView##notif_name: ) \
|
||||
name: NSTextView##notif_name##Notification \
|
||||
selector: @selector(text##notif_name: ) \
|
||||
name: NSText##notif_name##Notification \
|
||||
object: _notifObject]
|
||||
|
||||
/* MINOR FIXME: The following two should really be kept in the
|
||||
|
@ -407,8 +407,16 @@ static NSNotificationCenter *nc;
|
|||
if ((_delegate != nil) && (oldNotifObject != _notifObject))
|
||||
{
|
||||
[nc removeObserver: _delegate name: nil object: oldNotifObject];
|
||||
SET_DELEGATE_NOTIFICATION (DidChangeSelection);
|
||||
SET_DELEGATE_NOTIFICATION (WillChangeNotifyingTextView);
|
||||
|
||||
/* SET_DELEGATE_NOTIFICATION defined at the beginning of file */
|
||||
|
||||
/* NSText notifications */
|
||||
SET_DELEGATE_NOTIFICATION (DidBeginEditing);
|
||||
SET_DELEGATE_NOTIFICATION (DidChange);
|
||||
SET_DELEGATE_NOTIFICATION (DidEndEditing);
|
||||
/* NSTextView notifications */
|
||||
SET_DELEGATE_NOTIFICATION (ViewDidChangeSelection);
|
||||
SET_DELEGATE_NOTIFICATION (ViewWillChangeNotifyingTextView);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1383,6 +1391,7 @@ container, returning the modified location. */
|
|||
|
||||
- (void) setDelegate: (id)anObject
|
||||
{
|
||||
/* Code to allow sharing the delegate */
|
||||
if (_tvf.multiple_textviews && (isSynchronizingDelegate == NO))
|
||||
{
|
||||
/* Invoke setDelegate: on all the textviews which share this
|
||||
|
@ -1407,11 +1416,24 @@ container, returning the modified location. */
|
|||
}
|
||||
|
||||
/* Now the real code to set the delegate */
|
||||
|
||||
if (_delegate != nil)
|
||||
{
|
||||
[nc removeObserver: _delegate name: nil object: _notifObject];
|
||||
}
|
||||
|
||||
[super setDelegate: anObject];
|
||||
|
||||
/* SET_DELEGATE_NOTIFICATION defined at the beginning of file */
|
||||
SET_DELEGATE_NOTIFICATION (DidChangeSelection);
|
||||
SET_DELEGATE_NOTIFICATION (WillChangeNotifyingTextView);
|
||||
|
||||
/* NSText notifications */
|
||||
SET_DELEGATE_NOTIFICATION (DidBeginEditing);
|
||||
SET_DELEGATE_NOTIFICATION (DidChange);
|
||||
SET_DELEGATE_NOTIFICATION (DidEndEditing);
|
||||
|
||||
/* NSTextView notifications */
|
||||
SET_DELEGATE_NOTIFICATION (ViewDidChangeSelection);
|
||||
SET_DELEGATE_NOTIFICATION (ViewWillChangeNotifyingTextView);
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
Loading…
Reference in a new issue