ftp.nice.ch/pub/next/developer/resources/libraries/Puppeteer.1.1.s.tar.gz#/Puppeteer1.1.src/WindowInfo.m

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

/*
 * Puppeteer 1.1
 *
 * Copyright (c) 1994 Primitive Software Ltd.  All rights reserved.
 *
 * Author: Dave Griffiths <dave@prim.demon.co.uk>
 */

#import "WindowInfo.h"
#import "CopyWindow.h"
#import "CyberPost.h"

@implementation WindowInfo

- initLocalNumber:(int)localNumber  globalNumber:(int)globalNumber
{
	localWindowNumber = localNumber;
	globalWindowNumber = globalNumber;
	
	return self;
}

- getFrame:(NXRect *)frame
/*
 * Return the windows current frame.
 */
{
	myCurrentWindowBounds(globalWindowNumber, &frame->origin.x, &frame->origin.y, 
		&frame->size.width, &frame->size.height);
		
	return self;
}

- (int)localWindowNumber
{
	return localWindowNumber;
}

- (int)globalWindowNumber
{
	return globalWindowNumber;
}

- windowImage
/*
 * Returns an NXImage containing the windows current contents.
 */
{
	id image;
	NXRect frame;
	
	[self getFrame:&frame];
	image = [[NXImage alloc] initSize:&frame.size];
	[self copyWindowToImage:image];
	
	return image;
}

- copyWindowToImage:image
/*
 * Copies the windows current contents into the given NXImage.
 */
{
	NXRect frame;
	
	[self getFrame:&frame];
	[image lockFocus];
	copyWindow(globalWindowNumber, 0.0, 0.0, frame.size.width, frame.size.height);
	[image unlockFocus];
	
	return self;
}

@end

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