org.eclipse.swt.widgets.EventTable Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of org.eclipse.swt.gtk.linux.ppc64 Show documentation
Show all versions of org.eclipse.swt.gtk.linux.ppc64 Show documentation
SWT is an open source widget toolkit for Java designed to provide efficient, portable access to the user-interface facilities of the operating systems on which it is implemented.
The newest version!
/*******************************************************************************
* Copyright (c) 2000, 2011 IBM Corporation and others.
* 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:
* IBM Corporation - initial API and implementation
*******************************************************************************/
package org.eclipse.swt.widgets;
import org.eclipse.swt.*;
import org.eclipse.swt.internal.SWTEventListener;
/**
* Instances of this class implement a simple
* look up mechanism that maps an event type
* to a listener. Multiple listeners for the
* same event type are supported.
*/
class EventTable {
int [] types;
Listener [] listeners;
int level;
static final int GROW_SIZE = 4;
public Listener [] getListeners (int eventType) {
if (types == null) return new Listener [0];
int count = 0;
for (int i=0; i= 0) {
if (types [index] != 0) break;
--index;
}
index++;
if (index == length) {
int [] newTypes = new int [length + GROW_SIZE];
System.arraycopy (types, 0, newTypes, 0, length);
types = newTypes;
Listener [] newListeners = new Listener [length + GROW_SIZE];
System.arraycopy (listeners, 0, newListeners, 0, length);
listeners = newListeners;
}
types [index] = eventType;
listeners [index] = listener;
}
public boolean hooks (int eventType) {
if (types == null) return false;
for (int i=0; i= 0 ? 1 : -1;
try {
for (int i=0; i= 0 ? 1 : -1;
if (compact && level == 0) {
int index = 0;
for (int i=0; i 0) level = -level;
}
types [index] = 0;
listeners [index] = null;
}
public void unhook (int eventType, Listener listener) {
if (types == null) return;
for (int i=0; i
© 2015 - 2025 Weber Informatics LLC | Privacy Policy