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.

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