home *** CD-ROM | disk | FTP | other *** search
/ MacFormat 1995 January / macformat-020.iso / Shareware City / Developers / apps.to.go / DTS.Draw / TreeObj2.c < prev    next >
Encoding:
C/C++ Source or Header  |  1994-05-05  |  2.3 KB  |  106 lines  |  [TEXT/MPS ]

  1. /*
  2. ** Apple Macintosh Developer Technical Support
  3. **
  4. ** File:        TreeObj2.c
  5. ** Written by:    Eric Soldan
  6. **
  7. ** Copyright © 1992-1993 Apple Computer, Inc.
  8. ** All rights reserved.
  9. */
  10.  
  11. /* You may incorporate this sample code into your applications without
  12. ** restriction, though the sample code has been provided "AS IS" and the
  13. ** responsibility for its operation is 100% yours.  However, what you are
  14. ** not permitted to do is to redistribute the source as "DSC Sample Code"
  15. ** after having made changes. If you're going to re-distribute the source,
  16. ** we require that you make it clear in the source that the code was
  17. ** descended from Apple Sample Code, but that you've made changes. */
  18.  
  19. #include "App.h"            /* Get the application includes/typedefs, etc.    */
  20. #include "App.protos.h"        /* Get the prototypes for the application.        */
  21.  
  22. #ifndef __TREEOBJ2__
  23. #include "TreeObj2.h"
  24. #endif
  25.  
  26. extern TreeObjProcPtr    gTreeObjMethods[];
  27.  
  28.  
  29.  
  30. /**********************************************************************/
  31.  
  32.  
  33.  
  34. #pragma segment File
  35. TreeObjHndl    DoTreeHitTest(TreeObjHndl hndl, ClickInfo *click)
  36. {
  37.     short        cnum;
  38.     TreeObjHndl    hit;
  39.  
  40.     hit = (TreeObjHndl)DoTreeObjMethod(hndl, HITTESTMESSAGE, (long)click);
  41.     if (hit) return(hit);
  42.  
  43.     for (cnum = 0; cnum < (*hndl)->numChildren; ++cnum) {
  44.         hit = DoTreeHitTest(GetChildHndl(hndl, cnum), click);
  45.         if (hit) return(hit);
  46.     }
  47.  
  48.     return(nil);
  49. }
  50.  
  51.  
  52.  
  53. /**********************************************************************/
  54.  
  55.  
  56.  
  57. #pragma segment File
  58. void    DoTreeDraw(TreeObjHndl hndl, short drawType)
  59. {
  60.     DoBTreeMethod(hndl, DRAWMESSAGE, drawType);
  61. }
  62.  
  63.  
  64.  
  65. /**********************************************************************/
  66.  
  67.  
  68.  
  69. #pragma segment File
  70. void    DoTreeSelect(TreeObjHndl hndl, short selectType)
  71. {
  72.     FileRecHndl    frHndl;
  73.     WindowPtr    window;
  74.  
  75.     frHndl = mDerefRoot(GetRootHndl(hndl))->frHndl;
  76.     BeginContent(window = (*frHndl)->fileState.window);
  77.     DoFTreeMethod(hndl, SETSELECTMESSAGE, selectType);
  78.     EndContent(window);
  79. }
  80.  
  81.  
  82.  
  83. /**********************************************************************/
  84.  
  85.  
  86.  
  87. #pragma segment File
  88. long    DoTreeObjMethodClipped(TreeObjHndl hndl, short message, long data)
  89. {
  90.     FileRecHndl    frHndl;
  91.     WindowPtr    window;
  92.     long        val;
  93.  
  94.     frHndl = mDerefRoot(GetRootHndl(hndl))->frHndl;
  95.     BeginContent(window = (*frHndl)->fileState.window);
  96.  
  97.     val = DoTreeObjMethod(hndl, message, data);
  98.  
  99.     EndContent(window);
  100.  
  101.     return(val);
  102. }
  103.  
  104.  
  105.  
  106.