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

x33g5p2x  于2022-01-29 转载在 其他  
字(5.6k)|赞(0)|评价(0)|浏览(104)

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

Shell.getBoundsInPixels介绍

暂无

代码示例

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

void center () {
  if (parent == null) return;
  Rectangle rect = getBoundsInPixels ();
  Rectangle parentRect = display.mapInPixels (parent, null, parent.getClientAreaInPixels());
  int x = Math.max (parentRect.x, parentRect.x + (parentRect.width - rect.width) / 2);
  int y = Math.max (parentRect.y, parentRect.y + (parentRect.height - rect.height) / 2);
  Rectangle monitorRect = parent.getMonitor ().getClientArea();
  if (x + rect.width > monitorRect.x + monitorRect.width) {
    x = Math.max (monitorRect.x, monitorRect.x + monitorRect.width - rect.width);
  } else {
    x = Math.max (x, monitorRect.x);
  }
  if (y + rect.height > monitorRect.y + monitorRect.height) {
    y = Math.max (monitorRect.y, monitorRect.y + monitorRect.height - rect.height);
  } else {
    y = Math.max (y, monitorRect.y);
  }
  setLocationInPixels (x, y);
}

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

void center () {
  if (parent == null) return;
  Rectangle rect = getBoundsInPixels ();
  Rectangle parentRect = display.mapInPixels (parent, null, parent.getClientAreaInPixels());
  int x = Math.max (parentRect.x, parentRect.x + (parentRect.width - rect.width) / 2);
  int y = Math.max (parentRect.y, parentRect.y + (parentRect.height - rect.height) / 2);
  Rectangle monitorRect = DPIUtil.autoScaleUp(parent.getMonitor ().getClientArea());
  if (x + rect.width > monitorRect.x + monitorRect.width) {
    x = Math.max (monitorRect.x, monitorRect.x + monitorRect.width - rect.width);
  } else {
    x = Math.max (x, monitorRect.x);
  }
  if (y + rect.height > monitorRect.y + monitorRect.height) {
    y = Math.max (monitorRect.y, monitorRect.y + monitorRect.height - rect.height);
  } else {
    y = Math.max (y, monitorRect.y);
  }
  setLocationInPixels (x, y);
}

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

void center () {
  if (parent == null) return;
  Rectangle rect = getBoundsInPixels ();
  Rectangle parentRect = display.mapInPixels (parent, null, parent.getClientAreaInPixels());
  int x = Math.max (parentRect.x, parentRect.x + (parentRect.width - rect.width) / 2);
  int y = Math.max (parentRect.y, parentRect.y + (parentRect.height - rect.height) / 2);
  Rectangle monitorRect = DPIUtil.autoScaleUp(parent.getMonitor ().getClientArea());
  if (x + rect.width > monitorRect.x + monitorRect.width) {
    x = Math.max (monitorRect.x, monitorRect.x + monitorRect.width - rect.width);
  } else {
    x = Math.max (x, monitorRect.x);
  }
  if (y + rect.height > monitorRect.y + monitorRect.height) {
    y = Math.max (monitorRect.y, monitorRect.y + monitorRect.height - rect.height);
  } else {
    y = Math.max (y, monitorRect.y);
  }
  setLocationInPixels (x, y);
}

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

void center () {
  if (parent == null) return;
  Rectangle rect = getBoundsInPixels ();
  Rectangle parentRect = display.mapInPixels (parent, null, parent.getClientAreaInPixels());
  int x = Math.max (parentRect.x, parentRect.x + (parentRect.width - rect.width) / 2);
  int y = Math.max (parentRect.y, parentRect.y + (parentRect.height - rect.height) / 2);
  Rectangle monitorRect = DPIUtil.autoScaleUp(parent.getMonitor ().getClientArea());
  if (x + rect.width > monitorRect.x + monitorRect.width) {
    x = Math.max (monitorRect.x, monitorRect.x + monitorRect.width - rect.width);
  } else {
    x = Math.max (x, monitorRect.x);
  }
  if (y + rect.height > monitorRect.y + monitorRect.height) {
    y = Math.max (monitorRect.y, monitorRect.y + monitorRect.height - rect.height);
  } else {
    y = Math.max (y, monitorRect.y);
  }
  setLocationInPixels (x, y);
}

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

Rectangle rect = getBoundsInPixels ();
boolean sameOrigin = !move || (rect.x == x && rect.y == y);
boolean sameExtent = !resize || (rect.width == width && rect.height == height);

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

Rectangle rect = getBoundsInPixels ();
boolean sameOrigin = !move || (rect.x == x && rect.y == y);
boolean sameExtent = !resize || (rect.width == width && rect.height == height);

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

Rectangle rect = getBoundsInPixels ();
boolean sameOrigin = !move || (rect.x == x && rect.y == y);
boolean sameExtent = !resize || (rect.width == width && rect.height == height);

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

Rectangle bounds = getBoundsInPixels();
int widthAdjustment = display.trimWidths[trimStyle] - trimWidth;
int heightAdjustment = display.trimHeights[trimStyle] - trimHeight;

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

Rectangle bounds = getBoundsInPixels();
int widthAdjustment = display.trimWidths[trimStyle] - trimWidth;
int heightAdjustment = display.trimHeights[trimStyle] - trimHeight;

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

Rectangle bounds = getBoundsInPixels();
int widthAdjustment = display.trimWidths[trimStyle] - trimWidth;
int heightAdjustment = display.trimHeights[trimStyle] - trimHeight;

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

OS.gtk_widget_realize (parentHandle);
int /*long*/ window = gtk_widget_get_window (parentHandle);
Rectangle rect = getBoundsInPixels ();
GdkWindowAttr attributes = new GdkWindowAttr ();
attributes.width = rect.width;

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

OS.gtk_widget_realize (parentHandle);
int /*long*/ window = gtk_widget_get_window (parentHandle);
Rectangle rect = getBoundsInPixels ();
GdkWindowAttr attributes = new GdkWindowAttr ();
attributes.width = rect.width;

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

OS.gtk_widget_realize (parentHandle);
long /*int*/ window = gtk_widget_get_window (parentHandle);
Rectangle rect = getBoundsInPixels ();
GdkWindowAttr attributes = new GdkWindowAttr ();
attributes.width = rect.width;

相关文章

微信公众号

最新文章

更多

Shell类方法