public void controlResized(ControlEvent e) { // Don't store the maximized size in the model if (shell.getMaximized()) return; try { ignoreSizeChanges = true; w.setWidth(shell.getSize().x); w.setHeight(shell.getSize().y); } finally { ignoreSizeChanges = false; } }
@Override public void controlResized(ControlEvent e) { // Don't store the maximized size in the model if (shell.getMaximized()) { return; } try { ignoreSizeChanges = true; w.setWidth(shell.getSize().x); w.setHeight(shell.getSize().y); } finally { ignoreSizeChanges = false; } }
window.setX(bounds.x); window.setY(bounds.y); window.setWidth(bounds.width); window.setHeight(bounds.height); window.getTags().add("topLevel"); //$NON-NLS-1$
private void attach() { dragElement.getParent().getChildren().remove(dragElement); ((Shell) baseWindow.getWidget()).getDisplay().update(); dragWindow = MBasicFactory.INSTANCE.createWindow(); dragWindow.getTags().add(DragHostId); // define the initial location and size for the window Point cp = ((Shell) baseWindow.getWidget()).getDisplay() .getCursorLocation(); Point size = new Point(200, 200); if (dragElement.getWidget() instanceof Control) { Control ctrl = (Control) dragElement.getWidget(); size = ctrl.getSize(); } else if (dragElement.getWidget() instanceof ToolItem) { ToolItem ti = (ToolItem) dragElement.getWidget(); Rectangle bounds = ti.getBounds(); size = new Point(bounds.width + 3, bounds.height + 3); } dragWindow.setX(cp.x + xOffset); dragWindow.setY(cp.y + yOffset); dragWindow.setWidth(size.x); dragWindow.setHeight(size.y); // add the window as a child of the base window baseWindow.getWindows().add(dragWindow); getShell().layout(getShell().getChildren(), SWT.CHANGED | SWT.DEFER); getShell().setVisible(true); }
private void attach() { dragElement.getParent().getChildren().remove(dragElement); ((Shell) baseWindow.getWidget()).getDisplay().update(); dragWindow = MBasicFactory.INSTANCE.createWindow(); dragWindow.getTags().add(DragHostId); formatModel(dragWindow); // define the initial location and size for the window Point cp = ((Shell) baseWindow.getWidget()).getDisplay() .getCursorLocation(); Point size = new Point(200, 200); if (dragElement.getWidget() instanceof Control) { Control ctrl = (Control) dragElement.getWidget(); size = ctrl.getSize(); } else if (dragElement.getWidget() instanceof ToolItem) { ToolItem ti = (ToolItem) dragElement.getWidget(); Rectangle bounds = ti.getBounds(); size = new Point(bounds.width + 3, bounds.height + 3); } dragWindow.setX(cp.x + xOffset); dragWindow.setY(cp.y + yOffset); dragWindow.setWidth(size.x); dragWindow.setHeight(size.y); // add the window as a child of the base window baseWindow.getWindows().add(dragWindow); getShell().layout(getShell().getChildren(), SWT.CHANGED | SWT.DEFER); getShell().setVisible(true); }
window.setWidth(size.x); window.setHeight(size.y); application.getChildren().add(window);