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 / Sample3 / Sources / Frame.cpp < prev    next >
Encoding:
Text File  |  1996-08-16  |  2.5 KB  |  90 lines  |  [TEXT/CWIE]

  1. //    Copyright © 1995 Apple Computer, Inc. All rights reserved.
  2. //    Release Version:    $ 1.0 d11 $
  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 FWUTIL_H
  15. #include "FWUtil.h"                // FW_CFacetContext, FW_Beep()
  16. #endif
  17.  
  18. #ifndef FWCONTXT_H
  19. #include "FWContxt.h"            // FW_CViewContext
  20. #endif
  21.  
  22. // ----- Graphic Includes -----
  23. #ifndef FWRECT_H
  24. #include <FWRect.h>                // FW_CRect
  25. #endif
  26.  
  27. #ifndef FWRECSHP_H
  28. #include "FWRecShp.h"            // FW_CRectShape
  29. #endif
  30.  
  31. #ifndef SOM_DevUniv_STalker_xh
  32. #include "STalker.xh"            // for STalker
  33. #endif 
  34.  
  35. //========================================================================================
  36. #ifdef FW_BUILD_MAC
  37. #pragma segment Sample3
  38. #endif
  39.  
  40. //========================================================================================
  41. FW_DEFINE_AUTO(CSample3Frame)
  42.  
  43. const FW_Boolean kWaitUntilDone = TRUE;    // don't return until talking is finished.
  44. //========================================================================================
  45. CSample3Frame::CSample3Frame(Environment* ev, ODFrame* odFrame, 
  46.                                     FW_CPresentation* presentation, CSample3Part* sample3Part)
  47.   : FW_CFrame(ev, odFrame, presentation, sample3Part),
  48.       fSOMTalker(NULL)
  49. {
  50. #ifdef FW_BUILD_MAC                    // can we do text-to-speech on Windows?
  51.     fSOMTalker = new DevUniv_STalker;    
  52.     fSOMTalker->SayString(ev, "I use ODF", !kWaitUntilDone);    // say it!
  53. #endif
  54.     FW_END_CONSTRUCTOR
  55. }
  56.  
  57. //----------------------------------------------------------------------------------------
  58. CSample3Frame::~CSample3Frame()
  59. {
  60.     FW_START_DESTRUCTOR
  61. #ifdef FW_BUILD_MAC
  62.     delete fSOMTalker;
  63. #endif
  64. }
  65.  
  66. //----------------------------------------------------------------------------------------
  67. void 
  68. CSample3Frame::Draw(Environment *ev, ODFacet* odFacet, ODShape* invalidShape)    // Override
  69. {
  70.     FW_CViewContext context(ev, this, odFacet, invalidShape);
  71.     FW_CRect frameRect = this->GetBounds(ev);
  72.  
  73.     // fill frame with green  
  74.     FW_CRectShape rectShape(frameRect, FW_kFill);
  75.     rectShape.GetInk().SetForeColor(FW_kRGBGreen);
  76.     rectShape.Render(context);
  77. }
  78.  
  79. //----------------------------------------------------------------------------------------
  80. FW_Boolean 
  81. CSample3Frame::DoMouseDown(Environment* ev, const FW_CMouseEvent& theMouseEvent)
  82. {    
  83.     FW_UNUSED(ev);
  84.     FW_UNUSED(theMouseEvent);
  85. #ifdef FW_BUILD_MAC
  86.     fSOMTalker->SayString(ev, "Oh Boy", !kWaitUntilDone);    // say it!
  87. #endif
  88.     return TRUE;    // we handled event
  89. }
  90.