mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-06-02 14:50:59 +00:00
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:
parent
bd75f0f185
commit
7b00766409
4 changed files with 311 additions and 289 deletions
|
@ -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>
|
||||
|
||||
* Source/NSSplitView.m ([-mouseDown:]): Better management of the
|
||||
|
|
|
@ -51,15 +51,22 @@
|
|||
|
||||
typedef int NSTrackingRectTag;
|
||||
|
||||
typedef enum _NSBorderType { // constants representing the
|
||||
NSNoBorder, // four types of borders that
|
||||
NSLineBorder, // can appear around an NSView
|
||||
/*
|
||||
* constants representing the four types of borders that
|
||||
* can appear around an NSView
|
||||
*/
|
||||
typedef enum _NSBorderType {
|
||||
NSNoBorder,
|
||||
NSLineBorder,
|
||||
NSBezelBorder,
|
||||
NSGrooveBorder
|
||||
} 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 {
|
||||
NSViewNotSizable = 0, // view does not resize with its superview
|
||||
NSViewMinXMargin = 1, // left margin between views can stretch
|
||||
|
@ -102,14 +109,14 @@ enum {
|
|||
NSView *_previousKeyView;
|
||||
}
|
||||
|
||||
//
|
||||
//Initializing NSView Objects
|
||||
//
|
||||
/*
|
||||
* Initializing NSView Objects
|
||||
*/
|
||||
- (id) initWithFrame: (NSRect)frameRect;
|
||||
|
||||
//
|
||||
// Managing the NSView Hierarchy
|
||||
//
|
||||
/*
|
||||
* Managing the NSView Hierarchy
|
||||
*/
|
||||
- (void) addSubview: (NSView*)aView;
|
||||
- (void) addSubview: (NSView*)aView
|
||||
positioned: (NSWindowOrderingMode)place
|
||||
|
@ -129,9 +136,9 @@ enum {
|
|||
- (void) viewWillMoveToSuperview: (NSView*)newSuper;
|
||||
- (void) viewWillMoveToWindow: (NSWindow*)newWindow;
|
||||
|
||||
//
|
||||
// Modifying the Frame Rectangle
|
||||
//
|
||||
/*
|
||||
* Modifying the Frame Rectangle
|
||||
*/
|
||||
- (float) frameRotation;
|
||||
- (NSRect) frame;
|
||||
- (void) rotateByAngle: (float)angle;
|
||||
|
@ -140,10 +147,9 @@ enum {
|
|||
- (void) setFrameRotation: (float)angle;
|
||||
- (void) setFrameSize: (NSSize)newSize;
|
||||
|
||||
//
|
||||
// Modifying the Coordinate System
|
||||
//
|
||||
|
||||
/*
|
||||
* Modifying the Coordinate System
|
||||
*/
|
||||
- (float) boundsRotation;
|
||||
- (NSRect) bounds;
|
||||
- (BOOL) isFlipped;
|
||||
|
@ -156,9 +162,9 @@ enum {
|
|||
- (void) setBoundsSize: (NSSize)newSize;
|
||||
- (void) translateOriginToPoint: (NSPoint)point;
|
||||
|
||||
//
|
||||
// Converting Coordinates
|
||||
//
|
||||
/*
|
||||
* Converting Coordinates
|
||||
*/
|
||||
- (NSRect) centerScanRect: (NSRect)aRect;
|
||||
- (NSPoint) convertPoint: (NSPoint)aPoint
|
||||
fromView: (NSView*)aView;
|
||||
|
@ -173,17 +179,17 @@ enum {
|
|||
- (NSSize) convertSize: (NSSize)aSize
|
||||
toView: (NSView*)aView;
|
||||
|
||||
//
|
||||
// Notifying Ancestor Views
|
||||
//
|
||||
/*
|
||||
* Notifying Ancestor Views
|
||||
*/
|
||||
- (void) setPostsFrameChangedNotifications: (BOOL)flag;
|
||||
- (BOOL) postsFrameChangedNotifications;
|
||||
- (void) setPostsBoundsChangedNotifications: (BOOL)flag;
|
||||
- (BOOL) postsBoundsChangedNotifications;
|
||||
|
||||
//
|
||||
// Resizing Subviews
|
||||
//
|
||||
/*
|
||||
* Resizing Subviews
|
||||
*/
|
||||
- (void) resizeSubviewsWithOldSize: (NSSize)oldSize;
|
||||
- (void) setAutoresizesSubviews: (BOOL)flag;
|
||||
- (BOOL) autoresizesSubviews;
|
||||
|
@ -191,25 +197,25 @@ enum {
|
|||
- (unsigned int) autoresizingMask;
|
||||
- (void) resizeWithOldSuperviewSize: (NSSize)oldSize;
|
||||
|
||||
//
|
||||
// Graphics State Objects
|
||||
//
|
||||
/*
|
||||
* Graphics State Objects
|
||||
*/
|
||||
- (void) allocateGState;
|
||||
- (void) releaseGState;
|
||||
- (int) gState;
|
||||
- (void) renewGState;
|
||||
- (void) setUpGState;
|
||||
|
||||
//
|
||||
// Focusing
|
||||
//
|
||||
/*
|
||||
* Focusing
|
||||
*/
|
||||
+ (NSView*) focusView;
|
||||
- (void) lockFocus;
|
||||
- (void) unlockFocus;
|
||||
|
||||
//
|
||||
// Displaying
|
||||
//
|
||||
/*
|
||||
* Displaying
|
||||
*/
|
||||
- (BOOL) canDraw;
|
||||
- (void) display;
|
||||
- (void) displayIfNeeded;
|
||||
|
@ -226,9 +232,9 @@ enum {
|
|||
- (void) setNeedsDisplayInRect: (NSRect)invalidRect;
|
||||
- (BOOL) shouldDrawColor;
|
||||
|
||||
//
|
||||
// Scrolling
|
||||
//
|
||||
/*
|
||||
* Scrolling
|
||||
*/
|
||||
- (NSRect) adjustScroll: (NSRect)newVisible;
|
||||
- (BOOL) autoscroll: (NSEvent*)theEvent;
|
||||
- (NSScrollView*) enclosingScrollView;
|
||||
|
@ -240,9 +246,9 @@ enum {
|
|||
by: (NSSize)delta;
|
||||
- (BOOL) scrollRectToVisible: (NSRect)aRect;
|
||||
|
||||
//
|
||||
// Managing the Cursor
|
||||
//
|
||||
/*
|
||||
* Managing the Cursor
|
||||
*/
|
||||
- (void) addCursorRect: (NSRect)aRect
|
||||
cursor: (NSCursor*)anObject;
|
||||
- (void) discardCursorRects;
|
||||
|
@ -250,15 +256,15 @@ enum {
|
|||
cursor: (NSCursor*)anObject;
|
||||
- (void) resetCursorRects;
|
||||
|
||||
//
|
||||
// Assigning a Tag
|
||||
//
|
||||
/*
|
||||
* Assigning a Tag
|
||||
*/
|
||||
- (int) tag;
|
||||
- (id) viewWithTag: (int)aTag;
|
||||
|
||||
//
|
||||
// Aiding Event Handling
|
||||
//
|
||||
/*
|
||||
* Aiding Event Handling
|
||||
*/
|
||||
- (BOOL) acceptsFirstMouse: (NSEvent*)theEvent;
|
||||
- (NSView*) hitTest: (NSPoint)aPoint;
|
||||
- (BOOL) mouse: (NSPoint)aPoint
|
||||
|
@ -277,9 +283,9 @@ enum {
|
|||
- (NSView*) previousKeyView;
|
||||
- (NSView*) previousValidKeyView;
|
||||
|
||||
//
|
||||
// Dragging
|
||||
//
|
||||
/*
|
||||
* Dragging
|
||||
*/
|
||||
- (BOOL) dragFile: (NSString*)filename
|
||||
fromRect: (NSRect)rect
|
||||
slideBack: (BOOL)slideFlag
|
||||
|
@ -294,18 +300,18 @@ enum {
|
|||
- (void) registerForDraggedTypes: (NSArray*)newTypes;
|
||||
- (void) unregisterDraggedTypes;
|
||||
|
||||
//
|
||||
// Printing
|
||||
//
|
||||
/*
|
||||
* Printing
|
||||
*/
|
||||
- (NSData*) dataWithEPSInsideRect: (NSRect)aRect;
|
||||
- (void) fax: (id)sender;
|
||||
- (void) print: (id)sender;
|
||||
- (void) writeEPSInsideRect: (NSRect)rect
|
||||
toPasteboard: (NSPasteboard*)pasteboard;
|
||||
|
||||
//
|
||||
// Pagination
|
||||
//
|
||||
/*
|
||||
* Pagination
|
||||
*/
|
||||
- (void) adjustPageHeightNew: (float*)newBottom
|
||||
top: (float)oldTop
|
||||
bottom: (float)oldBottom
|
||||
|
@ -321,12 +327,12 @@ enum {
|
|||
- (NSRect) rectForPage: (int)page;
|
||||
- (float) widthAdjustLimit;
|
||||
|
||||
//
|
||||
// Writing Conforming PostScript
|
||||
//
|
||||
/*
|
||||
* Writing Conforming PostScript
|
||||
*/
|
||||
- (void) addToPageSetup;
|
||||
- (void) beginPage: (int)ordinalNum
|
||||
label:(NSString *)aString
|
||||
abel: (NSString*)aString
|
||||
bBox: (NSRect)pageRect
|
||||
fonts: (NSString*)fontNames;
|
||||
- (void) beginPageSetupRect: (NSRect)aRect
|
||||
|
@ -349,30 +355,24 @@ enum {
|
|||
- (void) endPage;
|
||||
- (void) endTrailer;
|
||||
|
||||
//
|
||||
// NSCoding protocol
|
||||
//
|
||||
- (void)encodeWithCoder:aCoder;
|
||||
- initWithCoder:aDecoder;
|
||||
/*
|
||||
* NSCoding protocol
|
||||
*/
|
||||
- (void) encodeWithCoder: (NSCoder*)aCoder;
|
||||
- (id) initWithCoder: (NSCoder*)aDecoder;
|
||||
|
||||
@end
|
||||
|
||||
|
||||
@class NSAffineTransform;
|
||||
|
||||
//
|
||||
// GNUstep extensions
|
||||
// Methods whose names begin with an underscore must NOT be overridden.
|
||||
//
|
||||
/*
|
||||
* GNUstep extensions
|
||||
* Methods whose names begin with an underscore must NOT be overridden.
|
||||
*/
|
||||
#ifndef NO_GNUSTEP
|
||||
@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
|
||||
* of the view and it's subview as being invalid. NSViews methods call this
|
||||
|
@ -384,6 +384,8 @@ enum {
|
|||
|
||||
- (NSAffineTransform*) _matrixToWindow;
|
||||
- (NSAffineTransform*) _matrixFromWindow;
|
||||
|
||||
- (void) _removeSubview: (NSView*)aSubview;
|
||||
@end
|
||||
#endif
|
||||
|
||||
|
|
|
@ -207,6 +207,22 @@ static Class rulerViewClass = nil;
|
|||
[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
|
||||
{
|
||||
[_horizScroller removeFromSuperview];
|
||||
|
|
100
Source/NSView.m
100
Source/NSView.m
|
@ -265,6 +265,10 @@ GSSetDragTypes(NSView* obj, NSArray *types)
|
|||
|
||||
RETAIN(aView);
|
||||
[aView removeFromSuperview];
|
||||
if (aView->_coordinates_valid)
|
||||
{
|
||||
(*invalidateImp)(aView, invalidateSel);
|
||||
}
|
||||
[aView viewWillMoveToWindow: _window];
|
||||
[aView viewWillMoveToSuperview: self];
|
||||
[aView setNextResponder: self];
|
||||
|
@ -301,6 +305,10 @@ GSSetDragTypes(NSView* obj, NSArray *types)
|
|||
}
|
||||
RETAIN(aView);
|
||||
[aView removeFromSuperview];
|
||||
if (aView->_coordinates_valid)
|
||||
{
|
||||
(*invalidateImp)(aView, invalidateSel);
|
||||
}
|
||||
[aView viewWillMoveToWindow: _window];
|
||||
[aView viewWillMoveToSuperview: self];
|
||||
[aView setNextResponder: self];
|
||||
|
@ -372,67 +380,19 @@ GSSetDragTypes(NSView* obj, NSArray *types)
|
|||
|
||||
- (void) removeFromSuperviewWithoutNeedingDisplay
|
||||
{
|
||||
/* This must be first because it invokes -resignFirstResponder:,
|
||||
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)
|
||||
if (_super_view != nil)
|
||||
{
|
||||
(*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
|
||||
{
|
||||
/* This must be first because it invokes -resignFirstResponder:,
|
||||
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)
|
||||
if (_super_view != nil)
|
||||
{
|
||||
(*invalidateImp)(self, invalidateSel);
|
||||
}
|
||||
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 _removeSubview: self];
|
||||
}
|
||||
_super_view = nil;
|
||||
[self viewWillMoveToWindow: nil];
|
||||
RELEASE(self);
|
||||
}
|
||||
|
||||
- (void) replaceSubview: (NSView*)oldView with: (NSView*)newView
|
||||
|
@ -454,6 +414,10 @@ GSSetDragTypes(NSView* obj, NSArray *types)
|
|||
*/
|
||||
RETAIN(newView);
|
||||
[newView removeFromSuperview];
|
||||
if (newView->_coordinates_valid)
|
||||
{
|
||||
(*invalidateImp)(newView, invalidateSel);
|
||||
}
|
||||
[newView viewWillMoveToWindow: _window];
|
||||
[newView viewWillMoveToSuperview: self];
|
||||
[newView setNextResponder: self];
|
||||
|
@ -486,6 +450,10 @@ GSSetDragTypes(NSView* obj, NSArray *types)
|
|||
*/
|
||||
RETAIN(newView);
|
||||
[newView removeFromSuperview];
|
||||
if (newView->_coordinates_valid)
|
||||
{
|
||||
(*invalidateImp)(newView, invalidateSel);
|
||||
}
|
||||
index = [_sub_views indexOfObjectIdenticalTo: oldView];
|
||||
[oldView removeFromSuperview];
|
||||
[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
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue