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 / DataCopy / Sources / Pizza.cpp < prev    next >
Encoding:
Text File  |  1996-08-22  |  2.1 KB  |  84 lines  |  [TEXT/CWIE]

  1. //    Copyright © 1995-96 Apple Computer, Inc. All rights reserved.
  2. //    Release Version:    $ ODF 2 $
  3.  
  4. //==========================================================================
  5. #ifndef PIZZA_H
  6. #include "Pizza.h"                //  CPizza
  7. #endif
  8.  
  9. // ----- OS Layer Includes -----
  10. #ifndef FWOVLSHP_H
  11. #include "FWOvlShp.h"            // FW_COvalShape
  12. #endif
  13.  
  14. // ----- Foundation Layer -----
  15. #ifndef FWSTREAM_H
  16. #include "FWStream.h"
  17. #endif
  18.  
  19. //========================================================================================
  20. #ifdef FW_BUILD_MAC
  21. #pragma segment DataCopy
  22. #endif
  23.  
  24. //=== RunTime Info ========================================================
  25. FW_DEFINE_CLASS_M0(CPizza)
  26.  
  27. const FW_ClassTypeConstant LPizza = FW_TYPE_CONSTANT('p','i','z','a');
  28. FW_REGISTER_ARCHIVABLE_CLASS(LPizza, CPizza, CPizza::Read, 0, 0, CPizza::Write)
  29.  
  30. //==========================================================================
  31. CPizza::CPizza(FW_CRect bounds)
  32.  :    fBounds(bounds)
  33. {
  34. }
  35.  
  36. //--------------------------------------------------------------------------
  37. CPizza::~CPizza()
  38. {
  39. }
  40.  
  41. //--------------------------------------------------------------------------
  42. void    
  43. CPizza::Draw(FW_CGraphicContext& gc)
  44. {
  45.     FW_COvalShape::RenderOval(gc, fBounds, FW_kFill, FW_kRGBYellow);
  46.     FW_COvalShape::RenderOval(gc, fBounds, FW_kFrame);
  47. }
  48.  
  49. //--------------------------------------------------------------------------
  50. FW_CRect    
  51. CPizza::GetBounds()
  52. {
  53.     return fBounds;
  54. }
  55.  
  56. //--------------------------------------------------------------------------
  57. void 
  58. CPizza::Write(FW_CWritableStream& stream, FW_ClassTypeConstant type, const void *object)
  59. {
  60.     FW_UNUSED(type);
  61.      ((CPizza*)object)->Flatten(stream);
  62. }
  63.  
  64. //--------------------------------------------------------------------------
  65. void
  66. CPizza::Flatten(FW_CWritableStream& stream)
  67. {    
  68.     stream << fBounds;
  69. }
  70.  
  71. //--------------------------------------------------------------------------
  72. void* 
  73. CPizza::Read(FW_CReadableStream& stream, FW_ClassTypeConstant type)
  74. {
  75.     FW_UNUSED(type);
  76.     return new CPizza(stream);
  77. }
  78.  
  79. //--------------------------------------------------------------------------
  80. CPizza::CPizza(FW_CReadableStream& stream)
  81. {
  82.     stream >> fBounds;
  83. }
  84.