1
|
/*******************************************************************************
|
2
|
* Copyright (c) 2003, 2010 IBM Corporation and others.
|
3
|
* All rights reserved. This program and the accompanying materials
|
4
|
* are made available under the terms of the Eclipse Public License v1.0
|
5
|
* which accompanies this distribution, and is available at
|
6
|
* http://www.eclipse.org/legal/epl-v10.html
|
7
|
*
|
8
|
* Contributors:
|
9
|
* IBM Corporation - initial API and implementation
|
10
|
*******************************************************************************/
|
11
|
package org.eclipse.gef.internal.ui.rulers;
|
12
|
|
13
|
import org.eclipse.draw2d.ColorConstants;
|
14
|
import org.eclipse.draw2d.Graphics;
|
15
|
import org.eclipse.draw2d.geometry.PointList;
|
16
|
import org.eclipse.draw2d.geometry.Rectangle;
|
17
|
|
18
|
/**
|
19
|
* @author Pratik Shah
|
20
|
*/
|
21
|
public class GuidePlaceHolder extends GuideFigure {
|
22
|
|
23
|
public GuidePlaceHolder(boolean isHorizontal) {
|
24
|
super(isHorizontal);
|
25
|
setBackgroundColor(ColorConstants.lightGray);
|
26
|
}
|
27
|
|
28
|
protected void paintFigure(Graphics graphics) {
|
29
|
PointList list = new PointList();
|
30
|
if (isHorizontal()) {
|
31
|
Rectangle clientArea = getClientArea();
|
32
|
clientArea.x = clientArea.getTopRight().x - 7;
|
33
|
clientArea.y++;
|
34
|
list.addPoint(clientArea.x, clientArea.y);
|
35
|
list.addPoint(clientArea.x + 3, clientArea.y);
|
36
|
list.addPoint(clientArea.x + 6, clientArea.y + 3);
|
37
|
list.addPoint(clientArea.x + 3, clientArea.y + 6);
|
38
|
list.addPoint(clientArea.x, clientArea.y + 6);
|
39
|
graphics.fillPolygon(list);
|
40
|
graphics.drawPolygon(list);
|
41
|
graphics.setForegroundColor(ColorConstants.buttonLightest);
|
42
|
graphics.drawLine(clientArea.x - 1, clientArea.y, clientArea.x - 1,
|
43
|
clientArea.y + 6);
|
44
|
graphics.drawLine(clientArea.x, clientArea.y - 1, clientArea.x + 3,
|
45
|
clientArea.y - 1);
|
46
|
graphics.drawLine(clientArea.x, clientArea.y + 7, clientArea.x + 3,
|
47
|
clientArea.y + 7);
|
48
|
} else {
|
49
|
Rectangle clientArea = getClientArea();
|
50
|
clientArea.y = clientArea.getBottomLeft().y - 7;
|
51
|
clientArea.x++;
|
52
|
list.addPoint(clientArea.x, clientArea.y);
|
53
|
list.addPoint(clientArea.x + 6, clientArea.y);
|
54
|
list.addPoint(clientArea.x + 6, clientArea.y + 3);
|
55
|
list.addPoint(clientArea.x + 3, clientArea.y + 6);
|
56
|
list.addPoint(clientArea.x, clientArea.y + 3);
|
57
|
graphics.fillPolygon(list);
|
58
|
graphics.drawPolygon(list);
|
59
|
graphics.setForegroundColor(ColorConstants.buttonLightest);
|
60
|
graphics.drawLine(clientArea.x, clientArea.y - 1, clientArea.x + 6,
|
61
|
clientArea.y - 1);
|
62
|
graphics.drawLine(clientArea.x - 1, clientArea.y, clientArea.x - 1,
|
63
|
clientArea.y + 3);
|
64
|
graphics.drawLine(clientArea.x + 7, clientArea.y, clientArea.x + 7,
|
65
|
clientArea.y + 3);
|
66
|
}
|
67
|
}
|
68
|
|
69
|
}
|