private boolean isTabOverflowing( CTabFolder tabfolder ) { // overflow happens when size of inner toolbar exceeds assigned tabHeight return ( tabfolder.getChildren().length > 0 && tabfolder.getChildren()[0].getSize().y > tabfolder.getTabHeight() ); } } );
@Override protected Point computeSizeConstraints(Control subjectControl, IInformationControl informationControl) { // at least as big as the proposal table Point sizeConstraint= super.computeSizeConstraints(subjectControl, informationControl); Point size= subjectControl.getSize(); if (sizeConstraint.x < size.x) sizeConstraint.x= size.x; if (sizeConstraint.y < size.y) sizeConstraint.y= size.y; return sizeConstraint; } }
private static void enlargeContentControl( Control content ) { Point currentSize = content.getSize(); int width = currentSize.x + TextSizeRecalculation.RESIZE_OFFSET; int height = currentSize.y + TextSizeRecalculation.RESIZE_OFFSET; content.setSize( width, height ); }
private void clearPacked( Point oldSize ) { if( !oldSize.equals( getSize() ) ) { packed = false; } }
static void scroll(ScrolledComposite scomp, int xoffset, int yoffset) { Point origin = scomp.getOrigin(); Point contentSize = scomp.getContent().getSize(); int xorigin = origin.x + xoffset; int yorigin = origin.y + yoffset; xorigin = Math.max(xorigin, 0); xorigin = Math.min(xorigin, contentSize.x - 1); yorigin = Math.max(yorigin, 0); yorigin = Math.min(yorigin, contentSize.y - 1); scomp.setOrigin(xorigin, yorigin); }
@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 void layoutIfNecessary() { if (dirtySize != null && control instanceof Composite) { if (control.getSize().equals(dirtySize)) { ((Composite) control).layout(flushChildren); flushChildren = false; } } dirtySize = null; } }
/** 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 layoutIfNecessary() { if (dirtySize != null && control != null && control instanceof Composite) { if (control.getSize().equals(dirtySize)) { ((Composite)control).layout(flushChildren); flushChildren = false; } } dirtySize = null; } }
private void updateSizeWhilePending() { Control c = getContent(); Rectangle area = getClientArea(); setMinSize(area.width, c.getSize().y); }
public void controlResized(ControlEvent e) { if (!ignoreShellResize) { Control control = (Control) e.getSource(); if (control.isVisible()) { originalSize = control.getSize(); if (advancedHeight == -1) setShellSizeForAdvanced(); } } }
void notifyResize( Point oldSize ) { if( !oldSize.equals( getSize() ) ) { notifyListeners( SWT.Resize, new Event() ); } }
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); }
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; }
protected boolean allowMouseEvent( T control, int x, int y ) { Point size = control.getSize(); int borderWidth = control.getBorderWidth(); Rectangle outerBounds = new Rectangle( - borderWidth, - borderWidth, size.x, size.y ); Rectangle innerBounds = new Rectangle( 0, 0, size.x - 2 * borderWidth, size.y - 2 * borderWidth ); return !outerBounds.contains( x, y ) || innerBounds.contains( x, y ); }
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 void paintTitleFocus(GC gc) { Point size = textLabel.getSize(); gc.setBackground(textLabel.getBackground()); gc.setForeground(textLabel.getForeground()); if (toggle.isFocusControl()) gc.drawFocus(0, 0, size.x, size.y); }
@Override public void paintControl(PaintEvent e) { assert e != null; Control c = (Control) e.widget; Point size = c.getSize(); e.gc.setBackground(ColorCache.getColor(e.display, "#23a7df")); int breakX = size.x * waitProgress / 100; e.gc.fillRectangle(0, 0, breakX, size.y); e.gc.setBackground(ColorCache.getColor(e.display, "#cccccc")); e.gc.fillRectangle(breakX, 0, size.x - breakX, size.y); } });
void setBounds( Rectangle bounds, boolean updateMode ) { Point oldLocation = getLocation(); Point oldSize = getSize(); _setBounds( new Rectangle( bounds.x, bounds.y, bounds.width, bounds.height ) ); if( updateMode ) { updateMode(); } clearPacked( oldSize ); notifyMove( oldLocation ); notifyResize( oldSize ); }
/** * manual fixing of shell size when details are shown. */ private void fixShellSize() { int yDelta = getShell().getSize().y - getContents().getSize().y; ((Composite) getContents()).layout(true, true); Point size = getShell().getSize(); getShell().setSize(size.x, getContents().computeSize(size.x, SWT.DEFAULT).y + yDelta); }