1 /*******************************************************************************
2  * Copyright (c) 2000, 2020 IBM Corporation and others.
3  *
4  * This program and the accompanying materials
5  * are made available under the terms of the Eclipse Public License 2.0
6  * which accompanies this distribution, and is available at
7  * https://www.eclipse.org/legal/epl-2.0/
8  *
9  * SPDX-License-Identifier: EPL-2.0
10  *
11  * Contributors:
12  *    IBM Corporation - initial API and implementation
13  *******************************************************************************/
14 package org.eclipse.swt.internal.cocoa;
15 
16 public class NSObject extends id {
17 
NSObject()18 public NSObject() {
19 	super();
20 }
21 
NSObject(long id)22 public NSObject(long id) {
23 	super(id);
24 }
25 
NSObject(id id)26 public NSObject(id id) {
27 	super(id);
28 }
29 
alloc()30 public NSObject alloc() {
31 	this.id = OS.objc_msgSend(objc_getClass(), OS.sel_alloc);
32 	return this;
33 }
34 
accessibilityAttributeValue(NSString attribute, id parameter)35 public id accessibilityAttributeValue(NSString attribute, id parameter) {
36 	long result = OS.objc_msgSend(this.id, OS.sel_accessibilityAttributeValue_forParameter_, attribute != null ? attribute.id : 0, parameter != null ? parameter.id : 0);
37 	return result != 0 ? new id(result) : null;
38 }
39 
accessibilitySetOverrideValue(id value, NSString attribute)40 public boolean accessibilitySetOverrideValue(id value, NSString attribute) {
41 	return OS.objc_msgSend_bool(this.id, OS.sel_accessibilitySetOverrideValue_forAttribute_, value != null ? value.id : 0, attribute != null ? attribute.id : 0);
42 }
43 
draggedImage(NSImage image, NSPoint screenPoint, long operation)44 public void draggedImage(NSImage image, NSPoint screenPoint, long operation) {
45 	OS.objc_msgSend(this.id, OS.sel_draggedImage_endedAt_operation_, image != null ? image.id : 0, screenPoint, operation);
46 }
47 
draggingDestinationWindow()48 public NSWindow draggingDestinationWindow() {
49 	long result = OS.objc_msgSend(this.id, OS.sel_draggingDestinationWindow);
50 	return result != 0 ? new NSWindow(result) : null;
51 }
52 
draggingLocation()53 public NSPoint draggingLocation() {
54 	NSPoint result = new NSPoint();
55 	OS.objc_msgSend_stret(result, this.id, OS.sel_draggingLocation);
56 	return result;
57 }
58 
draggingPasteboard()59 public NSPasteboard draggingPasteboard() {
60 	long result = OS.objc_msgSend(this.id, OS.sel_draggingPasteboard);
61 	return result != 0 ? new NSPasteboard(result) : null;
62 }
63 
draggingSourceOperationMask()64 public long draggingSourceOperationMask() {
65 	return OS.objc_msgSend(this.id, OS.sel_draggingSourceOperationMask);
66 }
67 
outlineView(NSOutlineView outlineView, NSTableColumn tableColumn, id item)68 public boolean outlineView(NSOutlineView outlineView, NSTableColumn tableColumn, id item) {
69 	return OS.objc_msgSend_bool(this.id, OS.sel_outlineView_shouldEditTableColumn_item_, outlineView != null ? outlineView.id : 0, tableColumn != null ? tableColumn.id : 0, item != null ? item.id : 0);
70 }
71 
outlineView(NSOutlineView outlineView, long columnIndex, long newColumnIndex)72 public boolean outlineView(NSOutlineView outlineView, long columnIndex, long newColumnIndex) {
73 	return OS.objc_msgSend_bool(this.id, OS.sel_outlineView_shouldReorderColumn_toColumn_, outlineView != null ? outlineView.id : 0, columnIndex, newColumnIndex);
74 }
75 
outlineView(NSOutlineView outlineView, NSCell cell, NSTableColumn tableColumn, id item)76 public boolean outlineView(NSOutlineView outlineView, NSCell cell, NSTableColumn tableColumn, id item) {
77 	return OS.objc_msgSend_bool(this.id, OS.sel_outlineView_shouldTrackCell_forTableColumn_item_, outlineView != null ? outlineView.id : 0, cell != null ? cell.id : 0, tableColumn != null ? tableColumn.id : 0, item != null ? item.id : 0);
78 }
79 
readSelectionFromPasteboard(NSPasteboard pboard)80 public boolean readSelectionFromPasteboard(NSPasteboard pboard) {
81 	return OS.objc_msgSend_bool(this.id, OS.sel_readSelectionFromPasteboard_, pboard != null ? pboard.id : 0);
82 }
83 
tableView(NSTableView tableView, long columnIndex, long newColumnIndex)84 public boolean tableView(NSTableView tableView, long columnIndex, long newColumnIndex) {
85 	return OS.objc_msgSend_bool(this.id, OS.sel_tableView_shouldReorderColumn_toColumn_, tableView != null ? tableView.id : 0, columnIndex, newColumnIndex);
86 }
87 
tableView(NSTableView tableView, NSCell cell, NSTableColumn tableColumn, long row)88 public boolean tableView(NSTableView tableView, NSCell cell, NSTableColumn tableColumn, long row) {
89 	return OS.objc_msgSend_bool(this.id, OS.sel_tableView_shouldTrackCell_forTableColumn_row_, tableView != null ? tableView.id : 0, cell != null ? cell.id : 0, tableColumn != null ? tableColumn.id : 0, row);
90 }
91 
writeSelectionToPasteboard(NSPasteboard pboard, NSArray types)92 public boolean writeSelectionToPasteboard(NSPasteboard pboard, NSArray types) {
93 	return OS.objc_msgSend_bool(this.id, OS.sel_writeSelectionToPasteboard_types_, pboard != null ? pboard.id : 0, types != null ? types.id : 0);
94 }
95 
autorelease()96 public NSObject autorelease() {
97 	long result = OS.objc_msgSend(this.id, OS.sel_autorelease);
98 	return result == this.id ? this : (result != 0 ? new NSObject(result) : null);
99 }
100 
cancelAuthenticationChallenge(NSURLAuthenticationChallenge challenge)101 public void cancelAuthenticationChallenge(NSURLAuthenticationChallenge challenge) {
102 	OS.objc_msgSend(this.id, OS.sel_cancelAuthenticationChallenge_, challenge != null ? challenge.id : 0);
103 }
104 
className()105 public NSString className() {
106 	long result = OS.objc_msgSend(this.id, OS.sel_className);
107 	return result != 0 ? new NSString(result) : null;
108 }
109 
conformsToProtocol(Protocol aProtocol)110 public boolean conformsToProtocol(Protocol aProtocol) {
111 	return OS.objc_msgSend_bool(this.id, OS.sel_conformsToProtocol_, aProtocol != null ? aProtocol.id : 0);
112 }
113 
copy()114 public id copy() {
115 	long result = OS.objc_msgSend(this.id, OS.sel_copy);
116 	return result != 0 ? new id(result) : null;
117 }
118 
description()119 public NSString description() {
120 	long result = OS.objc_msgSend(this.id, OS.sel_description);
121 	return result != 0 ? new NSString(result) : null;
122 }
123 
init()124 public NSObject init() {
125 	long result = OS.objc_msgSend(this.id, OS.sel_init);
126 	return result == this.id ? this : (result != 0 ? new NSObject(result) : null);
127 }
128 
isEqual(id object)129 public boolean isEqual(id object) {
130 	return OS.objc_msgSend_bool(this.id, OS.sel_isEqual_, object != null ? object.id : 0);
131 }
132 
isKindOfClass(long aClass)133 public boolean isKindOfClass(long aClass) {
134 	return OS.objc_msgSend_bool(this.id, OS.sel_isKindOfClass_, aClass);
135 }
136 
mutableCopy()137 public id mutableCopy() {
138 	long result = OS.objc_msgSend(this.id, OS.sel_mutableCopy);
139 	return result != 0 ? new id(result) : null;
140 }
141 
performSelector(long aSelector, id anArgument, double delay, NSArray modes)142 public void performSelector(long aSelector, id anArgument, double delay, NSArray modes) {
143 	OS.objc_msgSend(this.id, OS.sel_performSelector_withObject_afterDelay_inModes_, aSelector, anArgument != null ? anArgument.id : 0, delay, modes != null ? modes.id : 0);
144 }
145 
performSelectorOnMainThread(long aSelector, id arg, boolean wait)146 public void performSelectorOnMainThread(long aSelector, id arg, boolean wait) {
147 	OS.objc_msgSend(this.id, OS.sel_performSelectorOnMainThread_withObject_waitUntilDone_, aSelector, arg != null ? arg.id : 0, wait);
148 }
149 
release()150 public void release() {
151 	OS.objc_msgSend(this.id, OS.sel_release);
152 }
153 
respondsToSelector(long aSelector)154 public boolean respondsToSelector(long aSelector) {
155 	return OS.objc_msgSend_bool(this.id, OS.sel_respondsToSelector_, aSelector);
156 }
157 
retain()158 public NSObject retain() {
159 	long result = OS.objc_msgSend(this.id, OS.sel_retain);
160 	return result == this.id ? this : (result != 0 ? new NSObject(result) : null);
161 }
162 
retainCount()163 public long retainCount() {
164 	return OS.objc_msgSend(this.id, OS.sel_retainCount);
165 }
166 
setValue(id value, NSString key)167 public void setValue(id value, NSString key) {
168 	OS.objc_msgSend(this.id, OS.sel_setValue_forKey_, value != null ? value.id : 0, key != null ? key.id : 0);
169 }
170 
superclass()171 public long superclass() {
172 	return OS.objc_msgSend(this.id, OS.sel_superclass);
173 }
174 
useCredential(NSURLCredential credential, NSURLAuthenticationChallenge challenge)175 public void useCredential(NSURLCredential credential, NSURLAuthenticationChallenge challenge) {
176 	OS.objc_msgSend(this.id, OS.sel_useCredential_forAuthenticationChallenge_, credential != null ? credential.id : 0, challenge != null ? challenge.id : 0);
177 }
178 
valueForKey(NSString key)179 public id valueForKey(NSString key) {
180 	long result = OS.objc_msgSend(this.id, OS.sel_valueForKey_, key != null ? key.id : 0);
181 	return result != 0 ? new id(result) : null;
182 }
183 
addEventListener(NSString type, id listener, boolean useCapture)184 public void addEventListener(NSString type, id listener, boolean useCapture) {
185 	OS.objc_msgSend(this.id, OS.sel_addEventListener_listener_useCapture_, type != null ? type.id : 0, listener != null ? listener.id : 0, useCapture);
186 }
187 
handleEvent(DOMEvent event)188 public void handleEvent(DOMEvent event) {
189 	OS.objc_msgSend(this.id, OS.sel_handleEvent_, event != null ? event.id : 0);
190 }
191 
192 }
193