Search in sources :

Example 81 with Rectangle

use of org.eclipse.swt.graphics.Rectangle in project translationstudio8 by heartsome.

the class PaddingDecorator method paintCell.

public void paintCell(LayerCell cell, GC gc, Rectangle bounds, IConfigRegistry configRegistry) {
    Rectangle interiorBounds = new Rectangle(bounds.x + leftPadding, bounds.y + topPadding, bounds.width - leftPadding - rightPadding, bounds.height - topPadding - bottomPadding);
    super.paintCell(cell, gc, interiorBounds, configRegistry);
}
Also used : Rectangle(org.eclipse.swt.graphics.Rectangle)

Example 82 with Rectangle

use of org.eclipse.swt.graphics.Rectangle in project translationstudio8 by heartsome.

the class CompositeLayer method getChildClientArea.

private Rectangle getChildClientArea(final int layoutX, final int layoutY) {
    final ChildLayerInfo childLayerInfo = getChildLayerInfoByLayout(layoutX, layoutY);
    final Rectangle compositeClientArea = getClientAreaProvider().getClientArea();
    final Rectangle childClientArea = new Rectangle(compositeClientArea.x + childLayerInfo.getWidthOffset(), compositeClientArea.y + childLayerInfo.getHeightOffset(), childLayerInfo.getLayer().getPreferredWidth(), childLayerInfo.getLayer().getPreferredHeight());
    final Rectangle intersection = compositeClientArea.intersection(childClientArea);
    return intersection;
}
Also used : Rectangle(org.eclipse.swt.graphics.Rectangle)

Example 83 with Rectangle

use of org.eclipse.swt.graphics.Rectangle in project translationstudio8 by heartsome.

the class CompositeLayer method setChildLayer.

// Child layer stuff
public void setChildLayer(String regionName, ILayer childLayer, final int layoutX, final int layoutY) {
    if (childLayer == null) {
        throw new IllegalArgumentException("Cannot set null child layer");
    }
    childLayerToRegionNameMap.put(childLayer, regionName);
    childLayer.addLayerListener(this);
    childLayerToLayoutCoordinateMap.put(childLayer, new LayoutCoordinate(layoutX, layoutY));
    childLayerLayout[layoutX][layoutY] = childLayer;
    childLayer.setClientAreaProvider(new IClientAreaProvider() {

        public Rectangle getClientArea() {
            return getChildClientArea(layoutX, layoutY);
        }
    });
}
Also used : IClientAreaProvider(net.sourceforge.nattable.util.IClientAreaProvider) Rectangle(org.eclipse.swt.graphics.Rectangle)

Example 84 with Rectangle

use of org.eclipse.swt.graphics.Rectangle in project translationstudio8 by heartsome.

the class CompositeLayer method getBoundsByPosition.

@Override
public Rectangle getBoundsByPosition(int compositeColumnPosition, int compositeRowPosition) {
    ChildLayerInfo childLayerInfo = getChildLayerInfoByPosition(compositeColumnPosition, compositeRowPosition);
    if (childLayerInfo == null) {
        return null;
    }
    ILayer childLayer = childLayerInfo.getLayer();
    int childColumnPosition = compositeColumnPosition - childLayerInfo.getColumnPositionOffset();
    int childRowPosition = compositeRowPosition - childLayerInfo.getRowPositionOffset();
    final Rectangle bounds = childLayer.getBoundsByPosition(childColumnPosition, childRowPosition);
    if (bounds != null) {
        bounds.x += childLayerInfo.widthOffset;
        bounds.y += childLayerInfo.heightOffset;
    }
    return bounds;
}
Also used : Rectangle(org.eclipse.swt.graphics.Rectangle)

Example 85 with Rectangle

use of org.eclipse.swt.graphics.Rectangle in project translationstudio8 by heartsome.

the class ColorPicker method getColorImage.

private Image getColorImage(Color color) {
    Display display = Display.getCurrent();
    image = new Image(display, new Rectangle(10, 10, 70, 20));
    GC gc = new GC(image);
    gc.setBackground(color);
    gc.fillRectangle(image.getBounds());
    gc.dispose();
    return image;
}
Also used : Rectangle(org.eclipse.swt.graphics.Rectangle) Image(org.eclipse.swt.graphics.Image) GC(org.eclipse.swt.graphics.GC) Display(org.eclipse.swt.widgets.Display)

Aggregations

Rectangle (org.eclipse.swt.graphics.Rectangle)651 Point (org.eclipse.swt.graphics.Point)370 Image (org.eclipse.swt.graphics.Image)114 GC (org.eclipse.swt.graphics.GC)104 Test (org.junit.Test)80 Color (org.eclipse.swt.graphics.Color)61 Shell (org.eclipse.swt.widgets.Shell)54 Composite (org.eclipse.swt.widgets.Composite)53 SelectionEvent (org.eclipse.swt.events.SelectionEvent)51 TableItem (org.eclipse.swt.widgets.TableItem)47 GridLayout (org.eclipse.swt.layout.GridLayout)44 Display (org.eclipse.swt.widgets.Display)44 Button (org.eclipse.swt.widgets.Button)42 Menu (org.eclipse.swt.widgets.Menu)40 GridData (org.eclipse.swt.layout.GridData)38 Label (org.eclipse.swt.widgets.Label)37 SWT (org.eclipse.swt.SWT)34 Event (org.eclipse.swt.widgets.Event)34 Font (org.eclipse.swt.graphics.Font)30 Listener (org.eclipse.swt.widgets.Listener)29