@Override public void handleEvent(Event event) { Rectangle clientArea = table.getClientArea(); Point pt = new Point(event.x, event.y); int index = table.getTopIndex(); int count = table.getItemCount(); while (index < count) { boolean visible = false; TableItem item = table.getItem(index); for (int i = 0; i < table.getColumnCount(); i++) { Rectangle rect = item.getBounds(i); if (rect.contains(pt)) { beforeEdit(); clickRow(item, i); return; } if (!visible && rect.intersects(clientArea)) { visible = true; } } if (!visible) return; index++; } } protected void beforeEdit() {
if ( !visible && rect.intersects( clientArea ) ) { visible = true;
@Override public boolean intersects(Rectangle rect) { if (bounds==null) return false; return bounds.intersects(rect); }
@Override public boolean intersects(Rectangle rect) { if (bounds==null) return false; return bounds.intersects(rect); }
public boolean intersects(Rectangle region) { return rect.intersects(region); }
public boolean intersects(Rectangle region) { return rect.intersects(region); }
protected List<SashRect> getSashRects(int x, int y) { List<SashRect> srs = new ArrayList<>(); Rectangle target = new Rectangle(x - 5, y - 5, 10, 10); for (SashRect sr : sashes) { if (!sr.container.getTags().contains(IPresentationEngine.NO_MOVE) && sr.rect.intersects(target)) srs.add(sr); } return srs; }
/** * Returns <code>true</code> if the given rectangle intersects * with the receiver and <code>false</code> otherwise. * <p> * Two rectangles intersect if the area of the rectangle * representing their intersection is not empty. * </p> * * @param rect the rectangle to test for intersection * @return <code>true</code> if the rectangle intersects with the receiver, and <code>false</code> otherwise * * @exception IllegalArgumentException <ul> * <li>ERROR_NULL_ARGUMENT - if the argument is null</li> * </ul> * * @see #intersection(Rectangle) * @see #isEmpty() */ public boolean intersects (Rectangle rect) { if (rect == null) SWT.error(SWT.ERROR_NULL_ARGUMENT); return rect == this || intersects (rect.x, rect.y, rect.width, rect.height); }
/** * Returns <code>true</code> if the given rectangle intersects * with the receiver and <code>false</code> otherwise. * <p> * Two rectangles intersect if the area of the rectangle * representing their intersection is not empty. * </p> * * @param rect the rectangle to test for intersection * @return <code>true</code> if the rectangle intersects with the receiver, and <code>false</code> otherwise * * @exception IllegalArgumentException <ul> * <li>ERROR_NULL_ARGUMENT - if the argument is null</li> * </ul> * * @see #intersection(Rectangle) * @see #isEmpty() */ public boolean intersects (Rectangle rect) { if (rect == null) SWT.error(SWT.ERROR_NULL_ARGUMENT); return rect == this || intersects (rect.x, rect.y, rect.width, rect.height); }
/** * Returns <code>true</code> if the given rectangle intersects * with the receiver and <code>false</code> otherwise. * <p> * Two rectangles intersect if the area of the rectangle * representing their intersection is not empty. * </p> * * @param rect the rectangle to test for intersection * @return <code>true</code> if the rectangle intersects with the receiver, and <code>false</code> otherwise * * @exception IllegalArgumentException <ul> * <li>ERROR_NULL_ARGUMENT - if the argument is null</li> * </ul> * * @see #intersection(Rectangle) * @see #isEmpty() */ public boolean intersects (Rectangle rect) { if (rect == null) SWT.error(SWT.ERROR_NULL_ARGUMENT); return rect == this || intersects (rect.x, rect.y, rect.width, rect.height); }
/** * Returns <code>true</code> if the given rectangle intersects * with the receiver and <code>false</code> otherwise. * <p> * Two rectangles intersect if the area of the rectangle * representing their intersection is not empty. * </p> * * @param rect the rectangle to test for intersection * @return <code>true</code> if the rectangle intersects with the receiver, and <code>false</code> otherwise * * @exception IllegalArgumentException <ul> * <li>ERROR_NULL_ARGUMENT - if the argument is null</li> * </ul> * * @see #intersection(Rectangle) * @see #isEmpty() */ public boolean intersects (Rectangle rect) { if (rect == null) SWT.error(SWT.ERROR_NULL_ARGUMENT); return rect == this || intersects (rect.x, rect.y, rect.width, rect.height); }
/** * Returns <code>true</code> if the given rectangle intersects * with the receiver and <code>false</code> otherwise. * <p> * Two rectangles intersect if the area of the rectangle * representing their intersection is not empty. * </p> * * @param rect the rectangle to test for intersection * @return <code>true</code> if the rectangle intersects with the receiver, and <code>false</code> otherwise * * @exception IllegalArgumentException <ul> * <li>ERROR_NULL_ARGUMENT - if the argument is null</li> * </ul> * * @see #intersection(Rectangle) * @see #isEmpty() */ public boolean intersects (Rectangle rect) { if (rect == null) SWT.error(SWT.ERROR_NULL_ARGUMENT); return rect == this || intersects (rect.x, rect.y, rect.width, rect.height); }
/** * Returns <code>true</code> if the given rectangle intersects * with the receiver and <code>false</code> otherwise. * <p> * Two rectangles intersect if the area of the rectangle * representing their intersection is not empty. * </p> * * @param rect the rectangle to test for intersection * @return <code>true</code> if the rectangle intersects with the receiver, and <code>false</code> otherwise * * @exception IllegalArgumentException <ul> * <li>ERROR_NULL_ARGUMENT - if the argument is null</li> * </ul> * * @see #intersection(Rectangle) * @see #isEmpty() */ public boolean intersects (Rectangle rect) { if (rect == null) SWT.error(SWT.ERROR_NULL_ARGUMENT); return rect == this || intersects (rect.x, rect.y, rect.width, rect.height); }
protected List<SashRect> getSashRects(int x, int y) { List<SashRect> srs = new ArrayList<SashRect>(); boolean inSash = false; for (SashRect sr : sashes) { if (sr.rect.contains(x, y)) inSash = true; } if (!inSash) return srs; Rectangle target = new Rectangle(x - 5, y - 5, 10, 10); for (SashRect sr : sashes) { if (sr.rect.intersects(target)) srs.add(sr); } return srs; }
@Override public boolean intersects(Rectangle rect) { for (int i = 0; i < areaRectangles.size(); i++) { AreaRectangle ar = areaRectangles.get(i); if (ar.intersects(rect)) return true; if (i<areaRectangles.size()-1) { // test the gap Rectangle top = ar.rect; Rectangle bot = areaRectangles.get(i+1).rect; if (top.y+top.height < bot.y) { int y = top.y+top.height; int height = bot.y-y; int left = Math.max(top.x, bot.x); int right = Math.min(top.x+top.width, bot.x+bot.width); Rectangle gap = new Rectangle(left, y, right-left, height); if (gap.intersects(rect)) return true; } } } return false; }
@Override public boolean intersects(Rectangle rect) { for (int i = 0; i < areaRectangles.size(); i++) { AreaRectangle ar = areaRectangles.get(i); if (ar.intersects(rect)) return true; if (i<areaRectangles.size()-1) { // test the gap Rectangle top = ar.rect; Rectangle bot = areaRectangles.get(i+1).rect; if (top.y+top.height < bot.y) { int y = top.y+top.height; int height = bot.y-y; int left = Math.max(top.x, bot.x); int right = Math.min(top.x+top.width, bot.x+bot.width); Rectangle gap = new Rectangle(left, y, right-left, height); if (gap.intersects(rect)) return true; } } } return false; }
/** * * Returns true iff the given rectangle is located in the client area of any * monitor. * * @param display * the display * @param someRectangle * a rectangle in display coordinates (not null) * @return true iff the given point can be seen on any monitor */ public static boolean intersectsAnyMonitor(Display display, Rectangle someRectangle) { for (Monitor monitor : display.getMonitors()) { if (monitor.getClientArea().intersects(someRectangle)) { return true; } } return false; }
@Override public Image obfuscatedImage(Image image) { Rectangle treeBounds = tree.getBounds(); SideBarEntrySWT[] sideBarEntries = getEntries( new SideBarEntrySWT[0]); for (SideBarEntrySWT entry : sideBarEntries) { Rectangle entryBounds = entry.swt_getBounds(); if (entryBounds != null && treeBounds.intersects(entryBounds)) { entry.obfuscatedImage(image); } } return image; } }
public void paintItems(GC gc, TreeItem[] items, Rectangle treeBounds) { if (items != null) { for (int i = 0; i < items.length; i++) { TreeItem item = items[i]; if (item != null) { Rectangle bounds = item.getBounds(); if (bounds != null) { if (treeBounds.intersects(bounds)) { paintItem(gc, item, bounds); } } // defect 241039 // if (item.getExpanded()) { paintItems(gc, item.getItems(), treeBounds); } } } } }
private static Control controlThatCovers(Control toTest, Rectangle testRegion) { Composite parent = toTest.getParent(); if (parent == null || toTest instanceof Shell) { return null; } for (Control element : parent.getChildren()) { Control control = element; if (control == toTest) { break; } if (!control.isVisible()) { continue; } Rectangle nextBounds = DragUtil.getDisplayBounds(control); if (nextBounds.intersects(testRegion)) { return control; } } return controlThatCovers(parent, testRegion); }