[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Q] How can I display Window using StepTalk?
From: |
Matthew D Swank |
Subject: |
Re: [Q] How can I display Window using StepTalk? |
Date: |
Thu, 24 Feb 2005 14:55:14 -0600 |
User-agent: |
Mozilla Thunderbird 1.0 (X11/20050209) |
Matthew D Swank wrote:
I posted an example application that depends on a small external
framework I wrote:
http://lists.gnu.org/archive/html/discuss-gnustep/2005-02/msg00446.html.
This is a simpler version of the same idea:
-----------------------------------------------------------------------
[|:window :label :menu :application
applicationWillFinishLaunching: notification
window := NSWindow alloc
initWithContentRect:
(STLLUtil makeRectX:300
withY:300
withW:200
withH:100)
styleMask:15
backing: NSBackingStoreBuffered
defer: YES.
window setTitle:'Hello World'.
label := NSTextField alloc
initWithFrame:(STLLUtil makeRectX:30
withY:30
withW:80
withH:30).
label setSelectable:NO.
label setBezeled:NO.
label setDrawsBackground:NO.
label setStringValue:'Hello World'.
window contentView addSubview: label.
menu := NSMenu new.
menu addItemWithTitle: 'Info'
action: nil
keyEquivalent: ''.
menu addItemWithTitle: 'Hide'
action: #hide:
keyEquivalent: 'h'.
menu addItemWithTitle: 'Quit'
action: #terminate:
keyEquivalent: 'q'.
info := NSMenu new.
(info addItemWithTitle: 'Info Panel...'
action: #orderFrontStandardInfoPanel:
keyEquivalent: '') setTarget: self.
info addItemWithTitle: 'Preferences'
action: nil
keyEquivalent: ''.
info addItemWithTitle: 'Help'
action: #orderFrontHelpPanel:
keyEquivalent: '?'.
menu setSubmenu: info
forItem: (menu itemWithTitle:'Info').
application setMainMenu:menu.
!
applicationDidFinishLaunching: notification
window makeKeyAndOrderFront: self.
!
applicationShouldTerminateAfterLastWindowClosed: application
^true
!
orderFrontStandardInfoPanel: sender
"STLLUtil log:'orderFrontStandardInfoPanel fired'."
application orderFrontStandardInfoPanelWithOptions:
(NSDictionary alloc
initWithContentsOfFile:
'/home/singollo/Info.plist').
!
main
Environment loadModule:'AppKit'.
Environment includeFramework:'StepTalkLocalLib'.
application := NSApplication sharedApplication.
application setDelegate: self.
application run.
]