home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 January: Mac OS SDK / Dev.CD Jan 97 SDK2.toast / Development Kits (Disc 2) / OpenDoc Development Framework / Developer University / DU Projects / GraphicsBfr / Sources / Part.cpp < prev    next >
Encoding:
Text File  |  1996-08-22  |  2.6 KB  |  102 lines  |  [TEXT/CWIE]

  1. //    Release Version:    $ ODF 2 $
  2. //    Copyright:            (c) 1993 - 1996 by Apple Computer, Inc., all rights reserved.
  3.  
  4. //================================================================================
  5. #ifndef PART_H
  6. #include "Part.h"
  7. #endif
  8.  
  9. #ifndef FRAME_H
  10. #include "Frame.h"
  11. #endif
  12.  
  13. #ifndef DEFINES_K
  14. #include "Defines.k"
  15. #endif
  16.  
  17. #ifndef BINDING_K
  18. #include "Binding.k"
  19. #endif
  20.  
  21. // ----- Framework Includes -----
  22. #ifndef FWABOUT_H
  23. #include "FWAbout.h"        //::FW_About()
  24. #endif
  25.  
  26. #ifndef SLMIXOS_H
  27. #include "SLMixOS.h"        // FW_GetMainScreenBounds
  28. #endif
  29.  
  30. //==============================================================================
  31. #ifdef FW_BUILD_MAC
  32. #pragma segment GraphicsBfr
  33. #endif
  34.  
  35. FW_DEFINE_AUTO(CGraphicsBfrPart)
  36. //==============================================================================
  37. CGraphicsBfrPart::CGraphicsBfrPart(ODPart* odPart)
  38.   :    FW_CPart(odPart, FW_gInstance, kPartInfoID),
  39.       fPresentation(NULL)
  40. {
  41. }
  42.  
  43. //--------------------------------------------------------------------------------
  44. CGraphicsBfrPart::~CGraphicsBfrPart()
  45. {
  46. }
  47.  
  48. //--------------------------------------------------------------------------------
  49. void 
  50. CGraphicsBfrPart::Initialize(Environment* ev, ODStorageUnit* storageUnit, 
  51.                                                 FW_Boolean fromStorage)    // Override
  52. {
  53.     FW_CPart::Initialize(ev, storageUnit, fromStorage);
  54.     FW_CSelection* selection = NULL;
  55.     const ODType kMainPresentation = "Apple:Presentation:GraphicsBfr";
  56.     fPresentation = this->RegisterPresentation(ev, kMainPresentation, true, selection);
  57. }
  58.  
  59. //--------------------------------------------------------------------------------
  60. FW_CFrame* 
  61. CGraphicsBfrPart::NewFrame(Environment* ev, ODFrame* odFrame,
  62.                         FW_CPresentation* presentation, FW_Boolean fromStorage)    // Override
  63. {
  64.     FW_UNUSED(fromStorage);
  65.     return FW_NEW(CGraphicsBfrFrame, (ev, odFrame, presentation, this));
  66. }
  67.  
  68. //----------------------------------------------------------------------------------------
  69. FW_CWindow* 
  70. CGraphicsBfrPart::NewDocumentWindow(Environment* ev)
  71. {    
  72.     FW_CRect screenBounds;
  73.     ::FW_GetMainScreenBounds(screenBounds);
  74.     screenBounds.Inset(FW_IntToFixed(3), FW_IntToFixed(3));
  75.     
  76.     return new FW_CWindow(ev,
  77.                         this,
  78.                          FW_CPart::fgViewAsFrameToken,
  79.                         fPresentation,
  80.                         FW_CPoint(FW_IntToFixed(300), FW_IntToFixed(300)),
  81.                         screenBounds.TopLeft(),
  82.                         FW_kDocumentWindow);
  83. }
  84.  
  85. //--------------------------------------------------------------------------------
  86. FW_CContent* 
  87. CGraphicsBfrPart::NewPartContent(Environment* ev)
  88. {
  89.     FW_UNUSED(ev);
  90.     return NULL;
  91. }
  92.  
  93. //--------------------------------------------------------------------------------
  94. FW_Handled 
  95. CGraphicsBfrPart::DoAbout(Environment* ev)
  96. {
  97.     ::FW_About(ev, this, kAbout);
  98.     
  99.     return FW_kHandled;
  100. }
  101.  
  102.