home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 October: Mac OS SDK / Dev.CD Oct 96 SDK / Dev.CD Oct 96 SDK2.toast / Development Kits (Disc 2) / OpenDoc Development Framework / Developer University / DUProjects / Graphics3D / Sources / Part.cpp < prev    next >
Encoding:
Text File  |  1996-08-16  |  3.5 KB  |  152 lines  |  [TEXT/CWIE]

  1. //========================================================================================
  2. //    Release Version:    $ ODF 1 $
  3. //    Copyright:    (c) 1993 - 1996 by Apple Computer, Inc., all rights reserved.
  4.  
  5. //================================================================================
  6. #include "Graphics3D.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. #ifndef SELECTION_H
  25. #include "Selection.h"
  26. #endif
  27.  
  28. #ifndef DEFINES_K
  29. #include "Defines.k"            // command numbers
  30. #endif
  31.  
  32. // ----- Framework Layer -----
  33. #ifndef FWPRESEN_H
  34. #include "FWPresen.h"        // FW_CPresentation
  35. #endif
  36.  
  37. #ifndef FWUTIL_H
  38. #include "FWUtil.h"            // FW_Beep()
  39. #endif
  40.  
  41. #ifndef FWABOUT_H
  42. #include "FWAbout.h"        //::FW_About()
  43. #endif
  44.  
  45. // ----- OS Layer -----
  46. #ifndef FWMENU_H
  47. #include "FWMenu.h"            // FW_CMenuBar, FW_CPullDownMenu
  48. #endif
  49.  
  50. #ifndef FWCFMRES_H
  51. #include "FWCFMRes.h"        // FW_CSharedLibraryResourceFile
  52. #endif
  53.  
  54. #ifndef FWRESTYP_H
  55. #include "FWResTyp.h"        // MULTISTRINGRES
  56. #endif
  57.  
  58. #ifndef FWEVENT_H
  59. #include "FWEvent.h"        // FW_CMenuEvent
  60. #endif
  61.  
  62. #ifndef FWSUSINK_H
  63. #include "FWSUSink.h"        // FW_CStorageUnitSink
  64. #endif
  65.  
  66. #ifndef FWBARRAY_H
  67. #include "FWBArray.h"        // FW_CByteArray
  68. #endif
  69.  
  70. // ----- Foundation Layer -----
  71. #ifndef FWSTREAM_H
  72. #include <FWStream.h>        // FW_InitializeArchiving
  73. #endif
  74.  
  75. #ifndef FWMEMMGR_H
  76. #include "FWMemMgr.h"        // FW_CMemoryManager
  77. #endif
  78.  
  79. #ifndef FWSUSINK_H
  80. #include "FWSUSink.h"        // FW_CStorageUnitSink
  81. #endif
  82.  
  83. //==============================================================================
  84. #ifdef FW_BUILD_MAC
  85. #pragma segment Graphics3D
  86. #endif
  87.  
  88. FW_DEFINE_AUTO(CGraphics3DPart)
  89.  
  90. //==============================================================================
  91. CGraphics3DPart::CGraphics3DPart(ODPart* odPart)
  92.   :    FW_CPart(odPart, FW_gInstance, kPartInfoID),
  93.     fPresentation(NULL),
  94.     fPartContent(NULL)
  95. {
  96. }
  97.  
  98. //--------------------------------------------------------------------------------
  99. CGraphics3DPart::~CGraphics3DPart()
  100. {
  101. }
  102.  
  103. //--------------------------------------------------------------------------------
  104. void 
  105. CGraphics3DPart::Initialize(Environment* ev)    // Override
  106. {
  107.     FW_CPart::Initialize(ev);
  108.     CGraphics3DSelection* selection = FW_NEW(CGraphics3DSelection, (ev, fPartContent));
  109.     const ODType kMainPresentation = "Apple:Presentation:Graphics3D";
  110.     const FW_Boolean kDefaultPresentation = true;
  111.     fPresentation = RegisterPresentation(ev, kMainPresentation, 
  112.                                             kDefaultPresentation, selection);
  113.     FW_CSharedLibraryResourceFile resFile(ev);
  114.     GetMenuBar(ev)->InitializeFromResource(ev, kMenuBarID);
  115. }
  116.  
  117. //--------------------------------------------------------------------------------
  118. FW_Boolean 
  119. CGraphics3DPart::DoMenu(Environment* ev, const FW_CMenuEvent& theMenuEvent)    // Override
  120. {
  121.     FW_Boolean menuHandled = true;
  122.     switch (theMenuEvent.GetCommandID(ev))
  123.     {
  124.         case kODCommandAbout:
  125.             ::FW_About(ev, this, kAbout);
  126.             break;
  127.  
  128.         default:
  129.             menuHandled = false;
  130.     }
  131.     
  132.     return menuHandled;
  133. }
  134.  
  135. //--------------------------------------------------------------------------------
  136. FW_CFrame* 
  137. CGraphics3DPart::NewFrame(Environment* ev, ODFrame* odFrame,
  138.                         FW_CPresentation* presentation, FW_Boolean fromStorage)    // Override
  139. {
  140.     FW_UNUSED(presentation);
  141.     FW_UNUSED(fromStorage);
  142.     return FW_NEW(CGraphics3DFrame, (ev, odFrame, presentation, fPartContent));
  143. }
  144.  
  145. //------------------------------------------------------------------------------
  146. FW_CContent* 
  147. CGraphics3DPart::NewPartContent(Environment* ev)
  148. {
  149.     fPartContent = FW_NEW(CGraphics3DContent, (ev, this));
  150.     return fPartContent;
  151. }
  152.