root/trunk/win32/windef.d

Revision 380, 3.2 kB (checked in by Zone, 2 months ago)

Adding the missing bits and pieces (primarily vista/7 enums etc) required to compile the D port of the WTL that I am working on

Line 
1 /***********************************************************************\
2 *                                windef.d                               *
3 *                                                                       *
4 *                       Windows API header module                       *
5 *                                                                       *
6 *                 Translated from MinGW Windows headers                 *
7 *                           by Stewart Gordon                           *
8 *                                                                       *
9 *                       Placed into public domain                       *
10 \***********************************************************************/
11 module win32.windef;
12
13 public import win32.winnt;
14 private import win32.w32api;
15
16 const size_t MAX_PATH = 260;
17
18 ushort MAKEWORD(ubyte a, ubyte b) {
19     return cast(ushort) ((b << 8) | a);
20 }
21
22 ushort MAKEWORD(ushort a, ushort b) {
23     assert((a & 0xFF00) == 0);
24     assert((b & 0xFF00) == 0);
25     return MAKEWORD(cast(ubyte)a, cast(ubyte)b);
26 }
27
28 uint MAKELONG(ushort a, ushort b) {
29     return cast(uint) ((b << 16) | a);
30 }
31
32 uint MAKELONG(uint a, uint b) {
33     assert((a & 0xFFFF0000) == 0);
34     assert((b & 0xFFFF0000) == 0);
35     return MAKELONG(cast(ushort)a, cast(ushort)b);
36 }
37
38 ushort LOWORD(uint l) {
39     return cast(ushort) l;
40 }
41
42 ushort HIWORD(uint l) {
43     return cast(ushort) (l >>> 16);
44 }
45
46 ubyte LOBYTE(ushort w) {
47     return cast(ubyte) w;
48 }
49
50 ubyte HIBYTE(ushort w) {
51     return cast(ubyte) (w >>> 8);
52 }
53
54 template max(T) {
55     T max(T a, T b) {
56         return a > b ? a : b;
57     }
58 }
59
60 template min(T) {
61     T min(T a, T b) {
62         return a < b ? a : b;
63     }
64 }
65
66 const void* NULL = null;
67 alias ubyte       BYTE;
68 alias ubyte*      PBYTE, LPBYTE;
69 alias ushort      USHORT, WORD, ATOM;
70 alias ushort*     PUSHORT, PWORD, LPWORD;
71 alias uint        ULONG, DWORD, UINT, COLORREF;
72 alias uint*       PULONG, PDWORD, LPDWORD, PUINT, LPUINT;
73 alias int         WINBOOL, BOOL, INT, LONG, HFILE, HRESULT;
74 alias int*        PWINBOOL, LPWINBOOL, PBOOL, LPBOOL, PINT, LPINT, LPLONG;
75 alias float       FLOAT;
76 alias float*      PFLOAT;
77 alias CPtr!(void) PCVOID, LPCVOID;
78
79 alias UINT_PTR WPARAM;
80 alias LONG_PTR LPARAM, LRESULT;
81
82 alias HANDLE HGLOBAL, HLOCAL, GLOBALHANDLE, LOCALHANDLE, HGDIOBJ, HACCEL,
83   HBITMAP, HBRUSH, HCOLORSPACE, HDC, HGLRC, HDESK, HENHMETAFILE, HFONT,
84   HICON, HINSTANCE, HKEY, HMENU, HMETAFILE, HMODULE, HMONITOR, HPALETTE, HPEN,
85   HRGN, HRSRC, HSTR, HTASK, HWND, HWINSTA, HKL, HCURSOR;
86 alias HANDLE* PHKEY;
87
88 static if (WINVER >= 0x500) {
89     alias HANDLE HTERMINAL, HWINEVENTHOOK;
90 }
91
92 alias extern (Windows) int function() FARPROC, NEARPROC, PROC;
93
94 struct RECT {
95     LONG left;
96     LONG top;
97     LONG right;
98     LONG bottom;
99 }
100 alias RECT RECTL;
101 alias RECT*       PRECT, LPRECT, PRECTL, LPRECTL;
102 alias CPtr!(RECT) LPCRECT, LPCRECTL;
103
104 struct POINT {
105     LONG x;
106     LONG y;
107 }
108 alias POINT POINTL;
109 alias POINT* PPOINT, LPPOINT, PPOINTL, LPPOINTL;
110
111 struct SIZE {
112     LONG cx;
113     LONG cy;
114 }
115 alias SIZE SIZEL;
116 alias SIZE* PSIZE, LPSIZE, PSIZEL, LPSIZEL;
117
118 struct POINTS {
119     SHORT x;
120     SHORT y;
121 }
122 alias POINTS* PPOINTS, LPPOINTS;
123
124 enum : BOOL {
125     FALSE = 0,
126     TRUE  = 1
127 }
Note: See TracBrowser for help on using the browser.