home *** CD-ROM | disk | FTP | other *** search
- /*
- * 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
-