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.scenegraph.g2d.events;
\r
18 import org.simantics.utils.threads.IThreadWorkQueue;
\r
22 * @see MouseEventCoalescer
\r
23 * @see EventQueue Default implementation
\r
24 * @author Toni Kalajainen
\r
26 public interface IEventQueue {
\r
33 void queueEvent(Event e);
\r
36 * Queue event as next to be processed
\r
40 void queueFirst(Event e);
\r
46 void addEventCoalesceler(EventCoalescer coalescaler);
\r
47 void removeEventCoalesceler(EventCoalescer coalescaler);
\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
55 * Coalesces mouse events.
\r
57 public interface EventCoalescer {
\r
62 * @return coalesced event of the two or <code>null</code> if the two
\r
63 * events cannot be coalesced
\r
65 Event coalesce(Event apriori, Event aposterior);
\r
68 public interface IEventQueueListener {
\r
69 void onEventAdded(IEventQueue queue, Event e, int index);
\r
70 void onQueueEmpty(IEventQueue queue);
\r