mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-05-14 16:51:01 +00:00
In [setWidthTracksTextView:] and
[setHeightTracksTextView:] make sure that the view post changes and that notifications are only send once. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@8038 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
07b28f97da
commit
cd85ae9c86
1 changed files with 17 additions and 2 deletions
|
@ -137,6 +137,8 @@
|
|||
if (_textView)
|
||||
{
|
||||
[_textView setTextContainer: nil];
|
||||
// May we realy switch this off, as somebody else might be listening
|
||||
// to those notifications?
|
||||
[_textView setPostsFrameChangedNotifications: NO];
|
||||
[nc removeObserver: self name: NSViewFrameDidChangeNotification
|
||||
object: _textView];
|
||||
|
@ -182,15 +184,22 @@
|
|||
- (void) setWidthTracksTextView: (BOOL)flag
|
||||
{
|
||||
NSNotificationCenter *nc;
|
||||
nc = [NSNotificationCenter defaultCenter];
|
||||
BOOL old_observing = _observingFrameChanges;
|
||||
|
||||
_widthTracksTextView = flag;
|
||||
_observingFrameChanges = _widthTracksTextView | _heightTracksTextView;
|
||||
|
||||
if (_textView == nil)
|
||||
return;
|
||||
|
||||
if (_observingFrameChanges == old_observing)
|
||||
return;
|
||||
|
||||
nc = [NSNotificationCenter defaultCenter];
|
||||
|
||||
if (_observingFrameChanges)
|
||||
{
|
||||
[_textView setPostsFrameChangedNotifications: YES];
|
||||
[nc addObserver: self
|
||||
selector: @selector(_textViewFrameChanged:)
|
||||
name: NSViewFrameDidChangeNotification
|
||||
|
@ -211,15 +220,21 @@
|
|||
- (void) setHeightTracksTextView: (BOOL)flag
|
||||
{
|
||||
NSNotificationCenter *nc;
|
||||
nc = [NSNotificationCenter defaultCenter];
|
||||
BOOL old_observing = _observingFrameChanges;
|
||||
|
||||
_heightTracksTextView = flag;
|
||||
_observingFrameChanges = _widthTracksTextView | _heightTracksTextView;
|
||||
if (_textView == nil)
|
||||
return;
|
||||
|
||||
if (_observingFrameChanges == old_observing)
|
||||
return;
|
||||
|
||||
nc = [NSNotificationCenter defaultCenter];
|
||||
|
||||
if (_observingFrameChanges)
|
||||
{
|
||||
[_textView setPostsFrameChangedNotifications: YES];
|
||||
[nc addObserver: self
|
||||
selector: @selector(_textViewFrameChanged:)
|
||||
name: NSViewFrameDidChangeNotification
|
||||
|
|
Loading…
Reference in a new issue