Mark immutable objects as const. Fix inconsistent *-style.
[wine/multimedia.git] / include / windef.h
blobde226e0ed38f98d096f57ef13644c6278b78de5e
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 #ifndef WINVER
29 #define WINVER 0x0500
30 #endif
32 #include "winnt.h"
35 #ifdef __cplusplus
36 extern "C" {
37 #endif
40 /* Macros to map Winelib names to the correct implementation name */
41 /* depending on __WINE__ and UNICODE macros. */
42 /* Note that Winelib is purely Win32. */
44 #ifdef __WINE__
45 # define WINELIB_NAME_AW(func) \
46 func##_must_be_suffixed_with_W_or_A_in_this_context \
47 func##_must_be_suffixed_with_W_or_A_in_this_context
48 #else /* __WINE__ */
49 # ifdef UNICODE
50 # define WINELIB_NAME_AW(func) func##W
51 # else
52 # define WINELIB_NAME_AW(func) func##A
53 # endif /* UNICODE */
54 #endif /* __WINE__ */
56 #ifdef __WINE__
57 # define DECL_WINELIB_TYPE_AW(type) /* nothing */
58 #else /* __WINE__ */
59 # define DECL_WINELIB_TYPE_AW(type) typedef WINELIB_NAME_AW(type) type;
60 #endif /* __WINE__ */
63 /* Integer types */
64 typedef UINT WPARAM;
65 typedef LONG LPARAM;
66 typedef LONG LRESULT;
67 typedef WORD ATOM;
68 typedef WORD CATCHBUF[9];
69 typedef WORD *LPCATCHBUF;
70 typedef DWORD COLORREF, *LPCOLORREF;
73 /* Handle types that exist both in Win16 and Win32. */
75 typedef int HFILE;
76 DECLARE_HANDLE(HACCEL);
77 DECLARE_HANDLE(HBITMAP);
78 DECLARE_HANDLE(HBRUSH);
79 DECLARE_HANDLE(HCOLORSPACE);
80 DECLARE_HANDLE(HDC);
81 DECLARE_HANDLE(HDESK);
82 DECLARE_HANDLE(HENHMETAFILE);
83 DECLARE_HANDLE(HFONT);
84 DECLARE_HANDLE(HHOOK);
85 DECLARE_HANDLE(HICON);
86 DECLARE_HANDLE(HINSTANCE);
87 DECLARE_HANDLE(HKEY);
88 DECLARE_HANDLE(HKL);
89 DECLARE_HANDLE(HMENU);
90 DECLARE_HANDLE(HMETAFILE);
91 DECLARE_HANDLE(HMONITOR);
92 DECLARE_HANDLE(HPALETTE);
93 DECLARE_HANDLE(HPEN);
94 DECLARE_HANDLE(HRGN);
95 DECLARE_HANDLE(HRSRC);
96 DECLARE_HANDLE(HTASK);
97 DECLARE_HANDLE(HWINEVENTHOOK);
98 DECLARE_HANDLE(HWINSTA);
99 DECLARE_HANDLE(HWND);
101 /* Handle types that must remain interchangeable even with strict on */
103 typedef HINSTANCE HMODULE;
104 typedef HANDLE HGDIOBJ;
105 typedef HANDLE HGLOBAL;
106 typedef HANDLE HLOCAL;
107 typedef HANDLE GLOBALHANDLE;
108 typedef HANDLE LOCALHANDLE;
109 typedef HICON HCURSOR;
111 /* Callback function pointers types */
113 typedef INT (CALLBACK *FARPROC)();
114 typedef INT (CALLBACK *PROC)();
117 /* Macros to split words and longs. */
119 #define LOBYTE(w) ((BYTE)(WORD)(w))
120 #define HIBYTE(w) ((BYTE)((WORD)(w) >> 8))
122 #define LOWORD(l) ((WORD)(DWORD)(l))
123 #define HIWORD(l) ((WORD)((DWORD)(l) >> 16))
125 #define SLOWORD(l) ((SHORT)(LONG)(l))
126 #define SHIWORD(l) ((SHORT)((LONG)(l) >> 16))
128 #define MAKEWORD(low,high) ((WORD)(((BYTE)(low)) | ((WORD)((BYTE)(high))) << 8))
129 #define MAKELONG(low,high) ((LONG)(((WORD)(low)) | (((DWORD)((WORD)(high))) << 16)))
130 #define MAKELPARAM(low,high) ((LPARAM)MAKELONG(low,high))
131 #define MAKEWPARAM(low,high) ((WPARAM)MAKELONG(low,high))
132 #define MAKELRESULT(low,high) ((LRESULT)MAKELONG(low,high))
134 #define SELECTOROF(ptr) (HIWORD(ptr))
135 #define OFFSETOF(ptr) (LOWORD(ptr))
137 #ifdef __WINE__
138 /* macros to set parts of a DWORD (not in the Windows API) */
139 #define SET_LOWORD(dw,val) ((dw) = ((dw) & 0xffff0000) | LOWORD(val))
140 #define SET_LOBYTE(dw,val) ((dw) = ((dw) & 0xffffff00) | LOBYTE(val))
141 #define SET_HIBYTE(dw,val) ((dw) = ((dw) & 0xffff00ff) | (LOBYTE(val) << 8))
142 #define ADD_LOWORD(dw,val) ((dw) = ((dw) & 0xffff0000) | LOWORD((DWORD)(dw)+(val)))
143 #endif
145 /* min and max macros */
146 #ifndef NOMINMAX
147 #ifndef max
148 #define max(a,b) (((a) > (b)) ? (a) : (b))
149 #endif
150 #ifndef min
151 #define min(a,b) (((a) < (b)) ? (a) : (b))
152 #endif
153 #endif /* NOMINMAX */
155 #ifdef MAX_PATH /* Work-around for Mingw */
156 #undef MAX_PATH
157 #endif /* MAX_PATH */
159 #define MAX_PATH 260
160 #define HFILE_ERROR ((HFILE)-1)
162 /* The SIZE structure */
163 typedef struct tagSIZE
165 LONG cx;
166 LONG cy;
167 } SIZE, *PSIZE, *LPSIZE;
169 typedef SIZE SIZEL, *PSIZEL, *LPSIZEL;
171 /* The POINT structure */
172 typedef struct tagPOINT
174 LONG x;
175 LONG y;
176 } POINT, *PPOINT, *LPPOINT;
178 typedef struct _POINTL
180 LONG x;
181 LONG y;
182 } POINTL;
184 /* The POINTS structure */
186 typedef struct tagPOINTS
188 SHORT x;
189 SHORT y;
190 } POINTS, *PPOINTS, *LPPOINTS;
192 /* The RECT structure */
193 typedef struct tagRECT
195 INT left;
196 INT top;
197 INT right;
198 INT bottom;
199 } RECT, *PRECT, *LPRECT;
200 typedef const RECT *LPCRECT;
203 typedef struct tagRECTL
205 LONG left;
206 LONG top;
207 LONG right;
208 LONG bottom;
209 } RECTL, *PRECTL, *LPRECTL;
211 typedef const RECTL *LPCRECTL;
213 #ifdef __cplusplus
215 #endif
217 #endif /* __WINE_WINDEF_H */