+/*******************************************************************************\r
+ * Copyright (c) 2007, 2010 Association for Decentralized Information Management\r
+ * in Industry THTH ry.\r
+ * All rights reserved. This program and the accompanying materials\r
+ * are made available under the terms of the Eclipse Public License v1.0\r
+ * which accompanies this distribution, and is available at\r
+ * http://www.eclipse.org/legal/epl-v10.html\r
+ *\r
+ * Contributors:\r
+ * VTT Technical Research Centre of Finland - initial API and implementation\r
+ *******************************************************************************/\r
+/*\r
+ *\r
+ * @author Toni Kalajainen\r
+ */\r
+package org.simantics.g2d.canvas;\r
+\r
+import org.simantics.g2d.chassis.ICanvasChassis;\r
+import org.simantics.g2d.chassis.ITooltipProvider;\r
+import org.simantics.scenegraph.g2d.G2DParentNode;\r
+import org.simantics.scenegraph.g2d.G2DSceneGraph;\r
+import org.simantics.scenegraph.g2d.events.IEventHandlerStack;\r
+import org.simantics.scenegraph.g2d.events.IEventQueue;\r
+import org.simantics.utils.datastructures.context.IContext;\r
+import org.simantics.utils.datastructures.disposable.IDisposable;\r
+import org.simantics.utils.datastructures.hints.IHintContext;\r
+import org.simantics.utils.datastructures.hints.IHintStack;\r
+import org.simantics.utils.threads.IThreadWorkQueue;\r
+\r
+\r
+/**\r
+ * Canvas context.\r
+ *\r
+ * TODO Add Mouse(Id) Discovery and enumeration\r
+ */\r
+public interface ICanvasContext extends\r
+IContext<ICanvasParticipant>,\r
+IDisposable\r
+{\r
+\r
+ /**\r
+ * Get content monitor context.\r
+ * @return\r
+ */\r
+ IContentContext getContentContext();\r
+ void setContentContext(IContentContext ctx);\r
+\r
+ /**\r
+ * Get Event queue\r
+ * @return event queue\r
+ */\r
+ IEventQueue getEventQueue();\r
+\r
+\r
+ /**\r
+ * Get event handler stack. Higher priority event handlers get events first.\r
+ *\r
+ * @return the stack\r
+ */\r
+ IEventHandlerStack getEventHandlerStack();\r
+\r
+ /**\r
+ * Get the hint stack of this interactor context.\r
+ * Any interactor that adds a layer into the stack should also remove it\r
+ * if the context is changed.\r
+ *\r
+ * @return the hint stack\r
+ */\r
+ IHintStack getHintStack();\r
+\r
+ /**\r
+ * Get the hint context of lowest priority in the stack.\r
+ *\r
+ * @return hint context.\r
+ */\r
+ IHintContext getDefaultHintContext();\r
+\r
+ /**\r
+ * Get the thread that is used for handling events and painting.\r
+ * External modifications to the three stacks (painter, event handler,\r
+ * and hint stack) and to the participant context must be made\r
+ * in this thread.\r
+ *\r
+ * All participant events / painting is executed from this thread.\r
+ *\r
+ * @return access to thread\r
+ */\r
+ IThreadWorkQueue getThreadAccess();\r
+\r
+ /**\r
+ * Set mouse cursor context. Initially there is a default context.\r
+ * @param mctx\r
+ */\r
+ void setMouseCursorContext(IMouseCursorContext mctx);\r
+ IMouseCursorContext getMouseCursorContext();\r
+\r
+\r
+ /**\r
+ * Set mouse capture context. Initially there is a default context.\r
+ * @param mctx\r
+ */\r
+ void setMouseCaptureContext(IMouseCaptureContext mctx);\r
+ IMouseCaptureContext getMouseCaptureContext();\r
+\r
+ /**\r
+ * @return the scene graph root node associated with this canvas context\r
+ */\r
+ G2DSceneGraph getSceneGraph();\r
+\r
+ G2DParentNode getCanvasNode();\r
+ void setCanvasNode(G2DParentNode node);\r
+\r
+ /**\r
+ * Set the locked state of the canvas context. A locked canvas context may\r
+ * not be rendered. Unlocking a canvas context automatically marks the\r
+ * canvas context dirty. It will be repainted if attached to an\r
+ * {@link ICanvasChassis}. Invocations that don't change locked state do\r
+ * nothing.\r
+ * \r
+ * @param locked <code>true</code> to lock, <code>false</code> to unlock\r
+ */\r
+ void setLocked(boolean locked);\r
+\r
+ /**\r
+ * Tells whether the canvas context is locked. A locked canvas context is\r
+ * not allowed to be rendered by an {@link ICanvasChassis}. This is\r
+ * necessary for performing safe and glitch-free batch initialization on the\r
+ * canvas context.\r
+ * \r
+ * @return <code>true</code> if locked\r
+ */\r
+ boolean isLocked();\r
+ \r
+ /**\r
+ * Get Tooltip provider\r
+ * @return tooltip provider\r
+ */\r
+ ITooltipProvider getTooltipProvider();\r
+ \r
+ void setTooltipProvider( ITooltipProvider tooltipProvider );\r
+\r
+}\r