1997-08-05 21:50:10 +00:00
|
|
|
/*
|
1996-05-30 20:03:15 +00:00
|
|
|
NSScroller.m
|
|
|
|
|
|
|
|
Copyright (C) 1996 Free Software Foundation, Inc.
|
|
|
|
|
1997-08-05 21:50:10 +00:00
|
|
|
Author: Ovidiu Predescu <ovidiu@net-community.com>
|
|
|
|
A completely rewritten version of the original source by Scott Christley.
|
|
|
|
Date: July 1997
|
1998-08-30 16:06:47 +00:00
|
|
|
Author: Felipe A. Rodriguez <far@ix.netcom.com>
|
|
|
|
Date: August 1998
|
1996-05-30 20:03:15 +00:00
|
|
|
|
|
|
|
This file is part of the GNUstep GUI Library.
|
|
|
|
|
|
|
|
This library is free software; you can redistribute it and/or
|
|
|
|
modify it under the terms of the GNU Library General Public
|
|
|
|
License as published by the Free Software Foundation; either
|
|
|
|
version 2 of the License, or (at your option) any later version.
|
|
|
|
|
|
|
|
This library is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
Library General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU Library General Public
|
1997-08-05 21:50:10 +00:00
|
|
|
License along with this library; if not, write to the Free
|
|
|
|
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
|
|
*/
|
|
|
|
|
1997-09-23 22:43:24 +00:00
|
|
|
#include <gnustep/gui/config.h>
|
1998-12-09 01:26:37 +00:00
|
|
|
#include <math.h>
|
|
|
|
|
1997-08-05 21:50:10 +00:00
|
|
|
#include <Foundation/NSDate.h>
|
|
|
|
#include <Foundation/NSRunLoop.h>
|
1996-05-30 20:03:15 +00:00
|
|
|
|
1997-02-18 00:29:25 +00:00
|
|
|
#include <AppKit/NSScroller.h>
|
1998-10-15 12:04:53 +00:00
|
|
|
#include <AppKit/NSScrollView.h>
|
1997-02-18 00:29:25 +00:00
|
|
|
#include <AppKit/NSWindow.h>
|
1997-08-05 21:50:10 +00:00
|
|
|
#include <AppKit/NSButtonCell.h>
|
1997-03-05 01:11:17 +00:00
|
|
|
#include <AppKit/NSApplication.h>
|
|
|
|
#include <AppKit/NSImage.h>
|
1998-11-25 17:16:48 +00:00
|
|
|
#include <AppKit/PSMatrix.h>
|
|
|
|
|
1997-03-05 01:11:17 +00:00
|
|
|
|
1996-05-30 20:03:15 +00:00
|
|
|
|
1998-11-25 17:16:48 +00:00
|
|
|
@implementation NSScroller
|
1997-03-05 01:11:17 +00:00
|
|
|
|
1998-11-25 17:16:48 +00:00
|
|
|
//
|
|
|
|
// Class variables
|
|
|
|
//
|
|
|
|
static NSButtonCell* upCell = nil; // button cells used by
|
|
|
|
static NSButtonCell* downCell = nil; // scroller instances
|
|
|
|
static NSButtonCell* leftCell = nil; // to draw scroller
|
|
|
|
static NSButtonCell* rightCell = nil; // buttons and knob.
|
1997-08-05 21:50:10 +00:00
|
|
|
static NSButtonCell* knobCell = nil;
|
1997-03-05 01:11:17 +00:00
|
|
|
|
1998-11-25 17:16:48 +00:00
|
|
|
static const float scrollerWidth = 17;
|
|
|
|
static const float buttonsWidth = 16;
|
|
|
|
static const float buttonsDistance = 1;
|
|
|
|
|
|
|
|
static float halfKnobRectHeight;
|
|
|
|
static float slotOriginPlusKnobHeight;
|
|
|
|
static float slotOriginPlusSlotHeightMinusKnobHeight;
|
|
|
|
static float slotHeightMinusKnobHeight;
|
|
|
|
static float halfKnobRectWidth;
|
|
|
|
static float slotOriginPlusKnobWidth;
|
|
|
|
static float slotOriginPlusSlotWidthMinusHalfKnobWidth;
|
|
|
|
static float slotWidthMinusKnobWidth;
|
|
|
|
static NSRect slotRect = {{0,0},{0,0}};
|
|
|
|
static BOOL preCalcValues = NO;
|
|
|
|
|
|
|
|
//
|
|
|
|
// Class methods
|
|
|
|
//
|
1997-08-05 21:50:10 +00:00
|
|
|
+ (void)initialize
|
1997-03-05 01:11:17 +00:00
|
|
|
{
|
1998-11-25 17:16:48 +00:00
|
|
|
if (self == [NSScroller class])
|
|
|
|
[self setVersion:1];
|
1996-05-30 20:03:15 +00:00
|
|
|
}
|
|
|
|
|
1998-11-25 17:16:48 +00:00
|
|
|
+ (float)scrollerWidth { return scrollerWidth; }
|
1997-08-05 21:50:10 +00:00
|
|
|
- (NSScrollArrowPosition)arrowsPosition { return _arrowsPosition; }
|
|
|
|
- (NSUsableScrollerParts)usableParts { return _usableParts; }
|
1998-10-15 12:04:53 +00:00
|
|
|
- (float)knobProportion { return _knobProportion; }
|
|
|
|
- (NSScrollerPart)hitPart { return _hitPart; }
|
|
|
|
- (float)floatValue { return _floatValue; }
|
|
|
|
- (void)setAction:(SEL)action { _action = action; }
|
|
|
|
- (SEL)action { return _action; }
|
|
|
|
- (void)setTarget:(id)target { ASSIGN(_target, target); }
|
|
|
|
- (id)target { return _target; }
|
1998-12-09 01:26:37 +00:00
|
|
|
- (void)encodeWithCoder:aCoder { }
|
|
|
|
- initWithCoder:aDecoder { return self; }
|
1998-11-20 02:14:22 +00:00
|
|
|
- (BOOL)isOpaque { return YES; }
|
1996-05-30 20:03:15 +00:00
|
|
|
|
|
|
|
- initWithFrame:(NSRect)frameRect
|
|
|
|
{
|
1998-12-09 01:26:37 +00:00
|
|
|
if (frameRect.size.width > frameRect.size.height) // determine the
|
|
|
|
{ // orientation of
|
|
|
|
_isHorizontal = YES; // the scroller and
|
|
|
|
frameRect.size.height = [isa scrollerWidth]; // adjust it's size
|
|
|
|
} // accordingly
|
|
|
|
else
|
|
|
|
{
|
|
|
|
_isHorizontal = NO;
|
|
|
|
frameRect.size.width = [isa scrollerWidth];
|
|
|
|
}
|
|
|
|
|
|
|
|
[super initWithFrame:frameRect];
|
|
|
|
|
|
|
|
if (_isHorizontal)
|
|
|
|
_arrowsPosition = NSScrollerArrowsMinEnd;
|
|
|
|
else
|
|
|
|
_arrowsPosition = NSScrollerArrowsMaxEnd;
|
|
|
|
|
|
|
|
_hitPart = NSScrollerNoPart;
|
|
|
|
[self drawParts];
|
|
|
|
[self setEnabled:NO];
|
|
|
|
[self checkSpaceForParts];
|
|
|
|
|
|
|
|
return self;
|
1996-05-30 20:03:15 +00:00
|
|
|
}
|
1997-03-05 01:11:17 +00:00
|
|
|
|
1997-08-05 21:50:10 +00:00
|
|
|
- init
|
1996-05-30 20:03:15 +00:00
|
|
|
{
|
1998-12-09 01:26:37 +00:00
|
|
|
return [self initWithFrame:NSZeroRect];
|
1996-05-30 20:03:15 +00:00
|
|
|
}
|
|
|
|
|
1997-08-05 21:50:10 +00:00
|
|
|
- (void)drawParts
|
1998-12-09 01:26:37 +00:00
|
|
|
{ // Create the class variable
|
|
|
|
if (knobCell) // button cells if they do not
|
|
|
|
return; // yet exist.
|
|
|
|
|
|
|
|
upCell = [NSButtonCell new];
|
|
|
|
[upCell setHighlightsBy:NSChangeBackgroundCellMask|NSContentsCellMask];
|
|
|
|
[upCell setImage:[NSImage imageNamed:@"common_ArrowUp"]];
|
|
|
|
[upCell setAlternateImage:[NSImage imageNamed:@"common_ArrowUpH"]];
|
|
|
|
[upCell setImagePosition:NSImageOnly];
|
|
|
|
[upCell setContinuous:YES];
|
|
|
|
[upCell setPeriodicDelay:0.05 interval:0.05];
|
|
|
|
|
|
|
|
downCell = [NSButtonCell new];
|
|
|
|
[downCell setHighlightsBy:NSChangeBackgroundCellMask|NSContentsCellMask];
|
|
|
|
[downCell setImage:[NSImage imageNamed:@"common_ArrowDown"]];
|
|
|
|
[downCell setAlternateImage:[NSImage imageNamed:@"common_ArrowDownH"]];
|
|
|
|
[downCell setImagePosition:NSImageOnly];
|
|
|
|
[downCell setContinuous:YES];
|
|
|
|
[downCell setPeriodicDelay:0.05 interval:0.05];
|
|
|
|
|
|
|
|
leftCell = [NSButtonCell new];
|
|
|
|
[leftCell setHighlightsBy:NSChangeBackgroundCellMask|NSContentsCellMask];
|
|
|
|
[leftCell setImage:[NSImage imageNamed:@"common_ArrowLeft"]];
|
|
|
|
[leftCell setAlternateImage:[NSImage imageNamed:@"common_ArrowLeftH"]];
|
|
|
|
[leftCell setImagePosition:NSImageOnly];
|
|
|
|
[leftCell setContinuous:YES];
|
|
|
|
[leftCell setPeriodicDelay:0.05 interval:0.05];
|
|
|
|
|
|
|
|
rightCell = [NSButtonCell new];
|
|
|
|
[rightCell setHighlightsBy:NSChangeBackgroundCellMask|NSContentsCellMask];
|
|
|
|
[rightCell setImage:[NSImage imageNamed:@"common_ArrowRight"]];
|
|
|
|
[rightCell setAlternateImage:[NSImage imageNamed:@"common_ArrowRightH"]];
|
|
|
|
[rightCell setImagePosition:NSImageOnly];
|
|
|
|
[rightCell setContinuous:YES];
|
|
|
|
[rightCell setPeriodicDelay:0.05 interval:0.05];
|
|
|
|
|
|
|
|
knobCell = [NSButtonCell new];
|
|
|
|
[knobCell setButtonType:NSMomentaryChangeButton];
|
|
|
|
[knobCell setImage:[NSImage imageNamed:@"common_Dimple"]];
|
|
|
|
[knobCell setImagePosition:NSImageOnly];
|
1996-05-30 20:03:15 +00:00
|
|
|
}
|
|
|
|
|
1997-08-05 21:50:10 +00:00
|
|
|
- (void)_setTargetAndActionToCells
|
1997-03-05 01:11:17 +00:00
|
|
|
{
|
1998-12-09 01:26:37 +00:00
|
|
|
[upCell setTarget:_target];
|
|
|
|
[upCell setAction:_action];
|
|
|
|
|
|
|
|
[downCell setTarget:_target];
|
|
|
|
[downCell setAction:_action];
|
|
|
|
|
|
|
|
[leftCell setTarget:_target];
|
|
|
|
[leftCell setAction:_action];
|
|
|
|
|
|
|
|
[rightCell setTarget:_target];
|
|
|
|
[rightCell setAction:_action];
|
|
|
|
|
|
|
|
[knobCell setTarget:_target];
|
|
|
|
[knobCell setAction:_action];
|
1997-03-05 01:11:17 +00:00
|
|
|
}
|
1996-05-30 20:03:15 +00:00
|
|
|
|
1997-08-05 21:50:10 +00:00
|
|
|
- (void)checkSpaceForParts
|
1996-05-30 20:03:15 +00:00
|
|
|
{
|
1998-12-09 01:26:37 +00:00
|
|
|
NSSize frameSize = [self frame].size;
|
|
|
|
float size = (_isHorizontal ? frameSize.width : frameSize.height);
|
|
|
|
float scrollerWidth = [isa scrollerWidth];
|
|
|
|
|
|
|
|
if (size > 3 * scrollerWidth + 2)
|
|
|
|
_usableParts = NSAllScrollerParts;
|
|
|
|
else
|
|
|
|
if (size > 2 * scrollerWidth + 1)
|
|
|
|
_usableParts = NSOnlyScrollerArrows;
|
|
|
|
else
|
|
|
|
if (size > scrollerWidth)
|
|
|
|
_usableParts = NSNoScrollerParts;
|
1996-05-30 20:03:15 +00:00
|
|
|
}
|
|
|
|
|
1997-08-05 21:50:10 +00:00
|
|
|
- (void)setEnabled:(BOOL)flag
|
1996-05-30 20:03:15 +00:00
|
|
|
{
|
1998-12-09 01:26:37 +00:00
|
|
|
if (_isEnabled == flag)
|
|
|
|
return;
|
|
|
|
|
|
|
|
_isEnabled = flag;
|
|
|
|
[self setNeedsDisplay:YES];
|
1996-05-30 20:03:15 +00:00
|
|
|
}
|
|
|
|
|
1997-08-05 21:50:10 +00:00
|
|
|
- (void)setArrowsPosition:(NSScrollArrowPosition)where
|
1997-03-05 01:11:17 +00:00
|
|
|
{
|
1998-12-09 01:26:37 +00:00
|
|
|
if (_arrowsPosition == where)
|
|
|
|
return;
|
|
|
|
|
|
|
|
_arrowsPosition = where;
|
|
|
|
[self setNeedsDisplay:YES];
|
1997-03-05 01:11:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
- (void)setFloatValue:(float)aFloat
|
|
|
|
{
|
1998-08-30 16:06:47 +00:00
|
|
|
if (aFloat < 0)
|
|
|
|
_floatValue = 0;
|
|
|
|
else
|
|
|
|
if (aFloat > 1)
|
|
|
|
_floatValue = 1;
|
|
|
|
else
|
|
|
|
_floatValue = aFloat;
|
|
|
|
|
|
|
|
[self setNeedsDisplayInRect:[self rectForPart:NSScrollerKnobSlot]];
|
1997-03-05 01:11:17 +00:00
|
|
|
}
|
1996-05-30 20:03:15 +00:00
|
|
|
|
1998-12-09 01:26:37 +00:00
|
|
|
- (void)setFloatValue:(float)aFloat knobProportion:(float)ratio
|
1996-05-30 20:03:15 +00:00
|
|
|
{
|
1998-12-09 01:26:37 +00:00
|
|
|
if (ratio < 0)
|
|
|
|
_knobProportion = 0;
|
|
|
|
else
|
|
|
|
if (ratio > 1)
|
|
|
|
_knobProportion = 1;
|
|
|
|
else
|
|
|
|
_knobProportion = ratio;
|
|
|
|
|
|
|
|
[self setFloatValue:aFloat];
|
1996-05-30 20:03:15 +00:00
|
|
|
}
|
|
|
|
|
1997-08-05 21:50:10 +00:00
|
|
|
- (void)setFrame:(NSRect)frameRect
|
1997-03-05 01:11:17 +00:00
|
|
|
{
|
1998-12-09 01:26:37 +00:00
|
|
|
if (frameRect.size.width > frameRect.size.height) // determine the
|
|
|
|
{ // orientation of
|
|
|
|
_isHorizontal = YES; // the scroller and
|
|
|
|
frameRect.size.height = [isa scrollerWidth]; // adjust it's size
|
|
|
|
} // accordingly
|
|
|
|
else
|
|
|
|
{
|
|
|
|
_isHorizontal = NO;
|
|
|
|
frameRect.size.width = [isa scrollerWidth];
|
|
|
|
}
|
|
|
|
|
|
|
|
[super setFrame:frameRect];
|
|
|
|
|
|
|
|
if (_isHorizontal)
|
|
|
|
_arrowsPosition = NSScrollerArrowsMinEnd;
|
|
|
|
else
|
|
|
|
_arrowsPosition = NSScrollerArrowsMaxEnd;
|
|
|
|
|
|
|
|
_hitPart = NSScrollerNoPart;
|
|
|
|
[self checkSpaceForParts];
|
1997-03-05 01:11:17 +00:00
|
|
|
}
|
1996-05-30 20:03:15 +00:00
|
|
|
|
1997-08-05 21:50:10 +00:00
|
|
|
- (void)setFrameSize:(NSSize)size
|
1996-05-30 20:03:15 +00:00
|
|
|
{
|
1998-12-09 01:26:37 +00:00
|
|
|
[super setFrameSize:size];
|
|
|
|
[self checkSpaceForParts];
|
|
|
|
[self setNeedsDisplay:YES];
|
1996-05-30 20:03:15 +00:00
|
|
|
}
|
|
|
|
|
1998-12-09 01:26:37 +00:00
|
|
|
- (NSScrollerPart)testPart:(NSPoint)thePoint // return what part
|
|
|
|
{ // of the scroller
|
|
|
|
NSRect rect; // the mouse hit
|
1997-03-21 01:06:15 +00:00
|
|
|
|
1998-12-09 01:26:37 +00:00
|
|
|
if (thePoint.x < 0 || thePoint.x > frame.size.width
|
|
|
|
|| thePoint.y < 0 || thePoint.y > frame.size.height)
|
|
|
|
return NSScrollerNoPart;
|
|
|
|
|
|
|
|
rect = [self rectForPart:NSScrollerDecrementLine];
|
|
|
|
if ([self mouse:thePoint inRect:rect])
|
|
|
|
return NSScrollerDecrementLine;
|
|
|
|
|
|
|
|
rect = [self rectForPart:NSScrollerIncrementLine];
|
|
|
|
if ([self mouse:thePoint inRect:rect])
|
|
|
|
return NSScrollerIncrementLine;
|
|
|
|
|
|
|
|
rect = [self rectForPart:NSScrollerKnob];
|
|
|
|
if ([self mouse:thePoint inRect:rect])
|
|
|
|
return NSScrollerKnob;
|
|
|
|
|
|
|
|
rect = [self rectForPart:NSScrollerKnobSlot];
|
|
|
|
if ([self mouse:thePoint inRect:rect])
|
|
|
|
return NSScrollerKnobSlot;
|
|
|
|
|
|
|
|
rect = [self rectForPart:NSScrollerDecrementPage];
|
|
|
|
if ([self mouse:thePoint inRect:rect])
|
|
|
|
return NSScrollerDecrementPage;
|
|
|
|
|
|
|
|
rect = [self rectForPart:NSScrollerIncrementPage];
|
|
|
|
if ([self mouse:thePoint inRect:rect])
|
|
|
|
return NSScrollerIncrementPage;
|
|
|
|
|
|
|
|
return NSScrollerNoPart;
|
1997-03-05 01:11:17 +00:00
|
|
|
}
|
1996-05-30 20:03:15 +00:00
|
|
|
|
1997-08-05 21:50:10 +00:00
|
|
|
- (float)_floatValueForMousePoint:(NSPoint)point
|
1997-03-05 01:11:17 +00:00
|
|
|
{
|
1998-11-25 17:16:48 +00:00
|
|
|
NSRect knobRect = [self rectForPart:NSScrollerKnob];
|
|
|
|
NSRect slotRect = [self rectForPart:NSScrollerKnobSlot];
|
|
|
|
float floatValue = 0;
|
|
|
|
float position;
|
|
|
|
|
|
|
|
if (_isHorizontal) // Adjust point to lie
|
|
|
|
{ // within the knob slot
|
|
|
|
float halfKnobRectWidth = knobRect.size.width / 2;
|
1997-08-05 21:50:10 +00:00
|
|
|
|
1998-11-25 17:16:48 +00:00
|
|
|
if (point.x < slotRect.origin.x + halfKnobRectWidth)
|
|
|
|
position = slotRect.origin.x + halfKnobRectWidth;
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (point.x > slotRect.origin.x + slotRect.size.width -
|
|
|
|
halfKnobRectWidth)
|
|
|
|
position = slotRect.origin.x + slotRect.size.width -
|
|
|
|
halfKnobRectWidth;
|
|
|
|
else
|
|
|
|
position = point.x;
|
|
|
|
} // Compute float value
|
|
|
|
// given the knob size
|
|
|
|
floatValue = (position - (slotRect.origin.x + halfKnobRectWidth))
|
|
|
|
/ (slotRect.size.width - knobRect.size.width);
|
|
|
|
}
|
|
|
|
else // Adjust point to lie
|
|
|
|
{ // within the knob slot
|
|
|
|
float halfKnobRectHeight = knobRect.size.height / 2;
|
|
|
|
|
|
|
|
if (point.y < slotRect.origin.y + halfKnobRectHeight)
|
|
|
|
position = slotRect.origin.y + halfKnobRectHeight;
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (point.y > slotRect.origin.y + slotRect.size.height -
|
|
|
|
halfKnobRectHeight)
|
|
|
|
position = slotRect.origin.y + slotRect.size.height -
|
|
|
|
halfKnobRectHeight;
|
|
|
|
else
|
|
|
|
position = point.y;
|
|
|
|
}
|
|
|
|
// Compute float value
|
|
|
|
floatValue = (position - (slotRect.origin.y + halfKnobRectHeight)) /
|
|
|
|
(slotRect.size.height - knobRect.size.height);
|
|
|
|
floatValue = 1 - floatValue;
|
|
|
|
}
|
|
|
|
|
|
|
|
return floatValue;
|
1997-08-05 21:50:10 +00:00
|
|
|
}
|
|
|
|
|
1998-12-09 01:26:37 +00:00
|
|
|
- (void)_preCalcParts // pre calculate
|
|
|
|
{ // values to lessen
|
|
|
|
NSRect knobRect = [self rectForPart:NSScrollerKnob]; // the burden while
|
|
|
|
// scrolling
|
1998-11-25 17:16:48 +00:00
|
|
|
slotRect = [self rectForPart:NSScrollerKnobSlot];
|
1997-03-05 01:11:17 +00:00
|
|
|
|
1998-11-25 17:16:48 +00:00
|
|
|
halfKnobRectWidth = knobRect.size.width / 2;
|
|
|
|
slotOriginPlusKnobWidth = slotRect.origin.x + halfKnobRectWidth;
|
|
|
|
slotOriginPlusSlotWidthMinusHalfKnobWidth = slotRect.origin.x +
|
|
|
|
slotRect.size.width - halfKnobRectWidth;
|
|
|
|
slotWidthMinusKnobWidth = slotRect.size.width - knobRect.size.width;
|
1997-03-05 01:11:17 +00:00
|
|
|
|
1998-11-25 17:16:48 +00:00
|
|
|
halfKnobRectHeight = knobRect.size.height / 2;
|
|
|
|
slotOriginPlusKnobHeight = slotRect.origin.y + halfKnobRectHeight;
|
|
|
|
slotOriginPlusSlotHeightMinusKnobHeight = slotRect.origin.y +
|
|
|
|
slotRect.size.height - halfKnobRectHeight;
|
|
|
|
slotHeightMinusKnobHeight = slotRect.size.height - knobRect.size.height;
|
|
|
|
}
|
1997-03-20 19:23:21 +00:00
|
|
|
|
1998-11-25 17:16:48 +00:00
|
|
|
- (float)_floatValueForMousePointFromPreCalc:(NSPoint)point
|
1998-12-09 01:26:37 +00:00
|
|
|
{
|
|
|
|
float floatValue = 0;
|
1998-11-25 17:16:48 +00:00
|
|
|
float position;
|
1997-03-21 01:06:15 +00:00
|
|
|
|
1998-11-25 17:16:48 +00:00
|
|
|
if (_isHorizontal) // Adjust point to lie
|
|
|
|
{ // within the knob slot
|
|
|
|
if (point.x < slotOriginPlusKnobWidth)
|
|
|
|
position = slotOriginPlusKnobWidth;
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (point.x > slotOriginPlusSlotWidthMinusHalfKnobWidth)
|
|
|
|
position = slotOriginPlusSlotWidthMinusHalfKnobWidth;
|
|
|
|
else
|
|
|
|
position = point.x;
|
|
|
|
} // Compute float value
|
|
|
|
// given the knob size
|
|
|
|
floatValue = (position - slotOriginPlusKnobWidth) /
|
|
|
|
slotWidthMinusKnobWidth;
|
|
|
|
}
|
|
|
|
else // Adjust point to lie
|
|
|
|
{ // within the knob slot
|
|
|
|
if (point.y < slotOriginPlusKnobHeight)
|
|
|
|
position = slotOriginPlusKnobHeight;
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (point.y > slotOriginPlusSlotHeightMinusKnobHeight)
|
|
|
|
position = slotOriginPlusSlotHeightMinusKnobHeight;
|
|
|
|
else
|
|
|
|
position = point.y;
|
|
|
|
}
|
|
|
|
// Compute float value
|
|
|
|
floatValue = (position - slotOriginPlusKnobHeight) /
|
|
|
|
slotHeightMinusKnobHeight;
|
|
|
|
floatValue = 1 - floatValue;
|
|
|
|
}
|
|
|
|
|
|
|
|
return floatValue;
|
1997-03-05 01:11:17 +00:00
|
|
|
}
|
|
|
|
|
1998-11-25 17:16:48 +00:00
|
|
|
- (void)mouseDown:(NSEvent*)theEvent
|
1997-03-05 01:11:17 +00:00
|
|
|
{
|
1998-11-25 17:16:48 +00:00
|
|
|
NSPoint location = [self convertPoint:[theEvent locationInWindow]
|
|
|
|
fromView:nil];
|
|
|
|
|
|
|
|
[self lockFocus];
|
|
|
|
_hitPart = [self testPart:location];
|
|
|
|
[self _setTargetAndActionToCells];
|
|
|
|
|
|
|
|
switch (_hitPart)
|
|
|
|
{
|
|
|
|
case NSScrollerIncrementLine:
|
|
|
|
case NSScrollerDecrementLine:
|
|
|
|
case NSScrollerIncrementPage:
|
|
|
|
case NSScrollerDecrementPage:
|
|
|
|
[self trackScrollButtons:theEvent];
|
|
|
|
break;
|
|
|
|
|
|
|
|
case NSScrollerKnob:
|
|
|
|
[self trackKnob:theEvent];
|
|
|
|
break;
|
|
|
|
|
|
|
|
case NSScrollerKnobSlot:
|
|
|
|
{
|
|
|
|
float floatValue = [self _floatValueForMousePoint:location];
|
|
|
|
|
|
|
|
[self setFloatValue:floatValue];
|
|
|
|
[self sendAction:_action to:_target];
|
|
|
|
[self drawKnobSlot];
|
|
|
|
[self drawKnob];
|
|
|
|
[window flushWindow];
|
|
|
|
[self trackKnob:theEvent];
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
case NSScrollerNoPart:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
_hitPart = NSScrollerNoPart;
|
|
|
|
[self unlockFocus];
|
|
|
|
}
|
1997-03-05 01:11:17 +00:00
|
|
|
|
1998-11-25 17:16:48 +00:00
|
|
|
- (void)trackKnob:(NSEvent*)theEvent
|
|
|
|
{
|
|
|
|
unsigned int eventMask = NSLeftMouseDownMask | NSLeftMouseUpMask
|
|
|
|
| NSLeftMouseDraggedMask | NSMouseMovedMask
|
|
|
|
| NSPeriodicMask;
|
|
|
|
NSApplication *app = [NSApplication sharedApplication];
|
|
|
|
NSPoint point, apoint;
|
|
|
|
float oldFloatValue = _floatValue;
|
|
|
|
float floatValue;
|
|
|
|
NSDate *theDistantFuture = [NSDate distantFuture];
|
|
|
|
PSMatrix* matrix;
|
|
|
|
NSEventType eventType;
|
|
|
|
NSRect knobRect = {{0,0},{0,0}};
|
1998-12-09 01:26:37 +00:00
|
|
|
int periodCount = 0; // allows a forced update
|
1998-11-25 17:16:48 +00:00
|
|
|
NSArray* path = [self _pathBetweenSubview:self
|
|
|
|
toSuperview:[window contentView]];
|
|
|
|
|
|
|
|
matrix = [self _concatenateMatricesInReverseOrderFromPath:path];
|
|
|
|
[matrix inverse];
|
|
|
|
|
|
|
|
//fprintf(stderr, " trackKnob \n");
|
|
|
|
|
|
|
|
[self _preCalcParts]; // pre calc scroller parts
|
|
|
|
preCalcValues = YES;
|
|
|
|
|
|
|
|
_hitPart = NSScrollerKnob; // set periodic events rate
|
1998-12-09 01:26:37 +00:00
|
|
|
// to achieve max of ~30fps
|
1998-11-25 17:16:48 +00:00
|
|
|
[NSEvent startPeriodicEventsAfterDelay:0.02 withPeriod:0.03];
|
|
|
|
[[NSRunLoop currentRunLoop] limitDateForMode:NSEventTrackingRunLoopMode];
|
|
|
|
|
|
|
|
while ((eventType = [theEvent type]) != NSLeftMouseUp)
|
|
|
|
{ // user is moving scroller
|
|
|
|
if (eventType != NSPeriodic) // loop until left mouse up
|
1998-12-09 01:26:37 +00:00
|
|
|
{
|
|
|
|
apoint = [theEvent locationInWindow]; // zero the periodic count
|
|
|
|
periodCount = 0; // whenever a real position
|
|
|
|
} // event is recieved
|
|
|
|
else
|
|
|
|
{ // if 6x periods have gone by w/o movement
|
|
|
|
if(periodCount == 6) // check mouse and update if necessary
|
|
|
|
apoint = [window mouseLocationOutsideOfEventStream];
|
|
|
|
|
1998-11-25 17:16:48 +00:00
|
|
|
point = [matrix pointInMatrixSpace:apoint];
|
1998-12-09 01:26:37 +00:00
|
|
|
|
1998-11-25 17:16:48 +00:00
|
|
|
if (point.x != knobRect.origin.x || point.y != knobRect.origin.y)
|
1998-12-09 01:26:37 +00:00
|
|
|
{
|
1998-11-25 17:16:48 +00:00
|
|
|
floatValue = [self _floatValueForMousePointFromPreCalc:point];
|
|
|
|
|
|
|
|
if (floatValue != oldFloatValue)
|
|
|
|
{
|
|
|
|
if (floatValue < 0)
|
|
|
|
_floatValue = 0;
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (floatValue > 1)
|
|
|
|
_floatValue = 1;
|
|
|
|
else
|
|
|
|
_floatValue = floatValue;
|
|
|
|
}
|
|
|
|
|
1998-12-09 01:26:37 +00:00
|
|
|
[self drawKnobSlot]; // draw the scroller slot
|
|
|
|
[self drawKnob]; // draw the scroller knob
|
1998-11-25 17:16:48 +00:00
|
|
|
[_target performSelector:_action withObject:self];
|
|
|
|
[window flushWindow];
|
|
|
|
|
|
|
|
oldFloatValue = floatValue;
|
1998-12-09 01:26:37 +00:00
|
|
|
} // avoid timing related scrolling
|
|
|
|
// hesitation by counting number of
|
|
|
|
knobRect.origin = point; // periodic events since scroll pos
|
|
|
|
} // was updated, when this reaches
|
|
|
|
periodCount++; // 6x periodic rate an update is
|
|
|
|
} // forced on next periodic event
|
1998-11-25 17:16:48 +00:00
|
|
|
theEvent = [app nextEventMatchingMask:eventMask
|
|
|
|
untilDate:theDistantFuture
|
|
|
|
inMode:NSEventTrackingRunLoopMode
|
|
|
|
dequeue:YES];
|
|
|
|
}
|
|
|
|
[NSEvent stopPeriodicEvents];
|
1998-12-09 01:26:37 +00:00
|
|
|
|
|
|
|
if([_target isKindOf:[NSScrollView class]]) // hack for XRAW FIX ME
|
|
|
|
{
|
|
|
|
NSObject *targetCV = (NSObject *)[_target contentView];
|
|
|
|
|
|
|
|
if([targetCV respondsToSelector:@selector(_freeMatrix)])
|
|
|
|
[targetCV _freeMatrix];
|
1998-11-25 17:16:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
preCalcValues = NO;
|
1997-08-05 21:50:10 +00:00
|
|
|
}
|
1997-03-05 01:11:17 +00:00
|
|
|
|
1997-08-05 21:50:10 +00:00
|
|
|
- (void)trackScrollButtons:(NSEvent*)theEvent
|
|
|
|
{
|
1998-11-02 17:42:23 +00:00
|
|
|
NSApplication *theApp = [NSApplication sharedApplication];
|
|
|
|
unsigned int eventMask = NSLeftMouseDownMask | NSLeftMouseUpMask |
|
|
|
|
NSLeftMouseDraggedMask | NSMouseMovedMask;
|
|
|
|
NSPoint location;
|
|
|
|
BOOL shouldReturn = NO;
|
|
|
|
id theCell = nil;
|
|
|
|
NSRect rect;
|
|
|
|
|
|
|
|
NSDebugLog (@"trackScrollButtons");
|
|
|
|
do {
|
|
|
|
location = [self convertPoint:[theEvent locationInWindow]fromView:nil];
|
|
|
|
_hitPart = [self testPart:location];
|
|
|
|
rect = [self rectForPart:_hitPart];
|
|
|
|
|
|
|
|
switch (_hitPart) // determine which
|
|
|
|
{ // cell was hit
|
|
|
|
case NSScrollerIncrementLine:
|
|
|
|
case NSScrollerIncrementPage:
|
|
|
|
theCell = (_isHorizontal ? rightCell : upCell);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case NSScrollerDecrementLine:
|
|
|
|
case NSScrollerDecrementPage:
|
|
|
|
theCell = (_isHorizontal ? leftCell : downCell);
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
theCell = nil;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (theCell)
|
|
|
|
{
|
|
|
|
[theCell highlight:YES withFrame:rect inView:self];
|
|
|
|
[window flushWindow];
|
|
|
|
|
|
|
|
NSLog (@"tracking cell %x", theCell);
|
|
|
|
|
|
|
|
shouldReturn = [theCell trackMouse:theEvent // Track the mouse
|
|
|
|
inRect:rect // until left mouse
|
|
|
|
ofView:self // goes up
|
|
|
|
untilMouseUp:YES];
|
|
|
|
|
|
|
|
if([_target isKindOf:[NSScrollView class]]) // a hack for XRAW
|
|
|
|
{ // FIX ME
|
1998-11-25 17:16:48 +00:00
|
|
|
NSObject *targetCV = (NSObject *)[_target contentView];
|
|
|
|
|
|
|
|
if([targetCV respondsToSelector:@selector(_freeMatrix)])
|
|
|
|
[targetCV _freeMatrix];
|
1998-11-02 17:42:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
[theCell highlight:NO withFrame:rect inView:self];
|
|
|
|
[window flushWindow];
|
|
|
|
}
|
|
|
|
|
|
|
|
if (shouldReturn)
|
|
|
|
break;
|
|
|
|
|
|
|
|
theEvent = [theApp nextEventMatchingMask:eventMask
|
|
|
|
untilDate:[NSDate distantFuture]
|
|
|
|
inMode:NSEventTrackingRunLoopMode
|
|
|
|
dequeue:YES];
|
|
|
|
}
|
|
|
|
while ([theEvent type] != NSLeftMouseUp);
|
|
|
|
|
|
|
|
NSDebugLog (@"return from trackScrollButtons");
|
1997-03-05 01:11:17 +00:00
|
|
|
}
|
1996-05-30 20:03:15 +00:00
|
|
|
|
1998-10-19 06:10:49 +00:00
|
|
|
- (BOOL)sendActionO:(SEL)theAction to:(id)theTarget
|
|
|
|
{ // send action to
|
|
|
|
BOOL ret = [super sendAction:theAction to:theTarget]; // the target on
|
|
|
|
// behalf of cell
|
|
|
|
[self drawKnobSlot]; // lockFocus set in mouseDown method is
|
|
|
|
[self drawKnob]; // active so we simply redraw the knob and
|
|
|
|
[window flushWindow]; // slot to reflect the hit scroll button
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
1998-11-25 17:16:48 +00:00
|
|
|
//
|
|
|
|
// draw the scroller
|
|
|
|
//
|
1997-08-05 21:50:10 +00:00
|
|
|
- (void)drawRect:(NSRect)rect
|
|
|
|
{
|
1998-12-09 01:26:37 +00:00
|
|
|
NSDebugLog (@"NSScroller drawRect: ((%f, %f), (%f, %f))",
|
|
|
|
rect.origin.x, rect.origin.y, rect.size.width, rect.size.height);
|
|
|
|
|
|
|
|
[self drawArrow:NSScrollerDecrementArrow highlight:NO];
|
|
|
|
[self drawArrow:NSScrollerIncrementArrow highlight:NO];
|
|
|
|
|
|
|
|
[self drawKnobSlot];
|
|
|
|
[self drawKnob];
|
1997-03-05 01:11:17 +00:00
|
|
|
}
|
|
|
|
|
1998-11-25 17:16:48 +00:00
|
|
|
- (void)drawArrow:(NSScrollerArrow)whichButton highlight:(BOOL)flag
|
1997-03-05 01:11:17 +00:00
|
|
|
{
|
1998-12-09 01:26:37 +00:00
|
|
|
NSRect rect = [self rectForPart:(whichButton == NSScrollerIncrementArrow
|
|
|
|
? NSScrollerIncrementLine : NSScrollerDecrementLine)];
|
|
|
|
id theCell = nil;
|
|
|
|
|
|
|
|
NSDebugLog (@"position of %s cell is (%f, %f)",
|
|
|
|
(whichButton == NSScrollerIncrementArrow ? "increment" : "decrement"),
|
|
|
|
rect.origin.x, rect.origin.y);
|
|
|
|
|
|
|
|
switch (whichButton)
|
|
|
|
{
|
|
|
|
case NSScrollerDecrementArrow:
|
|
|
|
theCell = (_isHorizontal ? leftCell : downCell);
|
|
|
|
break;
|
|
|
|
case NSScrollerIncrementArrow:
|
|
|
|
theCell = (_isHorizontal ? rightCell : upCell);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
[theCell drawWithFrame:rect inView:self];
|
1997-03-05 01:11:17 +00:00
|
|
|
}
|
|
|
|
|
1997-08-05 21:50:10 +00:00
|
|
|
- (void)drawKnob
|
1997-03-05 01:11:17 +00:00
|
|
|
{
|
1998-11-25 17:16:48 +00:00
|
|
|
[knobCell drawWithFrame:[self rectForPart:NSScrollerKnob] inView:self];
|
1997-03-05 01:11:17 +00:00
|
|
|
}
|
|
|
|
|
1998-11-25 17:16:48 +00:00
|
|
|
- (void)drawKnobSlot
|
1997-03-05 01:11:17 +00:00
|
|
|
{
|
1998-11-25 17:16:48 +00:00
|
|
|
NSRect rect;
|
|
|
|
|
|
|
|
if(preCalcValues) // in a modal loop we
|
|
|
|
rect = slotRect; // have already pre
|
|
|
|
else // calc'd our parts
|
|
|
|
rect = [self rectForPart:NSScrollerKnobSlot];
|
|
|
|
|
|
|
|
[[NSColor darkGrayColor] set];
|
|
|
|
NSRectFill(rect); // draw the bar slot
|
1997-03-05 01:11:17 +00:00
|
|
|
}
|
|
|
|
|
1998-11-25 17:16:48 +00:00
|
|
|
- (NSRect)rectForPart:(NSScrollerPart)partCode
|
1998-09-08 14:56:29 +00:00
|
|
|
{
|
1998-11-25 17:16:48 +00:00
|
|
|
NSRect scrollerFrame = frame;
|
|
|
|
float x = 1, y = 1, width = 0, height = 0, floatValue;
|
|
|
|
NSScrollArrowPosition arrowsPosition;
|
|
|
|
NSUsableScrollerParts usableParts;
|
|
|
|
// If the scroller is disabled then
|
|
|
|
if (!_isEnabled) // the scroller buttons and the
|
|
|
|
usableParts = NSNoScrollerParts; // knob are not displayed at all.
|
|
|
|
else
|
|
|
|
usableParts = _usableParts;
|
|
|
|
|
|
|
|
// Since we haven't yet flipped views we have
|
|
|
|
if (!_isHorizontal) // to swap the meaning of the arrows position
|
|
|
|
{ // if the scroller's orientation is vertical.
|
|
|
|
if (_arrowsPosition == NSScrollerArrowsMaxEnd)
|
|
|
|
arrowsPosition = NSScrollerArrowsMinEnd;
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (_arrowsPosition == NSScrollerArrowsMinEnd)
|
|
|
|
arrowsPosition = NSScrollerArrowsMaxEnd;
|
|
|
|
else
|
|
|
|
arrowsPosition = NSScrollerArrowsNone;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
arrowsPosition = _arrowsPosition;
|
|
|
|
|
|
|
|
// Assign to `width' and `height' values describing
|
|
|
|
// the width and height of the scroller regardless
|
|
|
|
// of its orientation. Also compute the `floatValue'
|
|
|
|
if (_isHorizontal) // which is essentially the same width as _floatValue
|
|
|
|
{ // but keeps track of the scroller's orientation.
|
|
|
|
width = scrollerFrame.size.height;
|
|
|
|
height = scrollerFrame.size.width;
|
|
|
|
floatValue = _floatValue;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
width = scrollerFrame.size.width;
|
|
|
|
height = scrollerFrame.size.height;
|
|
|
|
floatValue = 1 - _floatValue;
|
|
|
|
} // The x, y, width and height values
|
|
|
|
// are computed below for the vertical
|
|
|
|
switch (partCode) // scroller. The height of the scroll
|
|
|
|
{ // buttons is assumed to be equal to
|
|
|
|
case NSScrollerKnob: // the width.
|
|
|
|
{
|
|
|
|
float knobHeight, knobPosition, slotHeight;
|
|
|
|
// If the scroller does not have parts
|
|
|
|
// or a knob return a zero rect.
|
|
|
|
if (usableParts == NSNoScrollerParts ||
|
|
|
|
usableParts == NSOnlyScrollerArrows)
|
|
|
|
return NSZeroRect;
|
|
|
|
// calc the slot Height
|
|
|
|
slotHeight = height - (arrowsPosition == NSScrollerArrowsNone ?
|
|
|
|
0 : 2 * (buttonsWidth + buttonsDistance));
|
|
|
|
if (_isHorizontal)
|
|
|
|
slotHeight -= 2;
|
|
|
|
knobHeight = _knobProportion * slotHeight;
|
|
|
|
if (knobHeight < buttonsWidth)
|
|
|
|
knobHeight = buttonsWidth;
|
|
|
|
// calc knob's position
|
|
|
|
knobPosition = floatValue * (slotHeight - knobHeight);
|
|
|
|
knobPosition = (float)floor(knobPosition); // avoid rounding error
|
|
|
|
// calc actual position
|
|
|
|
y = knobPosition + (arrowsPosition == NSScrollerArrowsMaxEnd
|
|
|
|
|| arrowsPosition == NSScrollerArrowsNone ?
|
|
|
|
0 : 2 * (buttonsWidth + buttonsDistance));
|
|
|
|
height = knobHeight;
|
|
|
|
width = buttonsWidth;
|
|
|
|
if (_isHorizontal) // keeps horiz knob off
|
|
|
|
y++; // of the buttons
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
case NSScrollerKnobSlot:
|
|
|
|
x = 0; // if the scroller does
|
* NSWindow.m renmae captureMouse: to _captureMouse: (designate as non OS),
various methods add fieldEditor support.
* GSContext.m/GSContext.h revert to previous code as solution discussed
with Adam Fedor regarding backends had problems I had not forseen.
* NSBrowserCell.h/.m specify text subcell as an NSCell, eliminate image
cell, copyWithZone: optimize and eliminate use of ASSIGN (fixes serious
dealloc bug), highlight: eliminate method (fixes dup display bug).
* NSButtonCell.m copyWithZone: optimize and eliminate use of ASSIGN
* NSStringDrawing.h/.m remove unimplemented draw methods from Category
(these are backend specific, can't be defined twice and are already
implemented in xraw).
* NSApplication.h redefine initialize_gnustep_backend () per Adam's
redefinition in the backend.
* Functions.m/.h remove initialize_gnustep_backend()
* NSCell.m preliminary implementation of fieldEditor mechanism,
copyWithZone: optimize and eliminate use of ASSIGN
* NSControl.m rename cell class global to _NSCONTROL_CELL_CLASS
* NSMatrix.m implement NSControl's updateCell: to prevent unecessary
matrix drawing if possible.
* NSView.m -resizeWithOldSuperviewSize reverted code to my own once more
(fewer lines and no if/else logic), changed code to use view frame instead
of bounds per 3.3/4.2 docs, optimize to avoid floating point math and scale
adjustment unless view has been scaled.
* NSScrollView.m define as externs various PS* functions for use in
drawing, polish drawing, move all backend code to front.
* Tools/dummy.m define dummy PS* functions employed in gui.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@3454 72102866-910b-0410-8b05-ffd578937521
1998-12-14 09:54:38 +00:00
|
|
|
width = scrollerWidth; // not have buttons the
|
1998-11-25 17:16:48 +00:00
|
|
|
// slot completely
|
|
|
|
if (usableParts == NSNoScrollerParts) // fills the scroller.
|
|
|
|
{
|
|
|
|
y = 0; // `height' unchanged
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
if (arrowsPosition == NSScrollerArrowsMaxEnd)
|
|
|
|
{
|
|
|
|
y = 0;
|
|
|
|
height -= 2 * (buttonsWidth + buttonsDistance) + 1;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (arrowsPosition == NSScrollerArrowsMinEnd)
|
|
|
|
{
|
|
|
|
y = 2 * (buttonsWidth + buttonsDistance) + 1;
|
|
|
|
height -= y;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
y = 0; // `height' unchanged
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case NSScrollerDecrementLine:
|
|
|
|
case NSScrollerDecrementPage:
|
|
|
|
if (usableParts == NSNoScrollerParts) // if scroller has no
|
|
|
|
return NSZeroRect; // parts or knob then
|
|
|
|
// return a zero rect
|
|
|
|
width = buttonsWidth;
|
|
|
|
if (arrowsPosition == NSScrollerArrowsMaxEnd)
|
|
|
|
y = height - 2 * (buttonsWidth + buttonsDistance);
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (arrowsPosition == NSScrollerArrowsMinEnd)
|
|
|
|
y = 1;
|
|
|
|
else
|
|
|
|
return NSZeroRect;
|
|
|
|
}
|
|
|
|
height = buttonsWidth;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case NSScrollerIncrementLine:
|
|
|
|
case NSScrollerIncrementPage:
|
|
|
|
if (usableParts == NSNoScrollerParts) // if scroller has no
|
|
|
|
return NSZeroRect; // parts or knob then
|
|
|
|
// return a zero rect
|
|
|
|
width = buttonsWidth;
|
|
|
|
if (arrowsPosition == NSScrollerArrowsMaxEnd)
|
|
|
|
y = height - (buttonsWidth + buttonsDistance);
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (arrowsPosition == NSScrollerArrowsMinEnd)
|
|
|
|
y = buttonsWidth + buttonsDistance + 1;
|
|
|
|
else
|
|
|
|
return NSZeroRect;
|
|
|
|
}
|
|
|
|
height = buttonsWidth;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case NSScrollerNoPart:
|
|
|
|
return NSZeroRect;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (_isHorizontal)
|
|
|
|
return NSMakeRect (y, x, height, width);
|
|
|
|
else
|
|
|
|
return NSMakeRect (x, y, width, height);
|
1998-09-08 14:56:29 +00:00
|
|
|
}
|
1997-08-05 21:50:10 +00:00
|
|
|
|
1997-03-05 01:11:17 +00:00
|
|
|
@end
|