1609
|
1 |
/*
|
|
2 |
* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
|
|
3 |
* All rights reserved.
|
|
4 |
* This component and the accompanying materials are made available
|
|
5 |
* under the terms of the License "Eclipse Public License v1.0"
|
|
6 |
* which accompanies this distribution, and is available
|
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
|
8 |
*
|
|
9 |
* Initial Contributors:
|
|
10 |
* Nokia Corporation - initial contribution.
|
|
11 |
*
|
|
12 |
* Contributors:
|
|
13 |
*
|
|
14 |
* Description:
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
package com.nokia.carbide.internal.discovery.ui.editor;
|
|
18 |
|
|
19 |
import org.eclipse.swt.graphics.Color;
|
|
20 |
import org.eclipse.swt.graphics.GC;
|
|
21 |
import org.eclipse.swt.widgets.Composite;
|
|
22 |
|
|
23 |
class RoundedCornerComposite extends SharedBackgroundComposite {
|
|
24 |
|
1831
|
25 |
private static final int ARC = 9;
|
1609
|
26 |
private final Color background;
|
|
27 |
private final Color outline;
|
|
28 |
|
|
29 |
public RoundedCornerComposite(Composite parent, Composite backgroundParent, Color outline, Color background) {
|
|
30 |
super(parent, backgroundParent);
|
|
31 |
this.background = background;
|
|
32 |
this.outline = outline;
|
|
33 |
}
|
|
34 |
|
|
35 |
@Override
|
|
36 |
public void drawBackground(GC gc, int x, int y, int width, int height) {
|
|
37 |
super.drawBackground(gc, x, y, width, height);
|
|
38 |
if (background != null) {
|
|
39 |
gc.setBackground(background);
|
1831
|
40 |
gc.fillRoundRectangle(0, 0, width, height, ARC, ARC);
|
1609
|
41 |
}
|
|
42 |
if (outline != null) {
|
|
43 |
gc.setForeground(outline);
|
1831
|
44 |
gc.drawRoundRectangle(0, 0, width - 1, height - 1, ARC, ARC);
|
1609
|
45 |
}
|
|
46 |
}
|
|
47 |
}
|