org.eclipse.swt.widgets.Scrollable.getClientArea()方法的使用及代码示例

x33g5p2x  于2022-01-30 转载在 其他  
字(5.1k)|赞(0)|评价(0)|浏览(177)

本文整理了Java中org.eclipse.swt.widgets.Scrollable.getClientArea()方法的一些代码示例,展示了Scrollable.getClientArea()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Scrollable.getClientArea()方法的具体详情如下:
包路径:org.eclipse.swt.widgets.Scrollable
类名称:Scrollable
方法名:getClientArea

Scrollable.getClientArea介绍

[英]Returns a rectangle which describes the area of the receiver which is capable of displaying data (that is, not covered by the "trimmings").
[中]返回一个矩形,该矩形描述接收器中能够显示数据的区域(即“修剪”未覆盖的区域)。

代码示例

代码示例来源:origin: org.eclipse.platform/org.eclipse.jface

/**
 * Compute the area required for trim.
 *
 * @param area
 * @param scrollable
 * @param currentWidth
 * @return int
 */
private int computeTrim(Rectangle area, Scrollable scrollable,
    int currentWidth) {
  int trim;
  if (currentWidth > 1) {
    trim = currentWidth - scrollable.getClientArea().width;
  } else {
    // initially, the table has no extend and no client area - use the
    // border with
    // plus some padding as educated guess
    trim = 2 * scrollable.getBorderWidth() + 1;
  }
  return trim;
}

代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.jface

/**
 * Compute the area required for trim.
 *
 * @param area
 * @param scrollable
 * @param currentWidth
 * @return int
 */
private int computeTrim(Rectangle area, Scrollable scrollable,
    int currentWidth) {
  int trim;
  if (currentWidth > 1) {
    trim = currentWidth - scrollable.getClientArea().width;
  } else {
    // initially, the table has no extend and no client area - use the
    // border with
    // plus some padding as educated guess
    trim = 2 * scrollable.getBorderWidth() + 1;
  }
  return trim;
}

代码示例来源:origin: org.eclipse.rap/org.eclipse.rap.rwt.q07

private static void checkAndProcessMouseEvent( MouseEvent event ) {
 boolean pass = false;
 Control control = ( Control )event.widget;
 if( control instanceof Scrollable ) {
  Scrollable scrollable = ( Scrollable )control;
  Rectangle clientArea = scrollable.getClientArea();
  pass = clientArea.contains( event.x, event.y );
 } else {
  pass = event.x >= 0 && event.y >= 0;
 }
 if( pass ) {
  event.processEvent();
 }
}

代码示例来源:origin: org.eclipse.mylyn.commons/workbench

private boolean contains(int x, int y) {
  if (control instanceof Scrollable) {
    return ((Scrollable) control).getClientArea().contains(x, y);
  } else {
    return control.getBounds().contains(x, y);
  }
}

代码示例来源:origin: org.eclipse.rap/org.eclipse.rap.jface

/**
 * Compute the area required for trim.
 *
 * @param area
 * @param scrollable
 * @param currentWidth
 * @return int
 */
private int computeTrim(Rectangle area, Scrollable scrollable,
    int currentWidth) {
  int trim;
  if (currentWidth > 1) {
    trim = currentWidth - scrollable.getClientArea().width;
  } else {
    // initially, the table has no extend and no client area - use the
    // border with
    // plus some padding as educated guess
    ControlThemeAdapter themeAdapter = scrollable.getAdapter( ControlThemeAdapter.class );
    BoxDimensions border = themeAdapter.getBorder( scrollable );
    trim = border.left + border.right + 1;
  }
  return trim;
}

代码示例来源:origin: org.eclipse.platform/org.eclipse.e4.ui.css.swt

/**
 * @return whether the mouse is currently over the scroll bar.
 */
public boolean mousePosOverScroll(Scrollable scrollable, Point controlPos) {
  if (this.fScrollBar == null || !this.fVisible || fScrollBarPositions == null
      || !this.fScrollBarSettings.getScrollBarThemed()) {
    return false;
  }
  Rectangle currClientArea = scrollable.getClientArea();
  Rectangle fullRect = this.getFullBackgroundRect(scrollable, currClientArea, true);
  if (fullRect != null) {
    boolean ret = fullRect.contains(controlPos.x, controlPos.y);
    return ret;
  }
  return false;
}

代码示例来源:origin: org.eclipse.platform/org.eclipse.e4.ui.css.swt

@Override
public void run() {
  if (fControlPos == null || fScrollable.isDisposed() || this.fDisplay.isDisposed()) {
    return;
  }
  // Note: we re-click based on the current position.
  Point cursorLocation = fDisplay.getCursorLocation();
  Point point = fScrollable.toControl(cursorLocation);
  Rectangle currClientArea = fScrollable.getClientArea();
  fTargetScrollHandler.scrollOnMouseDown(fScrollable, point, currClientArea);
  // After the first, the interval is only 50 millis
  fDisplay.timerExec(50, this);
}

代码示例来源:origin: org.eclipse.mylyn.commons/workbench

public void handleEvent(Event event) {
  if (shouldApplyGradient(event)) {
    Scrollable scrollable = (Scrollable) event.widget;
    GC gc = event.gc;
    Rectangle area = scrollable.getClientArea();
    Rectangle rect = event.getBounds();
    /* Paint the selection beyond the end of last column */
    expandRegion(event, scrollable, gc, area);
    /* Draw Gradient Rectangle */
    Color oldForeground = gc.getForeground();
    Color oldBackground = gc.getBackground();
    gc.setForeground(categoryGradientEnd);
    gc.drawLine(0, rect.y, area.width, rect.y);
    gc.setForeground(categoryGradientStart);
    gc.setBackground(categoryGradientEnd);
    // gc.setForeground(categoryGradientStart);
    // gc.setBackground(categoryGradientEnd);
    // gc.setForeground(new Clr(Display.getCurrent(), 255, 0, 0));
    gc.fillGradientRectangle(0, rect.y + 1, area.width, rect.height, true);
    /* Bottom Line */
    // gc.setForeground();
    gc.setForeground(categoryGradientEnd);
    gc.drawLine(0, rect.y + rect.height - 1, area.width, rect.y + rect.height - 1);
    gc.setForeground(oldForeground);
    gc.setBackground(oldBackground);
    /* Mark as Background being handled */
    event.detail &= ~SWT.BACKGROUND;
  }
}

代码示例来源:origin: org.eclipse.platform/org.eclipse.e4.ui.css.swt

Rectangle currClientArea = fScrollable.getClientArea();
if (this.fHorizontalScrollHandler.startDragOnMouseDown(fScrollable, controlPos,
    fLastHorizontalAndTopPixel, currClientArea)
Rectangle currClientArea = fScrollable.getClientArea();

代码示例来源:origin: org.eclipse.platform/org.eclipse.e4.ui.css.swt

Rectangle area = control.getClientArea();

相关文章

Scrollable类方法