1 /*******************************************************************************
2  * Copyright (c) 2000, 2019 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 NSApplication extends NSResponder {
17 
NSApplication()18 public NSApplication() {
19 	super();
20 }
21 
NSApplication(long id)22 public NSApplication(long id) {
23 	super(id);
24 }
25 
NSApplication(id id)26 public NSApplication(id id) {
27 	super(id);
28 }
29 
activateIgnoringOtherApps(boolean flag)30 public void activateIgnoringOtherApps(boolean flag) {
31 	OS.objc_msgSend(this.id, OS.sel_activateIgnoringOtherApps_, flag);
32 }
33 
applicationIconImage()34 public NSImage applicationIconImage() {
35 	long result = OS.objc_msgSend(this.id, OS.sel_applicationIconImage);
36 	return result != 0 ? new NSImage(result) : null;
37 }
38 
arrangeInFront(id sender)39 public void arrangeInFront(id sender) {
40 	OS.objc_msgSend(this.id, OS.sel_arrangeInFront_, sender != null ? sender.id : 0);
41 }
42 
beginSheet(NSWindow sheet, NSWindow docWindow, id modalDelegate, long didEndSelector, long contextInfo)43 public void beginSheet(NSWindow sheet, NSWindow docWindow, id modalDelegate, long didEndSelector, long contextInfo) {
44 	OS.objc_msgSend(this.id, OS.sel_beginSheet_modalForWindow_modalDelegate_didEndSelector_contextInfo_, sheet != null ? sheet.id : 0, docWindow != null ? docWindow.id : 0, modalDelegate != null ? modalDelegate.id : 0, didEndSelector, contextInfo);
45 }
46 
currentEvent()47 public NSEvent currentEvent() {
48 	long result = OS.objc_msgSend(this.id, OS.sel_currentEvent);
49 	return result != 0 ? new NSEvent(result) : null;
50 }
51 
dockTile()52 public NSDockTile dockTile() {
53 	long result = OS.objc_msgSend(this.id, OS.sel_dockTile);
54 	return result != 0 ? new NSDockTile(result) : null;
55 }
56 
endSheet(NSWindow sheet, long returnCode)57 public void endSheet(NSWindow sheet, long returnCode) {
58 	OS.objc_msgSend(this.id, OS.sel_endSheet_returnCode_, sheet != null ? sheet.id : 0, returnCode);
59 }
60 
finishLaunching()61 public void finishLaunching() {
62 	OS.objc_msgSend(this.id, OS.sel_finishLaunching);
63 }
64 
hide(id sender)65 public void hide(id sender) {
66 	OS.objc_msgSend(this.id, OS.sel_hide_, sender != null ? sender.id : 0);
67 }
68 
hideOtherApplications(id sender)69 public void hideOtherApplications(id sender) {
70 	OS.objc_msgSend(this.id, OS.sel_hideOtherApplications_, sender != null ? sender.id : 0);
71 }
72 
isActive()73 public boolean isActive() {
74 	return OS.objc_msgSend_bool(this.id, OS.sel_isActive);
75 }
76 
isRunning()77 public boolean isRunning() {
78 	return OS.objc_msgSend_bool(this.id, OS.sel_isRunning);
79 }
80 
keyWindow()81 public NSWindow keyWindow() {
82 	long result = OS.objc_msgSend(this.id, OS.sel_keyWindow);
83 	return result != 0 ? new NSWindow(result) : null;
84 }
85 
mainMenu()86 public NSMenu mainMenu() {
87 	long result = OS.objc_msgSend(this.id, OS.sel_mainMenu);
88 	return result != 0 ? new NSMenu(result) : null;
89 }
90 
nextEventMatchingMask(long mask, NSDate expiration, NSString mode, boolean deqFlag)91 public NSEvent nextEventMatchingMask(long mask, NSDate expiration, NSString mode, boolean deqFlag) {
92 	long result = OS.objc_msgSend(this.id, OS.sel_nextEventMatchingMask_untilDate_inMode_dequeue_, mask, expiration != null ? expiration.id : 0, mode != null ? mode.id : 0, deqFlag);
93 	return result != 0 ? new NSEvent(result) : null;
94 }
95 
orderFrontStandardAboutPanel(id sender)96 public void orderFrontStandardAboutPanel(id sender) {
97 	OS.objc_msgSend(this.id, OS.sel_orderFrontStandardAboutPanel_, sender != null ? sender.id : 0);
98 }
99 
postEvent(NSEvent event, boolean flag)100 public void postEvent(NSEvent event, boolean flag) {
101 	OS.objc_msgSend(this.id, OS.sel_postEvent_atStart_, event != null ? event.id : 0, flag);
102 }
103 
replyToOpenOrPrint(long reply)104 public void replyToOpenOrPrint(long reply) {
105 	OS.objc_msgSend(this.id, OS.sel_replyToOpenOrPrint_, reply);
106 }
107 
runModalForWindow(NSWindow theWindow)108 public long runModalForWindow(NSWindow theWindow) {
109 	return OS.objc_msgSend(this.id, OS.sel_runModalForWindow_, theWindow != null ? theWindow.id : 0);
110 }
111 
sendAction(long theAction, id theTarget, id sender)112 public boolean sendAction(long theAction, id theTarget, id sender) {
113 	return OS.objc_msgSend_bool(this.id, OS.sel_sendAction_to_from_, theAction, theTarget != null ? theTarget.id : 0, sender != null ? sender.id : 0);
114 }
115 
sendEvent(NSEvent theEvent)116 public void sendEvent(NSEvent theEvent) {
117 	OS.objc_msgSend(this.id, OS.sel_sendEvent_, theEvent != null ? theEvent.id : 0);
118 }
119 
setActivationPolicy(long activationPolicy)120 public boolean setActivationPolicy(long activationPolicy) {
121 	return OS.objc_msgSend_bool(this.id, OS.sel_setActivationPolicy_, activationPolicy);
122 }
123 
setApplicationIconImage(NSImage applicationIconImage)124 public void setApplicationIconImage(NSImage applicationIconImage) {
125 	OS.objc_msgSend(this.id, OS.sel_setApplicationIconImage_, applicationIconImage != null ? applicationIconImage.id : 0);
126 }
127 
setDelegate(id delegate)128 public void setDelegate(id delegate) {
129 	OS.objc_msgSend(this.id, OS.sel_setDelegate_, delegate != null ? delegate.id : 0);
130 }
131 
setHelpMenu(NSMenu helpMenu)132 public void setHelpMenu(NSMenu helpMenu) {
133 	OS.objc_msgSend(this.id, OS.sel_setHelpMenu_, helpMenu != null ? helpMenu.id : 0);
134 }
135 
setMainMenu(NSMenu mainMenu)136 public void setMainMenu(NSMenu mainMenu) {
137 	OS.objc_msgSend(this.id, OS.sel_setMainMenu_, mainMenu != null ? mainMenu.id : 0);
138 }
139 
setServicesMenu(NSMenu servicesMenu)140 public void setServicesMenu(NSMenu servicesMenu) {
141 	OS.objc_msgSend(this.id, OS.sel_setServicesMenu_, servicesMenu != null ? servicesMenu.id : 0);
142 }
143 
sharedApplication()144 public static NSApplication sharedApplication() {
145 	long result = OS.objc_msgSend(OS.class_NSApplication, OS.sel_sharedApplication);
146 	return result != 0 ? new NSApplication(result) : null;
147 }
148 
stop(id sender)149 public void stop(id sender) {
150 	OS.objc_msgSend(this.id, OS.sel_stop_, sender != null ? sender.id : 0);
151 }
152 
stopModal()153 public void stopModal() {
154 	OS.objc_msgSend(this.id, OS.sel_stopModal);
155 }
156 
terminate(id sender)157 public void terminate(id sender) {
158 	OS.objc_msgSend(this.id, OS.sel_terminate_, sender != null ? sender.id : 0);
159 }
160 
unhideAllApplications(id sender)161 public void unhideAllApplications(id sender) {
162 	OS.objc_msgSend(this.id, OS.sel_unhideAllApplications_, sender != null ? sender.id : 0);
163 }
164 
windowWithWindowNumber(long windowNum)165 public NSWindow windowWithWindowNumber(long windowNum) {
166 	long result = OS.objc_msgSend(this.id, OS.sel_windowWithWindowNumber_, windowNum);
167 	return result != 0 ? new NSWindow(result) : null;
168 }
169 
windows()170 public NSArray windows() {
171 	long result = OS.objc_msgSend(this.id, OS.sel_windows);
172 	return result != 0 ? new NSArray(result) : null;
173 }
174 
175 }
176