/** * Returns <code>true</code> if the given point is inside the * area specified by the receiver, and <code>false</code> * otherwise. * * @param pt the point to test for containment * @return <code>true</code> if the region contains the point and <code>false</code> otherwise * * @exception IllegalArgumentException <ul> * <li>ERROR_NULL_ARGUMENT - if the argument is null</li> * </ul> * @exception SWTException <ul> * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li> * </ul> */ public boolean contains(Point pt) { if (pt == null) SWT.error(SWT.ERROR_NULL_ARGUMENT); return contains(pt.x, pt.y); }
/** * Returns <code>true</code> if the point specified by the * arguments is inside the area specified by the receiver, * and <code>false</code> otherwise. * * @param x the x coordinate of the point to test for containment * @param y the y coordinate of the point to test for containment * @return <code>true</code> if the region contains the point and <code>false</code> otherwise * * @exception SWTException <ul> * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li> * </ul> */ public boolean contains(int x, int y) { if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED); return contains(new Point(x, y)); } boolean containsInPixels(int x, int y) {
/** * Returns <code>true</code> if the point specified by the * arguments is inside the area specified by the receiver, * and <code>false</code> otherwise. * * @param x the x coordinate of the point to test for containment * @param y the y coordinate of the point to test for containment * @return <code>true</code> if the region contains the point and <code>false</code> otherwise * * @exception SWTException <ul> * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li> * </ul> */ public boolean contains(int x, int y) { if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED); return contains(new Point(x, y)); } boolean containsInPixels(int x, int y) {
/** * Returns <code>true</code> if the point specified by the * arguments is inside the area specified by the receiver, * and <code>false</code> otherwise. * * @param x the x coordinate of the point to test for containment * @param y the y coordinate of the point to test for containment * @return <code>true</code> if the region contains the point and <code>false</code> otherwise * * @exception SWTException <ul> * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li> * </ul> */ public boolean contains(int x, int y) { if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED); return contains(new Point(x, y)); } boolean containsInPixels(int x, int y) {
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(); } }
@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(); } }