mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-06-02 15:51:00 +00:00
Respond to horizontal scrolling in NSScrollView
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@29531 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
c039b1fb67
commit
6ab53887e7
2 changed files with 43 additions and 34 deletions
|
@ -1,3 +1,8 @@
|
||||||
|
2010-02-10 Eric Wasylishen <ewasylishen@gmail.com>
|
||||||
|
|
||||||
|
* Source/NSScrollView.m (-scrollWheel:): Respond to horizontal
|
||||||
|
scrolling.
|
||||||
|
|
||||||
2010-01-14 Doug Simons <doug.simons@testplant.com>
|
2010-01-14 Doug Simons <doug.simons@testplant.com>
|
||||||
|
|
||||||
* Source/NSDrawer.m: Make drawers work, including:
|
* Source/NSDrawer.m: Make drawers work, including:
|
||||||
|
|
|
@ -387,7 +387,8 @@ static float scrollerWidth;
|
||||||
- (void) scrollWheel: (NSEvent *)theEvent
|
- (void) scrollWheel: (NSEvent *)theEvent
|
||||||
{
|
{
|
||||||
NSRect clipViewBounds;
|
NSRect clipViewBounds;
|
||||||
float delta = [theEvent deltaY];
|
float deltaY = [theEvent deltaY];
|
||||||
|
float deltaX = [theEvent deltaX];
|
||||||
float amount;
|
float amount;
|
||||||
NSPoint point;
|
NSPoint point;
|
||||||
|
|
||||||
|
@ -401,46 +402,49 @@ static float scrollerWidth;
|
||||||
}
|
}
|
||||||
point = clipViewBounds.origin;
|
point = clipViewBounds.origin;
|
||||||
|
|
||||||
|
// Holding shift converts vertical scrolling to horizontal
|
||||||
if (_hasHorizScroller == YES
|
if (([theEvent modifierFlags] & NSShiftKeyMask) == NSShiftKeyMask)
|
||||||
&& ([theEvent modifierFlags] & NSShiftKeyMask) == NSShiftKeyMask)
|
|
||||||
{
|
{
|
||||||
if (([theEvent modifierFlags] & NSAlternateKeyMask) == NSAlternateKeyMask)
|
deltaX = -deltaY;
|
||||||
{
|
deltaY = 0;
|
||||||
amount = - (clipViewBounds.size.width - _hPageScroll) * delta;
|
}
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
amount = - _hLineScroll * delta;
|
|
||||||
}
|
|
||||||
NSDebugLLog (@"NSScrollView",
|
|
||||||
@"increment/decrement: amount = %f, horizontal", amount);
|
|
||||||
|
|
||||||
point.x = clipViewBounds.origin.x + amount;
|
// Scroll horizontally
|
||||||
|
if (([theEvent modifierFlags] & NSAlternateKeyMask) == NSAlternateKeyMask)
|
||||||
|
{
|
||||||
|
amount = (clipViewBounds.size.width - _hPageScroll) * deltaX;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (([theEvent modifierFlags] & NSAlternateKeyMask) == NSAlternateKeyMask)
|
amount = _hLineScroll * deltaX;
|
||||||
{
|
|
||||||
amount = - (clipViewBounds.size.height - _vPageScroll) * delta;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
amount = - _vLineScroll * delta;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (_contentView != nil && !_contentView->_rFlags.flipped_view)
|
|
||||||
{
|
|
||||||
/* If view is flipped reverse the scroll direction */
|
|
||||||
amount = -amount;
|
|
||||||
}
|
|
||||||
NSDebugLLog (@"NSScrollView",
|
|
||||||
@"increment/decrement: amount = %f, flipped = %d",
|
|
||||||
amount, _contentView ? _contentView->_rFlags.flipped_view : 0);
|
|
||||||
|
|
||||||
point.y = clipViewBounds.origin.y + amount;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NSDebugLLog (@"NSScrollView",
|
||||||
|
@"increment/decrement: amount = %f, horizontal", amount);
|
||||||
|
|
||||||
|
point.x = clipViewBounds.origin.x + amount;
|
||||||
|
|
||||||
|
// Scroll vertically
|
||||||
|
if (([theEvent modifierFlags] & NSAlternateKeyMask) == NSAlternateKeyMask)
|
||||||
|
{
|
||||||
|
amount = - (clipViewBounds.size.height - _vPageScroll) * deltaY;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
amount = - _vLineScroll * deltaY;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_contentView != nil && !_contentView->_rFlags.flipped_view)
|
||||||
|
{
|
||||||
|
/* If view is flipped reverse the scroll direction */
|
||||||
|
amount = -amount;
|
||||||
|
}
|
||||||
|
NSDebugLLog (@"NSScrollView",
|
||||||
|
@"increment/decrement: amount = %f, flipped = %d",
|
||||||
|
amount, _contentView ? _contentView->_rFlags.flipped_view : 0);
|
||||||
|
|
||||||
|
point.y = clipViewBounds.origin.y + amount;
|
||||||
|
|
||||||
/* scrollToPoint: will call reflectScrolledClipView:, which will
|
/* scrollToPoint: will call reflectScrolledClipView:, which will
|
||||||
* update rules, headers, and scrollers. */
|
* update rules, headers, and scrollers. */
|
||||||
[_contentView _scrollToPoint: point];
|
[_contentView _scrollToPoint: point];
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue