home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Windows Gam…ming Gurus (2nd Edition) / Disc2.iso / msdn_vcb / samples / vc98 / sdk / graphics / audio / idfedit / drawstr.h < prev    next >
C/C++ Source or Header  |  1997-10-05  |  5KB  |  183 lines

  1.  
  2. /*****************************************************************************
  3. *
  4. *  THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF
  5. *  ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED
  6. *  TO THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR
  7. *  A PARTICULAR PURPOSE.
  8. *
  9. *  Copyright (C) 1993 - 1997 Microsoft Corporation. All Rights Reserved.
  10. *
  11. *****************************************************************************/
  12.  
  13. /*+
  14.  *  drawstr.h
  15.  *
  16.  *  structures & define & prototypes for the structure dumper
  17.  *
  18.  *
  19.  *-==================================================================*/
  20.  
  21. #if !defined DRAWSTR_H
  22. #define DRAWSTR_H
  23.  
  24. typedef struct _dsfield {
  25.    LPTSTR psz;
  26.    UINT   off;
  27.    UINT   siz;
  28.    UINT   fmt;
  29.    UINT   aux;
  30.    UINT   array;
  31.    } DSFIELD, * PDSFIELD;
  32.  
  33. typedef struct _dsfieldtbl {
  34.    PDSFIELD pFields;
  35.    LPCTSTR  pszName;
  36.    UINT     cbSize;
  37.    } DSFIELDTBL, * PDSFIELDTBL;
  38.  
  39. typedef struct _dsbuff {
  40.    LPTSTR  ptr;
  41.    UINT    cch;
  42.    } DSBUFF, *PDSBUFF;
  43.  
  44. typedef struct _dslineinfo {
  45.    UINT   nMaxLine;
  46.    UINT   nCurLine;
  47.    UINT   nMaxDepth;
  48.    UINT   nCurDepth;
  49.    int    cyLine;
  50.    struct _dsline {
  51.       LPVOID lpv;
  52.       UINT   uStruct;
  53.       UINT   uField;
  54.       WORD   uDepth;
  55.       WORD   uMember;
  56.       } aLine[10];
  57.    } DSLINEINFO, * PDSLINEINFO;
  58.  
  59. typedef struct _viewinit {
  60.    PDSFIELDTBL pTable;
  61.    UINT        uStruct;
  62.    UINT        uRepeat;
  63.    LPVOID      lpData;
  64.    } VIEWINIT, *PVIEWINIT;
  65.  
  66. // global preferences.
  67. //
  68. typedef struct _dspref {
  69.     BOOL bShowAddresses;
  70.     } DSPREF;
  71. extern DSPREF dspref;
  72.  
  73. #if !defined FIELDOFF
  74. #define FIELDSIZ(st,field)  (unsigned int) (sizeof(((st *)0)->field))
  75. #define FIELDREFSIZ(st,field)  (unsigned int) (sizeof(*(((st *)0)->field)))
  76. #define FIELDOFF(st,field)  (unsigned int) (&(((st *)0)->field))
  77. #define FLD(st,field)  FIELDOFF(st,field), FIELDSIZ(st,field)
  78. #define PFLD(st,field) FIELDOFF(st,field), FIELDREFSIZ(st,field)
  79. #endif
  80.  
  81. #ifndef NUMELMS
  82. #define NUMELMS(aa) (sizeof(aa)/sizeof((aa)[0]))
  83. #endif
  84.  
  85. #define AS_NONE         0
  86. #define AS_SZ           1
  87. #define AS_ACH          2
  88. #define AS_INT          3
  89. #define AS_UINT         4
  90. #define AS_HEX          5
  91. #define AS_BITFIELD     6
  92. #define AS_HANDLE       7
  93. #define AS_HWND         8
  94. #define AS_MODE         9
  95. #define AS_ERROR        10
  96. #define AS_XMODE        11
  97.  
  98. #define AS_RECT         16
  99. #define AS_POINT        17
  100. #define AS_POINTS       18
  101. #define AS_SIZE         19
  102. #define AS_FLOAT        20
  103. #define AS_BYTES        21
  104. #define AS_DUMP         22
  105.  
  106. #define AS_STRUCT      0x0100
  107. #define IS_EDIT        0x0200
  108. #define AS_REF         0x1000
  109. #define AS_ARRAY       0x4000
  110.  
  111.  
  112. VOID FAR PASCAL DrawDsLabels (
  113.    HDC          hDC,
  114.    PDSFIELDTBL  pTable,
  115.    PDSLINEINFO  lpLineInfo,
  116.    LPRECT       lpRect,
  117.    POINT        ptOffset);
  118.  
  119. VOID FAR PASCAL DrawDsData (
  120.    HDC          hDC,
  121.    PDSFIELDTBL  pTable,     // info used to label and format fields in struct
  122.    PDSLINEINFO  lpLineInfo, //
  123.    LPRECT       lpRect,     // rectangle to clip drawing to
  124.    POINT        ptOffset);  // scrolling offset for upper left corner
  125.  
  126. int FAR PASCAL GetDsLabelWidth (
  127.    HDC          hDC,
  128.    PDSFIELDTBL  pTable,      // info used to label and format fields in struct
  129.    PDSLINEINFO  lpLineInfo); //
  130.  
  131. PDSLINEINFO WINAPI AllocDsLineInfo (
  132.    UINT         nMax);
  133.  
  134. VOID FAR PASCAL BuildDsLineInfo (
  135.    PDSFIELDTBL pTable,      //in:
  136.    UINT        uStruct,     //in:
  137.    LPVOID      lpData,      //in:
  138.    WORD        nMember,     //in: index into lpData
  139.    WORD        nLastMember, //in: index into lpData
  140.    PDSLINEINFO pLineInfo);  //in,out:
  141.  
  142. BOOL WINAPI ExpandDsLineInfo (
  143.    PDSFIELDTBL pTable,     // info used to label and format fields in struct
  144.    UINT        nLine,      // line to expand (if possible)
  145.    PDSLINEINFO pLineInfo);
  146.  
  147. BOOL WINAPI ContractDsLineInfo (
  148.    PDSFIELDTBL pTable,     // info used to label and format fields in struct
  149.    UINT        nLine,      // line to expand (if possible)
  150.    PDSLINEINFO pLineInfo);
  151.  
  152. LRESULT WINAPI ViewWndProc (
  153.    HWND    hWnd,           // handle of spy window
  154.    UINT    wMsgID,         // id of current message
  155.    WPARAM  wParam,         // word argument, depends on message id
  156.    LPARAM  lParam);        // long argument, depends on message id
  157.  
  158. VOID WINAPI DrawDragEdge(
  159.    HWND    hWnd, 
  160.    LPPOINT lppt, 
  161.    LPPOINT lpptLastEdge);
  162.  
  163. #define VM_GETDATA   (WM_USER + 100)
  164. #define View_GetData(hWnd) (LPVOID)SendMessage(hWnd, VM_GETDATA, 0, 0)
  165. #define VM_SETDATA   (WM_USER + 101)
  166. #define View_SetData(hWnd,lpv) (LPVOID)SendMessage(hWnd, VM_SETDATA, 0, (LPARAM)lpv)
  167.  
  168. #define VM_INVALIDATE (WM_USER + 102)
  169. #define View_InvalidateLine(hWnd,nLine) SendMessage(hWnd, VM_INVALIDATE, 0, (LPARAM)nLine)
  170. #define View_InvalidateLines(hWnd,nLine,nCount) SendMessage(hWnd, VM_INVALIDATE, (WPARAM)nCount, (LPARAM)nLine)
  171.  
  172. #define VM_SETSEL    (WM_USER + 103)
  173. #define View_SetSel(hWnd, nLine) SendMessage (hWnd, VM_SETSEL, 0, (LPARAM)nLine);
  174.  
  175. #define VM_EDITNEXT  (WM_USER + 104)
  176. #define View_EditNext(hWnd,bPrev) SendMessage (hWnd, VM_EDITNEXT, (WPARAM)bPrev, 0);
  177.  
  178. // notifications
  179. //
  180. #define VN_CHANGE  (0U-800U)
  181.  
  182. #endif // drawstr_h
  183.