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 / DataSave / Sources / Pizza.cpp < prev    next >
Encoding:
Text File  |  1996-12-11  |  2.0 KB  |  79 lines  |  [TEXT/CWIE]

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