@Override public final int getScreenLocationY() { return c.toDisplay(0, 0).y; }
/** * Get the display relative location where the tooltip is displayed. * Subclasses may overwrite to implement custom positioning. * * @param tipSize * the size of the tooltip to be shown * @param event * the event triggered showing the tooltip * @return the absolute position on the display */ public Point getLocation(Point tipSize, Event event) { return control.toDisplay(event.x + xShift, event.y + yShift); }
@Override public final int getScreenLocationX() { return c.toDisplay(0, 0).x; }
/** * Get the display relative location where the tooltip is displayed. * Subclasses may overwrite to implement custom positioning. * * @param tipSize * the size of the tooltip to be shown * @param event * the event triggered showing the tooltip * @return the absolute position on the display */ public Point getLocation(Point tipSize, Event event) { return control.toDisplay(event.x + xShift, event.y + yShift); }
/** * Returns the location of the given event, in display coordinates * @return */ public static Point getEventLoc(Event event) { Control ctrl = (Control) event.widget; return ctrl.toDisplay(new Point(event.x, event.y)); }
public void getLocation(AccessibleControlEvent e) { Rectangle location = control.getBounds(); Point pt = control.toDisplay(new Point(location.x, location.y)); e.x = pt.x; e.y = pt.y; e.width = location.width; e.height = location.height; }
/** Converts a rectangle to global coordinates using the given control as a reference frame. */ public static Rectangle toDisplay(Control control, Rectangle rect) { Point topLeft = control.toDisplay(rect.x, rect.y); return new Rectangle(topLeft.x, topLeft.y, rect.width, rect.height); }
@Override protected Point getDefaultLocation(Point initialSize) { Control textWidget = (Control) xtextEditor.getAdapter(Control.class); Point size = textWidget.getSize(); Point popupLocation = new Point((size.x / 2) - (initialSize.x / 2), (size.y / 2) - (initialSize.y / 2)); return textWidget.toDisplay(popupLocation); }
public static Point getLocationRelativeToShell(Control control) { Point controlLocation = control.toDisplay(0, 0); Point shellLocation = control.getShell().getLocation(); return new Point(controlLocation.x - shellLocation.x, controlLocation.y - shellLocation.y); }
/** Returns the bounds of the given control in global coordinates. */ public static Rectangle globalBounds(Control control) { Point size = control.getSize(); Point topLeft = control.toDisplay(0, 0); return new Rectangle(topLeft.x, topLeft.y, size.x, size.y); }
public void setPosition(final int x, final int y) { final Point p = new Point(x, _control.getSize().y - y); _control.getDisplay().setCursorLocation(_control.toDisplay(p)); }
@Override public void mouseHover(MouseEvent e) { if (infoControl instanceof PDEDefaultInformationControl && ((PDEDefaultInformationControl) infoControl).isDisposed()) return; String text = provider.getHoverContent(control); if (text == null || text.trim().length() == 0) return; updateHover(infoControl, text); infoControl.setLocation(control.toDisplay(new Point(10, 25))); infoControl.setVisible(true); } });
@Override public void runWithEvent(Event event) { if (event.widget instanceof ToolItem) { ToolItem toolItem= (ToolItem) event.widget; Control control= toolItem.getParent(); Menu menu= getMenu(control); Rectangle bounds= toolItem.getBounds(); Point topLeft= new Point(bounds.x, bounds.y + bounds.height); menu.setLocation(control.toDisplay(topLeft)); menu.setVisible(true); } }
private void showProposalsMenu() { Control control = getControl(); Rectangle bounds = control.getBounds(); bounds.y += bounds.height + 5; Point point = control.toDisplay( bounds.x, bounds.y ); proposalsMenu.setLocation( point ); proposalsMenu.setVisible( true ); }
public void lazyOpen(String text) { Control c = Display.getDefault().getCursorControl(); if (c != null) { open(c.toDisplay(new Point(0, c.getBounds().height)), text); } else { Rectangle bounds = Display.getDefault().getBounds(); open(new Point(bounds.x + bounds.width / 2, bounds.y + bounds.height / 2), text); } }
@Override public void mouseDown(MouseEvent e) { Point ptOnDisplay = ((Control) e.widget).toDisplay(e.x, e.y); Point ptOnComposite = composite.toControl(ptOnDisplay); if (e.count > 1) { lastMoveHadMouseDown = true; return; } Point mousePos = display.getCursorLocation(); if (ptOnComposite.y > HEIGHT - SCALER_HEIGHT) { bMouseDown = true; setValue(getValueFromMousePos(e.x)); } }
private Rectangle getCaretRectangle(int offset) { Point location= fContentAssistSubjectControlAdapter.getLocationAtOffset(offset); Control subjectControl= fContentAssistSubjectControlAdapter.getControl(); Point controlSize= subjectControl.getSize(); constrainLocation(location, new Point(0, 0), new Rectangle(0, 0, controlSize.x, controlSize.y)); location= subjectControl.toDisplay(location); Rectangle subjectRectangle= new Rectangle(location.x, location.y, 1, fContentAssistSubjectControlAdapter.getLineHeight()); return subjectRectangle; }
private Rectangle getCaretRectangle(int offset) { Point location= fContentAssistSubjectControlAdapter.getLocationAtOffset(offset); Control subjectControl= fContentAssistSubjectControlAdapter.getControl(); Point controlSize= subjectControl.getSize(); constrainLocation(location, new Point(0, 0), new Rectangle(0, 0, controlSize.x, controlSize.y)); location= subjectControl.toDisplay(location); Rectangle subjectRectangle= new Rectangle(location.x, location.y, 1, fContentAssistSubjectControlAdapter.getLineHeight()); return subjectRectangle; }
private static void showToolTipSWTJface(Control control, int style, String title, String message) { DefaultToolTip tooltip = new DefaultToolTip(control, org.eclipse.jface.window.ToolTip.NO_RECREATE, true); tooltip.setHideDelay(TOOLTIP_HIDE_DELAY); tooltip.setText("[" + title+ "]\n\n" + message); tooltip.setImage(control.getDisplay().getSystemImage(/*SWT.ICON_INFORMATION*/ style)); tooltip.show(control.toDisplay(control.getSize().x/2, 5)); }
private static void showToolTipSWTwidget(Control control, int style, String title, String message) { ToolTip tooltip = new ToolTip(control.getShell(), /*SWT.BALLOON | */ style); tooltip.setAutoHide(true); tooltip.setLocation(control.toDisplay(control.getSize().x/2, control.getSize().y + 5)); tooltip.setText(title); tooltip.setMessage(message); tooltip.setVisible(true); }