This is AppKitDemo.m in view mode; [Download] [Up]
#import <appkit/appkit.h>
// a program to demonstrate how to display
// a window and a menu with a Quit option
void main(void)
{
// create an application object
// to establish connection to
// Window Server
id NXApp = [Application new];
id theWindow;
id theMenu;
id theMenuCell;
// create buffered window at default
// location with minituarize button
// and title bar
theWindow = [ [Window alloc]
initContent:NULL
style: NX_RESIZEBARSTYLE
backing:NX_BUFFERED
buttonMask:NX_MINIATURIZEBUTTONMASK
defer:YES];
// create the menu
theMenu = [ [Menu alloc]
initTitle: "AppKitDemo"];
// create the menu option
theMenuCell = [theMenu addItem:"Quit"
action:@selector(terminate:)
keyEquivalent:'q'];
// set NXApp as target of the menucell
[theMenuCell setTarget:NXApp];
// resize menu to accomodate menu option
[theMenu sizeToFit];
[NXApp setMainMenu:theMenu];
// send the window to the front
// and display it
[theWindow makeKeyAndOrderFront:nil];
// go into event loop to wait for events
[NXApp run];
}
These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.