home *** CD-ROM | disk | FTP | other *** search
/ Otherware / Otherware_1_SB_Development.iso / mac / developm / scnote / cplussmp.014 / TEDocument.h < prev    next >
Encoding:
C/C++ Source or Header  |  1989-10-01  |  3.0 KB  |  107 lines

  1. /*------------------------------------------------------------------------------
  2. #
  3. #    Apple Macintosh Developer Technical Support
  4. #
  5. #    MultiFinder-Aware Simple TextEdit Sample Application
  6. #
  7. #    CPlusTESample
  8. #
  9. #    TEDocument.h    -    C++ source
  10. #
  11. #    Copyright ⌐ 1989 Apple Computer, Inc.
  12. #    All rights reserved.
  13. #
  14. #    Versions:    
  15. #            1.20                    10/89
  16. #            1.10                     07/89
  17. #            1.00                     04/89
  18. #    
  19. #    Components:
  20. #            CPlusTESample.make        October 1, 1989
  21. #            TApplicationCommon.h    October 1, 1989
  22. #            TApplication.h            October 1, 1989
  23. #            TDocument.h                October 1, 1989
  24. #            TECommon.h                October 1, 1989
  25. #            TESample.h                October 1, 1989
  26. #            TEDocument.h            October 1, 1989
  27. #            TApplication.cp            October 1, 1989
  28. #            TDocument.cp            October 1, 1989
  29. #            TESample.cp                October 1, 1989
  30. #            TEDocument.cp            October 1, 1989
  31. #            TESampleGlue.a            October 1, 1989
  32. #            TApplication.r            October 1, 1989
  33. #            TESample.r                October 1, 1989
  34. #
  35. #    CPlusTESample is an example application that demonstrates
  36. #    how to initialize the commonly used toolbox managers,
  37. #    operate successfully under MultiFinder, handle desk
  38. #    accessories and create, grow, and zoom windows. The
  39. #    fundamental TextEdit toolbox calls and TextEdit autoscroll
  40. #    are demonstrated. It also shows how to create and maintain
  41. #    scrollbar controls. 
  42. #
  43. #    This version of TESample has been substantially reworked in
  44. #    C++ to show how a "typical" object oriented program could
  45. #    be written. To this end, what was once a single source code
  46. #    file has been restructured into a set of classes which
  47. #    demonstrate the advantages of object-oriented programming.
  48. #
  49. ------------------------------------------------------------------------------*/
  50.  
  51. #ifndef __TEDOCUMENT__
  52. #define __TEDOCUMENT__
  53.  
  54. #include <Types.h>
  55. #include <TextEdit.h>
  56. #include <Controls.h>
  57. #include <Events.h>
  58.  
  59. #ifndef __TDOCUMENT__
  60. #include "TDocument.h"
  61. #endif __TDOCUMENT__
  62.  
  63. class TEDocument : public TDocument {
  64. private:
  65.     TEHandle        fDocTE;            // our text
  66.     ControlHandle    fDocVScroll;    // vertical scrollbar
  67.     ControlHandle    fDocHScroll;    // horizontal scrollbar
  68.     ClikLoopProcPtr    fDocClik;        // our clik loop
  69.  
  70.     // methods not intended for use outside of this class
  71.     void GetTERect(Rect* teRect);
  72.     void AdjustTE();
  73.     void DrawWindow();
  74.     void AdjustViewRect();
  75.     void ResizeWindow();
  76.     void AdjustHV(Boolean isVert,Boolean mustRedraw);
  77.     void AdjustScrollSizes();
  78.     void AdjustScrollbars(Boolean needsResize);
  79.  
  80. public:
  81.     TEDocument(short resID);
  82.     virtual ~TEDocument();
  83.  
  84.     // methods from TDocument we override
  85.     virtual void DoZoom(short partCode);
  86.     virtual void DoGrow(EventRecord* theEvent);
  87.     virtual void DoContent(EventRecord* theEvent);
  88.     virtual void DoKeyDown(EventRecord* theEvent);
  89.     virtual void DoActivate(Boolean becomingActive);
  90.     virtual void DoIdle();
  91.     virtual void DoUpdate();
  92.     virtual void DoCut();
  93.     virtual void DoCopy();
  94.     virtual void DoPaste();
  95.     virtual void DoClear();
  96.     virtual unsigned long CalcIdle();
  97.     virtual Boolean HaveSelection();
  98.  
  99.     // new public methods
  100.     void AdjustScrollValues(Boolean mustRedraw);
  101.     ClikLoopProcPtr GetClikLoop();
  102.     TEHandle GetTEHandle();
  103.     void GetVisTERgn(RgnHandle rgn);
  104. };
  105.  
  106. #endif __TEDOCUMENT__
  107.