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.

393 lines
9.2 KiB

  1. //
  2. // CCL32.HPP
  3. // Common Control Classes
  4. //
  5. // Copyright Microsoft 1998-
  6. //
  7. #ifndef CCL32_HPP
  8. #define CCL32_HPP
  9. #define HLP_MENU_ITEM_OFFSET 0x10000
  10. #define HLP_BASE 600
  11. enum
  12. {
  13. IDH_CONTENTS = HLP_BASE + 1,
  14. IDH_SEARCH,
  15. IDH_ABOUT,
  16. IDH_HELPHELP,
  17. HLP_PROCESSED
  18. };
  19. #define HELPID_WBSAVEASDLG 4070
  20. #define HELPID_WBFILEMENU 4140
  21. #define HELPID_WBEDITMENU 4150
  22. #define HELPID_WBVIEWMENU 4160
  23. #define HELPID_WBTOOLSMENU 4170
  24. #define HELPID_WBOPTIONSMENU 4180
  25. #define HELPID_WBHELPMENU 4190
  26. #define HELPID_WBWIDTHMENU 4210
  27. #define HELPID_WBSYSTEMMENU 4300
  28. //
  29. // IMM32 stuff
  30. //
  31. typedef HIMC (WINAPI * IGC_PROC)(HWND);
  32. typedef BOOL (WINAPI * INI_PROC)(HIMC, DWORD, DWORD, DWORD);
  33. extern void UT_CaptureMouse( HWND hwnd );
  34. extern void UT_ReleaseMouse( HWND hwnd );
  35. //
  36. // Option entry names
  37. //
  38. #define OPT_MAIN_TOOLBARVISIBLE "ToolBarVisible"
  39. #define OPT_MAIN_STATUSBARVISIBLE "StatusBarVisible"
  40. #define OPT_MAIN_MAXIMIZED "Maximized"
  41. #define OPT_MAIN_MINIMIZED "Minimized"
  42. #define OPT_MAIN_MAINWINDOWRECT "MainWindowPosition"
  43. #define OPT_MAIN_SELECTWINDOW_NOTAGAIN "GrabWindow_dontwarn"
  44. #define OPT_MAIN_SELECTAREA_NOTAGAIN "GrabArea_dontwarn"
  45. #define OPT_MAIN_COLORPALETTE "ColorPalette"
  46. #define OPT_MAIN_CUSTOMCOLORS "CustomColors"
  47. #define DFLT_MAIN_TOOLBARVISIBLE TRUE
  48. #define DFLT_MAIN_STATUSBARVISIBLE TRUE
  49. #define DFLT_MAIN_MAXIMIZED FALSE
  50. #define DFLT_MAIN_MINIMIZED FALSE
  51. #define DFLT_MAIN_SELECTWINDOW_NOTAGAIN FALSE
  52. #define DFLT_MAIN_SELECTAREA_NOTAGAIN FALSE
  53. //
  54. // Settings routines
  55. //
  56. //
  57. // GetIntegerOption retrieves and converts an option string to a long.
  58. // If the specified option cannot be found, or cannot
  59. // be read, the default value specified as the last
  60. // parameter is returned.
  61. //
  62. LONG OPT_GetIntegerOption(LPCSTR cstrOptionName,
  63. LONG lDefault = 0L);
  64. //
  65. // GetBooleanOption retrieves and converts an option string to a boolean
  66. // If the specified option cannot be found, or cannot
  67. // be read, the default value specified as the last
  68. // parameter is returned.
  69. //
  70. BOOL OPT_GetBooleanOption(LPCSTR cstrOptionName,
  71. BOOL bDefault = FALSE);
  72. //
  73. // GetStringOption retrieves a string option (no conversion).
  74. // If the specified option cannot be found, or cannot
  75. // be read, the default value specified as the last
  76. // parameter is returned.
  77. //
  78. void OPT_GetStringOption(LPCSTR cstrOptionName,
  79. LPSTR pcDefault,
  80. UINT size);
  81. //
  82. // GetDataOption retrieves an option string and parses it into an
  83. // array of hex bytes.
  84. // If the specified option cannot be found, or cannot
  85. // be read, the default value specified as the last
  86. // parameter is returned.
  87. //
  88. int OPT_GetDataOption(LPCSTR optionName,
  89. int iBufferLength,
  90. BYTE* pbBuffer);
  91. //
  92. // GetWindowRectOption retrieves a option string and parses it into a
  93. // rectangle representing the corners of the
  94. // window.
  95. // If the specified option cannot be found, or cannot
  96. // be read, the default value specified as the last
  97. // parameter is returned.
  98. //
  99. void OPT_GetWindowRectOption(LPCSTR optionName, LPRECT lprc, LPCRECT lprcDefault);
  100. //
  101. // SetStringOption writes a string option (no conversion).
  102. // Returns TRUE if the option was successfully written.
  103. //
  104. BOOL OPT_SetStringOption(LPCSTR cstrOptionName,
  105. LPCSTR cstrValue);
  106. //
  107. // SetBooleanOption writes a boolean option
  108. // Returns TRUE if the option was successfully written.
  109. //
  110. BOOL OPT_SetBooleanOption(LPCSTR cstrOptionName,
  111. BOOL bValue);
  112. //
  113. // SetIntegerOption write an integer option
  114. // Returns TRUE if the option was successfully written.
  115. //
  116. BOOL OPT_SetIntegerOption(LPCSTR cstrOptionName,
  117. LONG lValue);
  118. //
  119. // SetWindowRectOption write a window rectangle option.
  120. // Returns TRUE if the option was successfully written.
  121. //
  122. BOOL OPT_SetWindowRectOption(LPCSTR optionName,
  123. LPCRECT lpwindowRect);
  124. //
  125. // SetDataOption writes a data option.
  126. // If the specified option cannot be found, or cannot
  127. // be read, the default value specified as the last
  128. // parameter is returned.
  129. //
  130. BOOL OPT_SetDataOption(LPCSTR optionName,
  131. int iBufferLength,
  132. BYTE* pbBuffer);
  133. BOOL OPT_Lookup(LPCSTR cstrOptionName,
  134. LPCSTR cstrResult,
  135. UINT size);
  136. //
  137. //
  138. // Class: WbPrinter
  139. //
  140. // Purpose: Printer class including cancellation dialog
  141. //
  142. //
  143. class WbPrinter
  144. {
  145. public:
  146. //
  147. // Constructor
  148. //
  149. // The parameter specifies the printer to be used. Under Windows this
  150. // value can be obtained from the Common Print Dialog.
  151. //
  152. WbPrinter(LPCTSTR szDeviceName);
  153. ~WbPrinter(void);
  154. void SetPrintPageNumber(int nPageNumber);
  155. // Return TRUE if an error has occurred
  156. BOOL Error(void) { return (m_bAborted || (m_nPrintResult < 0)); };
  157. // Return TRUE if the user has aborted the print
  158. BOOL Aborted(void) { return m_bAborted; };
  159. // Return the last result code from a print function call
  160. int PrintResult(void) { return m_nPrintResult; };
  161. //
  162. // Document manipulation functions
  163. //
  164. // Start a new print job
  165. int StartDoc(HDC hdc, LPCTSTR cstrDocName, int nStartPage);
  166. // Start a new page
  167. int StartPage(HDC hdc, int nPageNumber);
  168. // Indicate that the page is now complete
  169. int EndPage(HDC hdc);
  170. // Indicate that the document is complete
  171. int EndDoc(HDC hdc);
  172. // Abort the print job
  173. int AbortDoc(void);
  174. protected:
  175. HWND m_hwndDialog;
  176. //
  177. // Device and port name for this printer
  178. //
  179. LPCTSTR m_szDeviceName;
  180. TCHAR m_szPrintPageText[_MAX_PATH];
  181. //
  182. // Internal state variables
  183. //
  184. int m_nPrintResult;
  185. BOOL m_bAborted;
  186. void StopDialog(void);
  187. //
  188. // Friend callback routine
  189. //
  190. friend BOOL CALLBACK AbortProc(HDC, int);
  191. friend INT_PTR CALLBACK CancelPrintDlgProc(HWND, UINT, WPARAM, LPARAM);
  192. };
  193. //
  194. // Defines for palettes
  195. //
  196. #define PALVERSION 0x300
  197. #define MAXPALETTE 256
  198. HPALETTE CreateSystemPalette(void);
  199. HPALETTE CreateColorPalette(void);
  200. HBITMAP FromScreenAreaBmp(LPCRECT lprc);
  201. UINT DIB_NumberOfColors(LPBITMAPINFOHEADER lpbi);
  202. UINT DIB_PaletteLength(LPBITMAPINFOHEADER lpbi);
  203. UINT DIB_DataLength(LPBITMAPINFOHEADER lpbi);
  204. UINT DIB_TotalLength(LPBITMAPINFOHEADER lpbi);
  205. HPALETTE DIB_CreatePalette(LPBITMAPINFOHEADER lpbi);
  206. LPSTR DIB_Bits(LPBITMAPINFOHEADER lpbi);
  207. LPBITMAPINFOHEADER DIB_FromBitmap(HBITMAP hBitmap, HPALETTE hPalette, BOOL fGHandle);
  208. LPBITMAPINFOHEADER DIB_FromScreenArea(LPCRECT lprc);
  209. LPBITMAPINFOHEADER DIB_Copy(LPBITMAPINFOHEADER lpbi);
  210. //
  211. // Extra windows messages for the Whiteboard
  212. //
  213. enum
  214. {
  215. WM_USER_GOTO_USER_POSITION = WM_USER,
  216. WM_USER_GOTO_USER_POINTER,
  217. WM_USER_JOIN_CALL,
  218. WM_USER_DISPLAY_ERROR,
  219. WM_USER_UPDATE_ATTRIBUTES,
  220. WM_USER_JOIN_PENDING_CALL,
  221. WM_USER_PRIVATE_PARENTNOTIFY
  222. };
  223. //
  224. // Internal error codes
  225. //
  226. #define WBFE_RC_BASE (WB_LAST_RC - 20)
  227. enum
  228. {
  229. WBFE_RC_WINDOWS = WBFE_RC_BASE,
  230. WBFE_RC_WB,
  231. WBFE_RC_JOIN_CALL_FAILED,
  232. WBFE_RC_CM,
  233. WBFE_RC_AL,
  234. WBFE_RC_PRINTER
  235. };
  236. //
  237. // The following functions can be found in wwbapp.cpp
  238. //
  239. //
  240. // Functions displaying a message box from the string resources specified
  241. //
  242. int Message(HWND hwndOwner,
  243. UINT uiCaption,
  244. UINT uiMessage,
  245. UINT uiStyle = (MB_OK | MB_ICONEXCLAMATION));
  246. //
  247. // Functions displaying a message box from return codes
  248. //
  249. void ErrorMessage(UINT uiFEReturnCode, UINT uiDCGReturnCode);
  250. //
  251. // Default exception handler
  252. //
  253. void DefaultExceptionHandler(UINT uiFEReturnCode, UINT uiDCGReturnCode);
  254. //
  255. //
  256. // Class: DCWbPointerColorMap
  257. //
  258. // Purpose: Map from pointer color to pointer structures
  259. //
  260. //
  261. class DCWbColorToIconMap : public COBLIST
  262. {
  263. public:
  264. //
  265. // Destructor
  266. //
  267. ~DCWbColorToIconMap(void);
  268. };
  269. //
  270. // BOGUS LAURABU TEMP!
  271. // StrArray
  272. //
  273. #define ALLOC_CHUNK 8
  274. class StrArray
  275. {
  276. public:
  277. StrArray();
  278. ~StrArray();
  279. int GetSize() const { return(m_nSize); }
  280. void SetSize(int nNewSize);
  281. // Clean up
  282. void RemoveAll() { SetSize(0); }
  283. // Adding elements
  284. void SetAt(int nIndex, LPCTSTR newElement);
  285. void SetAtGrow(int nIndex, LPCTSTR newElement);
  286. void Add(LPCTSTR newElement);
  287. // overloaded operator helpers
  288. LPCTSTR operator[](int nIndex) const;
  289. // Implementation
  290. protected:
  291. void ClearOut();
  292. LPCTSTR * m_pData; // the actual array of data
  293. int m_nSize; // # of elements (upperBound - 1)
  294. int m_nMaxSize; // max allocated
  295. };
  296. char * StrTok (
  297. char * string,
  298. char * control
  299. );
  300. #endif // CCL32_HPP