This is nugdisplay.m in view mode; [Download] [Up]
#import <appkit/appkit.h>
#import <assert.h>
/*******
* Declare subclass of View object and add drawSelf method.
*******/
@interface nugView : View /* header */
{
}
- drawSelf:(NXRect *)rects :(int)rectcount; /* new method for nugView */
@end
@implementation nugView /* Code template */
- drawSelf:(NXRect *)rect :(int)cnt /* code for new method */
{
int count;
float currcolor;
/*******
* Call postscript functions to draw into nugView window.
* (Precede PostScript commands with PS and place arguments
* in parentheses following the function).
*******/
PStranslate(300,300);
PSmoveto(0,0);
PSselectfont("Times-Roman", 40.0);
for (count=15; count<360; count+=15)
{
currcolor=((float) count + 0.05)/ 360.0;
PSsetgray(currcolor);
PSgsave();
PSrotate(count);
PSmoveto(0,0);
PSshow("VaTNug");
PSgrestore();
}
PSsetgray(NX_BLACK);
PSmoveto(0,0);
PSselectfont("Times-BoldItalic", 60.0);
PSshow("VaTNug News");
return self;
}
@end
id nugobj;
void main()
{
id nugwindow;
NXRect aRect={{300.0, 300.0}, {800.0, 600.0}};
[Application new]; /* message Application for new app */
nugobj = [[nugView alloc] init]; /* instance of nugView */
nugwindow = [[Window alloc] initContent:&aRect /* instance of Window */
style:NX_RESIZEBARSTYLE
backing:NX_BUFFERED
buttonMask:NX_MINIATURIZEBUTTONMASK
defer:NO];
[nugwindow setContentView:nugobj]; /* contents of nugwindow=nugobj */
[nugwindow display]; /* message nugwindow to display itself */
[nugwindow orderFront:nil]; /* have nugwindow become key window */
[NXApp run]; /* run this application */
}
These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.