/** * Returns vertical or horizontal based on view size. * * @return vertical or horizontal */ int computeOrientation() { Point size= fParent.getSize(); if (size.x != 0 && size.y != 0) { if ((size.x / 3)> size.y) { return SWT.HORIZONTAL; } else { return SWT.VERTICAL; } } return SWT.HORIZONTAL; }
@Override public int getWidth() { if (!isDisposed()) { if (cellArea != null) { return cellArea.width - 2; } return composite.getSize().x; } return 0; }
@Override public int getHeight() { if (composite != null && !composite.isDisposed()) { if (cellArea != null) { return cellArea.height; } return composite.getSize().y; } return 0; }
@Override public void handleEvent(Event event) { float col1CurrentWidth = leftPanel.getSize().x; float col2CurrentWidth = rightPanel.getSize().x; final int minLeftPanelWidth = 250; // in pels final int minRightPanelWidth = (int) (col2CurrentWidth * minLeftPanelWidth / col1CurrentWidth); ((GridData) leftPanel.getLayoutData()).widthHint = minLeftPanelWidth; ((GridData) rightPanel.getLayoutData()).widthHint = minRightPanelWidth; sform.removeListener(SWT.Resize, this); // only do this one time } });
public void handleEvent(Event e) { Point textSize = textEditor.getSize(); Point parentSize = textEditorParent.getSize(); e.gc.drawRectangle(0, 0, Math.min(textSize.x + 4, parentSize.x - 1), parentSize.y - 1); } });
@Override public void mouseUp(MouseEvent e) { composite.setCapture(false); // Persist the current size Point size = composite.getSize(); toolControl.getPersistedState() .put(TrimStack.STATE_XSIZE, Integer.toString(size.x)); toolControl.getPersistedState() .put(TrimStack.STATE_YSIZE, Integer.toString(size.y)); trackState = NOT_SIZING; }
public void handleEvent(Event e) { Point textSize = textEditor.getSize(); Point parentSize = textEditorParent.getSize(); e.gc.drawRectangle(0, 0, Math.min(textSize.x + 4, parentSize.x - 1), parentSize.y - 1); } });
public void mouseUp(MouseEvent e) { composite.setCapture(false); // Persist the current size Point size = composite.getSize(); toolControl.getPersistedState() .put(TrimStack.STATE_XSIZE, Integer.toString(size.x)); toolControl.getPersistedState() .put(TrimStack.STATE_YSIZE, Integer.toString(size.y)); trackState = NOT_SIZING; }
public void handleEvent(Event e) { Point textSize = textEditor.computeSize(SWT.DEFAULT, SWT.DEFAULT); textSize.x += textSize.y; // Add extra space for new characters. Point parentSize = textEditorParent.getSize(); textEditor.setBounds(2, 1, Math.min(textSize.x, parentSize.x - 4), parentSize.y - 2); textEditorParent.redraw(); } });
public void handleEvent(Event e) { Point textSize = textEditor.computeSize(SWT.DEFAULT, SWT.DEFAULT); textSize.x += textSize.y; // Add extra space for new // characters. Point parentSize = textEditorParent.getSize(); textEditor.setBounds(2, inset, Math.min(textSize.x, parentSize.x - 4), parentSize.y - 2 * inset); textEditorParent.redraw(); } });
@Override public void paintControl(PaintEvent e) { GC gc = e.gc; gc.setForeground( Colors.grey); Point size = engine_comp.getSize(); gc.drawRectangle( new Rectangle( 0, 0, size.x-1, size.y-1 )); } });
/** * Toggle function to show or hide the explanation composite * @param showIt yes or no? */ private void showOrHideExplanationComposite ( boolean showIt ) { if ( showIt == (compositeExplanationW.getSize().y > 0) ) return; mkLayout4ExplanationAndContentComposite(showIt); getComposite().layout(); }
/** * */ protected void setDetailHints() { GridData data = (GridData) detailsComposite.getLayoutData(); if (showDetails) { Composite parent = detailsComposite.getParent(); data.widthHint = parent.getSize().x - ((GridLayout)parent.getLayout()).marginWidth * 2; data.heightHint = convertHeightInCharsToPixels(5); } else { data.widthHint = 0; data.heightHint = 0; } }
protected Point getMinSize() { int minWidth = scaler.convertXToCurrent(23) + detailButton.getSize().x + scaler.convertXToCurrent(HORIZONTAL_OFFSET); minWidth += copyButton.getSize().x + scaler.convertXToCurrent(HORIZONTAL_OFFSET); minWidth += getButtonComposite().getSize().x + scaler.convertXToCurrent(HORIZONTAL_OFFSET); int okBottomEnd = getButtonComposite().getLocation().y + getButtonComposite().getSize().y; int minHeight = okBottomEnd + scaler.convertYToCurrent(SHELL_DEFAULT_MIN_HEIGHT); if(detailOpen) { minHeight += scaler.convertYToCurrent(100); } return new Point(minWidth,minHeight); }
protected Point getMinSize() { int minWidth = scaler.convertXToCurrent(23) + detailButton.getSize().x + scaler.convertXToCurrent(HORIZONTAL_OFFSET); minWidth += copyButton.getSize().x + scaler.convertXToCurrent(HORIZONTAL_OFFSET); minWidth += getButtonComposite().getSize().x + scaler.convertXToCurrent(HORIZONTAL_OFFSET); int okBottomEnd = getButtonComposite().getLocation().y + getButtonComposite().getSize().y; int minHeight = okBottomEnd + scaler.convertYToCurrent(SHELL_DEFAULT_MIN_HEIGHT); if(detailOpen) { minHeight += scaler.convertYToCurrent(100); } return new Point(minWidth,minHeight); }
protected Point getMinSize() { Point size = getButtonComposite().getSize(); int bottomEnd = getButtonComposite().getLocation().y + size.y; int minWidth = size.x + 2*scaler.convertXToCurrent(HORIZONTAL_OFFSET) + 2*getShell().getBorderWidth(); int minHeight = bottomEnd + scaler.convertYToCurrent(SHELL_DEFAULT_MIN_HEIGHT); return new Point(minWidth,minHeight); }
protected Point getMinSize() { Point size = getButtonComposite().getSize(); int bottomEnd = getButtonComposite().getLocation().y + size.y; int minWidth = size.x + 2*scaler.convertXToCurrent(HORIZONTAL_OFFSET) + 2*getShell().getBorderWidth(); int minHeight = bottomEnd + scaler.convertYToCurrent(SHELL_DEFAULT_MIN_HEIGHT); return new Point(minWidth,minHeight); }
private void updateSizeAndLocations() { if (busyLabel == null || busyLabel.isDisposed()) return; if (titleLabel == null || titleLabel.isDisposed()) return; Point size = titleLabel.computeSize(SWT.DEFAULT, SWT.DEFAULT, true); int y = (titleLabel.getParent().getSize().y - size.y) / 2; titleLabel.setBounds(busyLabel.getLocation().x, y, size.x, size.y); }
public void mouseDown(MouseEvent e) { Composite parent= fControl.getParent(); Point s= parent.getSize(); Point as= fAncestorLabel.getSize(); Point ys= fLeftLabel.getSize(); Point ms= fRightLabel.getSize(); fWidth1= ys.x; fWidth2= ms.x; fHeight1= fLeftLabel.getLocation().y-as.y; fHeight2= s.y-(fLeftLabel.getLocation().y+ys.y); fX= e.x; fY= e.y; fIsDown= true; }