1 package ch
.cyberduck
.binding
.application
;
4 * Copyright (c) 2002-2009 David Kocher. All rights reserved.
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * Bug fixes, suggestions and comments should be sent to:
19 * dkocher@cyberduck.ch
22 import ch
.cyberduck
.binding
.foundation
.*;
24 import org
.rococoa
.ID
;
25 import org
.rococoa
.ObjCClass
;
26 import org
.rococoa
.Rococoa
;
27 import org
.rococoa
.Selector
;
28 import org
.rococoa
.cocoa
.foundation
.NSInteger
;
29 import org
.rococoa
.cocoa
.foundation
.NSUInteger
;
34 public abstract class NSApplication
extends NSObject
{
35 private static final _Class CLASS
= Rococoa
.createClass("NSApplication", _Class
.class); //$NON-NLS-1$
37 public interface Delegate
{
38 boolean application_openFile(NSApplication app
, String filename
);
40 boolean application_openTempFile(NSApplication app
, String filename
);
42 boolean applicationShouldOpenUntitledFile(NSApplication sender
);
44 boolean applicationOpenUntitledFile(NSApplication app
);
46 boolean applicationShouldHandleReopen_hasVisibleWindows(NSApplication app
, boolean visibleWindowsFound
);
48 void applicationDidFinishLaunching(NSNotification notification
);
50 NSUInteger
applicationShouldTerminate(NSApplication app
);
52 void applicationWillTerminate(NSNotification notification
);
54 boolean applicationShouldTerminateAfterLastWindowClosed(NSApplication app
);
57 public static final NSUInteger NSTerminateCancel
= new NSUInteger(0);
58 public static final NSUInteger NSTerminateNow
= new NSUInteger(1);
59 public static final NSUInteger NSTerminateLater
= new NSUInteger(2);
61 public interface _Class
extends ObjCClass
{
63 * This method also makes a connection to the window server and completes other initialization.
64 * Your program should invoke this method as one of the first statements in main();
68 public NSApplication
sharedApplication();
71 public static NSApplication
sharedApplication() {
72 return CLASS
.sharedApplication();
75 public abstract NSArray
windows();
78 * Original signature : <code>void setDelegate(id)</code><br>
79 * <i>native declaration : :108</i>
81 public abstract void setDelegate(org
.rococoa
.ID anObject
);
84 * Original signature : <code>id delegate()</code><br>
85 * <i>native declaration : :109</i>
87 public abstract org
.rococoa
.ID
delegate();
90 * Original signature : <code>NSGraphicsContext* context()</code><br>
91 * <i>native declaration : :110</i>
93 public abstract com
.sun
.jna
.Pointer
context();
96 * Original signature : <code>void hide(id)</code><br>
97 * <i>native declaration : :111</i>
99 public abstract void hide(ID sender
);
102 * Original signature : <code>void unhide(id)</code><br>
103 * <i>native declaration : :112</i>
105 public abstract void unhide(ID sender
);
108 * Original signature : <code>void unhideWithoutActivation()</code><br>
109 * <i>native declaration : :113</i>
111 public abstract void unhideWithoutActivation();
114 * Original signature : <code>NSWindow* windowWithWindowNumber(NSInteger)</code><br>
115 * <i>native declaration : :114</i>
117 public abstract NSWindow
windowWithWindowNumber(int windowNum
);
120 * Original signature : <code>NSWindow* mainWindow()</code><br>
121 * <i>native declaration : :115</i>
123 public abstract NSWindow
mainWindow();
126 * Original signature : <code>NSWindow* keyWindow()</code><br>
127 * <i>native declaration : :116</i>
129 public abstract NSWindow
keyWindow();
132 * Original signature : <code>BOOL isActive()</code><br>
133 * <i>native declaration : :117</i>
135 public abstract boolean isActive();
138 * Original signature : <code>BOOL isHidden()</code><br>
139 * <i>native declaration : :118</i>
141 public abstract boolean isHidden();
144 * Original signature : <code>BOOL isRunning()</code><br>
145 * <i>native declaration : :119</i>
147 public abstract boolean isRunning();
150 * Original signature : <code>void deactivate()</code><br>
151 * <i>native declaration : :120</i>
153 public abstract void deactivate();
156 * Original signature : <code>void activateIgnoringOtherApps(BOOL)</code><br>
157 * <i>native declaration : :121</i>
159 public abstract void activateIgnoringOtherApps(boolean flag
);
162 * Original signature : <code>void hideOtherApplications(id)</code><br>
163 * <i>native declaration : :123</i>
165 public abstract void hideOtherApplications(ID sender
);
168 * Original signature : <code>void unhideAllApplications(id)</code><br>
169 * <i>native declaration : :124</i>
171 public abstract void unhideAllApplications(ID sender
);
174 * Original signature : <code>void finishLaunching()</code><br>
175 * <i>native declaration : :126</i>
177 public abstract void finishLaunching();
180 * Original signature : <code>void run()</code><br>
181 * <i>native declaration : :127</i>
183 public abstract void run();
186 * Original signature : <code>NSInteger runModalForWindow(NSWindow*)</code><br>
187 * <i>native declaration : :128</i>
189 public abstract NSInteger
runModalForWindow(NSWindow theWindow
);
192 * Original signature : <code>void stop(id)</code><br>
193 * <i>native declaration : :129</i>
195 public abstract void stop(ID sender
);
198 * Original signature : <code>void stopModal()</code><br>
199 * <i>native declaration : :130</i>
201 public abstract void stopModal();
204 * Original signature : <code>void stopModalWithCode(NSInteger)</code><br>
205 * <i>native declaration : :131</i>
207 public abstract void stopModalWithCode(int returnCode
);
210 * Original signature : <code>void abortModal()</code><br>
211 * <i>native declaration : :132</i>
213 public abstract void abortModal();
216 * Original signature : <code>NSWindow* modalWindow()</code><br>
217 * <i>native declaration : :133</i>
219 public abstract NSWindow
modalWindow();
222 * Original signature : <code>NSModalSession beginModalSessionForWindow(NSWindow*)</code><br>
223 * <i>native declaration : :134</i>
225 public abstract com
.sun
.jna
.Pointer
beginModalSessionForWindow(NSWindow theWindow
);
228 * Original signature : <code>NSInteger runModalSession(NSModalSession)</code><br>
229 * <i>native declaration : :135</i>
231 public abstract NSInteger
runModalSession(com
.sun
.jna
.Pointer session
);
234 * Original signature : <code>void endModalSession(NSModalSession)</code><br>
235 * <i>native declaration : :136</i>
237 public abstract void endModalSession(com
.sun
.jna
.Pointer session
);
240 * Original signature : <code>void terminate(id)</code><br>
241 * <i>native declaration : :137</i>
243 public abstract void terminate(ID sender
);
246 * A key value coding compliant get-accessor for the orderedDocuments to-many-relationship declared in Cocoa's definition of the Standard Suite. Return an array of currently open scriptable documents, in a predictable order that will be meaningful to script writers. NSApplication's implementation of this method returns pointers to all NSDocuments in the front-to-back order of each document's frontmost window. NSDocuments that have no associated windows are at the end of the array.<br>
247 * Original signature : <code>NSArray* orderedDocuments()</code><br>
248 * <i>from NSScripting native declaration : :14</i>
250 public abstract NSArray
orderedDocuments();
253 * A key value coding compliant get-accessor for the orderedWindows to-many-relationship declared in Cocoa's definition of the Standard Suite. Return an array of currently open scriptable windows, including hidden windows, but typically not includings things like panels.<br>
254 * Original signature : <code>NSArray* orderedWindows()</code><br>
255 * <i>from NSScripting native declaration : :17</i>
257 public abstract NSArray
orderedWindows();
259 * <i>native declaration : :138</i><br>
260 * Conversion Error : /**<br>
261 * * inform the user that this application needs attention - call this method only if your application is not already active<br>
262 * * Original signature : <code>NSInteger requestUserAttention(null)</code><br>
264 * - (NSInteger)requestUserAttention:(null)requestType; (Argument requestType cannot be converted)
267 * Original signature : <code>void cancelUserAttentionRequest(NSInteger)</code><br>
268 * <i>native declaration : :139</i>
270 public abstract void cancelUserAttentionRequest(int request
);
273 * <i>native declaration : :149</i><br>
274 * Conversion Error : /**<br>
275 * * * Present a sheet on the given window. When the modal session is ended,<br>
276 * * * the didEndSelector will be invoked in the modalDelegate. The didEndSelector<br>
277 * * * should have the following signature, and will be invoked when the modal session ends.<br>
278 * * * This method should dimiss the sheet using orderOut:<br>
279 * * * - (void)sheetDidEnd:(NSWindow *)sheet returnCode:(NSInteger)returnCode contextInfo:(void *)contextInfo;<br>
281 * * Original signature : <code>void beginSheet(NSWindow*, NSWindow*, id, null, void*)</code><br>
283 * - (void)beginSheet:(NSWindow*)sheet modalForWindow:(NSWindow*)docWindow modalDelegate:(id)modalDelegate didEndSelector:(null)didEndSelector contextInfo:(void*)contextInfo; (Argument didEndSelector cannot be converted)
285 public abstract void beginSheet_modalForWindow_modalDelegate_didEndSelector_contextInfo(NSWindow sheet
, NSWindow docWindow
, ID modalDelegate
, Selector didEndSelector
, ID contextInfo
);
287 public void beginSheet(NSWindow sheet
, NSWindow docWindow
, ID modalDelegate
, Selector didEndSelector
, ID contextInfo
) {
288 this.beginSheet_modalForWindow_modalDelegate_didEndSelector_contextInfo(sheet
, docWindow
, modalDelegate
, didEndSelector
, contextInfo
);
292 * Original signature : <code>void endSheet(NSWindow*)</code><br>
293 * <i>native declaration : :150</i>
295 public abstract void endSheet(NSWindow sheet
);
298 * Original signature : <code>void endSheet(NSWindow*, NSInteger)</code><br>
299 * <i>native declaration : :151</i>
301 public abstract void endSheet_returnCode(NSWindow sheet
, int returnCode
);
303 public void endSheet(NSWindow sheet
, int returnCode
) {
304 this.endSheet_returnCode(sheet
, returnCode
);
308 * * runModalForWindow:relativeToWindow: is deprecated. <br>
309 * * Please use beginSheet:modalForWindow:modalDelegate:didEndSelector:contextInfo:<br>
310 * Original signature : <code>NSInteger runModalForWindow(NSWindow*, NSWindow*)</code><br>
311 * <i>native declaration : :157</i>
313 public abstract NSInteger
runModalForWindow_relativeToWindow(NSWindow theWindow
, NSWindow docWindow
);
316 * * beginModalSessionForWindow:relativeToWindow: is deprecated.<br>
317 * * Please use beginSheet:modalForWindow:modalDelegate:didEndSelector:contextInfo:<br>
318 * Original signature : <code>NSModalSession beginModalSessionForWindow(NSWindow*, NSWindow*)</code><br>
319 * <i>native declaration : :163</i>
321 public abstract com
.sun
.jna
.Pointer
beginModalSessionForWindow_relativeToWindow(NSWindow theWindow
, NSWindow docWindow
);
324 * Original signature : <code>NSEvent* nextEventMatchingMask(NSUInteger, NSDate*, NSString*, BOOL)</code><br>
325 * <i>native declaration : :164</i>
327 public abstract com
.sun
.jna
.Pointer
nextEventMatchingMask_untilDate_inMode_dequeue(int mask
, NSDate expiration
, String mode
, boolean deqFlag
);
330 * Original signature : <code>void discardEventsMatchingMask(NSUInteger, NSEvent*)</code><br>
331 * <i>native declaration : :165</i>
333 public abstract void discardEventsMatchingMask_beforeEvent(int mask
, com
.sun
.jna
.Pointer lastEvent
);
336 * Original signature : <code>void postEvent(NSEvent*, BOOL)</code><br>
337 * <i>native declaration : :166</i>
339 public abstract void postEvent_atStart(NSEvent event
, boolean flag
);
342 * Original signature : <code>NSEvent* currentEvent()</code><br>
343 * <i>native declaration : :167</i>
345 public abstract NSEvent
currentEvent();
348 * Original signature : <code>void sendEvent(NSEvent*)</code><br>
349 * <i>native declaration : :169</i>
351 public abstract void sendEvent(NSEvent event
);
354 * Original signature : <code>void preventWindowOrdering()</code><br>
355 * <i>native declaration : :170</i>
357 public abstract void preventWindowOrdering();
359 * <i>native declaration : :171</i><br>
360 * Conversion Error : /// Original signature : <code>NSWindow* makeWindowsPerform(null, BOOL)</code><br>
361 * - (NSWindow*)makeWindowsPerform:(null)aSelector inOrder:(BOOL)flag; (Argument aSelector cannot be converted)
365 * Original signature : <code>void setWindowsNeedUpdate(BOOL)</code><br>
366 * <i>native declaration : :173</i>
368 public abstract void setWindowsNeedUpdate(boolean needUpdate
);
371 * Original signature : <code>void updateWindows()</code><br>
372 * <i>native declaration : :174</i>
374 public abstract void updateWindows();
377 * Original signature : <code>void setMainMenu(NSMenu*)</code><br>
378 * <i>native declaration : :176</i>
380 public abstract void setMainMenu(NSMenu aMenu
);
383 * Original signature : <code>NSMenu* mainMenu()</code><br>
384 * <i>native declaration : :177</i>
386 public abstract NSMenu
mainMenu();
389 * Original signature : <code>void setApplicationIconImage(NSImage*)</code><br>
390 * <i>native declaration : :179</i>
392 public abstract void setApplicationIconImage(NSImage image
);
395 * Original signature : <code>NSImage* applicationIconImage()</code><br>
396 * <i>native declaration : :180</i>
398 public abstract NSImage
applicationIconImage();
401 * Original signature : <code>NSDockTile* dockTile()</code><br>
402 * <i>native declaration : :183</i>
404 public abstract NSDockTile
dockTile();
406 * <i>native declaration : :186</i><br>
407 * Conversion Error : /// Original signature : <code>BOOL sendAction(null, id, id)</code><br>
408 * - (BOOL)sendAction:(null)theAction to:(id)theTarget from:(id)sender; (Argument theAction cannot be converted)
411 * <i>native declaration : :187</i><br>
412 * Conversion Error : /// Original signature : <code>id targetForAction(null)</code><br>
413 * - (id)targetForAction:(null)theAction; (Argument theAction cannot be converted)
416 * <i>native declaration : :188</i><br>
417 * Conversion Error : /// Original signature : <code>id targetForAction(null, id, id)</code><br>
418 * - (id)targetForAction:(null)theAction to:(id)theTarget from:(id)sender; (Argument theAction cannot be converted)
421 * <i>native declaration : :189</i><br>
422 * Conversion Error : /// Original signature : <code>BOOL tryToPerform(null, id)</code><br>
423 * - (BOOL)tryToPerform:(null)anAction with:(id)anObject; (Argument anAction cannot be converted)
426 * Original signature : <code>id validRequestorForSendType(NSString*, NSString*)</code><br>
427 * <i>native declaration : :190</i>
429 public abstract ID
validRequestorForSendType_returnType(String sendType
, String returnType
);
432 * Original signature : <code>void reportException(NSException*)</code><br>
433 * <i>native declaration : :192</i>
435 public abstract void reportException(com
.sun
.jna
.Pointer theException
);
438 * If an application delegate returns NSTerminateLater from -applicationShouldTerminate:, -replyToApplicationShouldTerminate: must be called with YES or NO once the application decides if it can terminate<br>
439 * Original signature : <code>void replyToApplicationShouldTerminate(BOOL)</code><br>
440 * <i>native declaration : :196</i>
442 public abstract void replyToApplicationShouldTerminate(boolean shouldTerminate
);
445 * <i>native declaration : :200</i><br>
446 * Conversion Error : /**<br>
447 * * If an application delegate encounters an error while handling -application:openFiles: or -application:printFiles:, -replyToOpenOrPrint: should be called with NSApplicationDelegateReplyFailure. If the user cancels the operation, NSApplicationDelegateReplyCancel should be used, and if the operation succeeds, NSApplicationDelegateReplySuccess should be used<br>
448 * * Original signature : <code>void replyToOpenOrPrint(null)</code><br>
450 * - (void)replyToOpenOrPrint:(null)reply; (Argument reply cannot be converted)
453 * Opens the character palette<br>
454 * Original signature : <code>void orderFrontCharacterPalette(id)</code><br>
455 * <i>native declaration : :204</i>
457 public abstract void orderFrontCharacterPalette(final ID sender
);
460 * Original signature : <code>void setWindowsMenu(NSMenu*)</code><br>
461 * <i>from NSWindowsMenu native declaration : :209</i>
463 public abstract void setWindowsMenu(NSMenu aMenu
);
466 * Original signature : <code>NSMenu* windowsMenu()</code><br>
467 * <i>from NSWindowsMenu native declaration : :210</i>
469 public abstract NSMenu
windowsMenu();
472 * Original signature : <code>void arrangeInFront(id)</code><br>
473 * <i>from NSWindowsMenu native declaration : :211</i>
475 public abstract void arrangeInFront(final ID sender
);
478 * Original signature : <code>void removeWindowsItem(NSWindow*)</code><br>
479 * <i>from NSWindowsMenu native declaration : :212</i>
481 public abstract void removeWindowsItem(NSWindow win
);
484 * Original signature : <code>void addWindowsItem(NSWindow*, NSString*, BOOL)</code><br>
485 * <i>from NSWindowsMenu native declaration : :213</i>
487 public abstract void addWindowsItem_title_filename(NSWindow win
, String aString
, boolean isFilename
);
490 * Original signature : <code>void changeWindowsItem(NSWindow*, NSString*, BOOL)</code><br>
491 * <i>from NSWindowsMenu native declaration : :214</i>
493 public abstract void changeWindowsItem_title_filename(NSWindow win
, String aString
, boolean isFilename
);
496 * Original signature : <code>void updateWindowsItem(NSWindow*)</code><br>
497 * <i>from NSWindowsMenu native declaration : :215</i>
499 public abstract void updateWindowsItem(NSWindow win
);
502 * Original signature : <code>void miniaturizeAll(id)</code><br>
503 * <i>from NSWindowsMenu native declaration : :216</i>
505 public abstract void miniaturizeAll(final ID sender
);
508 * Original signature : <code>void setServicesMenu(NSMenu*)</code><br>
509 * <i>from NSServicesMenu native declaration : :275</i>
511 public abstract void setServicesMenu(NSMenu aMenu
);
514 * Original signature : <code>NSMenu* servicesMenu()</code><br>
515 * <i>from NSServicesMenu native declaration : :276</i>
517 public abstract NSMenu
servicesMenu();
520 * Original signature : <code>void registerServicesMenuSendTypes(NSArray*, NSArray*)</code><br>
521 * <i>from NSServicesMenu native declaration : :277</i>
523 public abstract void registerServicesMenuSendTypes_returnTypes(NSArray sendTypes
, NSArray returnTypes
);
526 * Original signature : <code>void setServicesProvider(id)</code><br>
527 * <i>from NSServicesHandling native declaration : :286</i>
529 public abstract void setServicesProvider(final ID provider
);
532 * Original signature : <code>id servicesProvider()</code><br>
533 * <i>from NSServicesHandling native declaration : :287</i>
535 public abstract NSObject
servicesProvider();
538 * Original signature : <code>void orderFrontStandardAboutPanel(id)</code><br>
539 * <i>from NSStandardAboutPanel native declaration : :291</i>
541 public abstract void orderFrontStandardAboutPanel(final ID sender
);
544 * Original signature : <code>void orderFrontStandardAboutPanelWithOptions(NSDictionary*)</code><br>
545 * <i>from NSStandardAboutPanel native declaration : :292</i>
547 public abstract void orderFrontStandardAboutPanelWithOptions(NSDictionary optionsDictionary
);