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