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 / Sample2 / Sources / Frame.cpp < prev    next >
Encoding:
Text File  |  1996-08-22  |  2.0 KB  |  73 lines  |  [TEXT/CWIE]

  1. //    Release Version:    $ ODF 2 $
  2. //    Copyright:            (c) 1993 - 1996 by Apple Computer, Inc., all rights reserved.
  3.  
  4. //=======================================================================
  5. #ifndef FRAME_H
  6. #include "Frame.h"
  7. #endif
  8.  
  9. #ifndef PART_H
  10. #include "Part.h"
  11. #endif
  12.  
  13. // ----- Framework Layer -----
  14. #ifndef FWCONTXT_H
  15. #include "FWContxt.h"            // FW_CViewContext
  16. #endif
  17.  
  18. // ----- Graphic Includes -----
  19. #ifndef FWRECT_H
  20. #include <FWRect.h>                // FW_CRect
  21. #endif
  22.  
  23. #ifndef FWRECSHP_H
  24. #include "FWRecShp.h"            // FW_CRectShape
  25. #endif
  26.  
  27. #ifndef SOM_DevUniv_STalker_xh
  28. #include "STalker.xh"            // for STalker
  29. #endif 
  30.  
  31. //========================================================================================
  32. #ifdef FW_BUILD_MAC
  33. #pragma segment Sample2
  34. #endif
  35.  
  36. //========================================================================================
  37. FW_DEFINE_AUTO(CSample2Frame)
  38.  
  39. const FW_Boolean kWaitUntilDone = TRUE;    // don't return until talking is finished.
  40.  
  41. //========================================================================================
  42. CSample2Frame::CSample2Frame(Environment* ev, ODFrame* odFrame, 
  43.                                     FW_CPresentation* presentation, CSample2Part* sample2Part)
  44.   : FW_CFrame(ev, odFrame, presentation, sample2Part),
  45.       fSOMTalker(NULL)
  46. {
  47. #ifdef FW_BUILD_MAC                    // can we do text-to-speech on Windows?
  48.     fSOMTalker = new DevUniv_STalker;    
  49.     fSOMTalker->SayString(ev, "I use ODF", !kWaitUntilDone);    // say it!
  50. #endif
  51.     FW_END_CONSTRUCTOR
  52. }
  53.  
  54. //----------------------------------------------------------------------------------------
  55. CSample2Frame::~CSample2Frame()
  56. {
  57.     FW_START_DESTRUCTOR
  58.     delete fSOMTalker;
  59. }
  60.  
  61. //----------------------------------------------------------------------------------------
  62. void 
  63. CSample2Frame::Draw(Environment* ev, ODFacet* odFacet, ODShape* invalidShape)    // Override
  64. {
  65.     FW_CViewContext context(ev, this, odFacet, invalidShape);
  66.     FW_CRect frameRect = this->GetBounds(ev);
  67.  
  68.     // fill frame with green  
  69.     FW_CRectShape rectShape(frameRect, FW_kFill);
  70.     rectShape.GetInk().SetForeColor(FW_kRGBGreen);
  71.     rectShape.Render(context);
  72. }
  73.