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.

232 lines
8.6 KiB

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