org.lwjgl.system.macosx.CGEventTapCallBack Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of org.lwjgl.lwjgl Show documentation
Show all versions of org.lwjgl.lwjgl Show documentation
LWJGL OSGi bundle (Core LWJGL bundle)
The newest version!
/*
* Copyright LWJGL. All rights reserved.
* License terms: https://www.lwjgl.org/license
* MACHINE GENERATED FILE, DO NOT EDIT
*/
package org.lwjgl.system.macosx;
import javax.annotation.*;
import org.lwjgl.system.*;
import static org.lwjgl.system.MemoryUtil.*;
/**
* Instances of this class may be passed to the {@link CoreGraphics#CGEventTapCreate EventTapCreate} method.
*
* Type
*
*
* CGEventRef (*{@link #invoke}) (
* CGEventTapProxy proxy,
* CGEventType type,
* CGEventRef event,
* void *userInfo
* )
*/
public abstract class CGEventTapCallBack extends Callback implements CGEventTapCallBackI {
/**
* Creates a {@code CGEventTapCallBack} instance from the specified function pointer.
*
* @return the new {@code CGEventTapCallBack}
*/
public static CGEventTapCallBack create(long functionPointer) {
CGEventTapCallBackI instance = Callback.get(functionPointer);
return instance instanceof CGEventTapCallBack
? (CGEventTapCallBack)instance
: new Container(functionPointer, instance);
}
/** Like {@link #create(long) create}, but returns {@code null} if {@code functionPointer} is {@code NULL}. */
@Nullable
public static CGEventTapCallBack createSafe(long functionPointer) {
return functionPointer == NULL ? null : create(functionPointer);
}
/** Creates a {@code CGEventTapCallBack} instance that delegates to the specified {@code CGEventTapCallBackI} instance. */
public static CGEventTapCallBack create(CGEventTapCallBackI instance) {
return instance instanceof CGEventTapCallBack
? (CGEventTapCallBack)instance
: new Container(instance.address(), instance);
}
protected CGEventTapCallBack() {
super(CIF);
}
CGEventTapCallBack(long functionPointer) {
super(functionPointer);
}
private static final class Container extends CGEventTapCallBack {
private final CGEventTapCallBackI delegate;
Container(long functionPointer, CGEventTapCallBackI delegate) {
super(functionPointer);
this.delegate = delegate;
}
@Override
public long invoke(long proxy, int type, long event, long userInfo) {
return delegate.invoke(proxy, type, event, userInfo);
}
}
}