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
10 * VTT Technical Research Centre of Finland - initial API and implementation
\r
11 *******************************************************************************/
\r
14 * @author Toni Kalajainen
\r
16 package org.simantics.g2d.canvas;
\r
18 import org.simantics.g2d.chassis.ICanvasChassis;
\r
19 import org.simantics.g2d.chassis.ITooltipProvider;
\r
20 import org.simantics.scenegraph.g2d.G2DParentNode;
\r
21 import org.simantics.scenegraph.g2d.G2DSceneGraph;
\r
22 import org.simantics.scenegraph.g2d.events.IEventHandlerStack;
\r
23 import org.simantics.scenegraph.g2d.events.IEventQueue;
\r
24 import org.simantics.utils.datastructures.context.IContext;
\r
25 import org.simantics.utils.datastructures.disposable.IDisposable;
\r
26 import org.simantics.utils.datastructures.hints.IHintContext;
\r
27 import org.simantics.utils.datastructures.hints.IHintStack;
\r
28 import org.simantics.utils.threads.IThreadWorkQueue;
\r
34 * TODO Add Mouse(Id) Discovery and enumeration
\r
36 public interface ICanvasContext extends
\r
37 IContext<ICanvasParticipant>,
\r
42 * Get content monitor context.
\r
45 IContentContext getContentContext();
\r
46 void setContentContext(IContentContext ctx);
\r
50 * @return event queue
\r
52 IEventQueue getEventQueue();
\r
56 * Get event handler stack. Higher priority event handlers get events first.
\r
60 IEventHandlerStack getEventHandlerStack();
\r
63 * Get the hint stack of this interactor context.
\r
64 * Any interactor that adds a layer into the stack should also remove it
\r
65 * if the context is changed.
\r
67 * @return the hint stack
\r
69 IHintStack getHintStack();
\r
72 * Get the hint context of lowest priority in the stack.
\r
74 * @return hint context.
\r
76 IHintContext getDefaultHintContext();
\r
79 * Get the thread that is used for handling events and painting.
\r
80 * External modifications to the three stacks (painter, event handler,
\r
81 * and hint stack) and to the participant context must be made
\r
84 * All participant events / painting is executed from this thread.
\r
86 * @return access to thread
\r
88 IThreadWorkQueue getThreadAccess();
\r
91 * Set mouse cursor context. Initially there is a default context.
\r
94 void setMouseCursorContext(IMouseCursorContext mctx);
\r
95 IMouseCursorContext getMouseCursorContext();
\r
99 * Set mouse capture context. Initially there is a default context.
\r
102 void setMouseCaptureContext(IMouseCaptureContext mctx);
\r
103 IMouseCaptureContext getMouseCaptureContext();
\r
106 * @return the scene graph root node associated with this canvas context
\r
108 G2DSceneGraph getSceneGraph();
\r
110 G2DParentNode getCanvasNode();
\r
111 void setCanvasNode(G2DParentNode node);
\r
114 * Set the locked state of the canvas context. A locked canvas context may
\r
115 * not be rendered. Unlocking a canvas context automatically marks the
\r
116 * canvas context dirty. It will be repainted if attached to an
\r
117 * {@link ICanvasChassis}. Invocations that don't change locked state do
\r
120 * @param locked <code>true</code> to lock, <code>false</code> to unlock
\r
122 void setLocked(boolean locked);
\r
125 * Tells whether the canvas context is locked. A locked canvas context is
\r
126 * not allowed to be rendered by an {@link ICanvasChassis}. This is
\r
127 * necessary for performing safe and glitch-free batch initialization on the
\r
130 * @return <code>true</code> if locked
\r
132 boolean isLocked();
\r
135 * Get Tooltip provider
\r
136 * @return tooltip provider
\r
138 ITooltipProvider getTooltipProvider();
\r
140 void setTooltipProvider( ITooltipProvider tooltipProvider );
\r