home *** CD-ROM | disk | FTP | other *** search
/ Nebula 1995 August / NEBULA.mdf / SourceCode / Puppeteer1.1 / Source / WindowInfo.m < prev   
Encoding:
Text File  |  1994-03-23  |  1.2 KB  |  75 lines

  1. /*
  2.  * Puppeteer 1.1
  3.  *
  4.  * Copyright (c) 1994 Primitive Software Ltd.  All rights reserved.
  5.  *
  6.  * Author: Dave Griffiths <dave@prim.demon.co.uk>
  7.  */
  8.  
  9. #import "WindowInfo.h"
  10. #import "CopyWindow.h"
  11. #import "CyberPost.h"
  12.  
  13. @implementation WindowInfo
  14.  
  15. - initLocalNumber:(int)localNumber  globalNumber:(int)globalNumber
  16. {
  17.     localWindowNumber = localNumber;
  18.     globalWindowNumber = globalNumber;
  19.     
  20.     return self;
  21. }
  22.  
  23. - getFrame:(NXRect *)frame
  24. /*
  25.  * Return the windows current frame.
  26.  */
  27. {
  28.     myCurrentWindowBounds(globalWindowNumber, &frame->origin.x, &frame->origin.y, 
  29.         &frame->size.width, &frame->size.height);
  30.         
  31.     return self;
  32. }
  33.  
  34. - (int)localWindowNumber
  35. {
  36.     return localWindowNumber;
  37. }
  38.  
  39. - (int)globalWindowNumber
  40. {
  41.     return globalWindowNumber;
  42. }
  43.  
  44. - windowImage
  45. /*
  46.  * Returns an NXImage containing the windows current contents.
  47.  */
  48. {
  49.     id image;
  50.     NXRect frame;
  51.     
  52.     [self getFrame:&frame];
  53.     image = [[NXImage alloc] initSize:&frame.size];
  54.     [self copyWindowToImage:image];
  55.     
  56.     return image;
  57. }
  58.  
  59. - copyWindowToImage:image
  60. /*
  61.  * Copies the windows current contents into the given NXImage.
  62.  */
  63. {
  64.     NXRect frame;
  65.     
  66.     [self getFrame:&frame];
  67.     [image lockFocus];
  68.     copyWindow(globalWindowNumber, 0.0, 0.0, frame.size.width, frame.size.height);
  69.     [image unlockFocus];
  70.     
  71.     return self;
  72. }
  73.  
  74. @end
  75.