Minor fixups

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@6246 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
richard 2000-03-10 07:48:29 +00:00
parent bd75f0f185
commit 7b00766409
4 changed files with 311 additions and 289 deletions

View file

@ -1,3 +1,11 @@
Fri Mar 10 06:46:00 2000 Richard Frith-Macdonald <richard@brainstorm.co.uk>
* Source/NSView.m: Added ([_removeSubview:]) and make all subview
removals use it. Modify addition of subviews to invalidate the
subview coordinates.
* Source/NSScrollView.m: Use _removeSubview
* Source/AppKit/NSView.h: tidyup and add new method.
Fri Mar 10 02:12:34 2000 Nicola Pero <n.pero@mi.flashnet.it> Fri Mar 10 02:12:34 2000 Nicola Pero <n.pero@mi.flashnet.it>
* Source/NSSplitView.m ([-mouseDown:]): Better management of the * Source/NSSplitView.m ([-mouseDown:]): Better management of the

View file

@ -51,15 +51,22 @@
typedef int NSTrackingRectTag; typedef int NSTrackingRectTag;
typedef enum _NSBorderType { // constants representing the /*
NSNoBorder, // four types of borders that * constants representing the four types of borders that
NSLineBorder, // can appear around an NSView * can appear around an NSView
*/
typedef enum _NSBorderType {
NSNoBorder,
NSLineBorder,
NSBezelBorder, NSBezelBorder,
NSGrooveBorder NSGrooveBorder
} NSBorderType; } NSBorderType;
// autoresize constants which NSView uses in
// determining the parts of a view which are /*
// resized when the view's superview is resized * autoresize constants which NSView uses in
* determining the parts of a view which are
* resized when the view's superview is resized
*/
enum { enum {
NSViewNotSizable = 0, // view does not resize with its superview NSViewNotSizable = 0, // view does not resize with its superview
NSViewMinXMargin = 1, // left margin between views can stretch NSViewMinXMargin = 1, // left margin between views can stretch
@ -102,114 +109,113 @@ enum {
NSView *_previousKeyView; NSView *_previousKeyView;
} }
// /*
//Initializing NSView Objects * Initializing NSView Objects
// */
- (id)initWithFrame:(NSRect)frameRect; - (id) initWithFrame: (NSRect)frameRect;
// /*
// Managing the NSView Hierarchy * Managing the NSView Hierarchy
// */
- (void)addSubview:(NSView *)aView; - (void) addSubview: (NSView*)aView;
- (void)addSubview:(NSView *)aView - (void) addSubview: (NSView*)aView
positioned:(NSWindowOrderingMode)place positioned: (NSWindowOrderingMode)place
relativeTo:(NSView *)otherView; relativeTo: (NSView*)otherView;
- (NSView *)ancestorSharedWithView:(NSView *)aView; - (NSView*) ancestorSharedWithView: (NSView*)aView;
- (BOOL)isDescendantOf:(NSView *)aView; - (BOOL) isDescendantOf: (NSView*)aView;
- (NSView *)opaqueAncestor; - (NSView*) opaqueAncestor;
- (void)removeFromSuperviewWithoutNeedingDisplay; - (void) removeFromSuperviewWithoutNeedingDisplay;
- (void)removeFromSuperview; - (void) removeFromSuperview;
- (void)replaceSubview:(NSView *)oldView - (void) replaceSubview: (NSView*)oldView
with:(NSView *)newView; with: (NSView*)newView;
- (void)sortSubviewsUsingFunction:(int (*)(id ,id ,void *))compare - (void) sortSubviewsUsingFunction: (int (*)(id ,id ,void*))compare
context:(void *)context; context: (void*)context;
- (NSArray *)subviews; - (NSArray*) subviews;
- (NSView *)superview; - (NSView*) superview;
- (NSWindow *)window; - (NSWindow*) window;
- (void)viewWillMoveToSuperview:(NSView *)newSuper; - (void) viewWillMoveToSuperview: (NSView*)newSuper;
- (void)viewWillMoveToWindow:(NSWindow *)newWindow; - (void) viewWillMoveToWindow: (NSWindow*)newWindow;
// /*
// Modifying the Frame Rectangle * Modifying the Frame Rectangle
// */
- (float)frameRotation; - (float) frameRotation;
- (NSRect)frame; - (NSRect) frame;
- (void)rotateByAngle:(float)angle; - (void) rotateByAngle: (float)angle;
- (void)setFrame:(NSRect)frameRect; - (void) setFrame: (NSRect)frameRect;
- (void)setFrameOrigin:(NSPoint)newOrigin; - (void) setFrameOrigin: (NSPoint)newOrigin;
- (void)setFrameRotation:(float)angle; - (void) setFrameRotation: (float)angle;
- (void)setFrameSize:(NSSize)newSize; - (void) setFrameSize: (NSSize)newSize;
// /*
// Modifying the Coordinate System * Modifying the Coordinate System
// */
- (float) boundsRotation;
- (NSRect) bounds;
- (BOOL) isFlipped;
- (BOOL) isRotatedFromBase;
- (BOOL) isRotatedOrScaledFromBase;
- (void) scaleUnitSquareToSize: (NSSize)newSize;
- (void) setBounds: (NSRect)aRect;
- (void) setBoundsOrigin: (NSPoint)newOrigin;
- (void) setBoundsRotation: (float)angle;
- (void) setBoundsSize: (NSSize)newSize;
- (void) translateOriginToPoint: (NSPoint)point;
- (float)boundsRotation; /*
- (NSRect)bounds; * Converting Coordinates
- (BOOL)isFlipped; */
- (BOOL)isRotatedFromBase; - (NSRect) centerScanRect: (NSRect)aRect;
- (BOOL)isRotatedOrScaledFromBase; - (NSPoint) convertPoint: (NSPoint)aPoint
- (void)scaleUnitSquareToSize:(NSSize)newSize; fromView: (NSView*)aView;
- (void)setBounds:(NSRect)aRect; - (NSPoint) convertPoint: (NSPoint)aPoint
- (void)setBoundsOrigin:(NSPoint)newOrigin; toView: (NSView*)aView;
- (void)setBoundsRotation:(float)angle; - (NSRect) convertRect: (NSRect)aRect
- (void)setBoundsSize:(NSSize)newSize; fromView: (NSView*)aView;
- (void)translateOriginToPoint:(NSPoint)point; - (NSRect) convertRect: (NSRect)aRect
toView: (NSView*)aView;
- (NSSize) convertSize: (NSSize)aSize
fromView: (NSView*)aView;
- (NSSize) convertSize: (NSSize)aSize
toView: (NSView*)aView;
// /*
// Converting Coordinates * Notifying Ancestor Views
// */
- (NSRect)centerScanRect:(NSRect)aRect; - (void) setPostsFrameChangedNotifications: (BOOL)flag;
- (NSPoint)convertPoint:(NSPoint)aPoint - (BOOL) postsFrameChangedNotifications;
fromView:(NSView *)aView; - (void) setPostsBoundsChangedNotifications: (BOOL)flag;
- (NSPoint)convertPoint:(NSPoint)aPoint - (BOOL) postsBoundsChangedNotifications;
toView:(NSView *)aView;
- (NSRect)convertRect:(NSRect)aRect
fromView:(NSView *)aView;
- (NSRect)convertRect:(NSRect)aRect
toView:(NSView *)aView;
- (NSSize)convertSize:(NSSize)aSize
fromView:(NSView *)aView;
- (NSSize)convertSize:(NSSize)aSize
toView:(NSView *)aView;
// /*
// Notifying Ancestor Views * Resizing Subviews
// */
- (void)setPostsFrameChangedNotifications:(BOOL)flag; - (void) resizeSubviewsWithOldSize: (NSSize)oldSize;
- (BOOL)postsFrameChangedNotifications; - (void) setAutoresizesSubviews: (BOOL)flag;
- (void)setPostsBoundsChangedNotifications:(BOOL)flag; - (BOOL) autoresizesSubviews;
- (BOOL)postsBoundsChangedNotifications; - (void) setAutoresizingMask: (unsigned int)mask;
- (unsigned int) autoresizingMask;
- (void) resizeWithOldSuperviewSize: (NSSize)oldSize;
// /*
// Resizing Subviews * Graphics State Objects
// */
- (void)resizeSubviewsWithOldSize:(NSSize)oldSize; - (void) allocateGState;
- (void)setAutoresizesSubviews:(BOOL)flag; - (void) releaseGState;
- (BOOL)autoresizesSubviews; - (int) gState;
- (void)setAutoresizingMask:(unsigned int)mask; - (void) renewGState;
- (unsigned int)autoresizingMask; - (void) setUpGState;
- (void)resizeWithOldSuperviewSize:(NSSize)oldSize;
// /*
// Graphics State Objects * Focusing
// */
- (void)allocateGState; + (NSView*) focusView;
- (void)releaseGState; - (void) lockFocus;
- (int)gState; - (void) unlockFocus;
- (void)renewGState;
- (void)setUpGState;
// /*
// Focusing * Displaying
// */
+ (NSView *)focusView;
- (void)lockFocus;
- (void)unlockFocus;
//
// Displaying
//
- (BOOL) canDraw; - (BOOL) canDraw;
- (void) display; - (void) display;
- (void) displayIfNeeded; - (void) displayIfNeeded;
@ -226,153 +232,147 @@ enum {
- (void) setNeedsDisplayInRect: (NSRect)invalidRect; - (void) setNeedsDisplayInRect: (NSRect)invalidRect;
- (BOOL) shouldDrawColor; - (BOOL) shouldDrawColor;
// /*
// Scrolling * Scrolling
// */
- (NSRect)adjustScroll:(NSRect)newVisible; - (NSRect) adjustScroll: (NSRect)newVisible;
- (BOOL)autoscroll:(NSEvent *)theEvent; - (BOOL) autoscroll: (NSEvent*)theEvent;
- (NSScrollView*) enclosingScrollView; - (NSScrollView*) enclosingScrollView;
- (void)reflectScrolledClipView:(NSClipView *)aClipView; - (void) reflectScrolledClipView: (NSClipView*)aClipView;
- (void)scrollClipView:(NSClipView *)aClipView - (void) scrollClipView: (NSClipView*)aClipView
toPoint:(NSPoint)aPoint; toPoint: (NSPoint)aPoint;
- (void)scrollPoint:(NSPoint)aPoint; - (void) scrollPoint: (NSPoint)aPoint;
- (void)scrollRect:(NSRect)aRect - (void) scrollRect: (NSRect)aRect
by:(NSSize)delta; by: (NSSize)delta;
- (BOOL)scrollRectToVisible:(NSRect)aRect; - (BOOL) scrollRectToVisible: (NSRect)aRect;
// /*
// Managing the Cursor * Managing the Cursor
// */
- (void)addCursorRect:(NSRect)aRect - (void) addCursorRect: (NSRect)aRect
cursor:(NSCursor *)anObject; cursor: (NSCursor*)anObject;
- (void)discardCursorRects; - (void) discardCursorRects;
- (void)removeCursorRect:(NSRect)aRect - (void) removeCursorRect: (NSRect)aRect
cursor:(NSCursor *)anObject; cursor: (NSCursor*)anObject;
- (void)resetCursorRects; - (void) resetCursorRects;
// /*
// Assigning a Tag * Assigning a Tag
// */
- (int)tag; - (int) tag;
- (id)viewWithTag:(int)aTag; - (id) viewWithTag: (int)aTag;
// /*
// Aiding Event Handling * Aiding Event Handling
// */
- (BOOL)acceptsFirstMouse:(NSEvent *)theEvent; - (BOOL) acceptsFirstMouse: (NSEvent*)theEvent;
- (NSView *)hitTest:(NSPoint)aPoint; - (NSView*) hitTest: (NSPoint)aPoint;
- (BOOL)mouse:(NSPoint)aPoint - (BOOL) mouse: (NSPoint)aPoint
inRect:(NSRect)aRect; inRect: (NSRect)aRect;
- (BOOL)performKeyEquivalent:(NSEvent *)theEvent; - (BOOL) performKeyEquivalent: (NSEvent*)theEvent;
- (void)removeTrackingRect:(NSTrackingRectTag)tag; - (void) removeTrackingRect: (NSTrackingRectTag)tag;
- (BOOL)shouldDelayWindowOrderingForEvent:(NSEvent *)anEvent; - (BOOL) shouldDelayWindowOrderingForEvent: (NSEvent*)anEvent;
- (NSTrackingRectTag)addTrackingRect:(NSRect)aRect - (NSTrackingRectTag) addTrackingRect: (NSRect)aRect
owner:(id)anObject owner: (id)anObject
userData:(void *)data userData: (void*)data
assumeInside:(BOOL)flag; assumeInside: (BOOL)flag;
- (void)setNextKeyView:(NSView *)aView; - (void) setNextKeyView: (NSView*)aView;
- (NSView *)nextKeyView; - (NSView*) nextKeyView;
- (NSView *)nextValidKeyView; - (NSView*) nextValidKeyView;
- (void)setPreviousKeyView:(NSView *)aView; - (void) setPreviousKeyView: (NSView*)aView;
- (NSView *)previousKeyView; - (NSView*) previousKeyView;
- (NSView *)previousValidKeyView; - (NSView*) previousValidKeyView;
// /*
// Dragging * Dragging
// */
- (BOOL)dragFile:(NSString *)filename - (BOOL) dragFile: (NSString*)filename
fromRect:(NSRect)rect fromRect: (NSRect)rect
slideBack:(BOOL)slideFlag slideBack: (BOOL)slideFlag
event:(NSEvent *)event; event: (NSEvent*)event;
- (void)dragImage:(NSImage *)anImage - (void) dragImage: (NSImage*)anImage
at:(NSPoint)viewLocation at: (NSPoint)viewLocation
offset:(NSSize)initialOffset offset: (NSSize)initialOffset
event:(NSEvent *)event event: (NSEvent*)event
pasteboard:(NSPasteboard *)pboard pasteboard: (NSPasteboard*)pboard
source:(id)sourceObject source: (id)sourceObject
slideBack:(BOOL)slideFlag; slideBack: (BOOL)slideFlag;
- (void)registerForDraggedTypes:(NSArray *)newTypes; - (void) registerForDraggedTypes: (NSArray*)newTypes;
- (void)unregisterDraggedTypes; - (void) unregisterDraggedTypes;
// /*
// Printing * Printing
// */
- (NSData *)dataWithEPSInsideRect:(NSRect)aRect; - (NSData*) dataWithEPSInsideRect: (NSRect)aRect;
- (void)fax:(id)sender; - (void) fax: (id)sender;
- (void)print:(id)sender; - (void) print: (id)sender;
- (void)writeEPSInsideRect:(NSRect)rect - (void) writeEPSInsideRect: (NSRect)rect
toPasteboard:(NSPasteboard *)pasteboard; toPasteboard: (NSPasteboard*)pasteboard;
// /*
// Pagination * Pagination
// */
- (void)adjustPageHeightNew:(float *)newBottom - (void) adjustPageHeightNew: (float*)newBottom
top:(float)oldTop top: (float)oldTop
bottom:(float)oldBottom bottom: (float)oldBottom
limit:(float)bottomLimit; limit: (float)bottomLimit;
- (void)adjustPageWidthNew:(float *)newRight - (void) adjustPageWidthNew: (float*)newRight
left:(float)oldLeft left: (float)oldLeft
right:(float)oldRight right: (float)oldRight
limit:(float)rightLimit; limit: (float)rightLimit;
- (float)heightAdjustLimit; - (float) heightAdjustLimit;
- (BOOL)knowsPagesFirst:(int *)firstPageNum - (BOOL) knowsPagesFirst: (int*)firstPageNum
last:(int *)lastPageNum; last: (int*)lastPageNum;
- (NSPoint)locationOfPrintRect:(NSRect)aRect; - (NSPoint) locationOfPrintRect: (NSRect)aRect;
- (NSRect)rectForPage:(int)page; - (NSRect) rectForPage: (int)page;
- (float)widthAdjustLimit; - (float) widthAdjustLimit;
// /*
// Writing Conforming PostScript * Writing Conforming PostScript
// */
- (void)addToPageSetup; - (void) addToPageSetup;
- (void)beginPage:(int)ordinalNum - (void) beginPage: (int)ordinalNum
label:(NSString *)aString abel: (NSString*)aString
bBox:(NSRect)pageRect bBox: (NSRect)pageRect
fonts:(NSString *)fontNames; fonts: (NSString*)fontNames;
- (void)beginPageSetupRect:(NSRect)aRect - (void) beginPageSetupRect: (NSRect)aRect
placement:(NSPoint)location; placement: (NSPoint)location;
- (void)beginPrologueBBox:(NSRect)boundingBox - (void) beginPrologueBBox: (NSRect)boundingBox
creationDate:(NSString *)dateCreated creationDate: (NSString*)dateCreated
createdBy:(NSString *)anApplication createdBy: (NSString*)anApplication
fonts:(NSString *)fontNames fonts: (NSString*)fontNames
forWhom:(NSString *)user forWhom: (NSString*)user
pages:(int)numPages pages: (int)numPages
title:(NSString *)aTitle; title: (NSString*)aTitle;
- (void)beginSetup; - (void) beginSetup;
- (void)beginTrailer; - (void) beginTrailer;
- (void)drawPageBorderWithSize:(NSSize)borderSize; - (void) drawPageBorderWithSize: (NSSize)borderSize;
- (void)drawSheetBorderWithSize:(NSSize)borderSize; - (void) drawSheetBorderWithSize: (NSSize)borderSize;
- (void)endHeaderComments; - (void) endHeaderComments;
- (void)endPrologue; - (void) endPrologue;
- (void)endSetup; - (void) endSetup;
- (void)endPageSetup; - (void) endPageSetup;
- (void)endPage; - (void) endPage;
- (void)endTrailer; - (void) endTrailer;
// /*
// NSCoding protocol * NSCoding protocol
// */
- (void)encodeWithCoder:aCoder; - (void) encodeWithCoder: (NSCoder*)aCoder;
- initWithCoder:aDecoder; - (id) initWithCoder: (NSCoder*)aDecoder;
@end @end
@class NSAffineTransform; @class NSAffineTransform;
// /*
// GNUstep extensions * GNUstep extensions
// Methods whose names begin with an underscore must NOT be overridden. * Methods whose names begin with an underscore must NOT be overridden.
// */
#ifndef NO_GNUSTEP #ifndef NO_GNUSTEP
@interface NSView (PrivateMethods) @interface NSView (PrivateMethods)
/*
* If the view is rotated, [-_boundingRectFor:] returns the bounding box
* of the rect in the "normal" coordinates
*/
- (NSRect) _boundingRectFor: (NSRect)rect;
/* /*
* The [-_invalidateCoordinates] method marks the cached visible rectangles * The [-_invalidateCoordinates] method marks the cached visible rectangles
* of the view and it's subview as being invalid. NSViews methods call this * of the view and it's subview as being invalid. NSViews methods call this
@ -382,8 +382,10 @@ enum {
- (void) _invalidateCoordinates; - (void) _invalidateCoordinates;
- (void) _rebuildCoordinates; - (void) _rebuildCoordinates;
- (NSAffineTransform*)_matrixToWindow; - (NSAffineTransform*) _matrixToWindow;
- (NSAffineTransform*)_matrixFromWindow; - (NSAffineTransform*) _matrixFromWindow;
- (void) _removeSubview: (NSView*)aSubview;
@end @end
#endif #endif

View file

@ -207,6 +207,22 @@ static Class rulerViewClass = nil;
[self tile]; [self tile];
} }
- (void) _removeSubview: (NSView*)aView
{
if (aView == _contentView)
{
RETAIN(aView);
_contentView = nil;
[super _removeSubview: aView];
RELEASE(aView);
[self tile];
}
else
{
[super _removeSubview: aView];
}
}
- (void) setHorizontalScroller: (NSScroller*)aScroller - (void) setHorizontalScroller: (NSScroller*)aScroller
{ {
[_horizScroller removeFromSuperview]; [_horizScroller removeFromSuperview];

View file

@ -265,6 +265,10 @@ GSSetDragTypes(NSView* obj, NSArray *types)
RETAIN(aView); RETAIN(aView);
[aView removeFromSuperview]; [aView removeFromSuperview];
if (aView->_coordinates_valid)
{
(*invalidateImp)(aView, invalidateSel);
}
[aView viewWillMoveToWindow: _window]; [aView viewWillMoveToWindow: _window];
[aView viewWillMoveToSuperview: self]; [aView viewWillMoveToSuperview: self];
[aView setNextResponder: self]; [aView setNextResponder: self];
@ -301,6 +305,10 @@ GSSetDragTypes(NSView* obj, NSArray *types)
} }
RETAIN(aView); RETAIN(aView);
[aView removeFromSuperview]; [aView removeFromSuperview];
if (aView->_coordinates_valid)
{
(*invalidateImp)(aView, invalidateSel);
}
[aView viewWillMoveToWindow: _window]; [aView viewWillMoveToWindow: _window];
[aView viewWillMoveToSuperview: self]; [aView viewWillMoveToSuperview: self];
[aView setNextResponder: self]; [aView setNextResponder: self];
@ -372,67 +380,19 @@ GSSetDragTypes(NSView* obj, NSArray *types)
- (void) removeFromSuperviewWithoutNeedingDisplay - (void) removeFromSuperviewWithoutNeedingDisplay
{ {
/* This must be first because it invokes -resignFirstResponder:, if (_super_view != nil)
which assumes the view is still in the view hierarchy */
if ([_window firstResponder] == self)
[_window makeFirstResponder: _window];
/*
* We MUST make sure that coordinates are invalidated even if we have
* no superview - cos they may have been rebuilt since we lost the
* superview and the fact that this method has been invoked probably
* means we are about to be placed in a new view where the coordinate
* system will be different.
*/
if (_coordinates_valid)
{ {
(*invalidateImp)(self, invalidateSel); [_super_view _removeSubview: self];
} }
if (!_super_view)
{
return;
}
RETAIN(self);
[_super_view->_sub_views removeObjectIdenticalTo: self];
if ([_super_view->_sub_views count] == 0)
{
_super_view->_rFlags.has_subviews = 0;
}
_super_view = nil;
[self viewWillMoveToWindow: nil];
RELEASE(self);
} }
- (void) removeFromSuperview - (void) removeFromSuperview
{ {
/* This must be first because it invokes -resignFirstResponder:, if (_super_view != nil)
which assumes the view is still in the view hierarchy */
if ([_window firstResponder] == self)
[_window makeFirstResponder: _window];
/*
* We MUST make sure that coordinates are invalidated even if we have
* no superview - cos they may have been rebuilt since we lost the
* superview and the fact that this method has been invoked probably
* means we are about to be placed in a new view where the coordinate
* system will be different.
*/
if (_coordinates_valid)
{ {
(*invalidateImp)(self, invalidateSel); [_super_view setNeedsDisplayInRect: _frame];
[_super_view _removeSubview: self];
} }
if (!_super_view)
{
return;
}
[_super_view setNeedsDisplayInRect: _frame];
RETAIN(self);
[_super_view->_sub_views removeObjectIdenticalTo: self];
if ([_super_view->_sub_views count] == 0)
{
_super_view->_rFlags.has_subviews = 0;
}
_super_view = nil;
[self viewWillMoveToWindow: nil];
RELEASE(self);
} }
- (void) replaceSubview: (NSView*)oldView with: (NSView*)newView - (void) replaceSubview: (NSView*)oldView with: (NSView*)newView
@ -454,6 +414,10 @@ GSSetDragTypes(NSView* obj, NSArray *types)
*/ */
RETAIN(newView); RETAIN(newView);
[newView removeFromSuperview]; [newView removeFromSuperview];
if (newView->_coordinates_valid)
{
(*invalidateImp)(newView, invalidateSel);
}
[newView viewWillMoveToWindow: _window]; [newView viewWillMoveToWindow: _window];
[newView viewWillMoveToSuperview: self]; [newView viewWillMoveToSuperview: self];
[newView setNextResponder: self]; [newView setNextResponder: self];
@ -486,6 +450,10 @@ GSSetDragTypes(NSView* obj, NSArray *types)
*/ */
RETAIN(newView); RETAIN(newView);
[newView removeFromSuperview]; [newView removeFromSuperview];
if (newView->_coordinates_valid)
{
(*invalidateImp)(newView, invalidateSel);
}
index = [_sub_views indexOfObjectIdenticalTo: oldView]; index = [_sub_views indexOfObjectIdenticalTo: oldView];
[oldView removeFromSuperview]; [oldView removeFromSuperview];
[newView viewWillMoveToWindow: _window]; [newView viewWillMoveToWindow: _window];
@ -2766,5 +2734,33 @@ static NSView* findByTag(NSView *view, int aTag, unsigned *level)
} }
} }
- (void) _removeSubview: (NSView*)aSubview
{
/*
* This must be first because it invokes -resignFirstResponder:,
* which assumes the view is still in the view hierarchy
*/
if ([_window firstResponder] == aSubview)
{
[_window makeFirstResponder: _window];
}
/*
* We make sure that the coordinates are invalidated even though the
* code to add this view to another view will also invalidate them.
* This is for consistency so that when a view is not in the view
* hierarchy, its coordinates should not be valid.
*/
if (aSubview->_coordinates_valid)
{
(*invalidateImp)(aSubview, invalidateSel);
}
aSubview->_super_view = nil;
[aSubview viewWillMoveToWindow: nil];
[_sub_views removeObjectIdenticalTo: aSubview];
if ([_sub_views count] == 0)
{
_rFlags.has_subviews = 0;
}
}
@end @end