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

x33g5p2x  于2022-01-19 转载在 其他  
字(7.6k)|赞(0)|评价(0)|浏览(156)

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

Event.getBounds介绍

[英]Gets the bounds.
[中]获取边界。

代码示例

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

Rectangle getBoundsInPixels () {
  return DPIUtil.autoScaleUp(getBounds());
}

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

Rectangle getBoundsInPixels () {
  return DPIUtil.autoScaleUp(getBounds());
}

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

Rectangle getBoundsInPixels () {
  return DPIUtil.autoScaleUp(getBounds());
}

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

Rectangle getBoundsInPixels () {
  return DPIUtil.autoScaleUp(getBounds());
}

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

sendSelectionEvent (SWT.Selection, event, true);
if (isDisposed ()) return 0;
Rectangle rect = DPIUtil.autoScaleUp (event.getBounds ());
if (event.doit) {
  lastX = rect.x;

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

private void markFocusedCell(Event event, ViewerCell cell) {
  Color background = (cell.getControl().isFocusControl()) ? getSelectedCellBackgroundColor(cell)
      : getSelectedCellBackgroundColorNoFocus(cell);
  Color foreground = (cell.getControl().isFocusControl()) ? getSelectedCellForegroundColor(cell)
      : getSelectedCellForegroundColorNoFocus(cell);
  if (foreground != null || background != null || onlyTextHighlighting(cell)) {
    GC gc = event.gc;
    if (background == null) {
      background = cell.getItem().getDisplay().getSystemColor(
          SWT.COLOR_LIST_SELECTION);
    }
    if (foreground == null) {
      foreground = cell.getItem().getDisplay().getSystemColor(
          SWT.COLOR_LIST_SELECTION_TEXT);
    }
    gc.setBackground(background);
    gc.setForeground(foreground);
    if (onlyTextHighlighting(cell)) {
      Rectangle area = event.getBounds();
      Rectangle rect = cell.getTextBounds();
      if( rect != null ) {
        area.x = rect.x;
      }
      gc.fillRectangle(area);
    } else {
      gc.fillRectangle(event.getBounds());
    }
    event.detail &= ~SWT.SELECTED;
  }
}

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

private void markFocusedCell(Event event, ViewerCell cell) {
  Color background = (cell.getControl().isFocusControl()) ? getSelectedCellBackgroundColor(cell)
      : getSelectedCellBackgroundColorNoFocus(cell);
  Color foreground = (cell.getControl().isFocusControl()) ? getSelectedCellForegroundColor(cell)
      : getSelectedCellForegroundColorNoFocus(cell);
  if (foreground != null || background != null || onlyTextHighlighting(cell)) {
    GC gc = event.gc;
    if (background == null) {
      background = cell.getItem().getDisplay().getSystemColor(
          SWT.COLOR_LIST_SELECTION);
    }
    if (foreground == null) {
      foreground = cell.getItem().getDisplay().getSystemColor(
          SWT.COLOR_LIST_SELECTION_TEXT);
    }
    gc.setBackground(background);
    gc.setForeground(foreground);
    if (onlyTextHighlighting(cell)) {
      Rectangle area = event.getBounds();
      Rectangle rect = cell.getTextBounds();
      if( rect != null ) {
        area.x = rect.x;
      }
      gc.fillRectangle(area);
    } else {
      gc.fillRectangle(event.getBounds());
    }
    event.detail &= ~SWT.SELECTED;
  }
}

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

Rectangle bounds = event.getBounds();
if ((event.detail & SWT.SELECTED) != 0) {

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

Rectangle bounds = event.getBounds();
if ((event.detail & SWT.SELECTED) != 0) {

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

boolean showMenu (int x, int y, int detail) {
  Event event = new Event ();
  Rectangle eventRect = new Rectangle (x, y, 0, 0);
  event.setBounds (DPIUtil.autoScaleDown (eventRect));
  event.detail = detail;
  sendEvent (SWT.MenuDetect, event);
  //widget could be disposed at this point
  if (isDisposed ()) return false;
  if (event.doit) {
    if (menu != null && !menu.isDisposed ()) {
      boolean hooksKeys = hooks (SWT.KeyDown) || hooks (SWT.KeyUp);
      menu.createIMMenu (hooksKeys ? imHandle() : 0);
      Rectangle rect = DPIUtil.autoScaleUp (event.getBounds ());
      if (rect.x != x || rect.y != y) {
        menu.setLocationInPixels (rect.x, rect.y);
      }
      menu.setVisible (true);
      return true;
    }
  }
  return false;
}

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

boolean showMenu (int x, int y, int detail) {
  Event event = new Event ();
  Rectangle eventRect = new Rectangle (x, y, 0, 0);
  event.setBounds (DPIUtil.autoScaleDown (eventRect));
  event.detail = detail;
  sendEvent (SWT.MenuDetect, event);
  //widget could be disposed at this point
  if (isDisposed ()) return false;
  if (event.doit) {
    if (menu != null && !menu.isDisposed ()) {
      boolean hooksKeys = hooks (SWT.KeyDown) || hooks (SWT.KeyUp);
      menu.createIMMenu (hooksKeys ? imHandle() : 0);
      Rectangle rect = DPIUtil.autoScaleUp (event.getBounds ());
      if (rect.x != x || rect.y != y) {
        menu.setLocationInPixels (rect.x, rect.y);
      }
      menu.setVisible (true);
      return true;
    }
  }
  return false;
}

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

boolean showMenu (int x, int y, int detail) {
  Event event = new Event ();
  Rectangle eventRect = new Rectangle (x, y, 0, 0);
  event.setBounds (DPIUtil.autoScaleDown (eventRect));
  event.detail = detail;
  sendEvent (SWT.MenuDetect, event);
  //widget could be disposed at this point
  if (isDisposed ()) return false;
  if (event.doit) {
    if (menu != null && !menu.isDisposed ()) {
      boolean hooksKeys = hooks (SWT.KeyDown) || hooks (SWT.KeyUp);
      menu.createIMMenu (hooksKeys ? imHandle() : 0);
      Rectangle rect = DPIUtil.autoScaleUp (event.getBounds ());
      if (rect.x != x || rect.y != y) {
        menu.setLocationInPixels (rect.x, rect.y);
      }
      menu.setVisible (true);
      return true;
    }
  }
  return false;
}

代码示例来源: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.swt.gtk.linux.s390x

if (event.doit) {
  if ((style & SWT.SMOOTH) != 0) {
    Rectangle rect = DPIUtil.autoScaleUp (event.getBounds ());
    setBoundsInPixels (rect.x, rect.y, width, height);

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

if (event.doit) {
  if ((style & SWT.SMOOTH) != 0) {
    Rectangle rect = DPIUtil.autoScaleUp (event.getBounds ());
    setBoundsInPixels (rect.x, rect.y, width, height);

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

if (event.doit) {
  if ((style & SWT.SMOOTH) != 0) {
    Rectangle rect = DPIUtil.autoScaleUp (event.getBounds ());
    setBoundsInPixels (rect.x, rect.y, width, height);

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

if (event.doit) {
  dragging = true;
  Rectangle rect = DPIUtil.autoScaleUp (event.getBounds ());
  lastX = rect.x;
  lastY = rect.y;

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

if (event.doit) {
  dragging = true;
  Rectangle rect = DPIUtil.autoScaleUp (event.getBounds ());
  lastX = rect.x;
  lastY = rect.y;

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

if (event.doit) {
  dragging = true;
  Rectangle rect = DPIUtil.autoScaleUp (event.getBounds ());
  lastX = rect.x;
  lastY = rect.y;

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

sendEvent (SWT.MeasureItem, event);
gc.dispose ();
Rectangle rect = DPIUtil.autoScaleUp (event.getBounds ());
contentWidth [0] = rect.width - imageWidth;
if (contentHeight [0] < rect.height) contentHeight [0] = rect.height;

相关文章