]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.scenegraph/src/org/simantics/scenegraph/g2d/events/IEventQueue.java
Sync git svn branch with SVN repository r33269.
[simantics/platform.git] / bundles / org.simantics.scenegraph / src / org / simantics / scenegraph / g2d / events / IEventQueue.java
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
8  *\r
9  * Contributors:\r
10  *     VTT Technical Research Centre of Finland - initial API and implementation\r
11  *******************************************************************************/\r
12 /*\r
13  *\r
14  * @author Toni Kalajainen\r
15  */\r
16 package org.simantics.scenegraph.g2d.events;\r
17 \r
18 import org.simantics.utils.threads.IThreadWorkQueue;\r
19 \r
20 /**\r
21  * \r
22  * @see MouseEventCoalescer\r
23  * @see EventQueue Default implementation\r
24  * @author Toni Kalajainen\r
25  */\r
26 public interface IEventQueue {\r
27 \r
28     /**\r
29      * queues event\r
30      * \r
31      * @param e\r
32      */\r
33     void queueEvent(Event e);\r
34 \r
35     /**\r
36      * Queue event as next to be processed\r
37      * \r
38      * @param e\r
39      */\r
40     void queueFirst(Event e);\r
41 \r
42     boolean isEmpty();\r
43 \r
44     int size();\r
45 \r
46     void addEventCoalesceler(EventCoalescer coalescaler);\r
47     void removeEventCoalesceler(EventCoalescer coalescaler);\r
48 \r
49     void addQueueListener(IEventQueueListener listener);\r
50     void removeQueueListener(IEventQueueListener listener);\r
51     void addQueueListener(IEventQueueListener listener, IThreadWorkQueue thread);\r
52     void removeQueueListener(IEventQueueListener listener, IThreadWorkQueue thread);\r
53 \r
54     /**\r
55      * Coalesces mouse events.\r
56      */\r
57     public interface EventCoalescer {\r
58         /**\r
59          * \r
60          * @param apriori\r
61          * @param aposterior\r
62          * @return coalesced event of the two or <code>null</code> if the two\r
63          *         events cannot be coalesced\r
64          */\r
65         Event coalesce(Event apriori, Event aposterior);\r
66     }\r
67 \r
68     public interface IEventQueueListener {\r
69         void onEventAdded(IEventQueue queue, Event e, int index);\r
70         void onQueueEmpty(IEventQueue queue);\r
71     }\r
72 \r
73 }\r