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

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

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

ScrollBar.getIncrement介绍

[英]Returns the amount that the receiver's value will be modified by when the up/down (or right/left) arrows are pressed.
[中]返回按下上/下(或右/左)箭头时接收器值将被修改的量。

代码示例

代码示例来源:origin: org.eclipse/org.eclipse.ajdt.ui

public void controlResized(ControlEvent e) {
    Rectangle clientArea = fScrolledComposite.getClientArea();
    
    ScrollBar verticalBar= fScrolledComposite.getVerticalBar();
    verticalBar.setIncrement(VERTICAL_SCROLL_INCREMENT);
    verticalBar.setPageIncrement(clientArea.height - verticalBar.getIncrement());
    ScrollBar horizontalBar= fScrolledComposite.getHorizontalBar();
    horizontalBar.setIncrement(HORIZONTAL_SCROLL_INCREMENT);
    horizontalBar.setPageIncrement(clientArea.width - horizontalBar.getIncrement());
  }
});

代码示例来源:origin: com.google.code.maven-play-plugin.org.xhtmlrenderer/core-renderer

switch (e.keyCode) {
  case SWT.ARROW_UP:
    pt.y -= getVerticalBar().getIncrement();
    break;
  case SWT.ARROW_DOWN:
    pt.y += getVerticalBar().getIncrement();
    break;
  case SWT.ARROW_LEFT:
    pt.x -= getHorizontalBar().getIncrement();
    break;
  case SWT.ARROW_RIGHT:
    pt.x += getHorizontalBar().getIncrement();
    break;
  case SWT.PAGE_UP:

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

private boolean checkEndOfDocument() {
  StyledText textWidget = getTextWidget();
  if (textWidget != null && !textWidget.isDisposed()) {
    int partialBottomIndex = JFaceTextUtil.getPartialBottomIndex(textWidget);
    int lineCount = textWidget.getLineCount();
    int delta = textWidget.getVerticalBar().getIncrement();
    return lineCount - partialBottomIndex < delta;
  }
  return false;
}

代码示例来源:origin: org.eclipse.swt.cocoa.macosx/x86_64

void setScrollbar () {
  if (itemCount == 0) return;
  ScrollBar verticalBar = getVerticalBar ();
  if (verticalBar == null) return;
  int height = getClientArea ().height;
  ExpandItem item = items [itemCount - 1];
  int maxHeight = item.y + getBandHeight () + spacing;
  if (item.expanded) maxHeight += item.height;

  //claim bottom free space
  if (yCurrentScroll > 0 && height > maxHeight) {
    yCurrentScroll = Math.max (0, yCurrentScroll + maxHeight - height);
    layoutItems (0, false);
  }
  maxHeight += yCurrentScroll;
  
  int selection = Math.min (yCurrentScroll, maxHeight);
  int increment = verticalBar.getIncrement ();
  int pageIncrement = verticalBar.getPageIncrement ();
  verticalBar.setValues(selection, 0, maxHeight, height, increment, pageIncrement);
  verticalBar.setVisible(maxHeight > height);
}

代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.swt.win32.win32.x86

break;
case OS.SB_LINEDOWN:
  info.nPos += bar.getIncrement ();
  break;
case OS.SB_LINEUP:
  int increment = bar.getIncrement ();
  info.nPos = Math.max (info.nMin, info.nPos - increment);
  break;

代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.gtk.linux.s390x

void setScrollBar(ScrollBar bar, int clientArea, int maximum, int margin) {
  int inactive = 1;
  if (clientArea < maximum) {
    bar.setMaximum(maximum - margin);
    bar.setThumb(clientArea - margin);
    bar.setPageIncrement(clientArea - margin);
    if (!alwaysShowScroll) bar.setVisible(true);
  } else if (bar.getThumb() != inactive || bar.getMaximum() != inactive) {
    bar.setValues(bar.getSelection(), bar.getMinimum(), inactive, inactive, bar.getIncrement(), inactive);
  }
}
/**

代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.swt.win32.win32.x86

void setScrollBar(ScrollBar bar, int clientArea, int maximum, int margin) {
  int inactive = 1;
  if (clientArea < maximum) {
    bar.setMaximum(maximum - margin);
    bar.setThumb(clientArea - margin);
    bar.setPageIncrement(clientArea - margin);
    if (!alwaysShowScroll) bar.setVisible(true);
  } else if (bar.getThumb() != inactive || bar.getMaximum() != inactive) {
    bar.setValues(bar.getSelection(), bar.getMinimum(), inactive, inactive, bar.getIncrement(), inactive);
  }
}
/**

代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.gtk.linux.ppc

void setScrollBar(ScrollBar bar, int clientArea, int maximum, int margin) {
  int inactive = 1;
  if (clientArea < maximum) {
    bar.setMaximum(maximum - margin);
    bar.setThumb(clientArea - margin);
    bar.setPageIncrement(clientArea - margin);
    if (!alwaysShowScroll) bar.setVisible(true);
  } else if (bar.getThumb() != inactive || bar.getMaximum() != inactive) {
    bar.setValues(bar.getSelection(), bar.getMinimum(), inactive, inactive, bar.getIncrement(), inactive);
  }
}
/**

代码示例来源:origin: org.eclipse.swt.cocoa.macosx/x86_64

void setScrollBar(ScrollBar bar, int clientArea, int maximum, int margin) {
  int inactive = 1;
  if (clientArea < maximum) {
    bar.setMaximum(maximum - margin);
    bar.setThumb(clientArea - margin);
    bar.setPageIncrement(clientArea - margin);
    if (!alwaysShowScroll) bar.setVisible(true);
  } else if (bar.getThumb() != inactive || bar.getMaximum() != inactive) {
    bar.setValues(bar.getSelection(), bar.getMinimum(), inactive, inactive, bar.getIncrement(), inactive);
  }
}
/**

代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.gtk.aix.ppc

void setScrollBar(ScrollBar bar, int clientArea, int maximum, int margin) {
  int inactive = 1;
  if (clientArea < maximum) {
    bar.setMaximum(maximum - margin);
    bar.setThumb(clientArea - margin);
    bar.setPageIncrement(clientArea - margin);
    if (!alwaysShowScroll) bar.setVisible(true);
  } else if (bar.getThumb() != inactive || bar.getMaximum() != inactive) {
    bar.setValues(bar.getSelection(), bar.getMinimum(), inactive, inactive, bar.getIncrement(), inactive);
  }
}
/**

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

/**
 * @private
 */
void updateScrollbars() {
  Rectangle bounds= fImage != null ? fImage.getBounds() : new Rectangle(0, 0, 0, 0);
  Point size= getSize();
  Rectangle clientArea= getClientArea();
  ScrollBar horizontal= getHorizontalBar();
  if (bounds.width <= clientArea.width) {
    horizontal.setVisible(false);
    horizontal.setSelection(0);
  } else {
    horizontal.setPageIncrement(clientArea.width - horizontal.getIncrement());
    int max= bounds.width + (size.x - clientArea.width);
    horizontal.setMaximum(max);
    horizontal.setThumb(size.x > max ? max : size.x);
    horizontal.setVisible(true);
  }
  ScrollBar vertical= getVerticalBar();
  if (bounds.height <= clientArea.height) {
    vertical.setVisible(false);
    vertical.setSelection(0);
  } else {
    vertical.setPageIncrement(clientArea.height - vertical.getIncrement());
    int max= bounds.height + (size.y - clientArea.height);
    vertical.setMaximum(max);
    vertical.setThumb(size.y > max ? max : size.y);
    vertical.setVisible(true);
  }
}

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

/**
 * @private
 */
void updateScrollbars() {
  Rectangle bounds= fImage != null ? fImage.getBounds() : new Rectangle(0, 0, 0, 0);
  Point size= getSize();
  Rectangle clientArea= getClientArea();
  ScrollBar horizontal= getHorizontalBar();
  if (bounds.width <= clientArea.width) {
    horizontal.setVisible(false);
    horizontal.setSelection(0);
  } else {
    horizontal.setPageIncrement(clientArea.width - horizontal.getIncrement());
    int max= bounds.width + (size.x - clientArea.width);
    horizontal.setMaximum(max);
    horizontal.setThumb(size.x > max ? max : size.x);
    horizontal.setVisible(true);
  }
  ScrollBar vertical= getVerticalBar();
  if (bounds.height <= clientArea.height) {
    vertical.setVisible(false);
    vertical.setSelection(0);
  } else {
    vertical.setPageIncrement(clientArea.height - vertical.getIncrement());
    int max= bounds.height + (size.y - clientArea.height);
    vertical.setMaximum(max);
    vertical.setThumb(size.y > max ? max : size.y);
    vertical.setVisible(true);
  }
}

代码示例来源:origin: org.eclipse.swt.cocoa.macosx/x86_64

if (-1 < deltaY && deltaY < 0) deltaY = -1;
if (0 < deltaY && deltaY < 1) deltaY = 1;
int selection = Math.max (0, (int)(0.5f + bar.getSelection () - bar.getIncrement () * deltaY));
bar.setSelection (selection);
Event event = new Event ();
if (-1 < deltaX && deltaX < 0) deltaX = -1;
if (0 < deltaX && deltaX < 1) deltaX = 1;
int selection = Math.max (0, (int)(0.5f + bar.getSelection () - bar.getIncrement () * deltaX));
bar.setSelection (selection);
Event event = new Event ();

代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.swt.win32.win32.x86

OS.GetScrollInfo (handle, bar.scrollBarType (), info);
if (vertical && !pageScroll) delta *= linesToScroll [0];
int increment = pageScroll ? bar.getPageIncrement () : bar.getIncrement ();
info.nPos -=  increment * delta / OS.WHEEL_DELTA;
OS.SetScrollInfo (handle, bar.scrollBarType (), info, true);

相关文章