X-Git-Url: https://gerrit.simantics.org/r/gitweb?p=simantics%2Fplatform.git;a=blobdiff_plain;f=bundles%2Forg.simantics.scenegraph%2Fsrc%2Forg%2Fsimantics%2Fscenegraph%2Fg2d%2Fevents%2FIEventQueue.java;fp=bundles%2Forg.simantics.scenegraph%2Fsrc%2Forg%2Fsimantics%2Fscenegraph%2Fg2d%2Fevents%2FIEventQueue.java;h=a0874b0f4c696236630262188ad5d0702e8cac6f;hp=0000000000000000000000000000000000000000;hb=969bd23cab98a79ca9101af33334000879fb60c5;hpb=866dba5cd5a3929bbeae85991796acb212338a08 diff --git a/bundles/org.simantics.scenegraph/src/org/simantics/scenegraph/g2d/events/IEventQueue.java b/bundles/org.simantics.scenegraph/src/org/simantics/scenegraph/g2d/events/IEventQueue.java new file mode 100644 index 000000000..a0874b0f4 --- /dev/null +++ b/bundles/org.simantics.scenegraph/src/org/simantics/scenegraph/g2d/events/IEventQueue.java @@ -0,0 +1,73 @@ +/******************************************************************************* + * Copyright (c) 2007, 2010 Association for Decentralized Information Management + * in Industry THTH ry. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * VTT Technical Research Centre of Finland - initial API and implementation + *******************************************************************************/ +/* + * + * @author Toni Kalajainen + */ +package org.simantics.scenegraph.g2d.events; + +import org.simantics.utils.threads.IThreadWorkQueue; + +/** + * + * @see MouseEventCoalescer + * @see EventQueue Default implementation + * @author Toni Kalajainen + */ +public interface IEventQueue { + + /** + * queues event + * + * @param e + */ + void queueEvent(Event e); + + /** + * Queue event as next to be processed + * + * @param e + */ + void queueFirst(Event e); + + boolean isEmpty(); + + int size(); + + void addEventCoalesceler(EventCoalescer coalescaler); + void removeEventCoalesceler(EventCoalescer coalescaler); + + void addQueueListener(IEventQueueListener listener); + void removeQueueListener(IEventQueueListener listener); + void addQueueListener(IEventQueueListener listener, IThreadWorkQueue thread); + void removeQueueListener(IEventQueueListener listener, IThreadWorkQueue thread); + + /** + * Coalesces mouse events. + */ + public interface EventCoalescer { + /** + * + * @param apriori + * @param aposterior + * @return coalesced event of the two or null if the two + * events cannot be coalesced + */ + Event coalesce(Event apriori, Event aposterior); + } + + public interface IEventQueueListener { + void onEventAdded(IEventQueue queue, Event e, int index); + void onQueueEmpty(IEventQueue queue); + } + +}