protected static void retain(long handle) { ObjCRuntime.void_objc_msgSend(handle, retain.getHandle()); }
protected static void release(long handle) { ObjCRuntime.void_objc_msgSend(handle, release.getHandle()); }
protected static void autorelease(long handle) { ObjCRuntime.void_objc_msgSend(handle, autorelease.getHandle()); }
static long alloc(ObjCClass c) { long h = ObjCRuntime.ptr_objc_msgSend(c.getHandle(), alloc.getHandle()); if (h == 0L) { throw new OutOfMemoryError(); } return h; }
private static void enableListener(long handle) { long releaseListener = ObjCRuntime.objc_getAssociatedObject(handle, RELEASE_LISTENER_CLASS); if (releaseListener == 0) { releaseListener = ObjCRuntime.ptr_objc_msgSend(RELEASE_LISTENER_CLASS, alloc.getHandle()); if (releaseListener == 0L) { throw new OutOfMemoryError(); } releaseListener = ObjCRuntime.ptr_objc_msgSend(releaseListener, init.getHandle()); VM.setPointer(releaseListener + OWNER_IVAR_OFFSET, handle); ObjCRuntime.objc_setAssociatedObject(handle, RELEASE_LISTENER_CLASS, releaseListener, OBJC_ASSOCIATION_RETAIN_NONATOMIC); ObjCRuntime.void_objc_msgSend(releaseListener, release.getHandle()); } }
public void setActionListener(OnActionListener action) { this.actionListener = action; Selector sel = null; if (action != null) { sel = getUniqueSelector(); } setAction(sel); synchronized (items) { if (action != null) { items.put(sel.getHandle(), this); } else { items.remove(sel.getHandle()); } } } public OnActionListener getActionListener() {
protected static String domain(long handle) { long h = ObjCRuntime.ptr_objc_msgSend(handle, domain.getHandle()); NSString s = ObjCObject.toObjCObject(NSString.class, h, 0); return s.toString(); }
public UIMenuItem(String title, OnActionListener action) { super((SkipInit) null); if (action == null) { throw new NullPointerException("action"); } this.actionListener = action; Selector sel = getUniqueSelector(); initObject(init(title, sel)); synchronized (items) { items.put(sel.getHandle(), this); } }
private void updateMenu(NSArray<UIMenuItem> items) { long imp = VM.getCallbackMethodImpl(cbForwarder); long typeEncodings = VM.getStringUTFChars("v@:@"); for (UIMenuItem item : items) { Selector sel = item.getAction(); ObjCRuntime.class_addMethod(UI_MENU_CONTROLLER, sel.getHandle(), imp, typeEncodings); } } /*<methods>*/
} else { long methodPtr = isClassMethod ? ObjCRuntime.class_getClassMethod(superclass.getHandle(), selector.getHandle()) : ObjCRuntime.class_getInstanceMethod(superclass.getHandle(), selector.getHandle()); if (methodPtr != 0L) { long encodingPtr = ObjCRuntime.method_getTypeEncoding(methodPtr); if (!ObjCRuntime.class_addMethod(ownerHandle, selector.getHandle(), impl, encoding != null ? VM.getStringUTFChars(encoding) : 0L)) { throw new ObjCClassNotFoundException("Failed to add method " + selName + " to custom Objective-C class for Java class: " + type);
@Callback static void release(@Pointer long self, @Pointer long sel) { int count = ObjCRuntime.int_objc_msgSend(self, retainCount.getHandle()); if (count == 1) { long owner = VM.getPointer(self + OWNER_IVAR_OFFSET); synchronized (ASSOCIATED_OBJECTS) { ASSOCIATED_OBJECTS.remove(owner); } } if(logRetainRelease) { long cls = ObjCRuntime.object_getClass(self); logRetainRelease(cls, self, count, false); } ObjCRuntime.void_objc_msgSendSuper(new Super(self, NS_OBJECT_CLASS).getHandle(), sel); } }
static long alloc(ObjCClass c) { long h = ObjCRuntime.ptr_objc_msgSend(c.getHandle(), alloc.getHandle()); if (h == 0L) { throw new OutOfMemoryError(); } return h; }
static long alloc(ObjCClass c) { long h = ObjCRuntime.ptr_objc_msgSend(c.getHandle(), alloc.getHandle()); if (h == 0L) { throw new OutOfMemoryError(); } return h; }
@Override protected void finalize() throws Throwable { ObjCRuntime.void_objc_msgSend(this.objCBlock.getHandle(), RELEASE_SELECTOR.getHandle()); } }
protected static String domain(long handle) { long h = ObjCRuntime.ptr_objc_msgSend(handle, domain.getHandle()); NSString s = ObjCObject.toObjCObject(NSString.class, h, 0); return s.toString(); }
public UIMenuItem(String title, OnActionListener action) { super((SkipInit) null); if (action == null) { throw new NullPointerException("action"); } this.actionListener = action; Selector sel = getUniqueSelector(); initObject(init(title, sel)); synchronized (items) { items.put(sel.getHandle(), this); } }
public UIMenuItem(String title, OnActionListener action) { super((SkipInit) null); if (action == null) { throw new NullPointerException("action"); } this.actionListener = action; Selector sel = getUniqueSelector(); initObject(init(title, sel)); synchronized (items) { items.put(sel.getHandle(), this); } }
protected static String domain(long handle) { long h = ObjCRuntime.ptr_objc_msgSend(handle, domain.getHandle()); NSString s = ObjCObject.toObjCObject(NSString.class, h, 0); return s.toString(); }
private void updateMenu(NSArray<UIMenuItem> items) { long imp = VM.getCallbackMethodImpl(cbForwarder); long typeEncodings = VM.getStringUTFChars("v@:@"); for (UIMenuItem item : items) { Selector sel = item.getAction(); ObjCRuntime.class_addMethod(UI_MENU_CONTROLLER, sel.getHandle(), imp, typeEncodings); } } /*<methods>*/
private void updateMenu(NSArray<UIMenuItem> items) { long imp = VM.getCallbackMethodImpl(cbForwarder); long typeEncodings = VM.getStringUTFChars("v@:@"); for (UIMenuItem item : items) { Selector sel = item.getAction(); ObjCRuntime.class_addMethod(UI_MENU_CONTROLLER, sel.getHandle(), imp, typeEncodings); } } /*<methods>*/