From fab1e8f6f4487d2b11ab113fc42ba526c0c95a07 Mon Sep 17 00:00:00 2001 From: Marcian Lytwyn Date: Wed, 6 Apr 2016 17:57:36 +0000 Subject: [PATCH] Merge with revision 39619 of GUI main branch git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/branches/gnustep_testplant_branch@39629 72102866-910b-0410-8b05-ffd578937521 --- Headers/AppKit/NSScrollView.h | 23 +++++++++++++++++++- Source/NSScrollView.m | 41 ++++++++++++++++++++++++++++++----- Source/NSScroller.m | 12 +++++----- 3 files changed, 63 insertions(+), 13 deletions(-) diff --git a/Headers/AppKit/NSScrollView.h b/Headers/AppKit/NSScrollView.h index e6d354668..65d07c44b 100644 --- a/Headers/AppKit/NSScrollView.h +++ b/Headers/AppKit/NSScrollView.h @@ -4,7 +4,7 @@ A view that allows you to scroll a document view that's too big to display entirely on a window. - Copyright (C) 1996 Free Software Foundation, Inc. + Copyright (C) 1996-2015 Free Software Foundation, Inc. Author: Ovidiu Predescu Date: July 1997 @@ -34,6 +34,15 @@ #import +enum +{ + NSScrollElasticityAutomatic = 0, + NSScrollElasticityNone = 1, + NSScrollElasticityAllowed = 2 +}; +typedef NSInteger NSScrollElasticity; + + @class NSClipView; @class NSRulerView; @class NSColor; @@ -66,6 +75,8 @@ BOOL _autohidesScrollers; NSUInteger _reflectScrolledClipView_HRecursionCnt; NSUInteger _reflectScrolledClipView_VRecursionCnt; + NSScrollElasticity _horizScrollElasticity; + NSScrollElasticity _vertScrollElasticity; } /* Calculating layout */ @@ -144,6 +155,16 @@ - (BOOL)autohidesScrollers; - (void)setAutohidesScrollers:(BOOL)flag; #endif +#if OS_API_VERSION(MAC_OS_X_VERSION_10_7, GS_API_LATEST) +- (NSScrollElasticity)horizontalScrollElasticity; +- (void)setHorizontalScrollElasticity:(NSScrollElasticity)value; +- (NSScrollElasticity)verticalScrollElasticity; +- (void)setVerticalScrollElasticity:(NSScrollElasticity)value; +#endif +#if OS_API_VERSION(MAC_OS_X_VERSION_10_8, GS_API_LATEST) +- (BOOL)allowsMagnification; +- (void)setAllowsMagnification:(BOOL)m; +#endif /* Updating display after scrolling */ - (void)reflectScrolledClipView:(NSClipView*)aClipView; diff --git a/Source/NSScrollView.m b/Source/NSScrollView.m index 26c56e06a..368013758 100644 --- a/Source/NSScrollView.m +++ b/Source/NSScrollView.m @@ -224,6 +224,8 @@ static CGFloat scrollerWidth; // For compatibility the ruler should be present but not visible. [self setHasHorizontalRuler: YES]; [self tile]; + _horizScrollElasticity = NSScrollElasticityAutomatic; + _vertScrollElasticity = NSScrollElasticityAutomatic; [[NSNotificationCenter defaultCenter] addObserver: self @@ -398,6 +400,27 @@ static CGFloat scrollerWidth; _autohidesScrollers = flag; } +- (NSScrollElasticity)horizontalScrollElasticity +{ + return _horizScrollElasticity; +} + +- (void)setHorizontalScrollElasticity:(NSScrollElasticity)value +{ + _horizScrollElasticity = value; +} + +- (NSScrollElasticity)verticalScrollElasticity +{ + return _vertScrollElasticity; +} + + +- (void)setVerticalScrollElasticity:(NSScrollElasticity)value +{ + _vertScrollElasticity = value; +} + - (void) scrollWheel: (NSEvent *)theEvent { NSRect clipViewBounds; @@ -913,7 +936,7 @@ static CGFloat scrollerWidth; // Testplant-MAL-2015-07-08: keeping testplant branch code... _reflectScrolledClipView_HRecursionCnt--; } - + if (_hasHeaderView) { NSPoint headerClipViewOrigin; @@ -1366,17 +1389,12 @@ GSOppositeEdge(NSRectEdge edge) - (BOOL) isOpaque { -#if 0 // FIXME: Only needs to be NO in a corner case, // when [[GSTheme theme] scrollViewUseBottomCorner] is NO // and the theme tile for the bottom corner is transparent. // So maybe cache the value of // [[GSTheme theme] scrollViewUseBottomCorner] and check it here. return NO; -#else - // Testplant-MAL-2015-07-08: keeping testplant branch code... - return [_contentView isOpaque]; -#endif } - (NSBorderType) borderType @@ -1532,6 +1550,17 @@ GSOppositeEdge(NSRectEdge edge) return _vertScroller; } +- (BOOL)allowsMagnification +{ + //we need an ivar for this + return NO; +} + +- (void)setAllowsMagnification:(BOOL)m +{ + //we need an ivar for this +} + /* * NSCoding protocol */ diff --git a/Source/NSScroller.m b/Source/NSScroller.m index 1a963cde6..6a902d41f 100644 --- a/Source/NSScroller.m +++ b/Source/NSScroller.m @@ -1060,11 +1060,11 @@ static float buttonsOffset = 1.0; // buttonsWidth = sw - 2*buttonsOffset } else { - [[GSTheme theme] drawScrollerRect: rect - inView: self - hitPart: _hitPart - isHorizontal: _scFlags.isHorizontal]; -} + [[GSTheme theme] drawScrollerRect: rect + inView: self + hitPart: _hitPart + isHorizontal: _scFlags.isHorizontal]; + } } /**

(Un)Highlight the button specified by whichButton. @@ -1127,7 +1127,7 @@ static float buttonsOffset = 1.0; // buttonsWidth = sw - 2*buttonsOffset - (void) drawKnobSlot { [self drawKnobSlotInRect: [self rectForPart: NSScrollerKnobSlot] - highlight: NO]; + highlight: NO]; } - (void) drawKnobSlotInRect: (NSRect)slotRect highlight: (BOOL)flag