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.

317 lines
12 KiB

  1. #if !defined(USRCTL32__UsrCtl32_h__INCLUDED)
  2. #define USRCTL32__UsrCtl32_h__INCLUDED
  3. //
  4. // Known dimensions of sys fonts
  5. //
  6. #define SYSFONT_CXCHAR 8
  7. #define SYSFONT_CYCHAR 16
  8. //
  9. // user control macros
  10. //
  11. #define UserAssert(e) \
  12. ASSERT(e)
  13. #define UserLocalAlloc(uFlag,uBytes) \
  14. HeapAlloc(GetProcessHeap(), uFlag, (uBytes))
  15. #define UserLocalReAlloc(p, uBytes, uFlags) \
  16. HeapReAlloc(GetProcessHeap(), uFlags, (LPSTR)(p), (uBytes))
  17. #define UserLocalFree(p) \
  18. HeapFree(GetProcessHeap(), 0, (LPSTR)(p))
  19. #define UserLocalSize(p) \
  20. HeapSize(GetProcessHeap(), 0, (LPSTR)(p))
  21. #define SetWindowState(hwnd, flags) \
  22. SetWindowLong(hwnd, GWL_STYLE, GetWindowStyle(hwnd) | (flags))
  23. #define ClearWindowState(hwnd, flags) \
  24. SetWindowLong(hwnd, GWL_STYLE, GetWindowStyle(hwnd) & ~(flags))
  25. #define SYSMET(i) GetSystemMetrics( SM_##i )
  26. #define SYSMETRTL(i) GetSystemMetrics( SM_##i )
  27. #define SYSRGB(i) GetSysColor(COLOR_##i)
  28. #define SYSRGBRTL(i) GetSysColor(COLOR_##i)
  29. #define SYSHBR(i) GetSysColorBrush(COLOR_##i)
  30. typedef struct tagWW
  31. {
  32. DWORD dwState;
  33. DWORD dwState2;
  34. DWORD dwExStyle;
  35. DWORD dwStyle;
  36. } WW, *PWW;
  37. #define GET_STATE(pctl) ((pctl)->pww->dwState)
  38. #define GET_STATE2(pctl) ((pctl)->pww->dwState2)
  39. #define GET_EXSTYLE(pctl) ((pctl)->pww->dwExStyle)
  40. #define GET_STYLE(pctl) ((pctl)->pww->dwStyle)
  41. #define TESTFLAG(field,bits) (((field)&(bits)) ? TRUE : FALSE)
  42. //
  43. // Window Style and State Masks -
  44. //
  45. // High byte of word is byte index from the start of the state field
  46. // in the WND structure, low byte is the mask to use on the byte.
  47. // These masks assume the order of the state and style fields of a
  48. // window instance structure.
  49. //
  50. // This is how the Test/Set/Clr/MaskWF value ranges map to the corresponding
  51. // fields in the window structure.
  52. //
  53. // offset WND field
  54. // 0 - 3 state - private
  55. // 4 - 7 state2 - private
  56. // 8 - B ExStyle - public, exposed in SetWindowLong(GWL_EXSTYLE)
  57. // C - F style - public, exposed in SetWindowLong(GWL_STYLE)
  58. // C-D are reserved for window class designer.
  59. // E-F are reserved for WS_ styles.
  60. //
  61. // See windows \core\ntuser\inc\user.h definition of WND struct
  62. // See public\internal\windows\inc\wowuserp.h for WW struct
  63. //
  64. // State flags, from 0x0000 to 0x0380.
  65. //
  66. //
  67. // DON'T MOVE ANY ONE OF THE FOLLOWING WFXPRESENT FLAGS,
  68. // BECAUSE WFFRAMEPRESENTMASK DEPENDS ON THEIR VALUES
  69. //
  70. #define WS_ST_MPRESENT 0x00000001
  71. #define WS_ST_VPRESENT 0x00000002
  72. #define WS_ST_HPRESENT 0x00000004
  73. #define WS_ST_CPRESENT 0x00000008
  74. #define WS_ST_FRAMEON 0x00000040
  75. #define WS_ST_ANSIPROC 0x00080000
  76. #define WS_ST_ANSICREATOR 0x20000000
  77. #define WS_S2_OLDUI 0x00000008
  78. #define WS_S2_WIN31COMPAT 0x00000100
  79. #define WS_S2_WIN40COMPAT 0x00000200
  80. #define WS_S2_LINEUPBUTTONDOWN 0x00010000
  81. #define WS_S2_PAGEUPBUTTONDOWN 0x00020000
  82. #define WS_S2_PAGEDNBUTTONDOWN 0x00040000
  83. #define WS_S2_LINEDNBUTTONDOWN 0x00080000
  84. #define WS_S2_VERTSCROLLTRACK 0x00200000
  85. #define WFMPRESENT 0x0001
  86. #define WFVPRESENT 0x0002
  87. #define WFHPRESENT 0x0004
  88. #define WFCPRESENT 0x0008
  89. #define WFFRAMEPRESENTMASK 0x000F
  90. #define WFSENDSIZEMOVE 0x0010
  91. #define WFMSGBOX 0x0020 // used to maintain count of msg boxes on screen
  92. #define WFFRAMEON 0x0040
  93. #define WFHASSPB 0x0080
  94. #define WFNONCPAINT 0x0101
  95. #define WFSENDERASEBKGND 0x0102
  96. #define WFERASEBKGND 0x0104
  97. #define WFSENDNCPAINT 0x0108
  98. #define WFINTERNALPAINT 0x0110
  99. #define WFUPDATEDIRTY 0x0120
  100. #define WFHIDDENPOPUP 0x0140
  101. #define WFMENUDRAW 0x0180
  102. //
  103. // NOTE -- WFDIALOGWINDOW is used in WOW. DO NOT CHANGE without
  104. // changing WD_DIALOG_WINDOW in winuser.w
  105. //
  106. #define WFDIALOGWINDOW 0x0201
  107. #define WFTITLESET 0x0202
  108. #define WFSERVERSIDEPROC 0x0204
  109. #define WFANSIPROC 0x0208
  110. #define WFBEINGACTIVATED 0x0210 // prevent recursion in xxxActivateThis Window
  111. #define WFHASPALETTE 0x0220
  112. #define WFPAINTNOTPROCESSED 0x0240 // WM_PAINT message not processed
  113. #define WFSYNCPAINTPENDING 0x0280
  114. #define WFGOTQUERYSUSPENDMSG 0x0301
  115. #define WFGOTSUSPENDMSG 0x0302
  116. #define WFTOGGLETOPMOST 0x0304 // Toggle the WS_EX_TOPMOST bit ChangeStates
  117. //
  118. // DON'T MOVE REDRAWIFHUNGFLAGS WITHOUT ADJUSTING WFANYHUNGREDRAW
  119. //
  120. #define WFREDRAWIFHUNG 0x0308
  121. #define WFREDRAWFRAMEIFHUNG 0x0310
  122. #define WFANYHUNGREDRAW 0x0318
  123. #define WFANSICREATOR 0x0320
  124. #define WFREALLYMAXIMIZABLE 0x0340 // The window fills the work area or monitor when maximized
  125. #define WFDESTROYED 0x0380
  126. //
  127. // State2 flags, from 0x0400 to 0x0780.
  128. //
  129. #define WFWMPAINTSENT 0x0401
  130. #define WFDONTVALIDATE 0x0402
  131. #define WFSTARTPAINT 0x0404
  132. #define WFOLDUI 0x0408
  133. #define WFCEPRESENT 0x0410 // Client edge present
  134. #define WFBOTTOMMOST 0x0420 // Bottommost window
  135. #define WFFULLSCREEN 0x0440
  136. #define WFINDESTROY 0x0480
  137. //
  138. // DON'T MOVE ANY ONE OF THE FOLLOWING WFWINXXCOMPAT FLAGS,
  139. // BECAUSE WFWINCOMPATMASK DEPENDS ON THEIR VALUES
  140. //
  141. #define WFWIN31COMPAT 0x0501 // Win 3.1 compatible window
  142. #define WFWIN40COMPAT 0x0502 // Win 4.0 compatible window
  143. #define WFWIN50COMPAT 0x0504 // Win 5.0 compatibile window
  144. #define WFWINCOMPATMASK 0x0507 // Compatibility flag mask
  145. #define WFMAXFAKEREGIONAL 0x0508 // Window has a fake region for maxing on 1 monitor
  146. //
  147. // Active Accessibility (Window Event) state
  148. //
  149. #define WFCLOSEBUTTONDOWN 0x0510
  150. #define WFZOOMBUTTONDOWN 0x0520
  151. #define WFREDUCEBUTTONDOWN 0x0540
  152. #define WFHELPBUTTONDOWN 0x0580
  153. #define WFLINEUPBUTTONDOWN 0x0601 // Line up/left scroll button down
  154. #define WFPAGEUPBUTTONDOWN 0x0602 // Page up/left scroll area down
  155. #define WFPAGEDNBUTTONDOWN 0x0604 // Page down/right scroll area down
  156. #define WFLINEDNBUTTONDOWN 0x0608 // Line down/right scroll area down
  157. #define WFSCROLLBUTTONDOWN 0x0610 // Any scroll button down?
  158. #define WFVERTSCROLLTRACK 0x0620 // Vertical or horizontal scroll track...
  159. #define WFALWAYSSENDNCPAINT 0x0640 // Always send WM_NCPAINT to children
  160. #define WFPIXIEHACK 0x0680 // Send (HRGN)1 to WM_NCPAINT (see PixieHack)
  161. //
  162. // WFFULLSCREENBASE MUST HAVE LOWORD OF 0. See SetFullScreen macro.
  163. //
  164. #define WFFULLSCREENBASE 0x0700 // Fullscreen flags take up 0x0701
  165. #define WFFULLSCREENMASK 0x0707 // and 0x0702 and 0x0704
  166. #define WEFTRUNCATEDCAPTION 0x0708 // The caption text was truncated -> caption tootip
  167. #define WFNOANIMATE 0x0710 // ???
  168. #define WFSMQUERYDRAGICON 0x0720 // ??? Small icon comes from WM_QUERYDRAGICON
  169. #define WFSHELLHOOKWND 0x0740 // ???
  170. #define WFISINITIALIZED 0x0780 // Window is initialized -- checked by WoW32
  171. //
  172. // Window Extended Style, from 0x0800 to 0x0B80.
  173. //
  174. #define WEFDLGMODALFRAME 0x0801 // WS_EX_DLGMODALFRAME
  175. #define WEFDRAGOBJECT 0x0802 // ???
  176. #define WEFNOPARENTNOTIFY 0x0804 // WS_EX_NOPARENTNOTIFY
  177. #define WEFTOPMOST 0x0808 // WS_EX_TOPMOST
  178. #define WEFACCEPTFILES 0x0810 // WS_EX_ACCEPTFILES
  179. #define WEFTRANSPARENT 0x0820 // WS_EX_TRANSPARENT
  180. #define WEFMDICHILD 0x0840 // WS_EX_MDICHILD
  181. #define WEFTOOLWINDOW 0x0880 // WS_EX_TOOLWINDOW
  182. #define WEFWINDOWEDGE 0x0901 // WS_EX_WINDOWEDGE
  183. #define WEFCLIENTEDGE 0x0902 // WS_EX_CLIENTEDGE
  184. #define WEFEDGEMASK 0x0903 // WS_EX_WINDOWEDGE | WS_EX_CLIENTEDGE
  185. #define WEFCONTEXTHELP 0x0904 // WS_EX_CONTEXTHELP
  186. //
  187. // intl styles
  188. //
  189. #define WEFRIGHT 0x0910 // WS_EX_RIGHT
  190. #define WEFRTLREADING 0x0920 // WS_EX_RTLREADING
  191. #define WEFLEFTSCROLL 0x0940 // WS_EX_LEFTSCROLLBAR
  192. #define WEFCONTROLPARENT 0x0A01 // WS_EX_CONTROLPARENT
  193. #define WEFSTATICEDGE 0x0A02 // WS_EX_STATICEDGE
  194. #define WEFAPPWINDOW 0x0A04 // WS_EX_APPWINDOW
  195. #define WEFLAYERED 0x0A08 // WS_EX_LAYERED
  196. #ifdef USE_MIRRORING
  197. #define WEFNOINHERITLAYOUT 0x0A10 // WS_EX_NOINHERITLAYOUT
  198. #define WEFLAYOUTVBHRESERVED 0x0A20 // WS_EX_LAYOUTVBHRESERVED
  199. #define WEFLAYOUTRTL 0x0A40 // WS_EX_LAYOUTRTL
  200. #define WEFLAYOUTBTTRESERVED 0x0A80 // WS_EX_LAYOUTBTTRESERVED
  201. #endif
  202. //
  203. // To delay adding a new state3 DWORD in the WW structure, we're using
  204. // the extended style bits for now. If we'll need more of these, we'll
  205. // add the new DWORD and move these ones around
  206. //
  207. #define WEFPUIFOCUSHIDDEN 0x0B80 // focus indicators hidden
  208. #define WEFPUIACCELHIDDEN 0x0B40 // keyboard acceleraors hidden
  209. #define WEFPREDIRECTED 0x0B20 // redirection bit
  210. #define WEFPCOMPOSITING 0x0B10 // compositing
  211. //
  212. // Window styles, from 0x0E00 to 0x0F80.
  213. //
  214. #define WFMAXBOX 0x0E01 // WS_MAXIMIZEBOX
  215. #define WFTABSTOP 0x0E01 // WS_TABSTOP
  216. #define WFMINBOX 0x0E02 // WS_MAXIMIZEBOX
  217. #define WFGROUP 0x0E02 // WS_GROUP
  218. #define WFSIZEBOX 0x0E04 // WS_THICKFRAME, WS_SIZEBOX
  219. #define WFSYSMENU 0x0E08 // WS_SYSMENU
  220. #define WFHSCROLL 0x0E10 // WS_HSCROLL
  221. #define WFVSCROLL 0x0E20 // WS_VSCROLL
  222. #define WFDLGFRAME 0x0E40 // WS_DLGFRAME
  223. #define WFTOPLEVEL 0x0E40 // ???
  224. #define WFBORDER 0x0E80 // WS_BORDER
  225. #define WFBORDERMASK 0x0EC0 // WS_BORDER | WS_DLGFRAME
  226. #define WFCAPTION 0x0EC0 // WS_CAPTION
  227. #define WFTILED 0x0F00 // WS_OVERLAPPED, WS_TILED
  228. #define WFMAXIMIZED 0x0F01 // WS_MAXIMIZE
  229. #define WFCLIPCHILDREN 0x0F02 // WS_CLIPCHILDREN
  230. #define WFCLIPSIBLINGS 0x0F04 // WS_CLIPSIBLINGS
  231. #define WFDISABLED 0x0F08 // WS_DISABLED
  232. #define WFVISIBLE 0x0F10 // WS_VISIBLE
  233. #define WFMINIMIZED 0x0F20 // WS_MINIMIZE
  234. #define WFCHILD 0x0F40 // WS_CHILD
  235. #define WFPOPUP 0x0F80 // WS_POPUP
  236. #define WFTYPEMASK 0x0FC0 // WS_CHILD | WS_POPUP
  237. #define WFICONICPOPUP 0x0FC0 // WS_CHILD | WS_POPUP
  238. #define WFICONIC WFMINIMIZED
  239. #ifdef __cplusplus
  240. extern "C" {
  241. #endif // __cplusplus
  242. VOID GetIconSize(HICON hicon, PSIZE psize);
  243. VOID AlterWindowStyle(HWND hwnd, DWORD mask, DWORD flags);
  244. UINT GetACPCharSet();
  245. LONG TestWF(HWND hwnd, DWORD flag);
  246. BOOL DrawFrame(HDC hdc, LPRECT prect, int clFrame, int cmd); // private export
  247. __inline BOOL IsEmptyString(PVOID p, ULONG bAnsi)
  248. {
  249. return (BOOL)!(bAnsi ? *(LPSTR)p : *(LPWSTR)p);
  250. }
  251. __inline DWORD UserGetVersion()
  252. {
  253. OSVERSIONINFO osvi;
  254. osvi.dwOSVersionInfoSize = sizeof(osvi);
  255. if (!GetVersionEx(&osvi))
  256. {
  257. return 0;
  258. }
  259. return (DWORD)MAKEWORD(osvi.dwMinorVersion, osvi.dwMajorVersion);
  260. }
  261. #ifdef __cplusplus
  262. }
  263. #endif // __cplusplus
  264. #endif // USRCTL32__UsrCtl32_h__INCLUDED