case SWT.TOP: caretControl.setSize(trimRect.width-(2*hDelta), width); caretControl.setLocation(trimRect.x + hDelta, trimRect.y + trimRect.height + threshold); bb = caretControl.getBounds(); end1.setLocation(bb.x, bb.y-width); end2.setLocation((bb.x+bb.width)-width, bb.y-width); break; case SWT.BOTTOM: caretControl.setSize(trimRect.width-(2*hDelta), width); caretControl.setLocation(trimRect.x + hDelta, trimRect.y - threshold); bb = caretControl.getBounds(); end1.setLocation(bb.x, bb.y+width); end2.setLocation((bb.x+bb.width)-width, bb.y+width); break; case SWT.LEFT: caretControl.setSize(width, trimRect.height -(2*vDelta)); caretControl.setLocation(trimRect.x + trimRect.width + threshold, trimRect.y + vDelta); bb = caretControl.getBounds(); end1.setLocation(bb.x-bb.width, bb.y); end2.setLocation(bb.x-bb.width, (bb.y+bb.height)-width); break; case SWT.RIGHT: caretControl.setSize(width, trimRect.height -(2*vDelta)); caretControl.setLocation(trimRect.x - threshold, trimRect.y + vDelta); bb = caretControl.getBounds(); end1.setLocation(bb.x+bb.width, bb.y); end2.setLocation(bb.x+bb.width, (bb.y+bb.height)-width);
border.setLocation(newPos.x - (size.x/2), newPos.y - (size.y/2)); border.setLocation(newPos.x, newPos.y); } else { border.setLocation(newPos.x, newPos.y - border.getSize().y);
/** * Build the window in the SWT thread. * * @param window Window to use as container. */ public void initialize(final SwtWindow window, boolean fullScreenMode, Coordinates c) { this.window = window; this.window.getShell().setBackgroundMode(SWT.INHERIT_DEFAULT); final Color white = this.window.getSystemColor(SWT.COLOR_WHITE); final Color black = this.window.getSystemColor(SWT.COLOR_BLACK); final PaletteData palette = new PaletteData(white.getRGB(), black.getRGB()); final ImageData sourceData = new ImageData(16, 16, 1, palette); sourceData.transparentPixel = 0; this.invisibleCursor = new Cursor(window.getShell().getDisplay(), sourceData, 0, 0); if (fullScreenMode) { this.window.setFullScreen(); } Image tmpImage = this.window.getImage("engine.png"); this.loadingBackground = new Image(this.window.getShell().getDisplay(), tmpImage.getImageData().scaledTo(this.window.getShell().getBounds().width, this.window.getShell().getBounds().height)); this.currentCursor = this.window.getCursor(); this.window.setCursor(this.invisibleCursor); this.window.setBackground(this.loadingBackground); this.canvas = window.createCanvas(c.width, c.height); this.canvas.setLocation(c.left, c.top); if(fullScreenMode) { this.window.getShell().setLayout(new FillLayout()); } }