home *** CD-ROM | disk | FTP | other *** search
/ MacFormat 1995 January / macformat-020.iso / Shareware City / Developers / apps.to.go / DTS.Lib / CDEFs / DataCDEF.c < prev    next >
Encoding:
C/C++ Source or Header  |  1993-12-02  |  2.4 KB  |  117 lines  |  [TEXT/MPS ]

  1. /*
  2. ** Apple Macintosh Developer Technical Support
  3. **
  4. ** Program:         datacontrol.c
  5. ** Written by:      Eric Soldan
  6. **
  7. ** Copyright © 1992 Apple Computer, Inc.
  8. ** All rights reserved.
  9. */
  10.  
  11. /* Data control theory of operation:
  12. **
  13. ** The Data control is used simply as a data holder for data related to a window.
  14. ** The advantage to using this control is that when the window is disposed of,
  15. ** the data is automatically disposed of.  This allows you to create a handle for
  16. ** storage of auxiliary window data and not have to worry about its disposal. */
  17.  
  18. /* The Data control is always invisible, inactive, and non-hittable.  As it does nothing,
  19. ** you can use most fields for storage of information.  The fields you can use are:
  20. **
  21. ** struct ControlRecord {
  22. **    struct ControlRecord **nextControl;
  23. **    WindowPtr contrlOwner;
  24. **    Rect contrlRect;                        can use
  25. **    unsigned char contrlVis;
  26. **    unsigned char contrlHilite;
  27. **    short contrlValue;                    can use
  28. **    short contrlMin;                        can use
  29. **    short contrlMax;                        can use
  30. **    Handle contrlDefProc;
  31. **    Handle contrlData;                    can use to store a handle
  32. **    ProcPtr contrlAction;
  33. **    long contrlRfCon;                        can use
  34. **    Str255 contrlTitle;                    can use
  35. ** };
  36. **
  37. ** The contrlData field is either nil or it holds a handle.  If not nil, then the
  38. ** handle is dispose of when the control is disposed of. */
  39.  
  40.  
  41.  
  42. /*****************************************************************************/
  43.  
  44.  
  45.  
  46. #ifndef __CONTROLS__
  47. #include <Controls.h>
  48. #endif
  49.  
  50. #ifndef __MEMORY__
  51. #include <Memory.h>
  52. #endif
  53.  
  54.  
  55.  
  56. pascal long        CDataCtl   (short varCode, ControlHandle ctl, short msg, long parm);
  57.  
  58.  
  59.  
  60. /*****************************************************************************/
  61.  
  62.  
  63.  
  64. #pragma segment DataCDEF
  65. pascal long    CDataCtl(short varCode, ControlHandle ctl, short msg, long parm)
  66. {
  67. #pragma unused (varCode)
  68.  
  69.     Rect    rct;
  70.  
  71.     switch (msg) {
  72.  
  73.         case drawCntl:
  74.             break;
  75.  
  76.         case testCntl:
  77.             if (varCode == 1) {
  78.                 rct = (*ctl)->contrlRect;
  79.                 if (PtInRect(*(Point *)&parm, &rct)) return(1);
  80.             }
  81.             break;
  82.  
  83.         case calcCRgns:
  84.         case calcCntlRgn:
  85.             if (msg == calcCRgns)
  86.                 parm &= 0x00FFFFFF;
  87.             SetRectRgn((RgnHandle)parm, 0, 0, 0, 0);
  88.             break;
  89.  
  90.         case initCntl:
  91.             (*ctl)->contrlData = nil;
  92.             break;
  93.  
  94.         case dispCntl:
  95.             if ((*ctl)->contrlData)
  96.                 DisposeHandle((Handle)(*ctl)->contrlData);
  97.             break;
  98.  
  99.         case posCntl:
  100.             break;
  101.  
  102.         case thumbCntl:
  103.             break;
  104.  
  105.         case dragCntl:
  106.             break;
  107.  
  108.         case autoTrack:
  109.             break;
  110.     }
  111.  
  112.     return(0);
  113. }
  114.  
  115.  
  116.  
  117.