Logo Search packages:      
Sourcecode: ladder.app version File versions  Download package

- (NSRect) knobRectFlipped: (BOOL)  flipped   [implementation]

Returns the rect in which to draw the knob, based on the coordinate system of the NSSlider or NSMatrix this NSSliderCell is associated with. flipped indicates whether or not that coordinate system is flipped, which can be determined by sending the isFlipped message to the associated NSSlider or NSMatrix.

Do not call this method directly. It is included for subclassing only.

Definition at line 127 of file ClockCell.m.

Referenced by drawKnob.

                          : (BOOL)flipped
{
  NSImage   *image = [_knobCell image];
  NSSize    size;
  NSPoint   origin;
  float           floatValue = [self floatValue];

  if (_isVertical && flipped)
    {
      floatValue = _maxValue + _minValue - floatValue;
    }

  floatValue = (floatValue - _minValue) / (_maxValue - _minValue);

  size = [image size];

  if (_isVertical == YES)
    {
      origin = _trackRect.origin;
      origin.y += (_trackRect.size.height - size.height) * floatValue;
    }
  else
    {
      origin = _trackRect.origin;
      origin.x += (_trackRect.size.width - size.width) * floatValue;
    }

  return NSMakeRect (origin.x, origin.y, size.width, size.height); 
}


Generated by  Doxygen 1.6.0   Back to index