1 /*******************************************************************************
2 * Copyright (c) 2007, 2010 Association for Decentralized Information Management
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
10 * VTT Technical Research Centre of Finland - initial API and implementation
11 *******************************************************************************/
14 * @author Toni Kalajainen
16 package org.simantics.g2d.canvas;
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;
34 * TODO Add Mouse(Id) Discovery and enumeration
36 public interface ICanvasContext extends
37 IContext<ICanvasParticipant>,
42 * Get content monitor context.
45 IContentContext getContentContext();
46 void setContentContext(IContentContext ctx);
52 IEventQueue getEventQueue();
56 * Get event handler stack. Higher priority event handlers get events first.
60 IEventHandlerStack getEventHandlerStack();
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.
67 * @return the hint stack
69 IHintStack getHintStack();
72 * Get the hint context of lowest priority in the stack.
74 * @return hint context.
76 IHintContext getDefaultHintContext();
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
84 * All participant events / painting is executed from this thread.
86 * @return access to thread
88 IThreadWorkQueue getThreadAccess();
91 * Set mouse cursor context. Initially there is a default context.
94 void setMouseCursorContext(IMouseCursorContext mctx);
95 IMouseCursorContext getMouseCursorContext();
99 * Set mouse capture context. Initially there is a default context.
102 void setMouseCaptureContext(IMouseCaptureContext mctx);
103 IMouseCaptureContext getMouseCaptureContext();
106 * @return the scene graph root node associated with this canvas context
108 G2DSceneGraph getSceneGraph();
110 G2DParentNode getCanvasNode();
111 void setCanvasNode(G2DParentNode node);
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
120 * @param locked <code>true</code> to lock, <code>false</code> to unlock
122 void setLocked(boolean locked);
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
130 * @return <code>true</code> if locked
135 * Get Tooltip provider
136 * @return tooltip provider
138 ITooltipProvider getTooltipProvider();
140 void setTooltipProvider( ITooltipProvider tooltipProvider );