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.

437 lines
14 KiB

  1. /*******************************************************************************
  2. *
  3. * (C) COPYRIGHT MICROSOFT CORPORATION, 1998
  4. *
  5. * TITLE: PVIEWIDS.H
  6. *
  7. * VERSION: 1.0
  8. *
  9. * AUTHOR: ShaunIv
  10. *
  11. * DATE: 8/12/1999
  12. *
  13. * DESCRIPTION: Message and other constants used by the preview control
  14. *
  15. *******************************************************************************/
  16. #ifndef __PVIEWIDS_H_INCLUDED
  17. #define __PVIEWIDS_H_INCLUDED
  18. #ifdef __cplusplus
  19. extern "C" {
  20. #endif
  21. #define IDC_INNER_PREVIEW_WINDOW 23401
  22. void WINAPI RegisterWiaPreviewClasses( HINSTANCE hInstance );
  23. /**************************************************************
  24. *
  25. * Window class names
  26. *
  27. **************************************************************/
  28. #define PREVIEW_WINDOW_CLASSW L"WiaPreviewControl"
  29. #define PREVIEW_WINDOW_CLASSA "WiaPreviewControl"
  30. #define PREVIEW_WINDOW_FRAME_CLASSW L"WiaPreviewControlFrame"
  31. #define PREVIEW_WINDOW_FRAME_CLASSA "WiaPreviewControlFrame"
  32. #if defined(UNICODE) || defined(_UNICODE)
  33. #define PREVIEW_WINDOW_CLASS PREVIEW_WINDOW_CLASSW
  34. #define PREVIEW_WINDOW_FRAME_CLASS PREVIEW_WINDOW_FRAME_CLASSW
  35. #else
  36. #define PREVIEW_WINDOW_CLASS PREVIEW_WINDOW_CLASSA
  37. #define PREVIEW_WINDOW_FRAME_CLASS PREVIEW_WINDOW_FRAME_CLASSA
  38. #endif
  39. /**************************************************************
  40. *
  41. * Notification codes, sent via WM_COMMAND
  42. *
  43. **************************************************************/
  44. #define PWN_SELCHANGE 1
  45. /**************************************************************
  46. *
  47. * Messages and flags
  48. *
  49. **************************************************************/
  50. //wParam = 0, lParam = LPSIZE lpResolution
  51. #define PWM_SETRESOLUTION (WM_USER+601)
  52. //wParam = 0, lParam = 0
  53. #define PWM_CLEARSELECTION (WM_USER+602)
  54. //wParam = 0, lParam = LPSIZE pSize
  55. #define PWM_GETIMAGESIZE (WM_USER+603)
  56. // wParam = MAKEWPARAM(bRepaint,bDontDestroy), lParam = (HBITMAP)hBmp
  57. #define PWM_SETBITMAP (WM_USER+604)
  58. // wParam = 0, lParam = 0
  59. #define PWM_GETBITMAP (WM_USER+605)
  60. // wParam = 0, lParam = LPSIZE lpResolution
  61. #define PWM_GETRESOLUTION (WM_USER+606)
  62. // wParam = bOuter, lParam = 0
  63. #define PWM_GETBORDERSIZE (WM_USER+607)
  64. // wParam = 0, lParam = 0
  65. #define PWM_GETHANDLESIZE (WM_USER+608)
  66. // wParam = 0, lParam = 0
  67. #define PWM_GETBGALPHA (WM_USER+609)
  68. // wParam = 0, lParam = 0
  69. #define PWM_GETHANDLETYPE (WM_USER+610)
  70. // wParam = (BOOL)MAKEWPARAM(bRepaint,bOuter), lParam = (UINT)nBorderSize
  71. #define PWM_SETBORDERSIZE (WM_USER+611)
  72. // wParam = (BOOL)bRepaint, lParam = (UINT)nHandleSize
  73. #define PWM_SETHANDLESIZE (WM_USER+612)
  74. // wParam = (BOOL)bRepaint, lParam = (BYTE)nAlpha
  75. #define PWM_SETBGALPHA (WM_USER+613)
  76. #define PREVIEW_WINDOW_SQUAREHANDLES 0x00000000
  77. #define PREVIEW_WINDOW_ROUNDHANDLES 0x00000001
  78. #define PREVIEW_WINDOW_FILLEDHANDLES 0x00000000
  79. #define PREVIEW_WINDOW_HOLLOWHANDLES 0x00010000
  80. // wParam = (BOOL)bRepaint, lParam = (int)nHandleType
  81. #define PWM_SETHANDLETYPE (WM_USER+614)
  82. // wParam = 0, lParam = 0
  83. #define PWM_GETSELCOUNT (WM_USER+615)
  84. // wParam = (BOOL)MAKEWPARAM((WORD)nItem,(BOOL)bPhysical), lParam = (PPOINT)pOrigin
  85. #define PWM_GETSELORIGIN (WM_USER+616)
  86. // wParam = (BOOL)MAKEWPARAM((WORD)nItem,(BOOL)bPhysical), lParam = (PSIZE)pExtent
  87. #define PWM_GETSELEXTENT (WM_USER+617)
  88. // wParam = 0, lParam = 0
  89. #define PWM_GETALLOWNULLSELECTION (WM_USER+618)
  90. // wParam = (BOOL)bAllowNullSelection, lParam = 0
  91. #define PWM_SETALLOWNULLSELECTION (WM_USER+619)
  92. // wParam = 0, lParam = 0
  93. #define PWM_SELECTIONDISABLED (WM_USER+620)
  94. // wParam = (BOOL)bDisableSelection, lParam = 0
  95. #define PWM_DISABLESELECTION (WM_USER+621)
  96. // wParam = 0, lParam = 0
  97. #define PWM_DETECTREGIONS (WM_USER+622)
  98. // wParam = MAKEWPARAM(bOuterBorder,0), lParam = 0
  99. #define PWM_GETBKCOLOR (WM_USER+623)
  100. // wParam = MAKEWPARAM(bOuterBorder,bRepaint), lParam = (COLORREF)color
  101. #define PWM_SETBKCOLOR (WM_USER+624)
  102. // wParam = 0, lParam = (LPSIZE)pSize
  103. #define PWM_SETDEFASPECTRATIO (WM_USER+625)
  104. // wParam = 0, lParam = (BOOL)bPreviewMode
  105. #define PWM_SETPREVIEWMODE (WM_USER+626)
  106. // wParam = 0, lParam = 0
  107. #define PWM_GETPREVIEWMODE (WM_USER+627)
  108. // wParam = MAKEWPARAM(bRepaint,0), lParam = MAKELPARAM(nBorderStyle,nBorderThickness)
  109. #define PWM_SETBORDERSTYLE (WM_USER+628)
  110. #define PREVIEW_WINDOW_SELECTED 0x00000000
  111. #define PREVIEW_WINDOW_UNSELECTED 0x00000001
  112. #define PREVIEW_WINDOW_DISABLED 0x00000002
  113. // wParam = MAKEWPARAM(bRepaint,nState), lParam = (COLORREF)crColor
  114. #define PWM_SETBORDERCOLOR (WM_USER+629)
  115. // wParam = MAKEWPARAM(bRepaint,nState), lParam = (COLORREF)crColor
  116. #define PWM_SETHANDLECOLOR (WM_USER+630)
  117. // wParam = 0, lParam = (SIZE *)psizeClient
  118. #define PWM_GETCLIENTSIZE (WM_USER+631)
  119. // wParam = 0, lParam = BOOL bEnable
  120. #define PWM_SETENABLESTRETCH (WM_USER+632)
  121. // wParam = 0, lParam = 0
  122. #define PWM_GETENABLESTRETCH (WM_USER+633)
  123. // wParam = 0, lParam = bHide
  124. #define PWM_HIDEEMPTYPREVIEW (WM_USER+634)
  125. #define PREVIEW_WINDOW_CENTER 0x0000
  126. #define PREVIEW_WINDOW_RIGHT 0x0001
  127. #define PREVIEW_WINDOW_LEFT 0x0002
  128. #define PREVIEW_WINDOW_TOP 0x0004
  129. #define PREVIEW_WINDOW_BOTTOM 0x0008
  130. // wParam = bRedraw, lParam = MAKELPARAM(horz,vert)
  131. #define PWM_SETPREVIEWALIGNMENT (WM_USER+635)
  132. // wParam = (BOOL)MAKEWPARAM((WORD)nItem,(BOOL)bPhysical), lParam = (PPOINT)pOrigin
  133. #define PWM_SETSELORIGIN (WM_USER+636)
  134. // wParam = (BOOL)MAKEWPARAM((WORD)nItem,(BOOL)bPhysical), lParam = (PSIZE)pExtent
  135. #define PWM_SETSELEXTENT (WM_USER+637)
  136. // wParam = 0, LPARAM = 0
  137. #define PWM_REFRESHBITMAP (WM_USER+638)
  138. //
  139. // wParam = bShow, lParam = 0
  140. //
  141. #define PWM_SETPROGRESS (WM_USER+639)
  142. //
  143. // wParam = 0, lParam = 0
  144. //
  145. #define PWM_GETPROGRESS (WM_USER+640)
  146. //
  147. // wParam = BOOL bUserChanged, lParam = 0
  148. //
  149. #define PWM_SETUSERCHANGEDSELECTION (WM_USER+641)
  150. //
  151. // wParam = 0, lParam = 0
  152. //
  153. #define PWM_GETUSERCHANGEDSELECTION (WM_USER+642)
  154. /**************************************************************
  155. *
  156. * inline WINAPI message wrapper helpers
  157. *
  158. **************************************************************/
  159. #ifdef __cplusplus // C doesn't know what inline WINAPI is...
  160. inline void WINAPI WiaPreviewControl_SetResolution( HWND hWnd, SIZE *pResolution)
  161. {
  162. ::SendMessage( hWnd, PWM_SETRESOLUTION, 0, reinterpret_cast<LPARAM>(pResolution) );
  163. }
  164. inline void WINAPI WiaPreviewControl_ClearSelection( HWND hWnd )
  165. {
  166. ::SendMessage( hWnd, PWM_CLEARSELECTION, 0, 0 );
  167. }
  168. inline BOOL WINAPI WiaPreviewControl_GetImageSize( HWND hWnd, SIZE *pSize )
  169. {
  170. return static_cast<BOOL>(::SendMessage( hWnd, PWM_GETIMAGESIZE, 0, reinterpret_cast<LPARAM>(pSize)));
  171. }
  172. inline void WINAPI WiaPreviewControl_SetBitmap( HWND hWnd, BOOL bRepaint, BOOL bDontDestroy, HBITMAP hBitmap )
  173. {
  174. ::SendMessage( hWnd, PWM_SETBITMAP, MAKEWPARAM(bRepaint,bDontDestroy), reinterpret_cast<LPARAM>(hBitmap) );
  175. }
  176. inline HBITMAP WINAPI WiaPreviewControl_GetBitmap( HWND hWnd )
  177. {
  178. return reinterpret_cast<HBITMAP>(::SendMessage( hWnd, PWM_GETBITMAP, 0, 0 ));
  179. }
  180. inline BOOL WINAPI WiaPreviewControl_GetResolution( HWND hWnd, SIZE *pResolution )
  181. {
  182. return static_cast<BOOL>(::SendMessage( hWnd, PWM_GETRESOLUTION, 0, reinterpret_cast<LPARAM>(pResolution)));
  183. }
  184. inline UINT WINAPI WiaPreviewControl_GetBorderSize( HWND hWnd, BOOL bOuter )
  185. {
  186. return static_cast<UINT>(::SendMessage( hWnd, PWM_GETBORDERSIZE, bOuter, 0 ));
  187. }
  188. inline UINT WINAPI WiaPreviewControl_GetHandleSize( HWND hWnd )
  189. {
  190. return static_cast<UINT>(::SendMessage( hWnd, PWM_GETHANDLESIZE, 0, 0 ));
  191. }
  192. inline BYTE WINAPI WiaPreviewControl_GetBgAlpha( HWND hWnd )
  193. {
  194. return static_cast<BYTE>(::SendMessage( hWnd, PWM_GETBGALPHA, 0, 0 ));
  195. }
  196. inline int WINAPI WiaPreviewControl_GetHandleType( HWND hWnd )
  197. {
  198. return static_cast<int>(::SendMessage( hWnd, PWM_GETHANDLETYPE, 0, 0 ));
  199. }
  200. inline void WINAPI WiaPreviewControl_SetBorderSize( HWND hWnd, BOOL bRepaint, BOOL bOuter, UINT nBorderSize )
  201. {
  202. ::SendMessage( hWnd, PWM_SETBORDERSIZE, MAKEWPARAM(bRepaint,bOuter), nBorderSize );
  203. }
  204. inline void WINAPI WiaPreviewControl_SetHandleSize( HWND hWnd, BOOL bRepaint, UINT nHandleSize )
  205. {
  206. ::SendMessage( hWnd, PWM_SETHANDLESIZE, bRepaint, nHandleSize );
  207. }
  208. inline void WINAPI WiaPreviewControl_SetBgAlpha( HWND hWnd, BOOL bRepaint, BYTE nAlpha )
  209. {
  210. ::SendMessage( hWnd, PWM_SETBGALPHA, bRepaint, nAlpha );
  211. }
  212. inline void WINAPI WiaPreviewControl_SetHandleType( HWND hWnd, BOOL bRepaint, int nHandleType )
  213. {
  214. ::SendMessage( hWnd, PWM_SETHANDLETYPE, bRepaint, nHandleType );
  215. }
  216. inline WORD WINAPI WiaPreviewControl_GetSelCount( HWND hWnd )
  217. {
  218. return static_cast<WORD>(::SendMessage( hWnd, PWM_GETSELCOUNT, 0, 0 ));
  219. }
  220. inline BOOL WINAPI WiaPreviewControl_GetSelOrigin( HWND hWnd, WORD nItem, BOOL bPhysical, POINT *pOrigin )
  221. {
  222. return static_cast<BOOL>(::SendMessage( hWnd, PWM_GETSELORIGIN, MAKEWPARAM(nItem,bPhysical), reinterpret_cast<LPARAM>(pOrigin)));
  223. }
  224. inline BOOL WINAPI WiaPreviewControl_GetSelExtent( HWND hWnd, WORD nItem, BOOL bPhysical, SIZE *pExtent )
  225. {
  226. return static_cast<BOOL>(::SendMessage( hWnd, PWM_GETSELEXTENT, MAKEWPARAM(nItem,bPhysical), reinterpret_cast<LPARAM>(pExtent)));
  227. }
  228. inline BOOL WINAPI WiaPreviewControl_SetSelOrigin( HWND hWnd, WORD nItem, BOOL bPhysical, POINT *pOrigin )
  229. {
  230. return static_cast<BOOL>(::SendMessage( hWnd, PWM_SETSELORIGIN, MAKEWPARAM(nItem,bPhysical), reinterpret_cast<LPARAM>(pOrigin)));
  231. }
  232. inline BOOL WINAPI WiaPreviewControl_SetSelExtent( HWND hWnd, WORD nItem, BOOL bPhysical, SIZE *pExtent )
  233. {
  234. return static_cast<BOOL>(::SendMessage( hWnd, PWM_SETSELEXTENT, MAKEWPARAM(nItem,bPhysical), reinterpret_cast<LPARAM>(pExtent)));
  235. }
  236. inline BOOL WINAPI WiaPreviewControl_NullSelectionAllowed( HWND hWnd )
  237. {
  238. return static_cast<BOOL>(::SendMessage( hWnd, PWM_GETALLOWNULLSELECTION, 0, 0 ));
  239. }
  240. inline void WINAPI WiaPreviewControl_AllowNullSelection( HWND hWnd, BOOL bAllowNullSelection )
  241. {
  242. ::SendMessage( hWnd, PWM_SETALLOWNULLSELECTION, bAllowNullSelection, 0 );
  243. }
  244. inline BOOL WINAPI WiaPreviewControl_SelectionDisabled( HWND hWnd )
  245. {
  246. return static_cast<BOOL>(::SendMessage( hWnd, PWM_SELECTIONDISABLED, 0, 0 ));
  247. }
  248. inline void WINAPI WiaPreviewControl_DisableSelection( HWND hWnd, BOOL bDisableSelection )
  249. {
  250. ::SendMessage( hWnd, PWM_DISABLESELECTION, bDisableSelection, 0 );
  251. }
  252. inline BOOL WINAPI WiaPreviewControl_DetectRegions( HWND hWnd )
  253. {
  254. return static_cast<BOOL>(::SendMessage( hWnd, PWM_DETECTREGIONS, 0, 0 ));
  255. }
  256. inline COLORREF WINAPI WiaPreviewControl_GetBkColor( HWND hWnd, BOOL bOuterBorder )
  257. {
  258. return static_cast<COLORREF>(::SendMessage( hWnd, PWM_GETBKCOLOR, MAKEWPARAM(bOuterBorder,0), 0 ));
  259. }
  260. inline void WINAPI WiaPreviewControl_SetBkColor( HWND hWnd, BOOL bRepaint, BOOL bOuterBorder, COLORREF color )
  261. {
  262. ::SendMessage( hWnd, PWM_SETBKCOLOR, MAKEWPARAM(bOuterBorder,bRepaint), color );
  263. }
  264. inline void WINAPI WiaPreviewControl_SetDefAspectRatio( HWND hWnd, SIZE *pAspectRatio )
  265. {
  266. ::SendMessage( hWnd, PWM_SETDEFASPECTRATIO, 0, reinterpret_cast<LPARAM>(pAspectRatio) );
  267. }
  268. inline void WINAPI WiaPreviewControl_SetPreviewMode( HWND hWnd, BOOL bPreviewMode )
  269. {
  270. ::SendMessage( hWnd, PWM_SETPREVIEWMODE, 0, static_cast<LPARAM>(bPreviewMode) );
  271. }
  272. inline BOOL WINAPI WiaPreviewControl_GetPreviewMode( HWND hWnd )
  273. {
  274. return static_cast<BOOL>(::SendMessage( hWnd, PWM_GETPREVIEWMODE, 0, 0 ));
  275. }
  276. inline void WINAPI WiaPreviewControl_SetBorderStyle( HWND hWnd, BOOL bRepaint, WORD nBorderStyle, WORD nBorderThickness )
  277. {
  278. ::SendMessage( hWnd, PWM_SETBORDERSTYLE, MAKEWPARAM(bRepaint,0), MAKELPARAM(nBorderStyle,nBorderThickness) );
  279. }
  280. inline void WINAPI WiaPreviewControl_SetBorderColor( HWND hWnd, BOOL bRepaint, WORD nState, COLORREF crColor )
  281. {
  282. ::SendMessage( hWnd, PWM_SETBORDERCOLOR, MAKEWPARAM(bRepaint,nState), static_cast<LPARAM>(crColor) );
  283. }
  284. inline void WINAPI WiaPreviewControl_SetHandleColor( HWND hWnd, BOOL bRepaint, WORD nState, COLORREF crColor )
  285. {
  286. ::SendMessage( hWnd, PWM_SETHANDLECOLOR, MAKEWPARAM(bRepaint,nState), static_cast<LPARAM>(crColor) );
  287. }
  288. inline BOOL WINAPI WiaPreviewControl_GetClientSize( HWND hWnd, SIZE *psizeClient )
  289. {
  290. return static_cast<BOOL>(::SendMessage( hWnd, PWM_GETCLIENTSIZE, 0, reinterpret_cast<LPARAM>(psizeClient) ) );
  291. }
  292. inline BOOL WINAPI WiaPreviewControl_GetEnableStretch( HWND hWnd )
  293. {
  294. return static_cast<BOOL>(::SendMessage( hWnd, PWM_GETENABLESTRETCH, 0, 0 ) );
  295. }
  296. inline void WINAPI WiaPreviewControl_SetEnableStretch( HWND hWnd, BOOL bEnable )
  297. {
  298. ::SendMessage( hWnd, PWM_SETENABLESTRETCH, 0, bEnable );
  299. }
  300. inline void WINAPI WiaPreviewControl_HideEmptyPreview( HWND hWnd, BOOL bHide )
  301. {
  302. ::SendMessage( hWnd, PWM_HIDEEMPTYPREVIEW, 0, bHide );
  303. }
  304. inline void WINAPI WiaPreviewControl_SetPreviewAlignment( HWND hWnd, WORD fHorizontal, WORD fVertical, BOOL bRepaint )
  305. {
  306. ::SendMessage( hWnd, PWM_SETPREVIEWALIGNMENT, bRepaint, MAKELPARAM(fHorizontal,fVertical) );
  307. }
  308. inline void WINAPI WiaPreviewControl_RefreshBitmap( HWND hWnd )
  309. {
  310. ::SendMessage( hWnd, PWM_REFRESHBITMAP, 0, 0 );
  311. }
  312. inline BOOL WINAPI WiaPreviewControl_SetProgress( HWND hWnd, BOOL bSet )
  313. {
  314. return static_cast<BOOL>(::SendMessage( hWnd, PWM_SETPROGRESS, bSet, 0 ) );
  315. }
  316. inline BOOL WINAPI WiaPreviewControl_GetProgress( HWND hWnd )
  317. {
  318. return static_cast<BOOL>(::SendMessage( hWnd, PWM_GETPROGRESS, 0, 0 ) );
  319. }
  320. inline BOOL WINAPI WiaPreviewControl_GetUserChangedSelection( HWND hWnd )
  321. {
  322. return static_cast<BOOL>(::SendMessage( hWnd, PWM_GETUSERCHANGEDSELECTION, 0, 0 ) );
  323. }
  324. inline BOOL WINAPI WiaPreviewControl_SetUserChangedSelection( HWND hWnd, BOOL bUserChangedSelection )
  325. {
  326. return static_cast<BOOL>(::SendMessage( hWnd, PWM_SETUSERCHANGEDSELECTION, bUserChangedSelection, 0 ) );
  327. }
  328. #endif // __cplusplus
  329. #ifdef __cplusplus
  330. }
  331. #endif
  332. #endif // __PVIEWIDS_H_INCLUDED