本文整理了Java中org.eclipse.swt.widgets.Shell.getRegion()
方法的一些代码示例,展示了Shell.getRegion()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Shell.getRegion()
方法的具体详情如下:
包路径:org.eclipse.swt.widgets.Shell
类名称:Shell
方法名:getRegion
[英]Returns the region that defines the shape of the shell, or null
if the shell has the default shape.
[中]
代码示例来源:origin: org.eclipse.platform/org.eclipse.e4.ui.workbench.addons.swt
public void dispose() {
if (feedbackShell != null && !feedbackShell.isDisposed()) {
Region region = feedbackShell.getRegion();
if (region != null && !region.isDisposed()) {
region.dispose();
}
feedbackShell.dispose();
}
feedbackShell = null;
}
代码示例来源:origin: org.eclipse.e4.ui.workbench.addons/swt
public void dispose() {
if (feedbackShell != null && !feedbackShell.isDisposed()) {
Region region = feedbackShell.getRegion();
if (region != null && !region.isDisposed())
region.dispose();
feedbackShell.dispose();
}
feedbackShell = null;
}
代码示例来源:origin: org.eclipse.e4.ui.workbench.addons/swt
private void defineRegion() {
Region rgn = new Region();
for (Rectangle r : rects) {
rgn.add(r);
rgn.subtract(r.x + 2, r.y + 2, r.width - 4, r.height - 4);
}
if (feedbackShell.getRegion() != null && !feedbackShell.getRegion().isDisposed())
feedbackShell.getRegion().dispose();
feedbackShell.setRegion(rgn);
feedbackShell.redraw();
display.update();
}
代码示例来源:origin: org.eclipse.platform/org.eclipse.e4.ui.workbench.addons.swt
private void defineRegion() {
Region rgn = new Region();
for (Rectangle r : rects) {
rgn.add(r);
rgn.subtract(r.x + 2, r.y + 2, r.width - 4, r.height - 4);
}
// Workaround: Some window managers draw a drop shadow even if the shell
// is set to NO_TRIM. By making the shell contain a component in the
// bottom-right of its parent shell, SWT won't resize it and any extra
// shadows will end up being drawn on top of the shadows for the parent
// shell rather than in the middle of the workbench window.
Composite parent = feedbackShell.getParent();
if (parent instanceof Shell) {
Shell parentShell = (Shell) parent;
Rectangle bounds = parentShell.getBounds();
rgn.add(bounds.width - 1, bounds.height - 1, 1, 1);
}
if (feedbackShell.getRegion() != null && !feedbackShell.getRegion().isDisposed()) {
feedbackShell.getRegion().dispose();
}
feedbackShell.setRegion(rgn);
feedbackShell.redraw();
display.update();
}
代码示例来源:origin: org.eclipse.e4.ui.workbench.addons/swt
public void setDragHost(Shell hostingShell, int xOffset, int yOffset) {
dragHost = hostingShell;
offsetX = xOffset;
offsetY = yOffset;
dragHostBounds = null;
if (dragHost == null)
return;
// Punch a 'hole' where the cursor is using a region
Region rgn = dragHost.getRegion();
// if (rgn != null && !rgn.isDisposed())
// rgn.dispose();
// rgn = new Region(display);
Rectangle bounds = dragHost.getBounds();
rgn.add(0, 0, bounds.width, bounds.height);
rgn.subtract(offsetX, offsetY, 1, 1);
dragHost.setRegion(rgn);
initialHostSize = dragHost.getSize();
// Do an initial 'track'
Point curLoc = dragHost.getDisplay().getCursorLocation();
dragHost.setLocation(curLoc.x - offsetX, curLoc.y - offsetY);
dragHost.layout(true);
}
代码示例来源:origin: org.eclipse.platform/org.eclipse.e4.ui.workbench.addons.swt
public void setDragHost(Shell hostingShell, int xOffset, int yOffset) {
dragHost = hostingShell;
offsetX = xOffset;
offsetY = yOffset;
dragHostBounds = null;
if (dragHost == null) {
return;
}
// Punch a 'hole' where the cursor is using a region
Region rgn = dragHost.getRegion();
// if (rgn != null && !rgn.isDisposed())
// rgn.dispose();
// rgn = new Region(display);
Rectangle bounds = dragHost.getBounds();
rgn.add(0, 0, bounds.width, bounds.height);
rgn.subtract(offsetX, offsetY, 1, 1);
dragHost.setRegion(rgn);
initialHostSize = dragHost.getSize();
// Do an initial 'track'
Point curLoc = dragHost.getDisplay().getCursorLocation();
dragHost.setLocation(curLoc.x - offsetX, curLoc.y - offsetY);
dragHost.layout(true);
}
代码示例来源:origin: org.eclipse.e4.ui.workbench.addons/swt
public void update() {
final Display display = Display.getCurrent();
if (display == null)
return;
reset();
cursorPos = display.getCursorLocation();
if (dragHost != null && !dragHost.isDisposed() && dragHost.getVisible()) {
if (dragHostBounds == null) {
// First move the dragHost so that its 'hole' is where the mouse is
dragHost.setLocation(cursorPos.x - offsetX, cursorPos.y - offsetY);
} else {
// Move the 'hole' to where the cursor is
Point cursorLoc = display.getCursorLocation();
cursorLoc = display.map(null, dragHost, cursorLoc);
Region rgn = dragHost.getRegion();
Rectangle bounds = dragHost.getBounds();
rgn.add(0, 0, bounds.width, bounds.height);
rgn.subtract(cursorLoc.x, cursorLoc.y, 1, 1);
}
}
curCtrl = display.getCursorControl();
if (curCtrl == null)
return;
curElement = getModelElement(curCtrl);
setItemInfo();
}
代码示例来源:origin: org.eclipse.e4.ui.workbench.addons/swt
public void setDragHostBounds(Rectangle displayRect) {
if (dragHost == null)
return;
dragHostBounds = displayRect;
// Re-attach the drag host to the cursor
if (dragHostBounds == null) {
dragHost.setSize(initialHostSize);
setDragHost(dragHost, offsetX, offsetY);
return;
}
// dragHost.setVisible(false);
dragHost.setAlpha(200);
dragHost.setBounds(dragHostBounds);
// punch a 'hole' where the cursor *is*
Point cursorLoc = display.getCursorLocation();
cursorLoc = display.map(null, dragHost, cursorLoc);
Region rgn = dragHost.getRegion();
Rectangle bounds = dragHost.getBounds();
rgn.add(0, 0, bounds.width, bounds.height);
rgn.subtract(cursorLoc.x, cursorLoc.y, 1, 1);
display.update();
}
代码示例来源:origin: org.eclipse.platform/org.eclipse.e4.ui.workbench.addons.swt
public void setDragHostBounds(Rectangle displayRect) {
if (dragHost == null) {
return;
}
dragHostBounds = displayRect;
// Re-attach the drag host to the cursor
if (dragHostBounds == null) {
dragHost.setSize(initialHostSize);
setDragHost(dragHost, offsetX, offsetY);
return;
}
// dragHost.setVisible(false);
dragHost.setAlpha(200);
dragHost.setBounds(dragHostBounds);
// punch a 'hole' where the cursor *is*
Point cursorLoc = display.getCursorLocation();
cursorLoc = display.map(null, dragHost, cursorLoc);
Region rgn = dragHost.getRegion();
Rectangle bounds = dragHost.getBounds();
rgn.add(0, 0, bounds.width, bounds.height);
rgn.subtract(cursorLoc.x, cursorLoc.y, 1, 1);
display.update();
}
代码示例来源:origin: org.eclipse/org.eclipse.jdt.ui
public void mouseExit(MouseEvent e) {
Item item= (Item) ((Widget) e.getSource()).getData();
if (item != null)
item.deselect();
// if the event lies outside the entire popup, dispose
org.eclipse.swt.graphics.Region region= fShell.getRegion();
Canvas can= (Canvas) e.getSource();
Point p= can.toDisplay(e.x, e.y);
if (region == null) {
Rectangle bounds= fShell.getBounds();
// p= fShell.toControl(p);
if (!bounds.contains(p))
dispose();
} else {
p= fShell.toControl(p);
if (!region.contains(p))
dispose();
}
}
代码示例来源:origin: org.eclipse.jdt/org.eclipse.jdt.ui
@Override
public void mouseExit(MouseEvent e) {
Item item= (Item) ((Widget) e.getSource()).getData();
if (item != null)
item.deselect();
// if the event lies outside the entire popup, dispose
org.eclipse.swt.graphics.Region region= fShell.getRegion();
Canvas can= (Canvas) e.getSource();
Point p= can.toDisplay(e.x, e.y);
if (region == null) {
Rectangle bounds= fShell.getBounds();
// p= fShell.toControl(p);
if (!bounds.contains(p))
dispose();
} else {
p= fShell.toControl(p);
if (!region.contains(p))
dispose();
}
}
代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.jdt.ui
@Override
public void mouseExit(MouseEvent e) {
Item item= (Item) ((Widget) e.getSource()).getData();
if (item != null)
item.deselect();
// if the event lies outside the entire popup, dispose
org.eclipse.swt.graphics.Region region= fShell.getRegion();
Canvas can= (Canvas) e.getSource();
Point p= can.toDisplay(e.x, e.y);
if (region == null) {
Rectangle bounds= fShell.getBounds();
// p= fShell.toControl(p);
if (!bounds.contains(p))
dispose();
} else {
p= fShell.toControl(p);
if (!region.contains(p))
dispose();
}
}
代码示例来源:origin: org.eclipse.platform/org.eclipse.e4.ui.workbench.addons.swt
Region curRegion = overlayFrame.getRegion();
if (curRegion != null && !curRegion.isDisposed()) {
curRegion.dispose();
代码示例来源:origin: org.eclipse.platform/org.eclipse.e4.ui.workbench.addons.swt
Region rgn = dragHost.getRegion();
Rectangle bounds = dragHost.getBounds();
rgn.add(0, 0, bounds.width, bounds.height);
代码示例来源:origin: org.eclipse.e4.ui.workbench.addons/swt
Region curRegion = overlayFrame.getRegion();
if (curRegion != null && !curRegion.isDisposed())
curRegion.dispose();
内容来源于网络,如有侵权,请联系作者删除!