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
This commit is contained in:
Marcian Lytwyn 2016-04-06 17:57:36 +00:00
parent 59be9b4a52
commit fab1e8f6f4
3 changed files with 63 additions and 13 deletions

View file

@ -4,7 +4,7 @@
A view that allows you to scroll a document view that's too big to display A view that allows you to scroll a document view that's too big to display
entirely on a window. entirely on a window.
Copyright (C) 1996 Free Software Foundation, Inc. Copyright (C) 1996-2015 Free Software Foundation, Inc.
Author: Ovidiu Predescu <ovidiu@net-community.com> Author: Ovidiu Predescu <ovidiu@net-community.com>
Date: July 1997 Date: July 1997
@ -34,6 +34,15 @@
#import <AppKit/NSView.h> #import <AppKit/NSView.h>
enum
{
NSScrollElasticityAutomatic = 0,
NSScrollElasticityNone = 1,
NSScrollElasticityAllowed = 2
};
typedef NSInteger NSScrollElasticity;
@class NSClipView; @class NSClipView;
@class NSRulerView; @class NSRulerView;
@class NSColor; @class NSColor;
@ -66,6 +75,8 @@
BOOL _autohidesScrollers; BOOL _autohidesScrollers;
NSUInteger _reflectScrolledClipView_HRecursionCnt; NSUInteger _reflectScrolledClipView_HRecursionCnt;
NSUInteger _reflectScrolledClipView_VRecursionCnt; NSUInteger _reflectScrolledClipView_VRecursionCnt;
NSScrollElasticity _horizScrollElasticity;
NSScrollElasticity _vertScrollElasticity;
} }
/* Calculating layout */ /* Calculating layout */
@ -144,6 +155,16 @@
- (BOOL)autohidesScrollers; - (BOOL)autohidesScrollers;
- (void)setAutohidesScrollers:(BOOL)flag; - (void)setAutohidesScrollers:(BOOL)flag;
#endif #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 */ /* Updating display after scrolling */
- (void)reflectScrolledClipView:(NSClipView*)aClipView; - (void)reflectScrolledClipView:(NSClipView*)aClipView;

View file

@ -224,6 +224,8 @@ static CGFloat scrollerWidth;
// For compatibility the ruler should be present but not visible. // For compatibility the ruler should be present but not visible.
[self setHasHorizontalRuler: YES]; [self setHasHorizontalRuler: YES];
[self tile]; [self tile];
_horizScrollElasticity = NSScrollElasticityAutomatic;
_vertScrollElasticity = NSScrollElasticityAutomatic;
[[NSNotificationCenter defaultCenter] [[NSNotificationCenter defaultCenter]
addObserver: self addObserver: self
@ -398,6 +400,27 @@ static CGFloat scrollerWidth;
_autohidesScrollers = flag; _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 - (void) scrollWheel: (NSEvent *)theEvent
{ {
NSRect clipViewBounds; NSRect clipViewBounds;
@ -913,7 +936,7 @@ static CGFloat scrollerWidth;
// Testplant-MAL-2015-07-08: keeping testplant branch code... // Testplant-MAL-2015-07-08: keeping testplant branch code...
_reflectScrolledClipView_HRecursionCnt--; _reflectScrolledClipView_HRecursionCnt--;
} }
if (_hasHeaderView) if (_hasHeaderView)
{ {
NSPoint headerClipViewOrigin; NSPoint headerClipViewOrigin;
@ -1366,17 +1389,12 @@ GSOppositeEdge(NSRectEdge edge)
- (BOOL) isOpaque - (BOOL) isOpaque
{ {
#if 0
// FIXME: Only needs to be NO in a corner case, // FIXME: Only needs to be NO in a corner case,
// when [[GSTheme theme] scrollViewUseBottomCorner] is NO // when [[GSTheme theme] scrollViewUseBottomCorner] is NO
// and the theme tile for the bottom corner is transparent. // and the theme tile for the bottom corner is transparent.
// So maybe cache the value of // So maybe cache the value of
// [[GSTheme theme] scrollViewUseBottomCorner] and check it here. // [[GSTheme theme] scrollViewUseBottomCorner] and check it here.
return NO; return NO;
#else
// Testplant-MAL-2015-07-08: keeping testplant branch code...
return [_contentView isOpaque];
#endif
} }
- (NSBorderType) borderType - (NSBorderType) borderType
@ -1532,6 +1550,17 @@ GSOppositeEdge(NSRectEdge edge)
return _vertScroller; return _vertScroller;
} }
- (BOOL)allowsMagnification
{
//we need an ivar for this
return NO;
}
- (void)setAllowsMagnification:(BOOL)m
{
//we need an ivar for this
}
/* /*
* NSCoding protocol * NSCoding protocol
*/ */

View file

@ -1060,11 +1060,11 @@ static float buttonsOffset = 1.0; // buttonsWidth = sw - 2*buttonsOffset
} }
else else
{ {
[[GSTheme theme] drawScrollerRect: rect [[GSTheme theme] drawScrollerRect: rect
inView: self inView: self
hitPart: _hitPart hitPart: _hitPart
isHorizontal: _scFlags.isHorizontal]; isHorizontal: _scFlags.isHorizontal];
} }
} }
/**<p>(Un)Highlight the button specified by <var>whichButton</var>. /**<p>(Un)Highlight the button specified by <var>whichButton</var>.
@ -1127,7 +1127,7 @@ static float buttonsOffset = 1.0; // buttonsWidth = sw - 2*buttonsOffset
- (void) drawKnobSlot - (void) drawKnobSlot
{ {
[self drawKnobSlotInRect: [self rectForPart: NSScrollerKnobSlot] [self drawKnobSlotInRect: [self rectForPart: NSScrollerKnobSlot]
highlight: NO]; highlight: NO];
} }
- (void) drawKnobSlotInRect: (NSRect)slotRect highlight: (BOOL)flag - (void) drawKnobSlotInRect: (NSRect)slotRect highlight: (BOOL)flag