ftp.nice.ch/peanuts/GeneralData/Documents/adobe/Hello.tar.gz#/WorldView.m

This is WorldView.m in view mode; [Download] [Up]

/*
 * (C) 1990 by Adobe Systems Incorporated. All rights reserved.
 *
 * This file may be freely copied and redistributed as long as:
 *   1) This entire notice continues to be included in the file, 
 *   2) If the file has been modified in any way, a notice of such
 *      modification is conspicuously indicated.
 *
 * PostScript, Display PostScript, and Adobe are registered trademarks of
 * Adobe Systems Incorporated.
 * 
 * ************************************************************************
 * THE INFORMATION BELOW IS FURNISHED AS IS, IS SUBJECT TO CHANGE WITHOUT
 * NOTICE, AND SHOULD NOT BE CONSTRUED AS A COMMITMENT BY ADOBE SYSTEMS
 * INCORPORATED. ADOBE SYSTEMS INCORPORATED ASSUMES NO RESPONSIBILITY OR 
 * LIABILITY FOR ANY ERRORS OR INACCURACIES, MAKES NO WARRANTY OF ANY 
 * KIND (EXPRESS, IMPLIED OR STATUTORY) WITH RESPECT TO THIS INFORMATION, 
 * AND EXPRESSLY DISCLAIMS ANY AND ALL WARRANTIES OF MERCHANTABILITY, 
 * FITNESS FOR PARTICULAR PURPOSES AND NONINFINGEMENT OF THIRD PARTY RIGHTS.
 * ************************************************************************
 */


/*
 * WorldView.m
 * 
 * WorldView is a subclass of View.  It simply displays and clears a 
 * message in the view.  The one lesson this example shows is the 
 * modification of "drawSelf::" and the call to "display".  The method, 
 * "drawSelf::", should not be called directly.  Instead, "display" should 
 * be called.  The reason is because display message performs some 
 * necessary overhead such as bringing the View into focus by constructing 
 * a clipping path around its frame rectangle and making its coordinate 
 * system the current coordinate system for the application.  The display 
 * method then messages drawSelf::.  These steps are repeated for each of 
 * the View's subviews. 
 *
 * Note:  Any instance variables that need to be initialized before the 
 * first display should be done in the "new" or "newFrame:" method.  In 
 * this case, DrawHello is already a null value at its creation so no 
 * initialization has to be performed.
 */

#import "WorldView.h"
#import <dpsclient/wraps.h>

@implementation WorldView

- drawHello:sender
{
    DrawHello = YES;
    [self display];
    return self;
}

- clearHello:sender
{
    DrawHello = NO;
    [self display];
    return self;
}

/*  The first two lines clear the view,  The remaider display the message 
 * in the view. */
- drawSelf:(NXRect *) r: (int) count
{
	PSsetgray (NX_LTGRAY);
	PSrectfill(
	    bounds.origin.x, bounds.origin.y, 
	    bounds.size.width, bounds.size.height);

	if (DrawHello)
	 {
		PSsetgray (NX_BLACK);
		PSmoveto (50.0, 70.0);
		PSselectfont ("Times-Roman", 40.0);
		PSshow ("Hello World");
	}

	return self;
}

@end

These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.