Updated so it's in line with README.
[wine.git] / include / windef.h
blobd7e6ee98aaf90c1d2afea562289333fa30672a4b
1 /*
2 * Basic types definitions
4 * Copyright 1996 Alexandre Julliard
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 #ifndef __WINE_WINDEF_H
22 #define __WINE_WINDEF_H
24 #ifdef __WINE__
25 # undef UNICODE
26 #endif /* __WINE__ */
28 #define WINVER 0x0500
30 #include "winnt.h"
33 #ifdef __cplusplus
34 extern "C" {
35 #endif
38 /* Macros to map Winelib names to the correct implementation name */
39 /* depending on __WINE__ and UNICODE macros. */
40 /* Note that Winelib is purely Win32. */
42 #ifdef __WINE__
43 # define WINELIB_NAME_AW(func) \
44 func##_must_be_suffixed_with_W_or_A_in_this_context \
45 func##_must_be_suffixed_with_W_or_A_in_this_context
46 #else /* __WINE__ */
47 # ifdef UNICODE
48 # define WINELIB_NAME_AW(func) func##W
49 # else
50 # define WINELIB_NAME_AW(func) func##A
51 # endif /* UNICODE */
52 #endif /* __WINE__ */
54 #ifdef __WINE__
55 # define DECL_WINELIB_TYPE_AW(type) /* nothing */
56 #else /* __WINE__ */
57 # define DECL_WINELIB_TYPE_AW(type) typedef WINELIB_NAME_AW(type) type;
58 #endif /* __WINE__ */
61 /* Integer types */
62 typedef UINT WPARAM;
63 typedef LONG LPARAM;
64 typedef LONG LRESULT;
65 typedef WORD ATOM;
66 typedef WORD CATCHBUF[9];
67 typedef WORD *LPCATCHBUF;
68 typedef DWORD COLORREF, *LPCOLORREF;
71 /* Handle types that exist both in Win16 and Win32. */
73 typedef int HFILE;
74 DECLARE_OLD_HANDLE(HACCEL);
75 DECLARE_OLD_HANDLE(HBITMAP);
76 DECLARE_OLD_HANDLE(HBRUSH);
77 DECLARE_HANDLE(HCOLORSPACE);
78 DECLARE_OLD_HANDLE(HDC);
79 DECLARE_HANDLE(HDESK);
80 DECLARE_OLD_HANDLE(HENHMETAFILE);
81 DECLARE_OLD_HANDLE(HFONT);
82 DECLARE_OLD_HANDLE(HHOOK);
83 DECLARE_OLD_HANDLE(HICON);
84 DECLARE_OLD_HANDLE(HINSTANCE);
85 DECLARE_OLD_HANDLE(HKEY);
86 DECLARE_OLD_HANDLE(HKL);
87 DECLARE_OLD_HANDLE(HMENU);
88 DECLARE_OLD_HANDLE(HMETAFILE);
89 DECLARE_OLD_HANDLE(HMONITOR);
90 DECLARE_OLD_HANDLE(HPALETTE);
91 DECLARE_OLD_HANDLE(HPEN);
92 DECLARE_OLD_HANDLE(HRGN);
93 DECLARE_OLD_HANDLE(HRSRC);
94 DECLARE_OLD_HANDLE(HTASK);
95 DECLARE_HANDLE(HWINSTA);
96 DECLARE_OLD_HANDLE(HWND);
98 /* Handle types that must remain interchangeable even with strict on */
100 typedef HINSTANCE HMODULE;
101 typedef HANDLE HGDIOBJ;
102 typedef HANDLE HGLOBAL;
103 typedef HANDLE HLOCAL;
104 typedef HANDLE GLOBALHANDLE;
105 typedef HANDLE LOCALHANDLE;
106 typedef HICON HCURSOR;
108 /* Callback function pointers types */
110 typedef INT (CALLBACK *FARPROC)();
111 typedef INT (CALLBACK *PROC)();
114 /* Macros to split words and longs. */
116 #define LOBYTE(w) ((BYTE)(WORD)(w))
117 #define HIBYTE(w) ((BYTE)((WORD)(w) >> 8))
119 #define LOWORD(l) ((WORD)(DWORD)(l))
120 #define HIWORD(l) ((WORD)((DWORD)(l) >> 16))
122 #define SLOWORD(l) ((SHORT)(LONG)(l))
123 #define SHIWORD(l) ((SHORT)((LONG)(l) >> 16))
125 #define MAKEWORD(low,high) ((WORD)(((BYTE)(low)) | ((WORD)((BYTE)(high))) << 8))
126 #define MAKELONG(low,high) ((LONG)(((WORD)(low)) | (((DWORD)((WORD)(high))) << 16)))
127 #define MAKELPARAM(low,high) ((LPARAM)MAKELONG(low,high))
128 #define MAKEWPARAM(low,high) ((WPARAM)MAKELONG(low,high))
129 #define MAKELRESULT(low,high) ((LRESULT)MAKELONG(low,high))
131 #define SELECTOROF(ptr) (HIWORD(ptr))
132 #define OFFSETOF(ptr) (LOWORD(ptr))
134 #ifdef __WINE__
135 /* macros to set parts of a DWORD (not in the Windows API) */
136 #define SET_LOWORD(dw,val) ((dw) = ((dw) & 0xffff0000) | LOWORD(val))
137 #define SET_LOBYTE(dw,val) ((dw) = ((dw) & 0xffffff00) | LOBYTE(val))
138 #define SET_HIBYTE(dw,val) ((dw) = ((dw) & 0xffff00ff) | (LOBYTE(val) << 8))
139 #define ADD_LOWORD(dw,val) ((dw) = ((dw) & 0xffff0000) | LOWORD((DWORD)(dw)+(val)))
140 #endif
142 /* min and max macros */
143 #ifndef NOMINMAX
144 #ifndef max
145 #define max(a,b) (((a) > (b)) ? (a) : (b))
146 #endif
147 #ifndef min
148 #define min(a,b) (((a) < (b)) ? (a) : (b))
149 #endif
150 #endif /* NOMINMAX */
152 #define MAX_PATH 260
153 #define HFILE_ERROR ((HFILE)-1)
155 /* The SIZE structure */
156 typedef struct tagSIZE
158 LONG cx;
159 LONG cy;
160 } SIZE, *PSIZE, *LPSIZE;
162 typedef SIZE SIZEL, *PSIZEL, *LPSIZEL;
164 /* The POINT structure */
165 typedef struct tagPOINT
167 LONG x;
168 LONG y;
169 } POINT, *PPOINT, *LPPOINT;
171 typedef struct _POINTL
173 LONG x;
174 LONG y;
175 } POINTL;
177 /* The POINTS structure */
179 typedef struct tagPOINTS
181 SHORT x;
182 SHORT y;
183 } POINTS, *PPOINTS, *LPPOINTS;
185 /* The RECT structure */
186 typedef struct tagRECT
188 INT left;
189 INT top;
190 INT right;
191 INT bottom;
192 } RECT, *PRECT, *LPRECT;
193 typedef const RECT *LPCRECT;
196 typedef struct tagRECTL
198 LONG left;
199 LONG top;
200 LONG right;
201 LONG bottom;
202 } RECTL, *PRECTL, *LPRECTL;
204 typedef const RECTL *LPCRECTL;
206 #ifdef __cplusplus
208 #endif
210 #endif /* __WINE_WINDEF_H */