PageRenderTime 59ms CodeModel.GetById 21ms RepoModel.GetById 0ms app.codeStats 0ms

/rococoa/rococoa-contrib/src/main/java/org/rococoa/cocoa/NSApplication.java

http://rococoa.googlecode.com/
Java | 320 lines | 33 code | 23 blank | 264 comment | 0 complexity | 2cfd8474aa08ee5f584ff682cdf9d523 MD5 | raw file
Possible License(s): GPL-3.0, LGPL-3.0
  1. /*
  2. * Copyright 2007, 2008, 2009 Duncan McGregor
  3. *
  4. * This file is part of Rococoa, a library to allow Java to talk to Cocoa.
  5. *
  6. * Rococoa is free software: you can redistribute it and/or modify
  7. * it under the terms of the GNU Lesser General Public License as published by
  8. * the Free Software Foundation, either version 3 of the License, or
  9. * (at your option) any later version.
  10. *
  11. * Rococoa is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU Lesser General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU Lesser General Public License
  17. * along with Rococoa. If not, see <http://www.gnu.org/licenses/>.
  18. */
  19. package org.rococoa.cocoa;
  20. import org.rococoa.ID;
  21. import org.rococoa.ObjCClass;
  22. import org.rococoa.Rococoa;
  23. import org.rococoa.RunOnMainThread;
  24. import org.rococoa.cocoa.foundation.NSImage;
  25. import org.rococoa.cocoa.foundation.NSInteger;
  26. import org.rococoa.cocoa.foundation.NSObject;
  27. /**
  28. * NSApplication
  29. *
  30. * @author <a href="mailto:harald.kuhr@gmail.com">Harald Kuhr</a>
  31. * @author last modified by $Author: haraldk$
  32. * @version $Id: NSApplication.java,v 1.0 Mar 21, 2008 11:12:34 PM haraldk Exp$
  33. */
  34. @RunOnMainThread
  35. public abstract class NSApplication extends NSObject {
  36. private static final _Class CLASS = Rococoa.createClass("NSApplication", _Class.class); //$NON-NLS-1$
  37. // NOTE: This class should not run on main thread (deadlocks?)
  38. private interface _Class extends ObjCClass {
  39. NSApplication sharedApplication();
  40. }
  41. static public final NSApplication NSApp = NSApplication.CLASS.sharedApplication();
  42. /*
  43. Tasks
  44. Getting the Application
  45. * + sharedApplication
  46. */
  47. static public NSApplication sharedApplication() {
  48. return NSApp;
  49. }
  50. public abstract void run();
  51. public abstract void stop(ID sender);
  52. /*
  53. Configuring Applications
  54. * ? applicationIconImage
  55. * ? setApplicationIconImage:
  56. * ? delegate
  57. * ? setDelegate:
  58. * */
  59. public abstract NSImage applicationIconImage();
  60. public abstract void setApplicationIconImage(NSImage image);
  61. public abstract NSDockTile dockTile();
  62. public abstract ID delegate();
  63. public abstract void setDelegate(ID delegate);
  64. public abstract NSWindow mainWindow();
  65. /*
  66. typedef enum {
  67. NSCriticalRequest = 0,
  68. NSInformationalRequest = 10
  69. } NSRequestUserAttentionType;
  70. */
  71. public static final int NSCriticalRequest = 0;
  72. public static final int NSInformationalRequest = 10;
  73. /**
  74. * Activating the application cancels the user attention request.
  75. * A spoken notification will occur if spoken notifications are enabled.
  76. * Sending requestUserAttention: to an application that is already active has no effect.
  77. *
  78. * If the inactive application presents a modal panel, this method will be invoked with
  79. * NSCriticalRequest automatically. The modal panel is not brought to the front for an
  80. * inactive application.
  81. *
  82. * @param requestType {@link #NSCriticalRequest} or {@link #NSInformationalRequest}
  83. * @return The identifier for the request.
  84. * You can use this value to cancel the request later using the {@link #cancelUserAttentionRequest} method.
  85. */
  86. public abstract NSInteger requestUserAttention(int requestType);
  87. public abstract void cancelUserAttentionRequest(NSInteger request);
  88. /*
  89. Launching Applications
  90. * ? finishLaunching
  91. * ? applicationWillFinishLaunching: delegate method
  92. * ? applicationDidFinishLaunching: delegate method
  93. Terminating Applications
  94. * ? terminate:
  95. * ? applicationShouldTerminate: delegate method
  96. * ? applicationShouldTerminateAfterLastWindowClosed: delegate method
  97. * ? replyToApplicationShouldTerminate:
  98. * ? applicationWillTerminate: delegate method
  99. Managing Active Status
  100. * ? isActive
  101. * ? activateIgnoringOtherApps:
  102. * ? applicationWillBecomeActive: delegate method
  103. * ? applicationDidBecomeActive: delegate method
  104. * ? deactivate
  105. * ? applicationWillResignActive: delegate method
  106. * ? applicationDidResignActive: delegate method
  107. Hiding Applications
  108. * ? hideOtherApplications:
  109. * ? unhideAllApplications:
  110. * ? applicationWillHide: delegate method
  111. * ? applicationDidHide: delegate method
  112. * ? applicationWillUnhide: delegate method
  113. * ? applicationDidUnhide: delegate method
  114. Managing the Event Loop
  115. * ? isRunning
  116. * ? run
  117. * ? stop:
  118. * ? runModalForWindow:
  119. */
  120. public abstract int runModalForWindow(NSWindow window);
  121. /*
  122. * ? stopModal
  123. * ? stopModalWithCode:
  124. * ? abortModal
  125. * ? beginModalSessionForWindow:
  126. * ? runModalSession:
  127. * ? modalWindow
  128. * ? endModalSession:
  129. * ? sendEvent:
  130. Handling Events
  131. * ? currentEvent
  132. * ? nextEventMatchingMask:untilDate:inMode:dequeue:
  133. * ? discardEventsMatchingMask:beforeEvent:
  134. Posting Events
  135. * ? postEvent:atStart:
  136. Managing Sheets
  137. * ? beginSheet:modalForWindow:modalDelegate:didEndSelector:contextInfo:
  138. * ? endSheet:
  139. * ? endSheet:returnCode:
  140. Managing Windows
  141. * ? keyWindow
  142. * ? mainWindow
  143. * ? windowWithWindowNumber:
  144. * ? windows
  145. * ? makeWindowsPerform:inOrder:
  146. * ? applicationWillUpdate: delegate method
  147. * ? applicationDidUpdate: delegate method
  148. * ? applicationShouldHandleReopen:hasVisibleWindows: delegate method
  149. Minimizing Windows
  150. * ? miniaturizeAll:
  151. Hiding Windows
  152. * ? isHidden
  153. * ? hide:
  154. * ? unhide:
  155. * ? unhideWithoutActivation
  156. Updating Windows
  157. * ? updateWindows
  158. * ? setWindowsNeedUpdate:
  159. Managing Window Layers
  160. * ? preventWindowOrdering
  161. * ? arrangeInFront:
  162. Accessing the Main Menu
  163. * ? mainMenu
  164. * */
  165. public abstract NSMenu mainMenu();
  166. /*
  167. * ? setMainMenu:
  168. Managing the Window Menu
  169. * ? windowsMenu
  170. * ? setWindowsMenu:
  171. * ? addWindowsItem:title:filename:
  172. * ? changeWindowsItem:title:filename:
  173. * ? removeWindowsItem:
  174. * ? updateWindowsItem:
  175. Managing the Dock Menu
  176. * ? applicationDockMenu: delegate method
  177. Managing the Services Menu
  178. * ? registerServicesMenuSendTypes:returnTypes:
  179. * ? servicesMenu
  180. * ? setServicesMenu:
  181. Providing Services
  182. * ? validRequestorForSendType:returnType:
  183. * ? servicesProvider
  184. * ? setServicesProvider:
  185. Managing Panels
  186. * ? orderFrontColorPanel:
  187. * ? orderFrontStandardAboutPanel:
  188. * ? orderFrontStandardAboutPanelWithOptions:
  189. * ? orderFrontCharacterPalette:
  190. * ? runPageLayout:
  191. Displaying Help
  192. * ? showHelp:
  193. * ? activateContextHelpMode:
  194. Displaying Errors
  195. * ? application:willPresentError: delegate method
  196. Managing Threads
  197. * + detachDrawingThread:toTarget:withObject:
  198. Posting Actions
  199. * ? tryToPerform:with:
  200. * ? sendAction:to:from:
  201. * ? targetForAction:
  202. * ? targetForAction:to:from:
  203. Drawing Windows
  204. * ? context
  205. Logging Exceptions
  206. * ? reportException:
  207. Scripting
  208. * ? orderedDocuments
  209. * ? orderedWindows
  210. * ? application:delegateHandlesKey: delegate method
  211. Managing User Attention Requests
  212. * ? requestUserAttention:
  213. * ? cancelUserAttentionRequest:
  214. * ? replyToOpenOrPrint:
  215. Managing the Screen
  216. * ? applicationDidChangeScreenParameters: delegate method
  217. Opening Files
  218. * ? application:openFile: delegate method
  219. * ? application:openFileWithoutUI: delegate method
  220. * ? application:openTempFile: delegate method
  221. * ? application:openFiles: delegate method
  222. * ? applicationOpenUntitledFile: delegate method
  223. * ? applicationShouldOpenUntitledFile: delegate method
  224. Printing
  225. * ? application:printFile: delegate method
  226. * ? application:printFiles:withSettings:showPrintPanels: delegate method
  227. Deprecated
  228. * ? runModalForWindow:relativeToWindow:
  229. * ? beginModalSessionForWindow:relativeToWindow:
  230. * ? application:printFiles: delegate method Deprecated in Mac OS X v10.4
  231. */
  232. }