summaryrefslogtreecommitdiffstats
path: root/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/NSObject.java
blob: cd3c788853bf60f7a86ef9345ab40aa9c83f1fc3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
/*******************************************************************************
 * Copyright (c) 2000, 2008 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.internal.cocoa;

public class NSObject extends id {

public NSObject() {
	super();
}

public NSObject(int /*long*/ id) {
	super(id);
}

public NSObject(id id) {
	super(id);
}

public NSObject alloc() {
	this.id = OS.objc_msgSend(objc_getClass(), OS.sel_alloc);
	return this;
}

public id autorelease() {
	int /*long*/ result = OS.objc_msgSend(this.id, OS.sel_autorelease);
	return result != 0 ? new id(result) : null;
}

public boolean conformsToProtocol(Protocol aProtocol) {
	return OS.objc_msgSend(this.id, OS.sel_conformsToProtocol_, aProtocol != null ? aProtocol.id : 0) != 0;
}

public id copy() {
	int /*long*/ result = OS.objc_msgSend(this.id, OS.sel_copy);
	return result != 0 ? new id(result) : null;
}

public NSObject init() {
	int /*long*/ result = OS.objc_msgSend(this.id, OS.sel_init);
	return result == this.id ? this : (result != 0 ? new NSObject(result) : null);
}

public boolean isEqual(id object) {
	return OS.objc_msgSend(this.id, OS.sel_isEqual_, object != null ? object.id : 0) != 0;
}

public boolean isEqualTo(id object) {
	return OS.objc_msgSend(this.id, OS.sel_isEqualTo_, object != null ? object.id : 0) != 0;
}

public boolean isKindOfClass(int /*long*/ aClass) {
	return OS.objc_msgSend(this.id, OS.sel_isKindOfClass_, aClass) != 0;
}

public void performSelectorOnMainThread(int /*long*/ aSelector, id arg, boolean wait) {
	OS.objc_msgSend(this.id, OS.sel_performSelectorOnMainThread_withObject_waitUntilDone_, aSelector, arg != null ? arg.id : 0, wait);
}

public void release() {
	OS.objc_msgSend(this.id, OS.sel_release);
}

public boolean respondsToSelector(int /*long*/ aSelector) {
	return OS.objc_msgSend(this.id, OS.sel_respondsToSelector_, aSelector) != 0;
}

public id retain() {
	int /*long*/ result = OS.objc_msgSend(this.id, OS.sel_retain);
	return result != 0 ? new id(result) : null;
}

public int /*long*/ retainCount() {
	return (int)/*64*/OS.objc_msgSend(this.id, OS.sel_retainCount);
}

public int /*long*/ superclass() {
	return (int)/*64*/OS.objc_msgSend(this.id, OS.sel_superclass);
}

public void addEventListener(NSString type, id  listener, boolean useCapture) {
	OS.objc_msgSend(this.id, OS.sel_addEventListener_listener_useCapture_, type != null ? type.id : 0, listener != null ? listener.id : 0, useCapture);
}

public void handleEvent(DOMEvent evt) {
	OS.objc_msgSend(this.id, OS.sel_handleEvent_, evt != null ? evt.id : 0);
}

}