]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.g2d/src/org/simantics/g2d/canvas/Hints.java
List the unsatisfied dependencies in CanvasContext
[simantics/platform.git] / bundles / org.simantics.g2d / src / org / simantics / g2d / canvas / Hints.java
1 /*******************************************************************************\r
2  * Copyright (c) 2007, 2010 Association for Decentralized Information Management\r
3  * in 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.g2d.canvas;\r
13 \r
14 import java.awt.Color;\r
15 import java.awt.Paint;\r
16 import java.awt.dnd.DnDConstants;\r
17 import java.awt.dnd.DragGestureRecognizer;\r
18 import java.awt.geom.AffineTransform;\r
19 import java.awt.geom.Rectangle2D;\r
20 \r
21 import org.simantics.g2d.canvas.impl.ToolMode;\r
22 import org.simantics.g2d.dnd.DragInteractor;\r
23 import org.simantics.g2d.participant.CanvasBoundsParticipant;\r
24 import org.simantics.utils.datastructures.hints.IHintContext.Key;\r
25 import org.simantics.utils.datastructures.hints.IHintContext.KeyOf;\r
26 import org.simantics.utils.datastructures.hints.IHintContext.MouseSpecificKeyOf;\r
27 import org.simantics.utils.page.PageDesc;\r
28 \r
29 /**\r
30  * @author Toni Kalajainen\r
31  */\r
32 public class Hints {\r
33 \r
34     public static final IToolMode POINTERTOOL              = new ToolMode("PointerTool");\r
35     public static final IToolMode PANTOOL                  = new ToolMode("PanTool");\r
36     public static final IToolMode CONNECTTOOL              = new ToolMode("ConnectTool");\r
37 \r
38     /** Selected Tool */\r
39     public static final Key KEY_TOOL = new MouseSpecificKeyOf(0, IToolMode.class);\r
40 \r
41     /** Transform that converts point from canvas to control */\r
42     public static final Key KEY_CANVAS_TRANSFORM = new KeyOf(AffineTransform.class, "CANVAS_TRANSFORM");\r
43 \r
44     /**\r
45      * Rendering surface boundaries.\r
46      * \r
47      * @see CanvasBoundsParticipant\r
48      */\r
49     public static final Key KEY_CONTROL_BOUNDS = new KeyOf(Rectangle2D.class, "CONTROL_BOUNDS");\r
50 \r
51     /**\r
52      * Visible canvas boundaries.\r
53      * \r
54      * @see CanvasBoundsParticipant\r
55      */\r
56     public static final Key KEY_CANVAS_BOUNDS = new KeyOf(Rectangle2D.class, "CANVAS_BOUNDS");\r
57 \r
58     /** Background color - BackgroundPainter */\r
59     public static final Key KEY_BACKGROUND_COLOR = new KeyOf(Color.class, "BACKGROUND_COLOR");\r
60     public static final Key KEY_BACKGROUND_PAINT = new KeyOf(Paint.class, "BACKGROUND_PAINT");\r
61 \r
62     /** The color of the grid */\r
63     public static final Key KEY_GRID_COLOR = new KeyOf(Color.class, "GRID_COLOR");\r
64 \r
65     /** Parent canvas (in hierarchical canvas structure) */\r
66     public static final Key KEY_SUPER_CANVAS = new KeyOf(ICanvasContext.class, "SUPER_CANVAS");\r
67 \r
68     /** Description of a page size for canvas or diagram. */\r
69     public static final Key KEY_PAGE_DESC = new KeyOf(PageDesc.class, "PAGE_DESC");\r
70 \r
71     /** Indicate whether or not to display page bounds. */\r
72     public static final Key KEY_DISPLAY_PAGE = new KeyOf(Boolean.class, "DISPLAY_PAGE");\r
73 \r
74     /** Indicate whether or not to display page margins. */\r
75     public static final Key KEY_DISPLAY_MARGINS = new KeyOf(Boolean.class, "DISPLAY_MARGINS");\r
76 \r
77     /**\r
78      * A hint for disabling painting of the diagram the hint is associated with.\r
79      * Can also be used with a canvas context to signal that the nothing should\r
80      * be painted on the canvas.\r
81      */\r
82     public static final Key KEY_DISABLE_PAINTING = new KeyOf(Boolean.class, "DISABLE_PAINTING");\r
83 \r
84     /**\r
85      * Used by {@link DragInteractor} during its {@link DragGestureRecognizer}\r
86      * initialization to get the allowed DND actions by the drag source. See\r
87      * {@link DnDConstants} for the values of which this value can ORed from.\r
88      */\r
89     public static final Key KEY_ALLOWED_DRAG_ACTIONS = new KeyOf(Integer.class, "ALLOWED_DRAG_ACTIONS");\r
90 \r
91     /**\r
92      * Set to true when the canvas is rendering to a printer\r
93      */\r
94     public static final Key KEY_PRINT = new KeyOf(Boolean.class, "PRINTING");\r
95    \r
96     \r
97     private interface Dirty {}\r
98 \r
99     /**\r
100      * The existence of this hint generically used to signal that something in\r
101      * the related observable has been modified that may cause it to be out of\r
102      * sync with its visual appearance which is represented by a scene graph.\r
103      * \r
104      * @see #VALUE_DIRTY\r
105      * \r
106      * @author Tuukka Lehtonen\r
107      */\r
108     public static final Key KEY_DIRTY = new KeyOf(Dirty.class, "DIRTY");\r
109 \r
110     /**\r
111      * The value to use for indicating that the scene graph of an observable may be\r
112      * dirty and needs to be updated.\r
113      * \r
114      * @see KEY_DIRTY\r
115      */\r
116     public static final Dirty VALUE_SG_DIRTY = new Dirty() {\r
117         @Override\r
118         public String toString() { return "SG_DIRTY"; }\r
119     };\r
120 \r
121     /**\r
122      * The value to use for indicating that the scene graph of an observable\r
123      * should be updated after a delay. The delay is left up to the party\r
124      * tracking this hint value.\r
125      * \r
126      * @see KEY_DIRTY\r
127      */\r
128     public static final Dirty VALUE_SG_DELAYED_UPDATE = new Dirty() {\r
129         @Override\r
130         public String toString() { return "SG_DELAYED_UPDATE"; }\r
131     };\r
132 \r
133     /**\r
134      * The value to use for indicating that the z-order of diagram elements may\r
135      * have changed.\r
136      * \r
137      * @see KEY_DIRTY\r
138      */\r
139     public static final Dirty VALUE_Z_ORDER_CHANGED = new Dirty() {\r
140         @Override\r
141         public String toString() { return "Z_ORDER_CHANGED"; }\r
142     };\r
143 \r
144 }\r