]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.g2d/src/org/simantics/g2d/canvas/ICanvasContext.java
Fixed invalid comparisons which were identified by Eclipse IDE 2018-09
[simantics/platform.git] / bundles / org.simantics.g2d / src / org / simantics / g2d / canvas / ICanvasContext.java
1 /*******************************************************************************
2  * Copyright (c) 2007, 2010 Association for Decentralized Information Management
3  * in Industry THTH ry.
4  * All rights reserved. This program and the accompanying materials
5  * are made available under the terms of the Eclipse Public License v1.0
6  * which accompanies this distribution, and is available at
7  * http://www.eclipse.org/legal/epl-v10.html
8  *
9  * Contributors:
10  *     VTT Technical Research Centre of Finland - initial API and implementation
11  *******************************************************************************/
12 /*
13  *
14  * @author Toni Kalajainen
15  */
16 package org.simantics.g2d.canvas;
17
18 import org.simantics.g2d.chassis.ICanvasChassis;
19 import org.simantics.g2d.chassis.ITooltipProvider;
20 import org.simantics.scenegraph.g2d.G2DParentNode;
21 import org.simantics.scenegraph.g2d.G2DSceneGraph;
22 import org.simantics.scenegraph.g2d.events.IEventHandlerStack;
23 import org.simantics.scenegraph.g2d.events.IEventQueue;
24 import org.simantics.utils.datastructures.context.IContext;
25 import org.simantics.utils.datastructures.disposable.IDisposable;
26 import org.simantics.utils.datastructures.hints.IHintContext;
27 import org.simantics.utils.datastructures.hints.IHintStack;
28 import org.simantics.utils.threads.IThreadWorkQueue;
29
30
31 /**
32  * Canvas context.
33  *
34  * TODO Add Mouse(Id) Discovery and enumeration
35  */
36 public interface ICanvasContext extends
37 IContext<ICanvasParticipant>,
38 IDisposable
39 {
40
41     /**
42      * Get content monitor context.
43      * @return
44      */
45     IContentContext getContentContext();
46     void setContentContext(IContentContext ctx);
47
48     /**
49      * Get Event queue
50      * @return event queue
51      */
52     IEventQueue getEventQueue();
53
54
55     /**
56      * Get event handler stack. Higher priority event handlers get events first.
57      *
58      * @return the stack
59      */
60     IEventHandlerStack getEventHandlerStack();
61
62     /**
63      * Get the hint stack of this interactor context.
64      * Any interactor that adds a layer into the stack should also remove it
65      * if the context is changed.
66      *
67      * @return the hint stack
68      */
69     IHintStack getHintStack();
70
71     /**
72      * Get the hint context of lowest priority in the stack.
73      *
74      * @return hint context.
75      */
76     IHintContext getDefaultHintContext();
77
78     /**
79      * Get the thread that is used for handling events and painting.
80      * External modifications to the three stacks (painter, event handler,
81      * and hint stack) and to the participant context must be made
82      * in this thread.
83      *
84      * All participant events / painting is executed from this thread.
85      *
86      * @return access to thread
87      */
88     IThreadWorkQueue getThreadAccess();
89
90     /**
91      * Set mouse cursor context. Initially there is a default context.
92      * @param mctx
93      */
94     void setMouseCursorContext(IMouseCursorContext mctx);
95     IMouseCursorContext getMouseCursorContext();
96
97
98     /**
99      * Set mouse capture context. Initially there is a default context.
100      * @param mctx
101      */
102     void setMouseCaptureContext(IMouseCaptureContext mctx);
103     IMouseCaptureContext getMouseCaptureContext();
104
105     /**
106      * @return the scene graph root node associated with this canvas context
107      */
108     G2DSceneGraph getSceneGraph();
109
110     G2DParentNode getCanvasNode();
111     void setCanvasNode(G2DParentNode node);
112
113     /**
114      * Set the locked state of the canvas context. A locked canvas context may
115      * not be rendered. Unlocking a canvas context automatically marks the
116      * canvas context dirty. It will be repainted if attached to an
117      * {@link ICanvasChassis}. Invocations that don't change locked state do
118      * nothing.
119      * 
120      * @param locked <code>true</code> to lock, <code>false</code> to unlock
121      */
122     void setLocked(boolean locked);
123
124     /**
125      * Tells whether the canvas context is locked. A locked canvas context is
126      * not allowed to be rendered by an {@link ICanvasChassis}. This is
127      * necessary for performing safe and glitch-free batch initialization on the
128      * canvas context.
129      * 
130      * @return <code>true</code> if locked
131      */
132     boolean isLocked();
133     
134     /**
135      * Get Tooltip provider
136      * @return tooltip provider
137      */
138     ITooltipProvider getTooltipProvider();
139     
140     void setTooltipProvider( ITooltipProvider tooltipProvider );
141
142 }