コード例 #1
0
  public void tile() {
    /* Let the superclass do most of the work. */
    super.tile();

    if (!hasHorizontalScroller()) {
      if (null != _scalePopUpButton) {
        _scalePopUpButton.removeFromSuperview();
        _scalePopUpButton = null;
      }
    } else {
      if (_scalePopUpButton == null) makeScalePopUpButton();

      NSScroller horizScroller = horizontalScroller();
      NSMutableRect horizScrollerFrame = new NSMutableRect(horizScroller.frame());
      NSRect incrementLineFrame = horizScroller.rectForPart(NSScroller.IncrementLine);
      NSMutableRect buttonFrame = new NSMutableRect(_scalePopUpButton.frame());

      /* Adjust the horizontal scroller size and set the button size and location. */
      buttonFrame.setX(horizScrollerFrame.x());
      buttonFrame.setHeight(incrementLineFrame.height());
      buttonFrame.setY(horizScrollerFrame.y() + incrementLineFrame.y());

      horizScrollerFrame.setWidth(horizScrollerFrame.width() - (buttonFrame.width() + 1.0f));
      horizScrollerFrame.setX(horizScrollerFrame.x() + (buttonFrame.width() + 1.0f));
      horizScroller.setFrame(horizScrollerFrame);

      _scalePopUpButton.setFrame(buttonFrame);
    }
  }
コード例 #2
0
  public void drawRect(NSRect rect) {
    NSMutableRect verticalLineRect;

    super.drawRect(rect);

    if ((_scalePopUpButton != null) && (_scalePopUpButton.superview() != null)) {
      verticalLineRect = new NSMutableRect(_scalePopUpButton.frame());
      verticalLineRect.setX(verticalLineRect.maxX());
      verticalLineRect.setWidth(1.0f);
      if (verticalLineRect.intersectsRect(rect)) {
        NSColor.blackColor().set();
        NSBezierPath.bezierPathWithRect(verticalLineRect).fill();
      }
    }
  }