use of org.eclipse.swt.graphics.Rectangle in project translationstudio8 by heartsome.
the class RowStructuralChangeEvent method getChangedPositionRectangles.
@Override
public Collection<Rectangle> getChangedPositionRectangles() {
Collection<Rectangle> changedPositionRectangles = new ArrayList<Rectangle>();
int columnCount = getLayer().getColumnCount();
int rowCount = getLayer().getRowCount();
for (Range range : getRowPositionRanges()) {
changedPositionRectangles.add(new Rectangle(0, range.start, columnCount, rowCount - range.start));
}
return changedPositionRectangles;
}
use of org.eclipse.swt.graphics.Rectangle in project translationstudio8 by heartsome.
the class BackgroundImagePainter method paintCell.
@Override
public void paintCell(LayerCell cell, GC gc, Rectangle rectangle, IConfigRegistry configRegistry) {
// Save GC settings
Color originalBackground = gc.getBackground();
Color originalForeground = gc.getForeground();
gc.setBackgroundPattern(new Pattern(Display.getCurrent(), bgImage));
gc.fillRectangle(rectangle);
gc.setBackgroundPattern(null);
if (isNotNull(separatorColor)) {
gc.setForeground(separatorColor);
gc.drawLine(rectangle.x - 1, rectangle.y, rectangle.x - 1, rectangle.y + rectangle.height);
gc.drawLine(rectangle.x - 1 + rectangle.width, rectangle.y, rectangle.x - 1 + rectangle.width, rectangle.y + rectangle.height);
}
// Restore original GC settings
gc.setBackground(originalBackground);
gc.setForeground(originalForeground);
// Draw interior
Rectangle interiorBounds = new Rectangle(rectangle.x + 2, rectangle.y + 2, rectangle.width - 4, rectangle.height - 4);
super.paintCell(cell, gc, interiorBounds, configRegistry);
}
use of org.eclipse.swt.graphics.Rectangle in project translationstudio8 by heartsome.
the class ImagePainter method paintCell.
@Override
public void paintCell(LayerCell cell, GC gc, Rectangle bounds, IConfigRegistry configRegistry) {
if (paintBg) {
super.paintCell(cell, gc, bounds, configRegistry);
}
Image image = getImage(cell, configRegistry);
if (image != null) {
Rectangle imageBounds = image.getBounds();
IStyle cellStyle = CellStyleUtil.getCellStyle(cell, configRegistry);
gc.drawImage(image, bounds.x + CellStyleUtil.getHorizontalAlignmentPadding(cellStyle, bounds, imageBounds.width), bounds.y + CellStyleUtil.getVerticalAlignmentPadding(cellStyle, bounds, imageBounds.height));
}
}
use of org.eclipse.swt.graphics.Rectangle in project translationstudio8 by heartsome.
the class BeveledBorderDecorator method paintCell.
public void paintCell(LayerCell cell, GC gc, Rectangle rectangle, IConfigRegistry configRegistry) {
Rectangle interiorBounds = new Rectangle(rectangle.x + 2, rectangle.y + 2, rectangle.width - 4, rectangle.height - 4);
super.paintCell(cell, gc, interiorBounds, configRegistry);
// Save GC settings
Color originalForeground = gc.getForeground();
//TODO: Need to look at the border style
// Up
gc.setForeground(GUIHelper.COLOR_WIDGET_LIGHT_SHADOW);
gc.drawLine(rectangle.x, rectangle.y, rectangle.x + rectangle.width - 1, rectangle.y);
gc.drawLine(rectangle.x, rectangle.y, rectangle.x, rectangle.y + rectangle.height - 1);
gc.setForeground(GUIHelper.COLOR_WIDGET_HIGHLIGHT_SHADOW);
gc.drawLine(rectangle.x + 1, rectangle.y + 1, rectangle.x + rectangle.width - 1, rectangle.y + 1);
gc.drawLine(rectangle.x + 1, rectangle.y + 1, rectangle.x + 1, rectangle.y + rectangle.height - 1);
// Down
gc.setForeground(GUIHelper.COLOR_WIDGET_DARK_SHADOW);
gc.drawLine(rectangle.x, rectangle.y + rectangle.height - 1, rectangle.x + rectangle.width - 1, rectangle.y + rectangle.height - 1);
gc.drawLine(rectangle.x + rectangle.width - 1, rectangle.y, rectangle.x + rectangle.width - 1, rectangle.y + rectangle.height - 1);
gc.setForeground(GUIHelper.COLOR_WIDGET_NORMAL_SHADOW);
gc.drawLine(rectangle.x, rectangle.y + rectangle.height - 2, rectangle.x + rectangle.width - 1, rectangle.y + rectangle.height - 2);
gc.drawLine(rectangle.x + rectangle.width - 2, rectangle.y, rectangle.x + rectangle.width - 2, rectangle.y + rectangle.height - 2);
// Restore GC settings
gc.setForeground(originalForeground);
}
use of org.eclipse.swt.graphics.Rectangle in project translationstudio8 by heartsome.
the class CellPainterDecorator method paintCell.
public void paintCell(LayerCell cell, GC gc, Rectangle bounds, IConfigRegistry configRegistry) {
int x = bounds.x + (cellEdge == CellEdgeEnum.LEFT ? decoratorCellPainter.getPreferredWidth(cell, gc, configRegistry) + spacing : 0);
int y = bounds.y + (cellEdge == CellEdgeEnum.TOP ? decoratorCellPainter.getPreferredHeight(cell, gc, configRegistry) + spacing : 0);
Rectangle baseCellPainterBounds = new Rectangle(x, y, bounds.width, bounds.height).intersection(bounds);
baseCellPainter.paintCell(cell, gc, baseCellPainterBounds, configRegistry);
x = bounds.x + (cellEdge == CellEdgeEnum.RIGHT ? bounds.width - spacing - decoratorCellPainter.getPreferredWidth(cell, gc, configRegistry) : 0);
y = bounds.y + (cellEdge == CellEdgeEnum.BOTTOM ? bounds.height - spacing - decoratorCellPainter.getPreferredHeight(cell, gc, configRegistry) : 0);
Rectangle decoratorCellPainterBounds = new Rectangle(x, y, bounds.width, bounds.height).intersection(bounds);
decoratorCellPainter.paintCell(cell, gc, decoratorCellPainterBounds, configRegistry);
}
Aggregations