home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 February: Technology Seed / Mac Tech Seed Feb '97.toast / ODF Release 3 / Developer University / DU Projects / ExtSample / Sources / Part.cpp < prev    next >
Encoding:
Text File  |  1996-12-11  |  2.6 KB  |  100 lines  |  [TEXT/CWIE]

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