home *** CD-ROM | disk | FTP | other *** search
/ Otherware / Otherware_1_SB_Development.iso / mac / developm / scnote / cplussmp.014 / SCN.014.CPlusTESample < prev    next >
Encoding:
Text File  |  1990-01-17  |  3.2 KB  |  76 lines

  1. Macintosh
  2. Sample Code Notes
  3. _____________________________________________________________________________
  4.                                                   Developer Technical Support
  5.  
  6. #14:    CPlusTESample
  7.  
  8. Written by:    Andrew Shebanow
  9.  
  10. Versions:            1.00                        April 1989
  11.                     1.1                         July 1989
  12.                     1.2                         February 1990
  13.  
  14. Components:            CPlusTESample.make            February 1, 1990
  15.                     TApplicationCommon.h        February 1, 1990
  16.                     TApplication.h                February 1, 1990
  17.                     TDocument.h                    February 1, 1990
  18.                     TECommon.h                    February 1, 1990
  19.                     TESample.h                    February 1, 1990
  20.                     TEDocument.h                February 1, 1990
  21.                     TApplication.cp                February 1, 1990
  22.                     TDocument.cp                February 1, 1990
  23.                     TESample.cp                    February 1, 1990
  24.                     TEDocument.cp                February 1, 1990
  25.                     TESampleGlue.a                February 1, 1990
  26.                     TApplication.r                February 1, 1990
  27.                     TESample.r                    February 1, 1990
  28. _____________________________________________________________________________
  29.  
  30. CPlusTESample is an example application that demonstrates how to 
  31. initialize the commonly used Toolbox managers, operate 
  32. successfully under MultiFinder, handle desk accessories, and 
  33. create, grow, and zoom windows.  It demonstrates fundamental 
  34. TextEdit toolbox calls and TextEdit automatic scrolling, and it 
  35. shows how to create and maintain scroll bar controls.
  36.  
  37. This version of TESample has been substantially reworked in C++ to 
  38. show how a ╥typical╙ object-oriented program could be written.  To 
  39. this end, what was once a single source code file has been 
  40. restructured into a set of classes which demonstrate the 
  41. advantages of object-oriented programming.
  42.  
  43. There are four main classes in this program.  Each one of these 
  44. has a definition (.h) file and an implementation (.cp) file.
  45.  
  46. The TApplication class does all of the basic event handling and 
  47. initialization necessary for Macintosh Toolbox applications.  It 
  48. maintains a list of TDocument objects and passes events to the 
  49. correct TDocument class when appropriate.
  50.  
  51. The TDocument class does all of the basic document handling work.  
  52. TDocuments are objects that are associated with a window.  Methods 
  53. are provided to deal with update, activate, mouse-click, key-down, 
  54. and other events.  Some additional classes which implement a 
  55. linked list of TDocument objects are provided.
  56.  
  57. The TApplication and TDocument classes together define a basic 
  58. framework for Macintosh applications, without having any specific 
  59. knowledge about the type of data being displayed by the 
  60. application╒s documents. They are a (very) crude implementation of 
  61. the MacApp application model, without the sophisticated view 
  62. hierarchies or any real error handling.
  63.  
  64. The TESample class is a subclass of TApplication.  It overrides 
  65. several TApplication methods, including those for handling menu 
  66. commands and cursor adjustment, and it does some necessary 
  67. initialization.  Note that we only need to override nine methods 
  68. to create a useful application class.
  69.  
  70. The TEDocument class is a subclass of TDocument.  This class 
  71. contains most of the special-purpose code for text editing.  In 
  72. addition to overriding most of the TDocument methods, it defines a 
  73. number of additional methods which are used by the TESample class 
  74. to get information on the document state.
  75.  
  76.