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 / Data / Sources / Part.cpp < prev    next >
Encoding:
Text File  |  1996-08-22  |  2.5 KB  |  98 lines  |  [TEXT/CWIE]

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