mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-05-31 19:10:48 +00:00
Tidied
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@4390 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
8bfdcdce8c
commit
1e0a90c91d
2 changed files with 286 additions and 253 deletions
197
Source/NSView.m
197
Source/NSView.m
|
@ -23,7 +23,7 @@
|
||||||
|
|
||||||
This library is distributed in the hope that it will be useful,
|
This library is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
Library General Public License for more details.
|
Library General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU Library General Public
|
You should have received a copy of the GNU Library General Public
|
||||||
|
@ -54,9 +54,11 @@
|
||||||
|
|
||||||
@implementation NSView
|
@implementation NSView
|
||||||
|
|
||||||
//
|
/*
|
||||||
// Class variables
|
* Class variables
|
||||||
//
|
*/
|
||||||
|
static Class rectClass;
|
||||||
|
|
||||||
static NSAffineTransform *flip = nil;
|
static NSAffineTransform *flip = nil;
|
||||||
|
|
||||||
static void (*appImp)(NSAffineTransform*, SEL, NSAffineTransform*) = 0;
|
static void (*appImp)(NSAffineTransform*, SEL, NSAffineTransform*) = 0;
|
||||||
|
@ -65,9 +67,9 @@ static SEL appSel = @selector(appendTransform:);
|
||||||
static void (*invalidateImp)(NSView*, SEL) = 0;
|
static void (*invalidateImp)(NSView*, SEL) = 0;
|
||||||
static SEL invalidateSel = @selector(_invalidateCoordinates);
|
static SEL invalidateSel = @selector(_invalidateCoordinates);
|
||||||
|
|
||||||
//
|
/*
|
||||||
// Class methods
|
* Class methods
|
||||||
//
|
*/
|
||||||
+ (void) initialize
|
+ (void) initialize
|
||||||
{
|
{
|
||||||
if (self == [NSView class])
|
if (self == [NSView class])
|
||||||
|
@ -84,6 +86,7 @@ static SEL invalidateSel = @selector(_invalidateCoordinates);
|
||||||
flip = [matrixClass new];
|
flip = [matrixClass new];
|
||||||
[flip setTransformStruct: ats];
|
[flip setTransformStruct: ats];
|
||||||
|
|
||||||
|
rectClass = [GSTrackingRect class];
|
||||||
NSDebugLLog(@"NSView", @"Initialize NSView class\n");
|
NSDebugLLog(@"NSView", @"Initialize NSView class\n");
|
||||||
[self setVersion: 1];
|
[self setVersion: 1];
|
||||||
}
|
}
|
||||||
|
@ -98,9 +101,9 @@ static SEL invalidateSel = @selector(_invalidateCoordinates);
|
||||||
return [GSCurrentContext() focusView];
|
return [GSCurrentContext() focusView];
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
/*
|
||||||
// Instance methods
|
* Instance methods
|
||||||
//
|
*/
|
||||||
- (id) init
|
- (id) init
|
||||||
{
|
{
|
||||||
return [self initWithFrame: NSZeroRect];
|
return [self initWithFrame: NSZeroRect];
|
||||||
|
@ -108,7 +111,7 @@ static SEL invalidateSel = @selector(_invalidateCoordinates);
|
||||||
|
|
||||||
- (id) initWithFrame: (NSRect)frameRect
|
- (id) initWithFrame: (NSRect)frameRect
|
||||||
{
|
{
|
||||||
[super init]; // super is NSResponder
|
[super init];
|
||||||
|
|
||||||
NSAssert(frameRect.size.width >= 0 && frameRect.size.height >= 0,
|
NSAssert(frameRect.size.width >= 0 && frameRect.size.height >= 0,
|
||||||
@"illegal frame dimensions supplied");
|
@"illegal frame dimensions supplied");
|
||||||
|
@ -219,25 +222,26 @@ static SEL invalidateSel = @selector(_invalidateCoordinates);
|
||||||
|
|
||||||
- (NSView*) ancestorSharedWithView: (NSView*)aView
|
- (NSView*) ancestorSharedWithView: (NSView*)aView
|
||||||
{
|
{
|
||||||
if (self == aView) // Are they the same view?
|
if (self == aView)
|
||||||
return self;
|
return self;
|
||||||
|
|
||||||
if ([self isDescendantOf: aView]) // Is self a descendant of view?
|
if ([self isDescendantOf: aView])
|
||||||
return aView;
|
return aView;
|
||||||
|
|
||||||
if ([aView isDescendantOf: self]) // Is view a descendant of self?
|
if ([aView isDescendantOf: self])
|
||||||
return self;
|
return self;
|
||||||
|
|
||||||
// If neither are descendants of each other and either does not have a
|
/*
|
||||||
// superview then they cannot have a common ancestor
|
* If neither are descendants of each other and either does not have a
|
||||||
|
* superview then they cannot have a common ancestor
|
||||||
|
*/
|
||||||
if (![self superview])
|
if (![self superview])
|
||||||
return nil;
|
return nil;
|
||||||
|
|
||||||
if (![aView superview])
|
if (![aView superview])
|
||||||
return nil;
|
return nil;
|
||||||
|
|
||||||
// Find the common ancestor of superviews
|
/* Find the common ancestor of superviews */
|
||||||
return [[self superview] ancestorSharedWithView: [aView superview]];
|
return [[self superview] ancestorSharedWithView: [aView superview]];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -282,7 +286,7 @@ static SEL invalidateSel = @selector(_invalidateCoordinates);
|
||||||
if (coordinates_valid)
|
if (coordinates_valid)
|
||||||
(*invalidateImp)(self, invalidateSel);
|
(*invalidateImp)(self, invalidateSel);
|
||||||
|
|
||||||
if (!super_view) // if no superview then just return
|
if (!super_view)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if ([window firstResponder] == self)
|
if ([window firstResponder] == self)
|
||||||
|
@ -308,7 +312,7 @@ static SEL invalidateSel = @selector(_invalidateCoordinates);
|
||||||
if (coordinates_valid)
|
if (coordinates_valid)
|
||||||
(*invalidateImp)(self, invalidateSel);
|
(*invalidateImp)(self, invalidateSel);
|
||||||
|
|
||||||
if (!super_view) // if no superview then just return
|
if (!super_view)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if ([window firstResponder] == self)
|
if ([window firstResponder] == self)
|
||||||
|
@ -368,7 +372,7 @@ static SEL invalidateSel = @selector(_invalidateCoordinates);
|
||||||
/*
|
/*
|
||||||
* Ok - the standard case - we remove the newView from wherever it
|
* Ok - the standard case - we remove the newView from wherever it
|
||||||
* was (which may have been in this view), locate the position of
|
* was (which may have been in this view), locate the position of
|
||||||
* the oldView (which may have changed due to the removal of the
|
* the oldView (which may have changed due to the removal of the
|
||||||
* newView), remove the oldView, and insert the newView in it's
|
* newView), remove the oldView, and insert the newView in it's
|
||||||
* place.
|
* place.
|
||||||
*/
|
*/
|
||||||
|
@ -444,7 +448,7 @@ static SEL invalidateSel = @selector(_invalidateCoordinates);
|
||||||
bounds.size = frame.size;
|
bounds.size = frame.size;
|
||||||
[frameMatrix setFrameOrigin: frame.origin];
|
[frameMatrix setFrameOrigin: frame.origin];
|
||||||
|
|
||||||
[self resizeSubviewsWithOldSize: old_size]; // Resize the subviews
|
[self resizeSubviewsWithOldSize: old_size];
|
||||||
if (post_frame_changes)
|
if (post_frame_changes)
|
||||||
[[NSNotificationCenter defaultCenter]
|
[[NSNotificationCenter defaultCenter]
|
||||||
postNotificationName: NSViewFrameDidChangeNotification
|
postNotificationName: NSViewFrameDidChangeNotification
|
||||||
|
@ -474,7 +478,7 @@ static SEL invalidateSel = @selector(_invalidateCoordinates);
|
||||||
(*invalidateImp)(self, invalidateSel);
|
(*invalidateImp)(self, invalidateSel);
|
||||||
frame.size = bounds.size = newSize;
|
frame.size = bounds.size = newSize;
|
||||||
|
|
||||||
[self resizeSubviewsWithOldSize: old_size]; // Resize the subviews
|
[self resizeSubviewsWithOldSize: old_size];
|
||||||
if (post_frame_changes)
|
if (post_frame_changes)
|
||||||
[[NSNotificationCenter defaultCenter]
|
[[NSNotificationCenter defaultCenter]
|
||||||
postNotificationName: NSViewFrameDidChangeNotification
|
postNotificationName: NSViewFrameDidChangeNotification
|
||||||
|
@ -516,8 +520,8 @@ static SEL invalidateSel = @selector(_invalidateCoordinates);
|
||||||
|
|
||||||
- (void) scaleUnitSquareToSize: (NSSize)newSize
|
- (void) scaleUnitSquareToSize: (NSSize)newSize
|
||||||
{
|
{
|
||||||
float sx;
|
float sx;
|
||||||
float sy;
|
float sy;
|
||||||
|
|
||||||
NSAssert(newSize.width > 0 && newSize.height > 0, @"illegal size supplied");
|
NSAssert(newSize.width > 0 && newSize.height > 0, @"illegal size supplied");
|
||||||
|
|
||||||
|
@ -888,7 +892,9 @@ static SEL invalidateSel = @selector(_invalidateCoordinates);
|
||||||
post_bounds_changes = flag;
|
post_bounds_changes = flag;
|
||||||
}
|
}
|
||||||
|
|
||||||
// resize subviews only if we are supposed to and we have never been rotated
|
/*
|
||||||
|
* resize subviews only if we are supposed to and we have never been rotated
|
||||||
|
*/
|
||||||
- (void) resizeSubviewsWithOldSize: (NSSize)oldSize
|
- (void) resizeSubviewsWithOldSize: (NSSize)oldSize
|
||||||
{
|
{
|
||||||
if (_rFlags.has_subviews)
|
if (_rFlags.has_subviews)
|
||||||
|
@ -910,18 +916,20 @@ static SEL invalidateSel = @selector(_invalidateCoordinates);
|
||||||
|
|
||||||
- (void) resizeWithOldSuperviewSize: (NSSize)oldSize
|
- (void) resizeWithOldSuperviewSize: (NSSize)oldSize
|
||||||
{
|
{
|
||||||
float change, changePerOption;
|
float change;
|
||||||
int options = 0;
|
float changePerOption;
|
||||||
NSSize old_size = frame.size;
|
int options = 0;
|
||||||
NSSize superViewFrameSize = [super_view frame].size;
|
NSSize old_size = frame.size;
|
||||||
BOOL changedOrigin = NO;
|
NSSize superViewFrameSize = [super_view frame].size;
|
||||||
BOOL changedSize = NO;
|
BOOL changedOrigin = NO;
|
||||||
|
BOOL changedSize = NO;
|
||||||
|
|
||||||
// do nothing if view is not resizable
|
|
||||||
if (autoresizingMask == NSViewNotSizable)
|
if (autoresizingMask == NSViewNotSizable)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// determine if and how the X axis can be resized
|
/*
|
||||||
|
* determine if and how the X axis can be resized
|
||||||
|
*/
|
||||||
if (autoresizingMask & NSViewWidthSizable)
|
if (autoresizingMask & NSViewWidthSizable)
|
||||||
options++;
|
options++;
|
||||||
if (autoresizingMask & NSViewMinXMargin)
|
if (autoresizingMask & NSViewMinXMargin)
|
||||||
|
@ -929,7 +937,9 @@ static SEL invalidateSel = @selector(_invalidateCoordinates);
|
||||||
if (autoresizingMask & NSViewMaxXMargin)
|
if (autoresizingMask & NSViewMaxXMargin)
|
||||||
options++;
|
options++;
|
||||||
|
|
||||||
// adjust the X axis if any X options are set in the mask
|
/*
|
||||||
|
* adjust the X axis if any X options are set in the mask
|
||||||
|
*/
|
||||||
if (options >= 1)
|
if (options >= 1)
|
||||||
{
|
{
|
||||||
change = superViewFrameSize.width - oldSize.width;
|
change = superViewFrameSize.width - oldSize.width;
|
||||||
|
@ -956,7 +966,9 @@ static SEL invalidateSel = @selector(_invalidateCoordinates);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// determine if and how the Y axis can be resized
|
/*
|
||||||
|
* determine if and how the Y axis can be resized
|
||||||
|
*/
|
||||||
options = 0;
|
options = 0;
|
||||||
if (autoresizingMask & NSViewHeightSizable)
|
if (autoresizingMask & NSViewHeightSizable)
|
||||||
options++;
|
options++;
|
||||||
|
@ -965,7 +977,9 @@ static SEL invalidateSel = @selector(_invalidateCoordinates);
|
||||||
if (autoresizingMask & NSViewMaxYMargin)
|
if (autoresizingMask & NSViewMaxYMargin)
|
||||||
options++;
|
options++;
|
||||||
|
|
||||||
// adjust the Y axis if any Y options are set in the mask
|
/*
|
||||||
|
* adjust the Y axis if any Y options are set in the mask
|
||||||
|
*/
|
||||||
if (options >= 1)
|
if (options >= 1)
|
||||||
{
|
{
|
||||||
change = superViewFrameSize.height - oldSize.height;
|
change = superViewFrameSize.height - oldSize.height;
|
||||||
|
@ -1260,11 +1274,11 @@ static SEL invalidateSel = @selector(_invalidateCoordinates);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If the rect we displayed contains the invalidRect or visibleRect
|
* If the rect we displayed contains the invalidRect or visibleRect
|
||||||
* then we can empty invalidRect. All subviews will have been
|
* then we can empty invalidRect. All subviews will have been
|
||||||
* fully displayed, so this view no longer needs to be displayed.
|
* fully displayed, so this view no longer needs to be displayed.
|
||||||
*/
|
*/
|
||||||
if (NSEqualRects(aRect, NSUnionRect(invalidRect, aRect)) == YES
|
if (NSEqualRects(aRect, NSUnionRect(invalidRect, aRect)) == YES
|
||||||
|| NSEqualRects(aRect, NSUnionRect(visibleRect, aRect)) == YES)
|
|| NSEqualRects(aRect, NSUnionRect(visibleRect, aRect)) == YES)
|
||||||
{
|
{
|
||||||
invalidRect = NSZeroRect;
|
invalidRect = NSZeroRect;
|
||||||
needs_display = NO;
|
needs_display = NO;
|
||||||
|
@ -1300,7 +1314,7 @@ static SEL invalidateSel = @selector(_invalidateCoordinates);
|
||||||
|
|
||||||
if (NSIsEmptyRect(aRect) == NO)
|
if (NSIsEmptyRect(aRect) == NO)
|
||||||
{
|
{
|
||||||
NSGraphicsContext *ctxt = GSCurrentContext();
|
NSGraphicsContext *ctxt = GSCurrentContext();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Now we draw this view.
|
* Now we draw this view.
|
||||||
|
@ -1377,7 +1391,7 @@ static SEL invalidateSel = @selector(_invalidateCoordinates);
|
||||||
[window flushWindow];
|
[window flushWindow];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)drawRect: (NSRect)rect
|
- (void) drawRect: (NSRect)rect
|
||||||
{}
|
{}
|
||||||
|
|
||||||
- (NSRect) visibleRect
|
- (NSRect) visibleRect
|
||||||
|
@ -1434,15 +1448,15 @@ static SEL invalidateSel = @selector(_invalidateCoordinates);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
/*
|
||||||
// Scrolling
|
* Scrolling
|
||||||
//
|
*/
|
||||||
- (NSRect)adjustScroll: (NSRect)newVisible
|
- (NSRect) adjustScroll: (NSRect)newVisible
|
||||||
{
|
{
|
||||||
return NSZeroRect;
|
return NSZeroRect;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (BOOL)autoscroll: (NSEvent*)theEvent
|
- (BOOL) autoscroll: (NSEvent*)theEvent
|
||||||
{
|
{
|
||||||
if (super_view)
|
if (super_view)
|
||||||
return [super_view autoscroll: theEvent];
|
return [super_view autoscroll: theEvent];
|
||||||
|
@ -1467,17 +1481,16 @@ static SEL invalidateSel = @selector(_invalidateCoordinates);
|
||||||
return NO;
|
return NO;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
/*
|
||||||
// Managing the Cursor
|
* Managing the Cursor
|
||||||
//
|
*
|
||||||
// We utilize the tracking rectangle class
|
* We use the tracking rectangle class to maintain the cursor rects
|
||||||
// to also maintain the cursor rects
|
*/
|
||||||
//
|
|
||||||
- (void) addCursorRect: (NSRect)aRect cursor: (NSCursor*)anObject
|
- (void) addCursorRect: (NSRect)aRect cursor: (NSCursor*)anObject
|
||||||
{
|
{
|
||||||
GSTrackingRect *m;
|
GSTrackingRect *m;
|
||||||
|
|
||||||
m = [GSTrackingRect allocWithZone: NSDefaultMallocZone()];
|
m = [rectClass allocWithZone: NSDefaultMallocZone()];
|
||||||
m = [m initWithRect: aRect
|
m = [m initWithRect: aRect
|
||||||
tag: 0
|
tag: 0
|
||||||
owner: anObject
|
owner: anObject
|
||||||
|
@ -1501,8 +1514,9 @@ static SEL invalidateSel = @selector(_invalidateCoordinates);
|
||||||
GSTrackingRect *o;
|
GSTrackingRect *o;
|
||||||
NSCursor *c;
|
NSCursor *c;
|
||||||
|
|
||||||
o = [e nextObject]; // Base remove test
|
/* Base remove test upon cursor object */
|
||||||
while (o) // upon cursor object
|
o = [e nextObject];
|
||||||
|
while (o)
|
||||||
{
|
{
|
||||||
c = [o owner];
|
c = [o owner];
|
||||||
if (c == anObject)
|
if (c == anObject)
|
||||||
|
@ -1613,9 +1627,9 @@ static NSView* findByTag(NSView *view, int aTag, unsigned *level)
|
||||||
return view;
|
return view;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
/*
|
||||||
// Aiding Event Handling
|
* Aiding Event Handling
|
||||||
//
|
*/
|
||||||
- (BOOL) acceptsFirstMouse: (NSEvent*)theEvent
|
- (BOOL) acceptsFirstMouse: (NSEvent*)theEvent
|
||||||
{
|
{
|
||||||
return NO;
|
return NO;
|
||||||
|
@ -1627,7 +1641,7 @@ static NSView* findByTag(NSView *view, int aTag, unsigned *level)
|
||||||
unsigned count;
|
unsigned count;
|
||||||
NSView *v = nil, *w;
|
NSView *v = nil, *w;
|
||||||
|
|
||||||
// If not within our frame then immediately return
|
/* If not within our frame then it can't be a hit */
|
||||||
if (![self mouse: aPoint inRect: frame])
|
if (![self mouse: aPoint inRect: frame])
|
||||||
return nil;
|
return nil;
|
||||||
|
|
||||||
|
@ -1635,7 +1649,7 @@ static NSView* findByTag(NSView *view, int aTag, unsigned *level)
|
||||||
|
|
||||||
if (_rFlags.has_subviews)
|
if (_rFlags.has_subviews)
|
||||||
{
|
{
|
||||||
count = [sub_views count]; // Check our sub_views
|
count = [sub_views count];
|
||||||
if (count > 0)
|
if (count > 0)
|
||||||
{
|
{
|
||||||
NSView* array[count];
|
NSView* array[count];
|
||||||
|
@ -1651,7 +1665,10 @@ static NSView* findByTag(NSView *view, int aTag, unsigned *level)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (v) // mouse is either in the subview or within self
|
/*
|
||||||
|
* mouse is either in the subview or within self
|
||||||
|
*/
|
||||||
|
if (v)
|
||||||
return v;
|
return v;
|
||||||
else
|
else
|
||||||
return self;
|
return self;
|
||||||
|
@ -1724,33 +1741,33 @@ static NSView* findByTag(NSView *view, int aTag, unsigned *level)
|
||||||
}
|
}
|
||||||
++t;
|
++t;
|
||||||
|
|
||||||
m = [[GSTrackingRect alloc] initWithRect: aRect
|
m = [[rectClass alloc] initWithRect: aRect
|
||||||
tag: t
|
tag: t
|
||||||
owner: anObject
|
owner: anObject
|
||||||
userData: data
|
userData: data
|
||||||
inside: flag];
|
inside: flag];
|
||||||
AUTORELEASE(m);
|
|
||||||
[tracking_rects addObject: m];
|
[tracking_rects addObject: m];
|
||||||
|
RELEASE(m);
|
||||||
_rFlags.has_trkrects = 1;
|
_rFlags.has_trkrects = 1;
|
||||||
return t;
|
return t;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
/*
|
||||||
// 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
|
||||||
{
|
{
|
||||||
return NO;
|
return NO;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (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
|
||||||
{}
|
{}
|
||||||
|
@ -1770,9 +1787,9 @@ static NSView* findByTag(NSView *view, int aTag, unsigned *level)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
/*
|
||||||
// Printing
|
* Printing
|
||||||
//
|
*/
|
||||||
- (NSData*) dataWithEPSInsideRect: (NSRect)aRect
|
- (NSData*) dataWithEPSInsideRect: (NSRect)aRect
|
||||||
{
|
{
|
||||||
return nil;
|
return nil;
|
||||||
|
@ -1791,9 +1808,9 @@ static NSView* findByTag(NSView *view, int aTag, unsigned *level)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
/*
|
||||||
// Pagination
|
* Pagination
|
||||||
//
|
*/
|
||||||
- (void) adjustPageHeightNew: (float*)newBottom
|
- (void) adjustPageHeightNew: (float*)newBottom
|
||||||
top: (float)oldTop
|
top: (float)oldTop
|
||||||
bottom: (float)oldBottom
|
bottom: (float)oldBottom
|
||||||
|
@ -1833,9 +1850,9 @@ static NSView* findByTag(NSView *view, int aTag, unsigned *level)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
/*
|
||||||
// Writing Conforming PostScript
|
* Writing Conforming PostScript
|
||||||
//
|
*/
|
||||||
- (void) beginPage: (int)ordinalNum
|
- (void) beginPage: (int)ordinalNum
|
||||||
label: (NSString*)aString
|
label: (NSString*)aString
|
||||||
bBox: (NSRect)pageRect
|
bBox: (NSRect)pageRect
|
||||||
|
@ -1863,7 +1880,7 @@ static NSView* findByTag(NSView *view, int aTag, unsigned *level)
|
||||||
|
|
||||||
- (void) beginSetup
|
- (void) beginSetup
|
||||||
{
|
{
|
||||||
} // not implemented
|
}
|
||||||
|
|
||||||
- (void) beginTrailer
|
- (void) beginTrailer
|
||||||
{
|
{
|
||||||
|
@ -1901,9 +1918,9 @@ static NSView* findByTag(NSView *view, int aTag, unsigned *level)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
/*
|
||||||
// NSCoding protocol
|
* NSCoding protocol
|
||||||
//
|
*/
|
||||||
- (void) encodeWithCoder: (NSCoder*)aCoder
|
- (void) encodeWithCoder: (NSCoder*)aCoder
|
||||||
{
|
{
|
||||||
[super encodeWithCoder: aCoder];
|
[super encodeWithCoder: aCoder];
|
||||||
|
@ -1957,9 +1974,9 @@ static NSView* findByTag(NSView *view, int aTag, unsigned *level)
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
/*
|
||||||
// Accessor methods
|
* Accessor methods
|
||||||
//
|
*/
|
||||||
- (void) setAutoresizesSubviews: (BOOL)flag
|
- (void) setAutoresizesSubviews: (BOOL)flag
|
||||||
{
|
{
|
||||||
autoresize_subviews = flag;
|
autoresize_subviews = flag;
|
||||||
|
@ -2161,7 +2178,7 @@ static NSView* findByTag(NSView *view, int aTag, unsigned *level)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* The flipping process must result in a coordinate system that
|
* The flipping process must result in a coordinate system that
|
||||||
* exactly overlays the original. To do that, we must translate
|
* exactly overlays the original. To do that, we must translate
|
||||||
* the origin by the height of the view.
|
* the origin by the height of the view.
|
||||||
*/
|
*/
|
||||||
flip->matrix.ty = bounds.size.height;
|
flip->matrix.ty = bounds.size.height;
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
Copyright (C) 1996 Free Software Foundation, Inc.
|
Copyright (C) 1996 Free Software Foundation, Inc.
|
||||||
|
|
||||||
Author: Scott Christley <scottc@net-community.com>
|
Author: Scott Christley <scottc@net-community.com>
|
||||||
Venkat Ajjanagadde <venkat@ocbi.com>
|
Venkat Ajjanagadde <venkat@ocbi.com>
|
||||||
Date: 1996
|
Date: 1996
|
||||||
Author: Felipe A. Rodriguez <far@ix.netcom.com>
|
Author: Felipe A. Rodriguez <far@ix.netcom.com>
|
||||||
Date: June 1998
|
Date: June 1998
|
||||||
|
@ -20,7 +20,7 @@
|
||||||
|
|
||||||
This library is distributed in the hope that it will be useful,
|
This library is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
Library General Public License for more details.
|
Library General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU Library General Public
|
You should have received a copy of the GNU Library General Public
|
||||||
|
@ -82,11 +82,11 @@
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
//*****************************************************************************
|
/*****************************************************************************
|
||||||
//
|
*
|
||||||
// NSWindow
|
* NSWindow
|
||||||
//
|
*
|
||||||
//*****************************************************************************
|
*****************************************************************************/
|
||||||
|
|
||||||
@implementation NSWindow
|
@implementation NSWindow
|
||||||
|
|
||||||
|
@ -105,9 +105,9 @@ static IMP ccImp;
|
||||||
static IMP ctImp;
|
static IMP ctImp;
|
||||||
static Class responderClass;
|
static Class responderClass;
|
||||||
|
|
||||||
//
|
/*
|
||||||
// Class methods
|
* Class methods
|
||||||
//
|
*/
|
||||||
+ (void) initialize
|
+ (void) initialize
|
||||||
{
|
{
|
||||||
if (self == [NSWindow class])
|
if (self == [NSWindow class])
|
||||||
|
@ -121,35 +121,36 @@ static Class responderClass;
|
||||||
}
|
}
|
||||||
|
|
||||||
+ (void) removeFrameUsingName: (NSString *)name
|
+ (void) removeFrameUsingName: (NSString *)name
|
||||||
{ // Saving and restoring
|
{
|
||||||
} // the window's frame
|
}
|
||||||
|
|
||||||
+ (NSRect) contentRectForFrameRect: (NSRect)aRect
|
+ (NSRect) contentRectForFrameRect: (NSRect)aRect
|
||||||
styleMask: (unsigned int)aStyle
|
styleMask: (unsigned int)aStyle
|
||||||
{
|
{
|
||||||
return aRect;
|
return aRect;
|
||||||
}
|
}
|
||||||
|
|
||||||
+ (NSRect) frameRectForContentRect: (NSRect)aRect
|
+ (NSRect) frameRectForContentRect: (NSRect)aRect
|
||||||
styleMask: (unsigned int)aStyle
|
styleMask: (unsigned int)aStyle
|
||||||
{
|
{
|
||||||
return aRect;
|
return aRect;
|
||||||
}
|
}
|
||||||
|
|
||||||
+ (NSRect) minFrameWidthWithTitle: (NSString *)aTitle
|
+ (NSRect) minFrameWidthWithTitle: (NSString *)aTitle
|
||||||
styleMask: (unsigned int)aStyle
|
styleMask: (unsigned int)aStyle
|
||||||
{
|
{
|
||||||
return NSZeroRect;
|
return NSZeroRect;
|
||||||
}
|
}
|
||||||
|
|
||||||
+ (NSWindowDepth) defaultDepthLimit // default Screen and
|
/* default Screen and window depth */
|
||||||
{ // window depth
|
+ (NSWindowDepth) defaultDepthLimit
|
||||||
|
{
|
||||||
return 8;
|
return 8;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
/*
|
||||||
// Instance methods
|
* Instance methods
|
||||||
//
|
*/
|
||||||
- (id) init
|
- (id) init
|
||||||
{
|
{
|
||||||
int style;
|
int style;
|
||||||
|
@ -185,9 +186,9 @@ static Class responderClass;
|
||||||
[super dealloc];
|
[super dealloc];
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
/*
|
||||||
// Initializing and getting a new NSWindow object
|
* Initializing and getting a new NSWindow object
|
||||||
//
|
*/
|
||||||
- (id) initWithContentRect: (NSRect)contentRect
|
- (id) initWithContentRect: (NSRect)contentRect
|
||||||
styleMask: (unsigned int)aStyle
|
styleMask: (unsigned int)aStyle
|
||||||
backing: (NSBackingStoreType)bufferingType
|
backing: (NSBackingStoreType)bufferingType
|
||||||
|
@ -206,7 +207,7 @@ static Class responderClass;
|
||||||
styleMask: (unsigned int)aStyle
|
styleMask: (unsigned int)aStyle
|
||||||
backing: (NSBackingStoreType)bufferingType
|
backing: (NSBackingStoreType)bufferingType
|
||||||
defer: (BOOL)flag
|
defer: (BOOL)flag
|
||||||
screen: (NSScreen*)aScreen
|
screen: (NSScreen*)aScreen
|
||||||
{
|
{
|
||||||
NSRect r = [[NSScreen mainScreen] frame];
|
NSRect r = [[NSScreen mainScreen] frame];
|
||||||
NSRect cframe;
|
NSRect cframe;
|
||||||
|
@ -216,22 +217,24 @@ static Class responderClass;
|
||||||
NSLog(@"No application!\n");
|
NSLog(@"No application!\n");
|
||||||
|
|
||||||
NSDebugLog(@"NSWindow start of init\n");
|
NSDebugLog(@"NSWindow start of init\n");
|
||||||
// Initialize attributes
|
|
||||||
[self cleanInit]; // and flags
|
/* Initialize attributes and flags */
|
||||||
|
[self cleanInit];
|
||||||
|
|
||||||
backing_type = bufferingType;
|
backing_type = bufferingType;
|
||||||
style_mask = aStyle;
|
style_mask = aStyle;
|
||||||
// Size the attributes
|
|
||||||
frame = [NSWindow frameRectForContentRect: contentRect styleMask: aStyle];
|
frame = [NSWindow frameRectForContentRect: contentRect styleMask: aStyle];
|
||||||
minimum_size = NSZeroSize;
|
minimum_size = NSZeroSize;
|
||||||
maximum_size = r.size;
|
maximum_size = r.size;
|
||||||
// Next responder is the
|
|
||||||
[self setNextResponder: NSApp]; // application
|
|
||||||
|
|
||||||
cursor_rects_enabled = YES; // Cursor management
|
[self setNextResponder: NSApp];
|
||||||
|
|
||||||
|
cursor_rects_enabled = YES;
|
||||||
cursor_rects_valid = NO;
|
cursor_rects_valid = NO;
|
||||||
|
|
||||||
cframe.origin = NSZeroPoint; // Create the content view
|
/* Create the content view */
|
||||||
|
cframe.origin = NSZeroPoint;
|
||||||
cframe.size = frame.size;
|
cframe.size = frame.size;
|
||||||
[self setContentView: AUTORELEASE([[NSView alloc] initWithFrame: cframe])];
|
[self setContentView: AUTORELEASE([[NSView alloc] initWithFrame: cframe])];
|
||||||
|
|
||||||
|
@ -244,9 +247,9 @@ static Class responderClass;
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
/*
|
||||||
// Accessing the content view
|
* Accessing the content view
|
||||||
//
|
*/
|
||||||
- (id) contentView
|
- (id) contentView
|
||||||
{
|
{
|
||||||
return content_view;
|
return content_view;
|
||||||
|
@ -256,11 +259,10 @@ static Class responderClass;
|
||||||
{
|
{
|
||||||
NSView *wv;
|
NSView *wv;
|
||||||
|
|
||||||
// contentview can't be nil
|
|
||||||
if (!aView)
|
if (!aView)
|
||||||
aView = AUTORELEASE([[NSView alloc] initWithFrame: frame]);
|
aView = AUTORELEASE([[NSView alloc] initWithFrame: frame]);
|
||||||
|
|
||||||
// If window view has not been created, create it
|
/* If window view has not been created, create it */
|
||||||
if ((!content_view) || ([content_view superview] == nil))
|
if ((!content_view) || ([content_view superview] == nil))
|
||||||
{
|
{
|
||||||
wv = [[GSWindowView allocWithZone: [self zone]] initWithFrame: frame];
|
wv = [[GSWindowView allocWithZone: [self zone]] initWithFrame: frame];
|
||||||
|
@ -276,17 +278,17 @@ static Class responderClass;
|
||||||
|
|
||||||
[content_view setFrame: [wv frame]]; // Resize to fill window.
|
[content_view setFrame: [wv frame]]; // Resize to fill window.
|
||||||
[content_view setAutoresizingMask: NSViewWidthSizable | NSViewHeightSizable];
|
[content_view setAutoresizingMask: NSViewWidthSizable | NSViewHeightSizable];
|
||||||
[wv addSubview: content_view]; // Add to our window view
|
[wv addSubview: content_view]; // Add to our window view
|
||||||
NSAssert1 ([[wv subviews] count] == 1, @"window's view has %d subviews!",
|
NSAssert1 ([[wv subviews] count] == 1, @"window's view has %d subviews!",
|
||||||
[[wv subviews] count]);
|
[[wv subviews] count]);
|
||||||
// Make self the view's
|
|
||||||
[content_view setNextResponder: self]; // next responder
|
[content_view setNextResponder: self];
|
||||||
[content_view setNeedsDisplay: YES]; // Make sure we redraw.
|
[content_view setNeedsDisplay: YES]; // Make sure we redraw.
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
/*
|
||||||
// Window graphics
|
* Window graphics
|
||||||
//
|
*/
|
||||||
- (NSColor *) backgroundColor
|
- (NSColor *) backgroundColor
|
||||||
{
|
{
|
||||||
return background_color;
|
return background_color;
|
||||||
|
@ -337,9 +339,9 @@ static Class responderClass;
|
||||||
return window_title;
|
return window_title;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
/*
|
||||||
// Window device attributes
|
* Window device attributes
|
||||||
//
|
*/
|
||||||
- (NSBackingStoreType) backingType
|
- (NSBackingStoreType) backingType
|
||||||
{
|
{
|
||||||
return backing_type;
|
return backing_type;
|
||||||
|
@ -375,9 +377,9 @@ static Class responderClass;
|
||||||
return window_num;
|
return window_num;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
/*
|
||||||
// The miniwindow
|
* The miniwindow
|
||||||
//
|
*/
|
||||||
- (NSImage *) miniwindowImage
|
- (NSImage *) miniwindowImage
|
||||||
{
|
{
|
||||||
return miniaturized_image;
|
return miniaturized_image;
|
||||||
|
@ -408,9 +410,9 @@ static Class responderClass;
|
||||||
filename: isDoc];
|
filename: isDoc];
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
/*
|
||||||
// The field editor
|
* The field editor
|
||||||
//
|
*/
|
||||||
- (void) endEditingFor: (id)anObject
|
- (void) endEditingFor: (id)anObject
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
@ -419,7 +421,7 @@ static Class responderClass;
|
||||||
{
|
{
|
||||||
/* ask delegate if it can provide a field editor */
|
/* ask delegate if it can provide a field editor */
|
||||||
if ([delegate respondsToSelector:
|
if ([delegate respondsToSelector:
|
||||||
@selector(windowWillReturnFieldEditor:toObject:)])
|
@selector(windowWillReturnFieldEditor:toObject:)])
|
||||||
return [delegate windowWillReturnFieldEditor: self toObject: anObject];
|
return [delegate windowWillReturnFieldEditor: self toObject: anObject];
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -435,9 +437,9 @@ static Class responderClass;
|
||||||
return _fieldEditor;
|
return _fieldEditor;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
/*
|
||||||
// Window status and ordering
|
* Window status and ordering
|
||||||
//
|
*/
|
||||||
- (void) becomeKeyWindow
|
- (void) becomeKeyWindow
|
||||||
{
|
{
|
||||||
NSNotificationCenter *nc = [NSNotificationCenter defaultCenter];
|
NSNotificationCenter *nc = [NSNotificationCenter defaultCenter];
|
||||||
|
@ -497,13 +499,13 @@ static Class responderClass;
|
||||||
|
|
||||||
- (void) makeKeyAndOrderFront: (id)sender
|
- (void) makeKeyAndOrderFront: (id)sender
|
||||||
{
|
{
|
||||||
[self makeKeyWindow]; // Make self the key window
|
[self makeKeyWindow];
|
||||||
/*
|
/*
|
||||||
* OPENSTEP makes a window the main window when it makes it the key window.
|
* OPENSTEP makes a window the main window when it makes it the key window.
|
||||||
* So we do the same (though the documentation doesn't mention it).
|
* So we do the same (though the documentation doesn't mention it).
|
||||||
*/
|
*/
|
||||||
[self makeMainWindow];
|
[self makeMainWindow];
|
||||||
[self orderFront: sender]; // order self to the front
|
[self orderFront: sender];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) makeKeyWindow
|
- (void) makeKeyWindow
|
||||||
|
@ -524,7 +526,7 @@ static Class responderClass;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) orderBack: (id)sender
|
- (void) orderBack: (id)sender
|
||||||
{} // implemented in back end
|
{} // implemented in back end
|
||||||
|
|
||||||
- (void) orderFront: (id)sender
|
- (void) orderFront: (id)sender
|
||||||
{}
|
{}
|
||||||
|
@ -566,9 +568,9 @@ static Class responderClass;
|
||||||
window_level = newLevel;
|
window_level = newLevel;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
/*
|
||||||
// Moving and resizing the window
|
* Moving and resizing the window
|
||||||
//
|
*/
|
||||||
- (NSPoint) cascadeTopLeftFromPoint: (NSPoint)topLeftPoint
|
- (NSPoint) cascadeTopLeftFromPoint: (NSPoint)topLeftPoint
|
||||||
{
|
{
|
||||||
return NSZeroPoint;
|
return NSZeroPoint;
|
||||||
|
@ -648,9 +650,9 @@ static Class responderClass;
|
||||||
increments = aSize;
|
increments = aSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
/*
|
||||||
// Converting coordinates
|
* Converting coordinates
|
||||||
//
|
*/
|
||||||
- (NSPoint) convertBaseToScreen: (NSPoint)basePoint
|
- (NSPoint) convertBaseToScreen: (NSPoint)basePoint
|
||||||
{
|
{
|
||||||
NSPoint screenPoint;
|
NSPoint screenPoint;
|
||||||
|
@ -671,9 +673,9 @@ static Class responderClass;
|
||||||
return basePoint;
|
return basePoint;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
/*
|
||||||
// Managing the display
|
* Managing the display
|
||||||
//
|
*/
|
||||||
- (void) disableFlushWindow
|
- (void) disableFlushWindow
|
||||||
{
|
{
|
||||||
disable_flush_window = YES;
|
disable_flush_window = YES;
|
||||||
|
@ -681,16 +683,16 @@ static Class responderClass;
|
||||||
|
|
||||||
- (void) display
|
- (void) display
|
||||||
{
|
{
|
||||||
needs_display = NO; // inform first responder
|
needs_display = NO;
|
||||||
// of it's status so it can
|
/*
|
||||||
[first_responder becomeFirstResponder]; // set the focus to itself
|
* inform first responder of it's status so it can set the focus to itself
|
||||||
|
*/
|
||||||
|
[first_responder becomeFirstResponder];
|
||||||
|
|
||||||
[self disableFlushWindow]; // tmp disable display
|
[self disableFlushWindow];
|
||||||
|
[[content_view superview] display];
|
||||||
[[content_view superview] display]; // Draw the window view
|
[self enableFlushWindow];
|
||||||
|
[self flushWindowIfNeeded];
|
||||||
[self enableFlushWindow]; // Reenable displaying and
|
|
||||||
[self flushWindowIfNeeded]; // flush the window
|
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) displayIfNeeded
|
- (void) displayIfNeeded
|
||||||
|
@ -771,8 +773,8 @@ static Class responderClass;
|
||||||
|
|
||||||
- (BOOL) canStoreColor
|
- (BOOL) canStoreColor
|
||||||
{
|
{
|
||||||
if (depth_limit > 1) // If the depth is greater
|
if (depth_limit > 1)
|
||||||
return YES; // than a single bit
|
return YES;
|
||||||
else
|
else
|
||||||
return NO;
|
return NO;
|
||||||
}
|
}
|
||||||
|
@ -807,9 +809,9 @@ static Class responderClass;
|
||||||
dynamic_depth_limit = flag;
|
dynamic_depth_limit = flag;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
/*
|
||||||
// Cursor management
|
* Cursor management
|
||||||
//
|
*/
|
||||||
- (BOOL) areCursorRectsEnabled
|
- (BOOL) areCursorRectsEnabled
|
||||||
{
|
{
|
||||||
return cursor_rects_enabled;
|
return cursor_rects_enabled;
|
||||||
|
@ -885,9 +887,9 @@ static Class responderClass;
|
||||||
cursor_rects_valid = YES;
|
cursor_rects_valid = YES;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
/*
|
||||||
// Handling user actions and events
|
* Handling user actions and events
|
||||||
//
|
*/
|
||||||
- (void) close
|
- (void) close
|
||||||
{
|
{
|
||||||
NSNotificationCenter *nc = [NSNotificationCenter defaultCenter];
|
NSNotificationCenter *nc = [NSNotificationCenter defaultCenter];
|
||||||
|
@ -1002,9 +1004,9 @@ static Class responderClass;
|
||||||
{
|
{
|
||||||
is_edited = flag;
|
is_edited = flag;
|
||||||
if (menu_exclude == NO)
|
if (menu_exclude == NO)
|
||||||
{
|
{
|
||||||
[NSApp updateWindowsItem: self];
|
[NSApp updateWindowsItem: self];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1013,9 +1015,9 @@ static Class responderClass;
|
||||||
is_released_when_closed = flag;
|
is_released_when_closed = flag;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
/*
|
||||||
// Aiding event handling
|
* Aiding event handling
|
||||||
//
|
*/
|
||||||
- (BOOL) acceptsMouseMovedEvents
|
- (BOOL) acceptsMouseMovedEvents
|
||||||
{
|
{
|
||||||
return accepts_mouse_moved;
|
return accepts_mouse_moved;
|
||||||
|
@ -1027,7 +1029,7 @@ static Class responderClass;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) discardEventsMatchingMask: (unsigned int)mask
|
- (void) discardEventsMatchingMask: (unsigned int)mask
|
||||||
beforeEvent: (NSEvent *)lastEvent
|
beforeEvent: (NSEvent *)lastEvent
|
||||||
{
|
{
|
||||||
[NSApp discardEventsMatchingMask: mask beforeEvent: lastEvent];
|
[NSApp discardEventsMatchingMask: mask beforeEvent: lastEvent];
|
||||||
}
|
}
|
||||||
|
@ -1053,8 +1055,10 @@ static Class responderClass;
|
||||||
if (![aResponder acceptsFirstResponder])
|
if (![aResponder acceptsFirstResponder])
|
||||||
return NO;
|
return NO;
|
||||||
|
|
||||||
// If there is a first responder tell it to resign.
|
/*
|
||||||
// Change only if it replies Y
|
* If there is a first responder tell it to resign.
|
||||||
|
* Change only if it replies Y
|
||||||
|
*/
|
||||||
if ((first_responder) && (![first_responder resignFirstResponder]))
|
if ((first_responder) && (![first_responder resignFirstResponder]))
|
||||||
return NO;
|
return NO;
|
||||||
|
|
||||||
|
@ -1067,8 +1071,8 @@ static Class responderClass;
|
||||||
* loop status */
|
* loop status */
|
||||||
- (NSPoint) mouseLocationOutsideOfEventStream
|
- (NSPoint) mouseLocationOutsideOfEventStream
|
||||||
{
|
{
|
||||||
float x;
|
float x;
|
||||||
float y;
|
float y;
|
||||||
|
|
||||||
DPSmouselocation(GSCurrentContext(), &x, &y);
|
DPSmouselocation(GSCurrentContext(), &x, &y);
|
||||||
x -= frame.origin.x;
|
x -= frame.origin.x;
|
||||||
|
@ -1085,7 +1089,7 @@ static Class responderClass;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (NSEvent *) nextEventMatchingMask: (unsigned int)mask
|
- (NSEvent *) nextEventMatchingMask: (unsigned int)mask
|
||||||
untilDate: (NSDate *)expiration
|
untilDate: (NSDate *)expiration
|
||||||
inMode: (NSString *)mode
|
inMode: (NSString *)mode
|
||||||
dequeue: (BOOL)deqFlag
|
dequeue: (BOOL)deqFlag
|
||||||
{
|
{
|
||||||
|
@ -1298,8 +1302,8 @@ static Class responderClass;
|
||||||
NSView *v;
|
NSView *v;
|
||||||
NSEventType type;
|
NSEventType type;
|
||||||
|
|
||||||
if (!cursor_rects_valid) // If the cursor rects are invalid
|
if (!cursor_rects_valid)
|
||||||
{ // Then discard and reset
|
{
|
||||||
[self discardCursorRects];
|
[self discardCursorRects];
|
||||||
[self resetCursorRects];
|
[self resetCursorRects];
|
||||||
}
|
}
|
||||||
|
@ -1307,7 +1311,7 @@ static Class responderClass;
|
||||||
type = [theEvent type];
|
type = [theEvent type];
|
||||||
switch (type)
|
switch (type)
|
||||||
{
|
{
|
||||||
case NSLeftMouseDown: // Left mouse down
|
case NSLeftMouseDown: // Left mouse down
|
||||||
v = [content_view hitTest: [theEvent locationInWindow]];
|
v = [content_view hitTest: [theEvent locationInWindow]];
|
||||||
if (first_responder != v)
|
if (first_responder != v)
|
||||||
{
|
{
|
||||||
|
@ -1320,19 +1324,19 @@ static Class responderClass;
|
||||||
last_point = [theEvent locationInWindow];
|
last_point = [theEvent locationInWindow];
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case NSLeftMouseUp: // Left mouse up
|
case NSLeftMouseUp: // Left mouse up
|
||||||
v = first_responder; /* Send to the view that got the mouse down. */
|
v = first_responder; /* Send to the view that got the mouse down. */
|
||||||
[v mouseUp: theEvent];
|
[v mouseUp: theEvent];
|
||||||
last_point = [theEvent locationInWindow];
|
last_point = [theEvent locationInWindow];
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case NSRightMouseDown: // Right mouse down
|
case NSRightMouseDown: // Right mouse down
|
||||||
v = [content_view hitTest: [theEvent locationInWindow]];
|
v = [content_view hitTest: [theEvent locationInWindow]];
|
||||||
[v rightMouseDown: theEvent];
|
[v rightMouseDown: theEvent];
|
||||||
last_point = [theEvent locationInWindow];
|
last_point = [theEvent locationInWindow];
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case NSRightMouseUp: // Right mouse up
|
case NSRightMouseUp: // Right mouse up
|
||||||
v = [content_view hitTest: [theEvent locationInWindow]];
|
v = [content_view hitTest: [theEvent locationInWindow]];
|
||||||
[v rightMouseUp: theEvent];
|
[v rightMouseUp: theEvent];
|
||||||
last_point = [theEvent locationInWindow];
|
last_point = [theEvent locationInWindow];
|
||||||
|
@ -1354,32 +1358,38 @@ static Class responderClass;
|
||||||
default:
|
default:
|
||||||
if (accepts_mouse_moved)
|
if (accepts_mouse_moved)
|
||||||
{
|
{
|
||||||
// If the window is set to accept mouse movements, we need to
|
/*
|
||||||
// forward the mouse movement to the correct view.
|
* If the window is set to accept mouse movements, we need to
|
||||||
|
* forward the mouse movement to the correct view.
|
||||||
|
*/
|
||||||
v = [content_view hitTest: [theEvent locationInWindow]];
|
v = [content_view hitTest: [theEvent locationInWindow]];
|
||||||
[v mouseMoved: theEvent];
|
[v mouseMoved: theEvent];
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// We need to go through all of the views, and if there is any with
|
/*
|
||||||
// a tracking rectangle then we need to determine if we should send
|
* We need to go through all of the views, and if there is any with
|
||||||
// a NSMouseEntered or NSMouseExited event.
|
* a tracking rectangle then we need to determine if we should send
|
||||||
|
* a NSMouseEntered or NSMouseExited event.
|
||||||
|
*/
|
||||||
(*ctImp)(self, ctSel, content_view, theEvent);
|
(*ctImp)(self, ctSel, content_view, theEvent);
|
||||||
|
|
||||||
if (is_key)
|
if (is_key)
|
||||||
{
|
{
|
||||||
// We need to go through all of the views, and if there is any with
|
/*
|
||||||
// a cursor rectangle then we need to determine if we should send a
|
* We need to go through all of the views, and if there is any with
|
||||||
// cursor update event.
|
* a cursor rectangle then we need to determine if we should send a
|
||||||
|
* cursor update event.
|
||||||
|
*/
|
||||||
(*ccImp)(self, ccSel, content_view, theEvent);
|
(*ccImp)(self, ccSel, content_view, theEvent);
|
||||||
}
|
}
|
||||||
|
|
||||||
last_point = [theEvent locationInWindow];
|
last_point = [theEvent locationInWindow];
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case NSMouseEntered: // Mouse entered
|
case NSMouseEntered: // Mouse entered
|
||||||
case NSMouseExited: // Mouse exited
|
case NSMouseExited: // Mouse exited
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case NSKeyDown:
|
case NSKeyDown:
|
||||||
|
@ -1391,26 +1401,29 @@ static Class responderClass;
|
||||||
[first_responder keyDown: theEvent];
|
[first_responder keyDown: theEvent];
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case NSKeyUp: // Key up
|
case NSKeyUp: // Key up
|
||||||
if (original_responder) // send message to the
|
/*
|
||||||
[original_responder keyUp: theEvent]; // object that got the
|
* send message to the object that got the key down
|
||||||
break; // key down
|
*/
|
||||||
|
if (original_responder)
|
||||||
case NSFlagsChanged: // Flags changed
|
[original_responder keyUp: theEvent];
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case NSCursorUpdate: // Cursor update
|
case NSFlagsChanged: // Flags changed
|
||||||
|
break;
|
||||||
|
|
||||||
|
case NSCursorUpdate: // Cursor update
|
||||||
{
|
{
|
||||||
GSTrackingRect *r =(GSTrackingRect *)[theEvent userData];
|
GSTrackingRect *r =(GSTrackingRect *)[theEvent userData];
|
||||||
NSCursor *c = (NSCursor *)[r owner];
|
NSCursor *c = (NSCursor *)[r owner];
|
||||||
|
|
||||||
c = (NSCursor *)[r owner];
|
c = (NSCursor *)[r owner];
|
||||||
if ([theEvent trackingNumber]) // It's a mouse entered
|
if ([theEvent trackingNumber]) // It's a mouse entered
|
||||||
{
|
{
|
||||||
if (c && [c isSetOnMouseEntered])
|
if (c && [c isSetOnMouseEntered])
|
||||||
[c set];
|
[c set];
|
||||||
}
|
}
|
||||||
else // it is a mouse exited
|
else // it is a mouse exited
|
||||||
{
|
{
|
||||||
if (c && [c isSetOnMouseExited])
|
if (c && [c isSetOnMouseExited])
|
||||||
[c set];
|
[c set];
|
||||||
|
@ -1419,6 +1432,9 @@ static Class responderClass;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case NSPeriodic:
|
case NSPeriodic:
|
||||||
|
case NSAppKitDefined:
|
||||||
|
case NSSystemDefined:
|
||||||
|
case NSApplicationDefined:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1433,16 +1449,16 @@ static Class responderClass;
|
||||||
return NO;
|
return NO;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
/*
|
||||||
// Dragging
|
* Dragging
|
||||||
//
|
*/
|
||||||
- (void) dragImage: (NSImage *)anImage
|
- (void) dragImage: (NSImage *)anImage
|
||||||
at: (NSPoint)baseLocation
|
at: (NSPoint)baseLocation
|
||||||
offset: (NSSize)initialOffset
|
offset: (NSSize)initialOffset
|
||||||
event: (NSEvent *)event
|
event: (NSEvent *)event
|
||||||
pasteboard: (NSPasteboard *)pboard
|
pasteboard: (NSPasteboard *)pboard
|
||||||
source: sourceObject
|
source: sourceObject
|
||||||
slideBack: (BOOL)slideFlag
|
slideBack: (BOOL)slideFlag
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1461,9 +1477,9 @@ static Class responderClass;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
/*
|
||||||
// Services and windows menu support
|
* Services and windows menu support
|
||||||
//
|
*/
|
||||||
- (BOOL) isExcludedFromWindowsMenu
|
- (BOOL) isExcludedFromWindowsMenu
|
||||||
{
|
{
|
||||||
return menu_exclude;
|
return menu_exclude;
|
||||||
|
@ -1475,7 +1491,7 @@ static Class responderClass;
|
||||||
}
|
}
|
||||||
|
|
||||||
- validRequestorForSendType: (NSString *)sendType
|
- validRequestorForSendType: (NSString *)sendType
|
||||||
returnType: (NSString *)returnType
|
returnType: (NSString *)returnType
|
||||||
{
|
{
|
||||||
id result = nil;
|
id result = nil;
|
||||||
|
|
||||||
|
@ -1489,9 +1505,9 @@ static Class responderClass;
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
/*
|
||||||
// Saving and restoring the frame
|
* Saving and restoring the frame
|
||||||
//
|
*/
|
||||||
- (NSString *) frameAutosaveName
|
- (NSString *) frameAutosaveName
|
||||||
{
|
{
|
||||||
return nil;
|
return nil;
|
||||||
|
@ -1520,9 +1536,9 @@ static Class responderClass;
|
||||||
return nil;
|
return nil;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
/*
|
||||||
// Printing and postscript
|
* Printing and postscript
|
||||||
//
|
*/
|
||||||
- (NSData *) dataWithEPSInsideRect: (NSRect)rect
|
- (NSData *) dataWithEPSInsideRect: (NSRect)rect
|
||||||
{
|
{
|
||||||
return nil;
|
return nil;
|
||||||
|
@ -1534,9 +1550,9 @@ static Class responderClass;
|
||||||
- (void) print: (id)sender
|
- (void) print: (id)sender
|
||||||
{}
|
{}
|
||||||
|
|
||||||
//
|
/*
|
||||||
// Assigning a delegate
|
* Assigning a delegate
|
||||||
//
|
*/
|
||||||
- (id) delegate
|
- (id) delegate
|
||||||
{
|
{
|
||||||
return delegate;
|
return delegate;
|
||||||
|
@ -1572,9 +1588,9 @@ static Class responderClass;
|
||||||
SET_DELEGATE_NOTIFICATION(WillMove);
|
SET_DELEGATE_NOTIFICATION(WillMove);
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
/*
|
||||||
// Implemented by the delegate
|
* Implemented by the delegate
|
||||||
//
|
*/
|
||||||
- (BOOL) windowShouldClose: (id)sender
|
- (BOOL) windowShouldClose: (id)sender
|
||||||
{
|
{
|
||||||
if ([delegate respondsToSelector: @selector(windowShouldClose:)])
|
if ([delegate respondsToSelector: @selector(windowShouldClose:)])
|
||||||
|
@ -1680,9 +1696,9 @@ static Class responderClass;
|
||||||
return [delegate windowWillMove: aNotification];
|
return [delegate windowWillMove: aNotification];
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
/*
|
||||||
// NSCoding protocol
|
* NSCoding protocol
|
||||||
//
|
*/
|
||||||
- (void) encodeWithCoder: (NSCoder*)aCoder
|
- (void) encodeWithCoder: (NSCoder*)aCoder
|
||||||
{
|
{
|
||||||
[self setNextResponder: nil];
|
[self setNextResponder: nil];
|
||||||
|
@ -1752,7 +1768,7 @@ static Class responderClass;
|
||||||
maximum_size = [aDecoder decodeSize];
|
maximum_size = [aDecoder decodeSize];
|
||||||
[aDecoder decodeValueOfObjCType: @encode(id) at: &miniaturized_image];
|
[aDecoder decodeValueOfObjCType: @encode(id) at: &miniaturized_image];
|
||||||
[aDecoder decodeValueOfObjCType: @encode(NSBackingStoreType)
|
[aDecoder decodeValueOfObjCType: @encode(NSBackingStoreType)
|
||||||
at: &backing_type];
|
at: &backing_type];
|
||||||
[aDecoder decodeValueOfObjCType: @encode(int) at: &window_level];
|
[aDecoder decodeValueOfObjCType: @encode(int) at: &window_level];
|
||||||
[aDecoder decodeValueOfObjCType: @encode(BOOL) at: &is_one_shot];
|
[aDecoder decodeValueOfObjCType: @encode(BOOL) at: &is_one_shot];
|
||||||
[aDecoder decodeValueOfObjCType: @encode(BOOL) at: &is_autodisplay];
|
[aDecoder decodeValueOfObjCType: @encode(BOOL) at: &is_autodisplay];
|
||||||
|
@ -1782,9 +1798,9 @@ static Class responderClass;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
//
|
/*
|
||||||
// GNUstep backend methods
|
* GNUstep backend methods
|
||||||
//
|
*/
|
||||||
@implementation NSWindow (GNUstepBackend)
|
@implementation NSWindow (GNUstepBackend)
|
||||||
|
|
||||||
+ (NSWindow*) _windowWithTag: (int)windowNumber
|
+ (NSWindow*) _windowWithTag: (int)windowNumber
|
||||||
|
@ -1797,15 +1813,15 @@ static Class responderClass;
|
||||||
window_num = windowNum;
|
window_num = windowNum;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
/*
|
||||||
// Mouse capture/release
|
* Mouse capture/release
|
||||||
//
|
*/
|
||||||
- (void) _captureMouse: sender {} // Do nothing, should be
|
- (void) _captureMouse: sender {} // Do nothing, should be
|
||||||
- (void) _releaseMouse: sender {} // implemented by back-end
|
- (void) _releaseMouse: sender {} // implemented by back-end
|
||||||
|
|
||||||
- (void) performDeminiaturize: sender {}
|
- (void) performDeminiaturize: sender {}
|
||||||
- (void) performHide: sender {}
|
- (void) performHide: sender {}
|
||||||
- (void) performUnhide: sender {}
|
- (void) performUnhide: sender {}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Allow subclasses to init without the backend
|
* Allow subclasses to init without the backend
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue