Guest User

Untitled

a guest
Feb 20th, 2018
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.24 KB | None | 0 0
  1. ;; file main.nu
  2. ;; discussion Entry point for a Nu program.
  3.  
  4. (import Cocoa) ;; bridgesupport
  5. (load "console") ;; interactive console
  6.  
  7. (set SHOW_CONSOLE_AT_STARTUP nil)
  8.  
  9. ;; @class ApplicationDelegate
  10. ;; @discussion Methods of this class perform general-purpose tasks that are not appropriate methods of any other classes.
  11. (class ApplicationDelegate is NSObject
  12.  
  13. ;; This method is called after Cocoa has finished its basic application setup.
  14. ;; It instantiates application-specific components.
  15. ;; In this case, it constructs an interactive Nu console that can be activated from the application's Window menu.
  16. (- (void) applicationDidFinishLaunching:(id) sender is
  17. (set $console ((NuConsoleWindowController alloc) init))
  18. (if SHOW_CONSOLE_AT_STARTUP ($console toggleConsole:self))))
  19.  
  20. ;; install the delegate and keep a reference to it since the application won't retain it.
  21. ((NSApplication sharedApplication) setDelegate:(set $delegate ((ApplicationDelegate alloc) init)))
  22.  
  23. ;; this makes the application window take focus when we've started it from the terminal (or with nuke)
  24. ((NSApplication sharedApplication) activateIgnoringOtherApps:YES)
  25.  
  26. ;; run the main Cocoa event loop
  27. (NSApplicationMain 0 nil)
Add Comment
Please, Sign In to add comment