]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.browsing.ui.swt/src/org/simantics/browsing/ui/swt/widgets/DefaultColorProvider.java
69198cf9f3631ba7317114aa35ca3000a03fe84e
[simantics/platform.git] / bundles / org.simantics.browsing.ui.swt / src / org / simantics / browsing / ui / swt / widgets / DefaultColorProvider.java
1 /*******************************************************************************\r
2  * Copyright (c) 2012 Association for Decentralized Information Management in\r
3  * Industry THTH ry.\r
4  * All rights reserved. This program and the accompanying materials\r
5  * are made available under the terms of the Eclipse Public License v1.0\r
6  * which accompanies this distribution, and is available at\r
7  * http://www.eclipse.org/legal/epl-v10.html\r
8  *\r
9  * Contributors:\r
10  *     VTT Technical Research Centre of Finland - initial API and implementation\r
11  *******************************************************************************/\r
12 package org.simantics.browsing.ui.swt.widgets;\r
13 \r
14 import org.eclipse.jface.resource.ColorDescriptor;\r
15 import org.eclipse.jface.resource.ResourceManager;\r
16 import org.eclipse.swt.graphics.Color;\r
17 import org.eclipse.swt.graphics.RGB;\r
18 import org.simantics.browsing.ui.swt.widgets.impl.ITrackedColorProvider;\r
19 \r
20 public class DefaultColorProvider implements ITrackedColorProvider {\r
21         \r
22         private final ResourceManager resourceManager;\r
23         \r
24     private final ColorDescriptor highlightColor = ColorDescriptor.createFrom(new RGB(254, 255, 197));\r
25     private final ColorDescriptor inactiveColor = ColorDescriptor.createFrom(new RGB(245, 246, 190));\r
26     private final ColorDescriptor invalidInputColor = ColorDescriptor.createFrom(new RGB(255, 128, 128));\r
27 \r
28     public DefaultColorProvider(ResourceManager resourceManager) {\r
29         this.resourceManager = resourceManager;\r
30     }\r
31     \r
32     @Override\r
33     public Color getEditingBackground() {\r
34         return null;\r
35     }\r
36 \r
37     @Override\r
38     public Color getHoverBackground() {\r
39         return resourceManager.createColor(highlightColor);\r
40     }\r
41 \r
42     @Override\r
43     public Color getInactiveBackground() {\r
44         return resourceManager.createColor(inactiveColor);\r
45     }\r
46 \r
47     @Override\r
48     public Color getInvalidBackground() {\r
49         return resourceManager.createColor(invalidInputColor);\r
50     }\r
51 \r
52 }\r
53 \r
54 \r