mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-04-23 15:11:37 +00:00
-dealloc and -setDocumentView:
Support for NSTableView superviewFrameChanged method git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@11277 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
1291ab4df1
commit
6bd75c41bc
1 changed files with 28 additions and 0 deletions
|
@ -35,6 +35,7 @@
|
|||
#include <AppKit/NSGraphics.h>
|
||||
#include <AppKit/PSOperators.h>
|
||||
|
||||
@class NSTableView;
|
||||
|
||||
/*
|
||||
* Return the biggest integral (in device space) rect contained in rect.
|
||||
|
@ -96,6 +97,11 @@ static inline NSRect integralRect (NSRect rect, NSView *view)
|
|||
NSNotificationCenter *nc = [NSNotificationCenter defaultCenter];
|
||||
|
||||
[nc removeObserver: self name: nil object: _documentView];
|
||||
if ([_documentView isKindOfClass: [NSTableView class]])
|
||||
{
|
||||
[nc removeObserver: _documentView name:nil object:self];
|
||||
}
|
||||
|
||||
RELEASE(_documentView);
|
||||
}
|
||||
RELEASE(_cursor);
|
||||
|
@ -117,6 +123,13 @@ static inline NSRect integralRect (NSRect rect, NSView *view)
|
|||
if (_documentView)
|
||||
{
|
||||
[nc removeObserver: self name: nil object: _documentView];
|
||||
/* if our documentView was a tableview, unregister its
|
||||
* observers
|
||||
*/
|
||||
if ([_documentView isKindOfClass: [NSTableView class]])
|
||||
{
|
||||
[nc removeObserver: _documentView name: nil object: self];
|
||||
}
|
||||
[_documentView removeFromSuperview];
|
||||
}
|
||||
|
||||
|
@ -157,6 +170,21 @@ static inline NSRect integralRect (NSRect rect, NSView *view)
|
|||
selector: @selector(viewBoundsChanged:)
|
||||
name: NSViewBoundsDidChangeNotification
|
||||
object: _documentView];
|
||||
|
||||
/*
|
||||
* if out document view is a tableview, let it know
|
||||
* when we resize
|
||||
*/
|
||||
if ([_documentView isKindOfClass: [NSTableView class]])
|
||||
{
|
||||
[nc removeObserver: _documentView name: nil object: self];
|
||||
[self setPostsFrameChangedNotifications: YES];
|
||||
[nc addObserver: _documentView
|
||||
selector: @selector(superviewFrameChanged:)
|
||||
name: NSViewFrameDidChangeNotification
|
||||
object: self];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/* TODO: Adjust the key view loop to include the new document view */
|
||||
|
|
Loading…
Reference in a new issue