home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 2000 October: Mac OS SDK / Dev.CD Oct 00 SDK1.toast / Development Kits / Mac OS / MLTE SDK / TEtoMLTESample / MLTESources / MLTEDocument.h < prev    next >
Encoding:
C/C++ Source or Header  |  1999-12-24  |  3.2 KB  |  104 lines  |  [TEXT/MPS ]

  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.10                     07/89
  16. #            1.00                     04/89
  17. #
  18. #    Components:
  19. #            CPlusTESample.make        July 9, 1989
  20. #            TApplicationCommon.h    July 9, 1989
  21. #            TApplication.h            July 9, 1989
  22. #            TDocument.h                July 9, 1989
  23. #            TECommon.h                July 9, 1989
  24. #            TESample.h                July 9, 1989
  25. #            TEDocument.h            July 9, 1989
  26. #            TApplication.cp            July 9, 1989
  27. #            TDocument.cp            July 9, 1989
  28. #            TESample.cp                July 9, 1989
  29. #            TEDocument.cp            July 9, 1989
  30. #            TESampleGlue.a            July 9, 1989
  31. #            TApplication.r            July 9, 1989
  32. #            TESample.r                July 9, 1989
  33. #
  34. #    CPlusTESample is an example application that demonstrates
  35. #    how to initialize the commonly used toolbox managers,
  36. #    operate successfully under MultiFinder, handle desk
  37. #    accessories and create, grow, and zoom windows. The
  38. #    fundamental TextEdit toolbox calls and TextEdit autoscroll
  39. #    are demonstrated. It also shows how to create and maintain
  40. #    scrollbar controls. 
  41. #
  42. #    This version of TESample has been substantially reworked in
  43. #    C++ to show how a "typical" object oriented program could
  44. #    be written. To this end, what was once a single source code
  45. #    file has been restructured into a set of classes which
  46. #    demonstrate the advantages of object-oriented programming.
  47. #
  48. ------------------------------------------------------------------------------*/
  49.  
  50. #ifndef TEDocument_Defs
  51. #define TEDocument_Defs
  52.  
  53. #include <Types.h>
  54. #include <MacTextEditor.h>
  55. #include <Controls.h>
  56. #include <Events.h>
  57.  
  58. #include "TDocument.h"
  59.  
  60. class TEDocument : public TDocument
  61. {
  62.     //change change TEHandle to TXNObject and add a frame ID
  63.     TXNObject            fMLTEObject;    // our text
  64.     TXNFrameID            fMLTEFrameID;
  65.     //change remove the scrollbars and the click loop UPP
  66.  
  67.     // remove all the private classes that munged the TERect
  68.     // or dealt with controls
  69.  
  70. public:
  71.     TEDocument(short resID);
  72.     ~TEDocument(void);
  73.  
  74.     // methods from TDocument we override
  75.         void DoZoom                ( short partCode );
  76.         void DoGrow                ( EventRecord* theEvent );
  77.         void DoContent            ( EventRecord* theEvent );
  78.         void DoKeyDown            ( EventRecord* theEvent );
  79.         void DoActivate            ( Boolean becomingActive );
  80.         void DoIdle                ( void );
  81.         void DoUpdate            ( void );
  82.         void DoCut                ( void );
  83.         void DoCopy                ( void );
  84.         void DoPaste            ( void );
  85.         void DoClear            ( void );
  86.         unsigned long CalcIdle    ( void );
  87.         Boolean HaveSelection    ( void );
  88.  
  89.     // new public methods
  90.     // reomve AdjustScrollValues, GetClickLoop
  91.     // change GetTEHandle to GetMLTEObject
  92.         TXNObject            GetMLTEObject        ( void );
  93.     //remove GetVisTERgn
  94.  
  95.     
  96. };  /* class TEDocument */
  97.  
  98.     // methods for housekeeping
  99.             void    AlertUser                    ( short errResID, short errCode );                // display alert, using specified error STR# resource and error code as index
  100.     inline    void    SetWindowDoc                ( WindowPtr theWindow, TEDocument *theDoc )    { SetWRefCon( theWindow, long( theDoc )); }
  101.     inline            TEDocument* GetWindowDoc    ( WindowPtr theWindow )                        { return (TEDocument*) ( GetWRefCon( theWindow )); }
  102.  
  103. #endif // TEDocument_Defs
  104.