Project

General

Profile

Download (1.89 KB) Statistics
| Branch: | Tag: | Revision:
1
/*******************************************************************************
2
 * Copyright (c) 2000, 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.palette.editparts;
12

    
13
import org.eclipse.draw2d.ColorConstants;
14
import org.eclipse.draw2d.Graphics;
15
import org.eclipse.draw2d.IFigure;
16
import org.eclipse.draw2d.MarginBorder;
17
import org.eclipse.draw2d.geometry.Insets;
18
import org.eclipse.draw2d.geometry.Rectangle;
19

    
20
/**
21
 * @author Pratik Shah
22
 */
23
public class RaisedBorder extends MarginBorder {
24

    
25
	private static final Insets DEFAULT_INSETS = new Insets(1, 1, 1, 1);
26

    
27
	/**
28
	 * @see org.eclipse.draw2d.Border#getInsets(IFigure)
29
	 */
30
	public Insets getInsets(IFigure figure) {
31
		return insets;
32
	}
33

    
34
	public RaisedBorder() {
35
		this(DEFAULT_INSETS);
36
	}
37

    
38
	public RaisedBorder(Insets insets) {
39
		super(insets);
40
	}
41

    
42
	public RaisedBorder(int t, int l, int b, int r) {
43
		super(t, l, b, r);
44
	}
45

    
46
	public boolean isOpaque() {
47
		return true;
48
	}
49

    
50
	/**
51
	 * @see org.eclipse.draw2d.Border#paint(IFigure, Graphics, Insets)
52
	 */
53
	public void paint(IFigure figure, Graphics g, Insets insets) {
54
		g.setLineStyle(Graphics.LINE_SOLID);
55
		g.setLineWidth(1);
56
		g.setForegroundColor(ColorConstants.buttonLightest);
57
		Rectangle r = getPaintRectangle(figure, insets);
58
		r.resize(-1, -1);
59
		g.drawLine(r.x, r.y, r.right(), r.y);
60
		g.drawLine(r.x, r.y, r.x, r.bottom());
61
		g.setForegroundColor(ColorConstants.buttonDarker);
62
		g.drawLine(r.x, r.bottom(), r.right(), r.bottom());
63
		g.drawLine(r.right(), r.y, r.right(), r.bottom());
64
	}
65

    
66
}
(16-16/22)