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.

212 lines
8.2 KiB

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