Convert MessageBox family functions to unicode.
[wine] / include / windef.h
1 /*
2  * Basic types definitions
3  *
4  * Copyright 1996 Alexandre Julliard
5  *
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.
10  *
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.
15  *
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
19  */
20
21 #ifndef __WINE_WINDEF_H
22 #define __WINE_WINDEF_H
23
24 #ifdef __WINE__
25 # undef UNICODE
26 #endif  /* __WINE__ */
27
28 #define WINVER 0x0500
29
30 #include "winnt.h"
31
32
33 #ifdef __cplusplus
34 extern "C" {
35 #endif
36
37
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.                             */
41
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__ */
53
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__ */
59
60
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;
69
70
71 /* Handle types that exist both in Win16 and Win32. */
72
73 typedef int HFILE;
74 DECLARE_HANDLE(HACCEL);
75 DECLARE_HANDLE(HBITMAP);
76 DECLARE_HANDLE(HBRUSH);
77 DECLARE_HANDLE(HCOLORSPACE);
78 DECLARE_HANDLE(HDC);
79 DECLARE_HANDLE(HDESK);
80 DECLARE_HANDLE(HENHMETAFILE);
81 DECLARE_HANDLE(HFONT);
82 DECLARE_HANDLE(HHOOK);
83 DECLARE_HANDLE(HICON);
84 DECLARE_HANDLE(HINSTANCE);
85 DECLARE_HANDLE(HKEY);
86 DECLARE_HANDLE(HKL);
87 DECLARE_HANDLE(HMENU);
88 DECLARE_HANDLE(HMETAFILE);
89 DECLARE_HANDLE(HMONITOR);
90 DECLARE_HANDLE(HPALETTE);
91 DECLARE_HANDLE(HPEN);
92 DECLARE_HANDLE(HRGN);
93 DECLARE_HANDLE(HRSRC);
94 DECLARE_HANDLE(HTASK);
95 DECLARE_HANDLE(HWINEVENTHOOK);
96 DECLARE_HANDLE(HWINSTA);
97 DECLARE_HANDLE(HWND);
98
99 /* Handle types that must remain interchangeable even with strict on */
100
101 typedef HINSTANCE HMODULE;
102 typedef HANDLE HGDIOBJ;
103 typedef HANDLE HGLOBAL;
104 typedef HANDLE HLOCAL;
105 typedef HANDLE GLOBALHANDLE;
106 typedef HANDLE LOCALHANDLE;
107 typedef HICON HCURSOR;
108
109 /* Callback function pointers types */
110
111 typedef INT     (CALLBACK *FARPROC)();
112 typedef INT     (CALLBACK *PROC)();
113
114
115 /* Macros to split words and longs. */
116
117 #define LOBYTE(w)              ((BYTE)(WORD)(w))
118 #define HIBYTE(w)              ((BYTE)((WORD)(w) >> 8))
119
120 #define LOWORD(l)              ((WORD)(DWORD)(l))
121 #define HIWORD(l)              ((WORD)((DWORD)(l) >> 16))
122
123 #define SLOWORD(l)             ((SHORT)(LONG)(l))
124 #define SHIWORD(l)             ((SHORT)((LONG)(l) >> 16))
125
126 #define MAKEWORD(low,high)     ((WORD)(((BYTE)(low)) | ((WORD)((BYTE)(high))) << 8))
127 #define MAKELONG(low,high)     ((LONG)(((WORD)(low)) | (((DWORD)((WORD)(high))) << 16)))
128 #define MAKELPARAM(low,high)   ((LPARAM)MAKELONG(low,high))
129 #define MAKEWPARAM(low,high)   ((WPARAM)MAKELONG(low,high))
130 #define MAKELRESULT(low,high)  ((LRESULT)MAKELONG(low,high))
131
132 #define SELECTOROF(ptr)     (HIWORD(ptr))
133 #define OFFSETOF(ptr)       (LOWORD(ptr))
134
135 #ifdef __WINE__
136 /* macros to set parts of a DWORD (not in the Windows API) */
137 #define SET_LOWORD(dw,val)  ((dw) = ((dw) & 0xffff0000) | LOWORD(val))
138 #define SET_LOBYTE(dw,val)  ((dw) = ((dw) & 0xffffff00) | LOBYTE(val))
139 #define SET_HIBYTE(dw,val)  ((dw) = ((dw) & 0xffff00ff) | (LOBYTE(val) << 8))
140 #define ADD_LOWORD(dw,val)  ((dw) = ((dw) & 0xffff0000) | LOWORD((DWORD)(dw)+(val)))
141 #endif
142
143 /* min and max macros */
144 #ifndef NOMINMAX
145 #ifndef max
146 #define max(a,b)   (((a) > (b)) ? (a) : (b))
147 #endif
148 #ifndef min
149 #define min(a,b)   (((a) < (b)) ? (a) : (b))
150 #endif
151 #endif  /* NOMINMAX */
152
153 #ifdef MAX_PATH /* Work-around for Mingw */ 
154 #undef MAX_PATH
155 #endif /* MAX_PATH */
156
157 #define MAX_PATH        260
158 #define HFILE_ERROR     ((HFILE)-1)
159
160 /* The SIZE structure */
161 typedef struct tagSIZE
162 {
163     LONG cx;
164     LONG cy;
165 } SIZE, *PSIZE, *LPSIZE;
166
167 typedef SIZE SIZEL, *PSIZEL, *LPSIZEL;
168
169 /* The POINT structure */
170 typedef struct tagPOINT
171 {
172     LONG  x;
173     LONG  y;
174 } POINT, *PPOINT, *LPPOINT;
175
176 typedef struct _POINTL
177 {
178     LONG x;
179     LONG y;
180 } POINTL;
181
182 /* The POINTS structure */
183
184 typedef struct tagPOINTS
185 {
186     SHORT x;
187     SHORT y;
188 } POINTS, *PPOINTS, *LPPOINTS;
189
190 /* The RECT structure */
191 typedef struct tagRECT
192 {
193     INT  left;
194     INT  top;
195     INT  right;
196     INT  bottom;
197 } RECT, *PRECT, *LPRECT;
198 typedef const RECT *LPCRECT;
199
200
201 typedef struct tagRECTL
202 {
203     LONG left;
204     LONG top;
205     LONG right;
206     LONG bottom;
207 } RECTL, *PRECTL, *LPRECTL;
208
209 typedef const RECTL *LPCRECTL;
210
211 #ifdef __cplusplus
212 }
213 #endif
214
215 #endif /* __WINE_WINDEF_H */