]> git.saurik.com Git - wxWidgets.git/blob - include/wx/msw/missing.h
fix crash when reading malformed PCX images (#3836)
[wxWidgets.git] / include / wx / msw / missing.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/msw/missing.h
3 // Purpose: Declarations for parts of the Win32 SDK that are missing in
4 // the versions that come with some compilers
5 // Created: 2002/04/23
6 // RCS-ID: $Id$
7 // Copyright: (c) 2002 Mattia Barbon
8 // Licence: wxWindows licence
9 /////////////////////////////////////////////////////////////////////////////
10
11 #ifndef _WX_MISSING_H_
12 #define _WX_MISSING_H_
13
14 /*
15 * The following are required for VC++ 6.
16 */
17
18 // Needed by cursor.cpp
19 #ifndef IDC_HAND
20 #define IDC_HAND MAKEINTRESOURCE(32649)
21 #endif
22
23 // Needed by strconv.cpp
24 #ifndef WC_NO_BEST_FIT_CHARS
25 #define WC_NO_BEST_FIT_CHARS 0x400
26 #endif
27
28 #ifndef WM_CONTEXTMENU
29 #define WM_CONTEXTMENU 0x007B
30 #endif
31
32 // Needed by toplevel.cpp
33 #ifndef WM_UPDATEUISTATE
34 #define WM_UPDATEUISTATE 0x0128
35 #endif
36
37 #ifndef WM_CHANGEUISTATE
38 #define WM_CHANGEUISTATE 0x0127
39 #endif
40
41 #ifndef WM_PRINTCLIENT
42 #define WM_PRINTCLIENT 0x318
43 #endif
44
45 // Needed by toplevel.cpp
46 #ifndef UIS_SET
47 #define UIS_SET 1
48 #define UIS_CLEAR 2
49 #define UIS_INITIALIZE 3
50 #endif
51
52 #ifndef UISF_HIDEFOCUS
53 #define UISF_HIDEFOCUS 1
54 #endif
55
56 #ifndef UISF_HIDEACCEL
57 #define UISF_HIDEACCEL 2
58 #endif
59
60 #ifndef OFN_EXPLORER
61 #define OFN_EXPLORER 0x00080000
62 #endif
63
64 #ifndef OFN_ENABLESIZING
65 #define OFN_ENABLESIZING 0x00800000
66 #endif
67
68 // Needed by window.cpp
69 #if wxUSE_MOUSEWHEEL
70 #ifndef WM_MOUSEWHEEL
71 #define WM_MOUSEWHEEL 0x020A
72 #endif
73 #ifndef WHEEL_DELTA
74 #define WHEEL_DELTA 120
75 #endif
76 #ifndef SPI_GETWHEELSCROLLLINES
77 #define SPI_GETWHEELSCROLLLINES 104
78 #endif
79 #endif // wxUSE_MOUSEWHEEL
80
81 // Needed by window.cpp
82 #ifndef VK_OEM_1
83 #define VK_OEM_1 0xBA
84 #define VK_OEM_2 0xBF
85 #define VK_OEM_3 0xC0
86 #define VK_OEM_4 0xDB
87 #define VK_OEM_5 0xDC
88 #define VK_OEM_6 0xDD
89 #define VK_OEM_7 0xDE
90 #endif
91
92 #ifndef VK_OEM_COMMA
93 #define VK_OEM_PLUS 0xBB
94 #define VK_OEM_COMMA 0xBC
95 #define VK_OEM_MINUS 0xBD
96 #define VK_OEM_PERIOD 0xBE
97 #endif
98
99 #ifndef SM_TABLETPC
100 #define SM_TABLETPC 86
101 #endif
102
103 #ifndef INKEDIT_CLASS
104 # define INKEDIT_CLASSW L"INKEDIT"
105 # ifdef UNICODE
106 # define INKEDIT_CLASS INKEDIT_CLASSW
107 # else
108 # define INKEDIT_CLASS "INKEDIT"
109 # endif
110 #endif
111
112 #ifndef EM_SETINKINSERTMODE
113 # define EM_SETINKINSERTMODE (WM_USER + 0x0204)
114 #endif
115
116 #ifndef EM_SETUSEMOUSEFORINPUT
117 #define EM_SETUSEMOUSEFORINPUT (WM_USER + 0x224)
118 #endif
119
120 #ifndef TPM_RECURSE
121 #define TPM_RECURSE 1
122 #endif
123
124
125 #ifndef WS_EX_LAYOUTRTL
126 #define WS_EX_LAYOUTRTL 0x00400000
127 #endif
128
129 #ifndef WS_EX_COMPOSITED
130 #define WS_EX_COMPOSITED 0x02000000L
131 #endif
132
133 #ifndef WS_EX_LAYERED
134 #define WS_EX_LAYERED 0x00080000
135 #endif
136
137 #ifndef LWA_ALPHA
138 #define LWA_ALPHA 2
139 #endif
140
141 #ifndef QS_ALLPOSTMESSAGE
142 #define QS_ALLPOSTMESSAGE 0
143 #endif
144
145 /*
146 * The following are required for VC++ 5 when the PSDK is not available.
147 */
148
149 #if defined __VISUALC__ && __VISUALC__ <= 1100
150
151 #ifndef VER_NT_WORKSTATION
152
153 typedef struct _OSVERSIONINFOEXA {
154 DWORD dwOSVersionInfoSize;
155 DWORD dwMajorVersion;
156 DWORD dwMinorVersion;
157 DWORD dwBuildNumber;
158 DWORD dwPlatformId;
159 CHAR szCSDVersion[128];
160 WORD wServicePackMajor;
161 WORD wServicePackMinor;
162 WORD wSuiteMask;
163 BYTE wProductType;
164 BYTE wReserved;
165 } OSVERSIONINFOEXA, *POSVERSIONINFOEXA, *LPOSVERSIONINFOEXA;
166 typedef struct _OSVERSIONINFOEXW {
167 DWORD dwOSVersionInfoSize;
168 DWORD dwMajorVersion;
169 DWORD dwMinorVersion;
170 DWORD dwBuildNumber;
171 DWORD dwPlatformId;
172 WCHAR szCSDVersion[128];
173 WORD wServicePackMajor;
174 WORD wServicePackMinor;
175 WORD wSuiteMask;
176 BYTE wProductType;
177 BYTE wReserved;
178 } OSVERSIONINFOEXW, *POSVERSIONINFOEXW, *LPOSVERSIONINFOEXW;
179
180 #ifdef UNICODE
181 typedef OSVERSIONINFOW OSVERSIONINFO,*POSVERSIONINFO,*LPOSVERSIONINFO;
182 typedef OSVERSIONINFOEXW OSVERSIONINFOEX,*POSVERSIONINFOEX,*LPOSVERSIONINFOEX;
183 #else
184 typedef OSVERSIONINFOA OSVERSIONINFO,*POSVERSIONINFO,*LPOSVERSIONINFO;
185 typedef OSVERSIONINFOEXA OSVERSIONINFOEX,*POSVERSIONINFOEX,*LPOSVERSIONINFOEX;
186 #endif
187
188 #endif // defined VER_NT_WORKSTATION
189
190 #ifndef CP_SYMBOL
191 #define CP_SYMBOL 42
192 #endif
193
194 // NMLVCUSTOMDRAW originally didn't have the iSubItem member. It was added
195 // with IE4, as was IPN_FIRST which is used as a test :-(.
196 //
197 #ifndef IPN_FIRST
198
199 typedef struct wxtagNMLVCUSTOMDRAW_ {
200 NMCUSTOMDRAW nmcd;
201 COLORREF clrText;
202 COLORREF clrTextBk;
203 int iSubItem;
204 } wxNMLVCUSTOMDRAW_, *wxLPNMLVCUSTOMDRAW_;
205
206 #define NMLVCUSTOMDRAW wxNMLVCUSTOMDRAW_
207 #define LPNMLVCUSTOMDRAW wxLPNMLVCUSTOMDRAW_
208
209 #endif // defined IPN_FIRST
210
211 #endif // defined __VISUALC__ && __VISUALC__ <= 1100
212
213 // ----------------------------------------------------------------------------
214 // ListView common control
215 // Needed by listctrl.cpp
216 // ----------------------------------------------------------------------------
217
218 #ifndef LVS_EX_FULLROWSELECT
219 #define LVS_EX_FULLROWSELECT 0x00000020
220 #endif
221
222 // LVS_EX_LABELTIP is not supported by Windows CE, don't define it there
223 #if !defined(LVS_EX_LABELTIP) && !defined(__WXWINCE__)
224 #define LVS_EX_LABELTIP 0x00004000
225 #endif
226
227 #ifndef LVS_EX_SUBITEMIMAGES
228 #define LVS_EX_SUBITEMIMAGES 0x00000002
229 #endif
230
231 #ifndef HDN_GETDISPINFOW
232 #define HDN_GETDISPINFOW (HDN_FIRST-29)
233 #endif
234
235 #ifndef HDS_HOTTRACK
236 #define HDS_HOTTRACK 4
237 #endif
238
239 #ifndef HDF_SORTUP
240 #define HDF_SORTUP 0x0400
241 #define HDF_SORTDOWN 0x0200
242 #endif
243
244 /*
245 * In addition to the above, the following are required for several compilers.
246 */
247
248 #if !defined(CCS_VERT)
249 #define CCS_VERT 0x00000080L
250 #endif
251
252 #if !defined(CCS_RIGHT)
253 #define CCS_RIGHT (CCS_VERT|CCS_BOTTOM)
254 #endif
255
256 #if !defined(TB_SETDISABLEDIMAGELIST)
257 #define TB_SETDISABLEDIMAGELIST (WM_USER + 54)
258 #endif // !defined(TB_SETDISABLEDIMAGELIST)
259
260 #ifndef CFM_BACKCOLOR
261 #define CFM_BACKCOLOR 0x04000000
262 #endif
263
264 #ifndef HANGUL_CHARSET
265 #define HANGUL_CHARSET 129
266 #endif
267
268 #ifndef CCM_SETUNICODEFORMAT
269 #define CCM_SETUNICODEFORMAT 8197
270 #endif
271
272 // ----------------------------------------------------------------------------
273 // Tree control
274 // ----------------------------------------------------------------------------
275
276 #ifndef TV_FIRST
277 #define TV_FIRST 0x1100
278 #endif
279
280 #ifndef TVS_FULLROWSELECT
281 #define TVS_FULLROWSELECT 0x1000
282 #endif
283
284 #ifndef TVM_SETBKCOLOR
285 #define TVM_SETBKCOLOR (TV_FIRST + 29)
286 #define TVM_SETTEXTCOLOR (TV_FIRST + 30)
287 #endif
288
289 /*
290 * The following are required for BC++ 5.5 (none at present.)
291 */
292
293 /*
294 * The following are specifically required for Digital Mars C++
295 */
296
297 #ifdef __DMC__
298
299 typedef struct _OSVERSIONINFOEX {
300 DWORD dwOSVersionInfoSize;
301 DWORD dwMajorVersion;
302 DWORD dwMinorVersion;
303 DWORD dwBuildNumber;
304 DWORD dwPlatformId;
305 TCHAR szCSDVersion[ 128 ];
306 WORD wServicePackMajor;
307 WORD wServicePackMinor;
308 WORD wSuiteMask;
309 BYTE wProductType;
310 BYTE wReserved;
311 } OSVERSIONINFOEX;
312
313 #ifndef _TrackMouseEvent
314 #define _TrackMouseEvent TrackMouseEvent
315 #endif
316
317 #ifndef LVM_SETEXTENDEDLISTVIEWSTYLE
318 #define LVM_SETEXTENDEDLISTVIEWSTYLE (0x1000 + 54)
319 #endif
320
321 #ifndef LVM_GETSUBITEMRECT
322 #define LVM_GETSUBITEMRECT (0x1000 + 56)
323 #endif
324
325 #ifndef LVCF_IMAGE
326 #define LVCF_IMAGE 0x0010
327 #endif
328
329 #ifndef Header_GetItemRect
330 #define Header_GetItemRect(w,i,r) \
331 (BOOL)SendMessage((w),HDM_GETITEMRECT,(WPARAM)(i),(LPARAM)(r))
332 #endif
333
334 #ifndef HDM_GETITEMRECT
335 #define HDM_GETITEMRECT (HDM_FIRST+7)
336 #endif
337
338 #ifndef ListView_GetHeader
339 #define ListView_GetHeader(w) (HWND)SendMessage((w),LVM_GETHEADER,0,0)
340 #endif
341
342 #ifndef ListView_GetSubItemRect
343 #define ListView_GetSubItemRect(w, i, s, c, p) (HWND)SendMessage(w,LVM_GETSUBITEMRECT,i, ((p) ? ((((LPRECT)(p))->top = s), (((LPRECT)(p))->left = c), (LPARAM)(p)) : (LPARAM)(LPRECT)NULL))
344 #endif
345
346 #ifndef LVM_GETHEADER
347 #define LVM_GETHEADER (LVM_FIRST+31)
348 #endif
349
350 #ifndef HDLAYOUT
351 #define HDLAYOUT HD_LAYOUT
352 #endif
353
354 #ifndef HDITEM
355 #define HDITEM HD_ITEM
356 #endif
357
358 #ifndef NMHEADER
359 #define NMHEADER HD_NOTIFY
360 #endif
361
362 #ifndef HDS_FULLDRAG
363 #define HDS_FULLDRAG 128
364 #endif
365
366 #ifndef HDN_BEGINDRAG
367 #define HDN_BEGINDRAG (HDN_FIRST - 11)
368 #endif
369
370 #ifndef HDN_ENDDRAG
371 #define HDN_ENDDRAG (HDN_FIRST - 10)
372 #endif
373
374 #ifndef LVSICF_NOSCROLL
375 #define LVSICF_NOINVALIDATEALL 0x0001
376 #define LVSICF_NOSCROLL 0x0002
377 #endif
378
379 #ifndef CP_SYMBOL
380 #define CP_SYMBOL 42
381 #endif
382
383 // ----------------------------------------------------------------------------
384 // wxDisplay
385 // ----------------------------------------------------------------------------
386
387 // The windows headers with Digital Mars lack some typedefs.
388 // typedef them as my_XXX and then #define to rename to XXX in case
389 // a newer version of Digital Mars fixes the headers
390 // (or up to date PSDK is in use with older version)
391 // also we use any required definition (MONITOR_DEFAULTTONULL) to recognize
392 // whether whole missing block needs to be included
393
394 #ifndef MONITOR_DEFAULTTONULL
395
396 #define HMONITOR_DECLARED
397 DECLARE_HANDLE(HMONITOR);
398 typedef BOOL(CALLBACK* my_MONITORENUMPROC)(HMONITOR,HDC,LPRECT,LPARAM);
399 #define MONITORENUMPROC my_MONITORENUMPROC
400 typedef struct my_tagMONITORINFO {
401 DWORD cbSize;
402 RECT rcMonitor;
403 RECT rcWork;
404 DWORD dwFlags;
405 } my_MONITORINFO,*my_LPMONITORINFO;
406 #define MONITORINFO my_MONITORINFO
407 #define LPMONITORINFO my_LPMONITORINFO
408
409 typedef struct my_MONITORINFOEX : public my_tagMONITORINFO
410 {
411 TCHAR szDevice[CCHDEVICENAME];
412 } my_MONITORINFOEX, *my_LPMONITORINFOEX;
413 #define MONITORINFOEX my_MONITORINFOEX
414 #define LPMONITORINFOEX my_LPMONITORINFOEX
415
416 #ifndef MONITOR_DEFAULTTONULL
417 #define MONITOR_DEFAULTTONULL 0
418 #endif // MONITOR_DEFAULTTONULL
419
420 #ifndef MONITORINFOF_PRIMARY
421 #define MONITORINFOF_PRIMARY 1
422 #endif // MONITORINFOF_PRIMARY
423
424 #ifndef DDENUM_ATTACHEDSECONDARYDEVICES
425 #define DDENUM_ATTACHEDSECONDARYDEVICES 1
426 #endif
427
428 #endif // MONITOR_DEFAULTTONULL
429
430 // ----------------------------------------------------------------------------
431 // Tree control
432 // ----------------------------------------------------------------------------
433
434 #ifndef TVIS_FOCUSED
435 #define TVIS_FOCUSED 0x0001
436 #endif
437
438 #ifndef TVS_CHECKBOXES
439 #define TVS_CHECKBOXES 0x0100
440 #endif
441
442 #ifndef TVITEM
443 #define TVITEM TV_ITEM
444 #endif
445
446 #endif
447 // DMC++
448
449 /*
450 * The following are specifically required for OpenWatcom C++ (none at present)
451 */
452
453 #if defined(__WATCOMC__)
454 #endif
455
456 /*
457 * The following are specifically required for MinGW (none at present)
458 */
459
460 #if defined (__MINGW32__)
461
462 #if !wxCHECK_W32API_VERSION(3,1)
463
464 #include <windows.h>
465 #include "wx/msw/winundef.h"
466
467 typedef struct
468 {
469 RECT rgrc[3];
470 WINDOWPOS *lppos;
471 } NCCALCSIZE_PARAMS, *LPNCCALCSIZE_PARAMS;
472
473 #endif
474
475 #endif
476
477 /*
478 * In addition to the declarations for VC++, the following are required for WinCE
479 */
480
481 #ifdef __WXWINCE__
482 #include "wx/msw/wince/missing.h"
483 #endif
484
485 /*
486 * The following are specifically required for Wine
487 */
488
489 #ifdef __WINE__
490 #ifndef ENUM_CURRENT_SETTINGS
491 #define ENUM_CURRENT_SETTINGS ((DWORD)-1)
492 #endif
493 #ifndef BROADCAST_QUERY_DENY
494 #define BROADCAST_QUERY_DENY 1112363332
495 #endif
496 #endif // defined __WINE__
497
498 #endif
499 // _WX_MISSING_H_