Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

208 lines
8.1 KiB

  1. /*****************************************************************************\
  2. * *
  3. * custcntl.h - Custom Control Library header file *
  4. * *
  5. * Copyright (c) 1992-1993, Microsoft Corp. All rights reserved *
  6. * *
  7. \*****************************************************************************/
  8. #ifndef _INC_CUSTCNTL
  9. #define _INC_CUSTCNTL
  10. #ifdef __cplusplus
  11. extern "C" { /* Assume C declarations for C++ */
  12. #endif /* __cplusplus */
  13. /*
  14. * General size defines.
  15. */
  16. #define CCHCCCLASS 32 // Max chars in a class name.
  17. #define CCHCCDESC 32 // Max chars in a control description.
  18. #define CCHCCTEXT 256 // Max chars in a text field.
  19. /*
  20. * CCSTYLE - Custom Control Style structure. This structure is passed
  21. * tp the Custom Control Style function when the user wants to edit the
  22. * styles of the custom control.
  23. */
  24. typedef struct tagCCSTYLEA {
  25. DWORD flStyle; // Style of the control.
  26. DWORD flExtStyle; // Extended style of the control.
  27. CHAR szText[CCHCCTEXT]; // Text of the control.
  28. LANGID lgid; // Language Id of the control's dialog.
  29. WORD wReserved1; // Reserved value. Do not change.
  30. } CCSTYLEA, *LPCCSTYLEA;
  31. typedef struct tagCCSTYLEW {
  32. DWORD flStyle; // Style of the control.
  33. DWORD flExtStyle; // Extended style of the control.
  34. WCHAR szText[CCHCCTEXT]; // Text of the control.
  35. LANGID lgid; // Language Id of the control's dialog.
  36. WORD wReserved1; // Reserved value. Do not change.
  37. } CCSTYLEW, *LPCCSTYLEW;
  38. #ifdef UNICODE
  39. #define CCSTYLE CCSTYLEW
  40. #define LPCCSTYLE LPCCSTYLEW
  41. #else
  42. #define CCSTYLE CCSTYLEA
  43. #define LPCCSTYLE LPCCSTYLEA
  44. #endif // UNICODE
  45. /*
  46. * The Style function prototype. This will be called when the user
  47. * wants to edit the styles of a custom control. It should display a
  48. * dialog to edit the styles, update the styles in the pccs structure,
  49. * then return TRUE for success. If an error occurs or the user
  50. * cancels the dialog, FALSE should be returned.
  51. */
  52. typedef BOOL (CALLBACK* LPFNCCSTYLEA)(HWND hwndParent, LPCCSTYLEA pccs);
  53. typedef BOOL (CALLBACK* LPFNCCSTYLEW)(HWND hwndParent, LPCCSTYLEW pccs);
  54. #ifdef UNICODE
  55. #define LPFNCCSTYLE LPFNCCSTYLEW
  56. #else
  57. #define LPFNCCSTYLE LPFNCCSTYLEA
  58. #endif // UNICODE
  59. /*
  60. * The SizeToText function prototype. This will be called if the user
  61. * requests that the custom control be sized to fit it's text. It
  62. * should use the specified styles, text and font to determine how
  63. * large the control must be to accommodate the text, then return this
  64. * value in pixels. The value of -1 should be returned if an error
  65. * occurs.
  66. */
  67. typedef INT (CALLBACK* LPFNCCSIZETOTEXTA)(DWORD flStyle, DWORD flExtStyle,
  68. HFONT hfont, LPSTR pszText);
  69. typedef INT (CALLBACK* LPFNCCSIZETOTEXTW)(DWORD flStyle, DWORD flExtStyle,
  70. HFONT hfont, LPWSTR pszText);
  71. #ifdef UNICODE
  72. #define LPFNCCSIZETOTEXT LPFNCCSIZETOTEXTW
  73. #else
  74. #define LPFNCCSIZETOTEXT LPFNCCSIZETOTEXTA
  75. #endif // UNICODE
  76. /*
  77. * CCSTYLEFLAG - Custom Control Style Flag structure. A table of these
  78. * structures is used to specify the define strings that match the
  79. * different styles for a custom control.
  80. */
  81. typedef struct tagCCSTYLEFLAGA {
  82. DWORD flStyle; // Style bits for this style.
  83. DWORD flStyleMask; // Mask for the style. Can be zero.
  84. LPSTR pszStyle; // Points to the style define string.
  85. } CCSTYLEFLAGA, *LPCCSTYLEFLAGA;
  86. typedef struct tagCCSTYLEFLAGW {
  87. DWORD flStyle; // Style bits for this style.
  88. DWORD flStyleMask; // Mask for the style. Can be zero.
  89. LPWSTR pszStyle; // Points to the style define string.
  90. } CCSTYLEFLAGW, *LPCCSTYLEFLAGW;
  91. #ifdef UNICODE
  92. #define CCSTYLEFLAG CCSTYLEFLAGW
  93. #define LPCCSTYLEFLAG LPCCSTYLEFLAGW
  94. #else
  95. #define CCSTYLEFLAG CCSTYLEFLAGA
  96. #define LPCCSTYLEFLAG LPCCSTYLEFLAGA
  97. #endif // UNICODE
  98. /*
  99. * CCF_* defines. These flags are used for the flOptions field of the
  100. * CCINFO structure, and describe some basic characteristics of the
  101. * custom control.
  102. */
  103. #define CCF_NOTEXT 0x00000001 // Control cannot have text.
  104. /*
  105. * CCINFO - Custom Control Info structure. This structure provides
  106. * the dialog editor with information about the control types that the
  107. * DLL supports.
  108. */
  109. typedef struct tagCCINFOA {
  110. CHAR szClass[CCHCCCLASS]; // Class name for the control.
  111. DWORD flOptions; // Option flags (CCF_* defines).
  112. CHAR szDesc[CCHCCDESC]; // Short, descriptive text for the ctrl.
  113. UINT cxDefault; // Default width (in dialog units).
  114. UINT cyDefault; // Default height (in dialog units).
  115. DWORD flStyleDefault; // Default style (WS_CHILD | WS_VISIBLE).
  116. DWORD flExtStyleDefault; // Default extended style.
  117. DWORD flCtrlTypeMask; // Mask for control type styles.
  118. CHAR szTextDefault[CCHCCTEXT]; // Default text.
  119. INT cStyleFlags; // Entries in the following style table.
  120. LPCCSTYLEFLAGA aStyleFlags; // Points to style flag table.
  121. LPFNCCSTYLEA lpfnStyle; // Pointer to the Styles function.
  122. LPFNCCSIZETOTEXTA lpfnSizeToText; // Pointer to the SizeToText function.
  123. DWORD dwReserved1; // Reserved. Must be zero.
  124. DWORD dwReserved2; // Reserved. Must be zero.
  125. } CCINFOA, *LPCCINFOA;
  126. typedef struct tagCCINFOW {
  127. WCHAR szClass[CCHCCCLASS]; // Class name for the control.
  128. DWORD flOptions; // Option flags (CCF_* defines).
  129. WCHAR szDesc[CCHCCDESC]; // Short, descriptive text for the ctrl.
  130. UINT cxDefault; // Default width (in dialog units).
  131. UINT cyDefault; // Default height (in dialog units).
  132. DWORD flStyleDefault; // Default style (WS_CHILD | WS_VISIBLE).
  133. DWORD flExtStyleDefault; // Default extended style.
  134. DWORD flCtrlTypeMask; // Mask for control type styles.
  135. INT cStyleFlags; // Entries in the following style table.
  136. LPCCSTYLEFLAGW aStyleFlags; // Points to style flag table.
  137. WCHAR szTextDefault[CCHCCTEXT]; // Default text.
  138. LPFNCCSTYLEW lpfnStyle; // Pointer to the Styles function.
  139. LPFNCCSIZETOTEXTW lpfnSizeToText; // Pointer to the SizeToText function.
  140. DWORD dwReserved1; // Reserved. Must be zero.
  141. DWORD dwReserved2; // Reserved. Must be zero.
  142. } CCINFOW, *LPCCINFOW;
  143. #ifdef UNICODE
  144. #define CCINFO CCINFOW
  145. #define LPCCINFO LPCCINFOW
  146. #else
  147. #define CCINFO CCINFOA
  148. #define LPCCINFO LPCCINFOA
  149. #endif // UNICODE
  150. /*
  151. * The Info function prototype. This function is the first one
  152. * called by the dialog editor. Custom control DLL's must export
  153. * one or both of the following functions by name (the ordinal
  154. * used for the export does not matter):
  155. *
  156. * UINT CALLBACK CustomControlInfoA(LPCCINFOA acci)
  157. * UINT CALLBACK CustomControlInfoW(LPCCINFOW acci)
  158. *
  159. * This function must return the number of controls that the DLL
  160. * supports, or NULL if an error occurs. If the acci parameter is
  161. * not NULL, it will be pointing to an array of CCINFOA or CCINFOW
  162. * structures that should be filled in with the information about
  163. * the different control types supported by the DLL.
  164. *
  165. * If both functions are present, the CustomControlInfoW function
  166. * will be used by the dialog editor.
  167. */
  168. typedef UINT (CALLBACK* LPFNCCINFOA)(LPCCINFOA acci);
  169. typedef UINT (CALLBACK* LPFNCCINFOW)(LPCCINFOW acci);
  170. #ifdef UNICODE
  171. #define LPFNCCINFO LPFNCCINFOW
  172. #else
  173. #define LPFNCCINFO LPFNCCINFOA
  174. #endif // UNICODE
  175. #ifdef __cplusplus
  176. }
  177. #endif /* __cplusplus */
  178. #endif /* _INC_CUSTCNTL */
  179.