List of usage examples for org.eclipse.jface.util Geometry flipXY
public static void flipXY(Rectangle toFlip)
From source file:org.eclipse.ui.internal.FastViewBar.java
License:Open Source License
private void updateLayoutData() { ToolItem[] items = fastViewBar.getControl().getItems(); boolean isHorizontal = Geometry.isHorizontal(getSide()); boolean shouldExpand = items.length > 0; Point hint = new Point(32, shouldExpand ? SWT.DEFAULT : HIDDEN_WIDTH); if (!isHorizontal) { Geometry.flipXY(hint); }// w ww.j a va 2 s.c o m if (shouldExpand) { toolBarData.setHint(CellData.MINIMUM, hint); } else { toolBarData.setHint(CellData.OVERRIDE, hint); } if (items.length != oldLength) { LayoutUtil.resize(fvbComposite); oldLength = items.length; } }
From source file:org.eclipse.ui.internal.LayoutPartSash.java
License:Open Source License
private void checkDragLimit(SelectionEvent event) { LayoutTree root = rootContainer.getLayoutTree(); LayoutTreeNode node = root.findSash(this); Rectangle nodeBounds = node.getBounds(); Rectangle eventRect = new Rectangle(event.x, event.y, event.width, event.height); boolean vertical = (style == SWT.VERTICAL); // If a horizontal sash, flip the coordinate system so that we // can handle horizontal and vertical sashes without special cases if (!vertical) { Geometry.flipXY(nodeBounds); Geometry.flipXY(eventRect);//from ww w . j a va 2 s. c o m } int eventX = eventRect.x; int left = Math.max(0, eventX - nodeBounds.x); left = Math.min(left, nodeBounds.width - getSashSize()); int right = nodeBounds.width - left - getSashSize(); LayoutTreeNode.ChildSizes sizes = node.computeChildSizes(nodeBounds.width, nodeBounds.height, left, right, nodeBounds.width); eventRect.x = nodeBounds.x + sizes.left; // If it's a horizontal sash, restore eventRect to its original coordinate system if (!vertical) { Geometry.flipXY(eventRect); } event.x = eventRect.x; event.y = eventRect.y; }
From source file:org.eclipse.ui.internal.LayoutTreeNode.java
License:Open Source License
/** * Resize the parts on this tree to fit in <code>bounds</code>. *//*from www . ja v a 2 s. c o m*/ public void doSetBounds(Rectangle bounds) { if (!children[0].isVisible()) { children[1].setBounds(bounds); getSash().setVisible(false); return; } if (!children[1].isVisible()) { children[0].setBounds(bounds); getSash().setVisible(false); return; } bounds = Geometry.copy(bounds); boolean vertical = getSash().isVertical(); // If this is a horizontal sash, flip coordinate systems so // that we can eliminate special cases if (!vertical) { Geometry.flipXY(bounds); } ChildSizes childSizes = computeChildSizes(bounds.width, bounds.height, getSash().getLeft(), getSash().getRight(), bounds.width); getSash().setVisible(true); getSash().setEnabled(childSizes.resizable); Rectangle leftBounds = new Rectangle(bounds.x, bounds.y, childSizes.left, bounds.height); Rectangle sashBounds = new Rectangle(leftBounds.x + leftBounds.width, bounds.y, this.getSashSize(), bounds.height); Rectangle rightBounds = new Rectangle(sashBounds.x + sashBounds.width, bounds.y, childSizes.right, bounds.height); if (!vertical) { Geometry.flipXY(leftBounds); Geometry.flipXY(sashBounds); Geometry.flipXY(rightBounds); } getSash().setBounds(sashBounds); children[0].setBounds(leftBounds); children[1].setBounds(rightBounds); }