mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-04-22 18:11:06 +00:00
Minor updates
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@4585 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
603b2acf91
commit
80cd2786dd
2 changed files with 85 additions and 2 deletions
|
@ -1,7 +1,11 @@
|
|||
Wed Jul 14 15:35:00 1999 Richard Frith-Macdonald <richard@brainstorm.co.uk>
|
||||
Wed Jul 14 16:20:00 1999 Richard Frith-Macdonald <richard@brainstorm.co.uk>
|
||||
|
||||
* Source/NSMatrix.m: Modifications to get rid of most internal
|
||||
methods and get the list-mode selection by rectangle working.
|
||||
* Source/NSView.m: Implemented ([scrollPoint:]) and
|
||||
([scrollrectToVisible:]) (based on mGSTEP). Code probably buggy
|
||||
and untested.
|
||||
* Source/NSActionCell.m: Minor optimisations.
|
||||
|
||||
Tue Jul 13 6:44:00 1999 Richard Frith-Macdonald <richard@brainstorm.co.uk>
|
||||
|
||||
|
|
|
@ -51,6 +51,8 @@
|
|||
#include <AppKit/GSWraps.h>
|
||||
#include <AppKit/PSOperators.h>
|
||||
#include <AppKit/NSAffineTransform.h>
|
||||
#include <AppKit/NSScrollView.h>
|
||||
#include <AppKit/NSClipView.h>
|
||||
|
||||
struct NSWindow_struct
|
||||
{
|
||||
|
@ -1656,13 +1658,90 @@ GSSetDragTypes(NSView* obj, NSArray *types)
|
|||
{}
|
||||
|
||||
- (void) scrollPoint: (NSPoint)aPoint
|
||||
{}
|
||||
{
|
||||
NSClipView *s = (NSClipView*)super_view;
|
||||
|
||||
while (s != nil && [s isKindOfClass: [NSClipView class]] == NO)
|
||||
{
|
||||
s = (NSClipView*)[s superview];
|
||||
}
|
||||
|
||||
aPoint = [self convertPoint: aPoint toView: s];
|
||||
if (NSEqualPoints(aPoint, [s bounds].origin) == NO)
|
||||
{
|
||||
id cSuper = [s superview];
|
||||
|
||||
aPoint = [s constrainScrollPoint: aPoint];
|
||||
[s scrollToPoint: aPoint];
|
||||
|
||||
if ([cSuper respondsToSelector:@selector(reflectScrolledClipView:)])
|
||||
[(NSScrollView *)cSuper reflectScrolledClipView: s];
|
||||
}
|
||||
}
|
||||
|
||||
- (void) scrollRect: (NSRect)aRect by: (NSSize)delta
|
||||
{}
|
||||
|
||||
- (BOOL) scrollRectToVisible: (NSRect)aRect
|
||||
{
|
||||
NSClipView *s = (NSClipView*)super_view;
|
||||
|
||||
while (s != nil && [s isKindOfClass: [NSClipView class]] == NO)
|
||||
{
|
||||
s = (NSClipView*)[s superview];
|
||||
}
|
||||
if (s != nil)
|
||||
{
|
||||
NSRect vRect = [self visibleRect];
|
||||
NSPoint aPoint = vRect.origin;
|
||||
BOOL shouldScroll = NO;
|
||||
|
||||
if (vRect.size.width == 0 && vRect.size.height == 0)
|
||||
return NO;
|
||||
|
||||
if (!(NSMinX(vRect) <= NSMinX(aRect)
|
||||
&& (NSMaxX(vRect) >= NSMaxX(aRect))))
|
||||
{
|
||||
shouldScroll = YES;
|
||||
if (aRect.origin.x < vRect.origin.x)
|
||||
aPoint.x = aRect.origin.x;
|
||||
else
|
||||
{
|
||||
float visibleRange = vRect.origin.x + vRect.size.width;
|
||||
float aRectRange = aRect.origin.x + aRect.size.width;
|
||||
|
||||
aPoint.x = vRect.origin.x + (aRectRange - visibleRange);
|
||||
}
|
||||
}
|
||||
|
||||
if (!(NSMinY(vRect) <= NSMinY(aRect)
|
||||
&& (NSMaxY(vRect) >= NSMaxY(aRect))))
|
||||
{
|
||||
shouldScroll = YES;
|
||||
if (aRect.origin.y < vRect.origin.y)
|
||||
aPoint.y = aRect.origin.y;
|
||||
else
|
||||
{
|
||||
float visibleRange = vRect.origin.y + vRect.size.height;
|
||||
float aRectRange = aRect.origin.y + aRect.size.height;
|
||||
|
||||
aPoint.y = vRect.origin.y + (aRectRange - visibleRange);
|
||||
}
|
||||
}
|
||||
|
||||
if (shouldScroll)
|
||||
{
|
||||
id cSuper = [s superview];
|
||||
|
||||
aPoint = [self convertPoint: aPoint toView: s];
|
||||
aPoint = [s constrainScrollPoint: aPoint];
|
||||
[s scrollToPoint: aPoint];
|
||||
if ([cSuper respondsToSelector:@selector(reflectScrolledClipView:)])
|
||||
[(NSScrollView *)cSuper reflectScrolledClipView: s];
|
||||
|
||||
return YES;
|
||||
}
|
||||
}
|
||||
return NO;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue