--- /dev/null
+/*******************************************************************************\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.scenegraph.g2d.events;\r
+\r
+import org.simantics.utils.threads.IThreadWorkQueue;\r
+\r
+/**\r
+ * \r
+ * @see MouseEventCoalescer\r
+ * @see EventQueue Default implementation\r
+ * @author Toni Kalajainen\r
+ */\r
+public interface IEventQueue {\r
+\r
+ /**\r
+ * queues event\r
+ * \r
+ * @param e\r
+ */\r
+ void queueEvent(Event e);\r
+\r
+ /**\r
+ * Queue event as next to be processed\r
+ * \r
+ * @param e\r
+ */\r
+ void queueFirst(Event e);\r
+\r
+ boolean isEmpty();\r
+\r
+ int size();\r
+\r
+ void addEventCoalesceler(EventCoalescer coalescaler);\r
+ void removeEventCoalesceler(EventCoalescer coalescaler);\r
+\r
+ void addQueueListener(IEventQueueListener listener);\r
+ void removeQueueListener(IEventQueueListener listener);\r
+ void addQueueListener(IEventQueueListener listener, IThreadWorkQueue thread);\r
+ void removeQueueListener(IEventQueueListener listener, IThreadWorkQueue thread);\r
+\r
+ /**\r
+ * Coalesces mouse events.\r
+ */\r
+ public interface EventCoalescer {\r
+ /**\r
+ * \r
+ * @param apriori\r
+ * @param aposterior\r
+ * @return coalesced event of the two or <code>null</code> if the two\r
+ * events cannot be coalesced\r
+ */\r
+ Event coalesce(Event apriori, Event aposterior);\r
+ }\r
+\r
+ public interface IEventQueueListener {\r
+ void onEventAdded(IEventQueue queue, Event e, int index);\r
+ void onQueueEmpty(IEventQueue queue);\r
+ }\r
+\r
+}\r