Created
July 17, 2012 01:33
-
-
Save fjolnir/3126350 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
nsapp = NSApplication sharedApplication | |
\ Create the menubar | |
menuBar = NSMenu new | |
appMenuItem = NSMenuItem new | |
menuBar addItem: appMenuItem | |
nsapp setMainMenu: menuBar | |
\ Add the Application menu & the quit item | |
appMenu = NSMenu new | |
quitMenuItem = NSMenuItem alloc initWithTitle: "Quit #{NSProcessInfo processInfo processName}" | |
action: "terminate:" | |
keyEquivalent: "q" | |
appMenu addItem: quitMenuItem | |
appMenuItem setSubmenu: appMenu | |
\ Create a window | |
win = NSWindow alloc initWithContentRect: #[NSZeroPoint, [300, 200]] | |
styleMask: NSTitledWindowMask | |
backing: NSBackingStoreBuffered | |
defer: 0 | |
win#title = "Tranquil!" | |
win makeKeyAndOrderFront: nil | |
view = NSTextField alloc initWithFrame: (win contentView bounds) | |
view#stringValue = "Hey!" | |
win contentView addSubview: view | |
\ Start the app | |
nsapp setActivationPolicy: NSApplicationActivationPolicyRegular | |
nsapp activateIgnoringOtherApps:1 | |
nsapp run |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment