menu.setLocation( canvas.toDisplay( mouseX, mouseY ) ); menu.setVisible( true );
@Override public void mouseDown(MouseEvent e) { Rectangle shellBounds= fShell.getBounds(); final int shellX= shellBounds.x; final int shellY= shellBounds.y; final int shellWidth= shellBounds.width; final int shellHeight= shellBounds.height; Point mouseLoc= resizer.toDisplay(e.x, e.y); final int mouseX= mouseLoc.x; final int mouseY= mouseLoc.y; fResizeListener= new MouseMoveListener() { @Override public void mouseMove(MouseEvent e2) { Point mouseLoc2= resizer.toDisplay(e2.x, e2.y); int dx= mouseLoc2.x - mouseX; int dy= mouseLoc2.y - mouseY; if (isRTL) { setLocation(new Point(shellX + dx, shellY)); setSize(shellWidth - dx, shellHeight + dy); } else { setSize(shellWidth + dx, shellHeight + dy); } } }; resizer.addMouseMoveListener(fResizeListener); }
@Override public void mouseDown(MouseEvent e) { Rectangle shellBounds= fShell.getBounds(); final int shellX= shellBounds.x; final int shellY= shellBounds.y; final int shellWidth= shellBounds.width; final int shellHeight= shellBounds.height; Point mouseLoc= resizer.toDisplay(e.x, e.y); final int mouseX= mouseLoc.x; final int mouseY= mouseLoc.y; fResizeListener= e2 -> { Point mouseLoc2= resizer.toDisplay(e2.x, e2.y); int dx= mouseLoc2.x - mouseX; int dy= mouseLoc2.y - mouseY; if (isRTL) { setLocation(new Point(shellX + dx, shellY)); setSize(shellWidth - dx, shellHeight + dy); } else { setSize(shellWidth + dx, shellHeight + dy); } }; resizer.addMouseMoveListener(fResizeListener); }
@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(); } }
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(); } }
@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(); } }