1 /*
2 * Name: wx/defs.h
3 * Purpose: Declarations/definitions common to all wx source files
4 * Author: Julian Smart and others
5 * Modified by: Ryan Norton (Converted to C)
6 * Created: 01/02/97
7 * Copyright: (c) Julian Smart
8 * Licence: wxWindows licence
9 */
10
11 /* THIS IS A C FILE, DON'T USE C++ FEATURES (IN PARTICULAR COMMENTS) IN IT */
12
13 #ifndef _WX_DEFS_H_
14 #define _WX_DEFS_H_
15
16 /*
17 NOTE: this symbol will be replaced with "WXWIN_COMPATIBILITY_3_0" as soon
18 as the development branch for 3.1 is created
19 */
20 #define FUTURE_WXWIN_COMPATIBILITY_3_0 1
21 #define wxDEPRECATED_FUTURE( x ) x
22
23 /* ---------------------------------------------------------------------------- */
24 /* compiler and OS identification */
25 /* ---------------------------------------------------------------------------- */
26
27 #include "wx/platform.h"
28
29 #ifdef __cplusplus
30 /* Make sure the environment is set correctly */
31 # if defined(__WXMSW__) && defined(__X__)
32 # error "Target can't be both X and MSW"
33 # elif !defined(__WXMOTIF__) && \
34 !defined(__WXMSW__) && \
35 !defined(__WXGTK__) && \
36 !defined(__WXPM__) && \
37 !defined(__WXOSX_CARBON__) && \
38 !defined(__WXOSX_COCOA__) && \
39 !defined(__WXOSX_IPHONE__) && \
40 !defined(__WXCOCOA__) && \
41 !defined(__X__) && \
42 !defined(__WXDFB__) && \
43 !defined(__WXX11__) && \
44 wxUSE_GUI
45 # ifdef __UNIX__
46 # error "No Target! You should use wx-config program for compilation flags!"
47 # else /* !Unix */
48 # error "No Target! You should use supplied makefiles for compilation!"
49 # endif /* Unix/!Unix */
50 # endif
51 #endif /*__cplusplus*/
52
53 #ifndef __WXWINDOWS__
54 #define __WXWINDOWS__ 1
55 #endif
56
57 #ifndef wxUSE_BASE
58 /* by default consider that this is a monolithic build */
59 #define wxUSE_BASE 1
60 #endif
61
62 #if !wxUSE_GUI && !defined(__WXBASE__)
63 #define __WXBASE__
64 #endif
65
66 /* suppress some Visual C++ warnings */
67 #ifdef __VISUALC__
68 /* the only "real" warning here is 4244 but there are just too many of them */
69 /* in our code... one day someone should go and fix them but until then... */
70 # pragma warning(disable:4097) /* typedef used as class */
71 # pragma warning(disable:4201) /* nonstandard extension used: nameless struct/union */
72 # pragma warning(disable:4244) /* conversion from double to float */
73 # pragma warning(disable:4355) /* 'this' used in base member initializer list */
74 # pragma warning(disable:4511) /* copy ctor couldn't be generated */
75 # pragma warning(disable:4512) /* operator=() couldn't be generated */
76 # pragma warning(disable:4514) /* unreferenced inline func has been removed */
77 # pragma warning(disable:4710) /* function not inlined */
78
79 /*
80 TODO: this warning should really be enabled as it can be genuinely
81 useful, check where does it occur in wxWidgets
82 */
83 #pragma warning(disable: 4127) /* conditional expression is constant */
84
85 /* There are too many false positivies for this one, particularly when
86 using templates like wxVector<T> */
87 /* class 'foo' needs to have dll-interface to be used by clients of
88 class 'bar'" */
89 # pragma warning(disable:4251)
90
91 /*
92 This is a similar warning which occurs when deriving from standard
93 containers. MSDN even mentions that it can be ignored in this case
94 (albeit only in debug build while the warning is the same in release
95 too and seems equally harmless).
96 */
97 #if wxUSE_STD_CONTAINERS
98 # pragma warning(disable:4275)
99 #endif /* wxUSE_STD_CONTAINERS */
100
101 # ifdef __VISUALC5__
102 /* For VC++ 5.0 for release mode, the warning 'C4702: unreachable code */
103 /* is buggy, and occurs for code that does actually get executed */
104 # ifndef __WXDEBUG__
105 # pragma warning(disable:4702) /* unreachable code */
106 # endif
107
108 /* The VC++ 5.0 warning 'C4003: not enough actual parameters for macro'
109 * is incompatible with the wxWidgets headers since it is given when
110 * parameters are empty but not missing. */
111 # pragma warning(disable:4003) /* not enough actual parameters for macro */
112 # endif
113
114 /*
115 VC6 insists on complaining about
116
117 return type for 'wxVector<T>::reverse_iterator::operator ->' is 'T **'
118 (ie; not a UDT or reference to a UDT. Will produce errors if applied
119 using infix notation)
120
121 which is perfectly fine because template classes do routinely define
122 operators which don't make sense for all template parameter values
123 (besides this warning was removed in subsequent versions).
124 */
125 #ifdef __VISUALC6__
126 #pragma warning(disable: 4284)
127 #endif /* VC6 */
128
129 /*
130 When compiling with VC++ 7 /Wp64 option we get thousands of warnings for
131 conversion from size_t to int or long. Some precious few of them might
132 be worth looking into but unfortunately it seems infeasible to fix all
133 the other, harmless ones (e.g. inserting static_cast<int>(s.length())
134 everywhere this method is used though we are quite sure that using >4GB
135 strings is a bad idea anyhow) so just disable it globally for now.
136 */
137 #if wxCHECK_VISUALC_VERSION(7)
138 /* conversion from 'size_t' to 'unsigned long', possible loss of data */
139 #pragma warning(disable:4267)
140 #endif /* VC++ 7 or later */
141
142 /*
143 VC++ 8 gives a warning when using standard functions such as sprintf,
144 localtime, ... -- stop this madness, unless the user had already done it
145 */
146 #if wxCHECK_VISUALC_VERSION(8)
147 #ifndef _CRT_SECURE_NO_DEPRECATE
148 #define _CRT_SECURE_NO_DEPRECATE 1
149 #endif
150 #ifndef _CRT_NON_CONFORMING_SWPRINTFS
151 #define _CRT_NON_CONFORMING_SWPRINTFS 1
152 #endif
153 #ifndef _SCL_SECURE_NO_WARNINGS
154 #define _SCL_SECURE_NO_WARNINGS 1
155 #endif
156 #endif /* VC++ 8 */
157 #endif /* __VISUALC__ */
158
159 /* suppress some Borland C++ warnings */
160 #ifdef __BORLANDC__
161 # pragma warn -inl /* Functions containing reserved words and certain constructs are not expanded inline */
162 #endif /* __BORLANDC__ */
163
164 /*
165 g++ gives a warning when a class has private dtor if it has no friends but
166 this is a perfectly valid situation for a ref-counted class which destroys
167 itself when its ref count drops to 0, so provide a macro to suppress this
168 warning
169 */
170 #ifdef __GNUG__
171 # define wxSUPPRESS_GCC_PRIVATE_DTOR_WARNING(name) \
172 friend class wxDummyFriendFor ## name;
173 #else /* !g++ */
174 # define wxSUPPRESS_GCC_PRIVATE_DTOR_WARNING(name)
175 #endif
176
177 /*
178 Clang Support
179 */
180
181 #ifndef WX_HAS_CLANG_FEATURE
182 # ifndef __has_feature
183 # define WX_HAS_CLANG_FEATURE(x) 0
184 # else
185 # define WX_HAS_CLANG_FEATURE(x) __has_feature(x)
186 # endif
187 #endif
188
189 /* ---------------------------------------------------------------------------- */
190 /* wxWidgets version and compatibility defines */
191 /* ---------------------------------------------------------------------------- */
192
193 #include "wx/version.h"
194
195 /* ============================================================================ */
196 /* non portable C++ features */
197 /* ============================================================================ */
198
199 /* ---------------------------------------------------------------------------- */
200 /* compiler defects workarounds */
201 /* ---------------------------------------------------------------------------- */
202
203 /*
204 Digital Unix C++ compiler only defines this symbol for .cxx and .hxx files,
205 so define it ourselves (newer versions do it for all files, though, and
206 don't allow it to be redefined)
207 */
208 #if defined(__DECCXX) && !defined(__VMS) && !defined(__cplusplus)
209 #define __cplusplus
210 #endif /* __DECCXX */
211
212 /* Resolves linking problems under HP-UX when compiling with gcc/g++ */
213 #if defined(__HPUX__) && defined(__GNUG__)
214 #define va_list __gnuc_va_list
215 #endif /* HP-UX */
216
217 /* Prevents conflicts between sys/types.h and winsock.h with Cygwin, */
218 /* when using Windows sockets. */
219 #if defined(__CYGWIN__) && defined(__WINDOWS__)
220 #define __USE_W32_SOCKETS
221 #endif
222
223 /* ---------------------------------------------------------------------------- */
224 /* check for native bool type and TRUE/FALSE constants */
225 /* ---------------------------------------------------------------------------- */
226
227 /* for backwards compatibility, also define TRUE and FALSE */
228 /* */
229 /* note that these definitions should work both in C++ and C code, so don't */
230 /* use true/false below */
231 #ifndef TRUE
232 #define TRUE 1
233 #endif
234
235 #ifndef FALSE
236 #define FALSE 0
237 #endif
238
239 typedef short int WXTYPE;
240
241
242 /* ---------------------------------------------------------------------------- */
243 /* other feature tests */
244 /* ---------------------------------------------------------------------------- */
245
246 /* Every ride down a slippery slope begins with a single step.. */
247 /* */
248 /* Yes, using nested classes is indeed against our coding standards in */
249 /* general, but there are places where you can use them to advantage */
250 /* without totally breaking ports that cannot use them. If you do, then */
251 /* wrap it in this guard, but such cases should still be relatively rare. */
252 #define wxUSE_NESTED_CLASSES 1
253
254 /* check for explicit keyword support */
255 #ifndef HAVE_EXPLICIT
256 #if defined(__VISUALC__) && (__VISUALC__ >= 1100)
257 /* VC++ 6.0 and 5.0 have explicit (what about earlier versions?) */
258 #define HAVE_EXPLICIT
259 #elif ( defined(__MINGW32__) || defined(__CYGWIN32__) ) \
260 && wxCHECK_GCC_VERSION(2, 95)
261 /* GCC 2.95 has explicit, what about earlier versions? */
262 #define HAVE_EXPLICIT
263 #elif defined(__BORLANDC__) && (__BORLANDC__ >= 0x0520)
264 /* BC++ 4.52 doesn't support explicit, CBuilder 1 does */
265 #define HAVE_EXPLICIT
266 #elif defined(__DIGITALMARS__)
267 #define HAVE_EXPLICIT
268 #elif defined(__WATCOMC__)
269 #define HAVE_EXPLICIT
270 #endif
271 #endif /* !HAVE_EXPLICIT */
272
273 #ifdef HAVE_EXPLICIT
274 #define wxEXPLICIT explicit
275 #else /* !HAVE_EXPLICIT */
276 #define wxEXPLICIT
277 #endif /* HAVE_EXPLICIT/!HAVE_EXPLICIT */
278
279 /* wxFALLTHROUGH is used to notate explicit fallthroughs in switch statements */
280 #ifdef __cplusplus
281 #if __cplusplus >= 201103L && defined(__has_warning)
282 #if WX_HAS_CLANG_FEATURE(cxx_attributes)
283 #define wxFALLTHROUGH [[clang::fallthrough]]
284 #endif
285 #endif
286 #endif /* __cplusplus */
287
288 #ifndef wxFALLTHROUGH
289 #define wxFALLTHROUGH ((void)0)
290 #endif
291
292 /* these macros are obsolete, use the standard C++ casts directly now */
293 #define wx_static_cast(t, x) static_cast<t>(x)
294 #define wx_const_cast(t, x) const_cast<t>(x)
295 #define wx_reinterpret_cast(t, x) reinterpret_cast<t>(x)
296
297 /*
298 This one is a wx invention: like static cast but used when we intentionally
299 truncate from a larger to smaller type, static_cast<> can't be used for it
300 as it results in warnings when using some compilers (SGI mipspro for example)
301 */
302 #if defined(__INTELC__) && defined(__cplusplus)
303 template <typename T, typename X>
wx_truncate_cast_impl(X x)304 inline T wx_truncate_cast_impl(X x)
305 {
306 #pragma warning(push)
307 /* implicit conversion of a 64-bit integral type to a smaller integral type */
308 #pragma warning(disable: 1682)
309 /* conversion from "X" to "T" may lose significant bits */
310 #pragma warning(disable: 810)
311 /* non-pointer conversion from "foo" to "bar" may lose significant bits */
312 #pragma warning(disable: 2259)
313
314 return x;
315
316 #pragma warning(pop)
317 }
318
319 #define wx_truncate_cast(t, x) wx_truncate_cast_impl<t>(x)
320
321 #elif defined(__cplusplus) && defined(__VISUALC__) && __VISUALC__ >= 1310
322 template <typename T, typename X>
wx_truncate_cast_impl(X x)323 inline T wx_truncate_cast_impl(X x)
324 {
325 #pragma warning(push)
326 /* conversion from 'size_t' to 'type', possible loss of data */
327 #pragma warning(disable: 4267)
328 /* conversion from 'type1' to 'type2', possible loss of data */
329 #pragma warning(disable: 4242)
330
331 return x;
332
333 #pragma warning(pop)
334 }
335
336 #define wx_truncate_cast(t, x) wx_truncate_cast_impl<t>(x)
337 #else
338 #define wx_truncate_cast(t, x) ((t)(x))
339 #endif
340
341 /* for consistency with wxStatic/DynamicCast defined in wx/object.h */
342 #define wxConstCast(obj, className) wx_const_cast(className *, obj)
343
344 #ifndef HAVE_STD_WSTRING
345 #if defined(__VISUALC__) && (__VISUALC__ >= 1100)
346 /* VC++ 6.0 and 5.0 have std::wstring (what about earlier versions?) */
347 #define HAVE_STD_WSTRING
348 #elif defined(__MINGW32__) && wxCHECK_GCC_VERSION(3, 3)
349 /* GCC 3.1 has std::wstring; 3.0 never was in MinGW, 2.95 hasn't it */
350 #define HAVE_STD_WSTRING
351 #endif
352 #endif
353
354 #ifndef HAVE_STD_STRING_COMPARE
355 #if defined(__VISUALC__) && (__VISUALC__ >= 1100)
356 /* VC++ 6.0 and 5.0 have std::string::compare */
357 /* (what about earlier versions?) */
358 #define HAVE_STD_STRING_COMPARE
359 #elif ( defined(__MINGW32__) || defined(__CYGWIN32__) ) \
360 && wxCHECK_GCC_VERSION(3, 1)
361 /* GCC 3.1 has std::string::compare; */
362 /* 3.0 never was in MinGW, 2.95 hasn't it */
363 #define HAVE_STD_STRING_COMPARE
364 #endif
365 #endif
366
367 #ifndef HAVE_TR1_TYPE_TRAITS
368 #if defined(__VISUALC__) && (_MSC_FULL_VER >= 150030729)
369 #define HAVE_TR1_TYPE_TRAITS
370 #endif
371 #endif
372
373 /*
374 Check for C++11 compilers, it is important to do it before the
375 __has_include() checks because of g++ 4.9.2+ complications below.
376 */
377 #if (defined(__cplusplus) && __cplusplus >= 201103L) || wxCHECK_VISUALC_VERSION(10)
378 #ifndef HAVE_TYPE_TRAITS
379 #define HAVE_TYPE_TRAITS
380 #endif
381 #ifndef HAVE_STD_UNORDERED_MAP
382 #define HAVE_STD_UNORDERED_MAP
383 #endif
384 #ifndef HAVE_STD_UNORDERED_SET
385 #define HAVE_STD_UNORDERED_SET
386 #endif
387 #elif defined(__has_include)
388 /*
389 Notice that we trust our configure tests more than __has_include(),
390 notably the latter can return true even if the header exists but isn't
391 actually usable, as it happens with <type_traits> in non C++11 mode.
392 So if configure already detected at least one working alternative,
393 just use it.
394 */
395
396 /*
397 Since 4.9.2, g++ provides __has_include() but, unlike clang, refuses to
398 compile the C++11 headers in C++98 mode (and we are sure we use the
399 latter because we explicitly checked for C++11 above).
400 */
401 #if defined(__GNUC__) && !defined(__clang__)
402 #define wx_has_cpp11_include(h) 0
403 #else
404 #define wx_has_cpp11_include(h) __has_include(h)
405 #endif
406
407 #if !defined(HAVE_TYPE_TRAITS) && !defined(HAVE_TR1_TYPE_TRAITS)
408 #if wx_has_cpp11_include(<type_traits>)
409 #define HAVE_TYPE_TRAITS
410 #elif __has_include(<tr1/type_traits>)
411 #define HAVE_TR1_TYPE_TRAITS
412 #endif
413 #endif
414
415 #if !defined(HAVE_STD_UNORDERED_MAP) && !defined(HAVE_TR1_UNORDERED_MAP)
416 #if wx_has_cpp11_include(<unordered_map>)
417 #define HAVE_STD_UNORDERED_MAP
418 #elif __has_include(<tr1/unordered_map>)
419 #define HAVE_TR1_UNORDERED_MAP
420 #endif
421 #endif
422
423 #if !defined(HAVE_STD_UNORDERED_SET) && !defined(HAVE_TR1_UNORDERED_SET)
424 #if wx_has_cpp11_include(<unordered_set>)
425 #define HAVE_STD_UNORDERED_SET
426 #elif __has_include(<tr1/unordered_set>)
427 #define HAVE_TR1_UNORDERED_SET
428 #endif
429 #endif
430 #endif /* defined(__has_include) */
431
432 /* provide replacement for C99 va_copy() if the compiler doesn't have it */
433
434 /* could be already defined by configure or the user */
435 #ifndef wxVaCopy
436 /* if va_copy is a macro or configure detected that we have it, use it */
437 #if defined(va_copy) || defined(HAVE_VA_COPY)
438 #define wxVaCopy va_copy
439 #else /* no va_copy, try to provide a replacement */
440 /*
441 configure tries to determine whether va_list is an array or struct
442 type, but it may not be used under Windows, so deal with a few
443 special cases.
444 */
445
446 #ifdef __WATCOMC__
447 /* Watcom uses array type for va_list except for PPC and Alpha */
448 #if !defined(__PPC__) && !defined(__AXP__)
449 #define VA_LIST_IS_ARRAY
450 #endif
451 #endif /* __WATCOMC__ */
452
453 #if defined(__PPC__) && (defined(_CALL_SYSV) || defined (_WIN32))
454 /*
455 PPC using SysV ABI and NT/PPC are special in that they use an
456 extra level of indirection.
457 */
458 #define VA_LIST_IS_POINTER
459 #endif /* SysV or Win32 on __PPC__ */
460
461 /*
462 note that we use memmove(), not memcpy(), in case anybody tries
463 to do wxVaCopy(ap, ap)
464 */
465 #if defined(VA_LIST_IS_POINTER)
466 #define wxVaCopy(d, s) memmove(*(d), *(s), sizeof(va_list))
467 #elif defined(VA_LIST_IS_ARRAY)
468 #define wxVaCopy(d, s) memmove((d), (s), sizeof(va_list))
469 #else /* we can only hope that va_lists are simple lvalues */
470 #define wxVaCopy(d, s) ((d) = (s))
471 #endif
472 #endif /* va_copy/!va_copy */
473 #endif /* wxVaCopy */
474
475 #ifndef HAVE_WOSTREAM
476 /*
477 Mingw <= 3.4 and all versions of Cygwin don't have std::wostream
478 */
479 #if (defined(__MINGW32__) && !wxCHECK_GCC_VERSION(4, 0)) || \
480 defined(__CYGWIN__)
481 #define wxNO_WOSTREAM
482 #endif
483
484 /* VC++ doesn't have it in the old iostream library */
485 #if defined(__VISUALC__) && wxUSE_IOSTREAMH
486 #define wxNO_WOSTREAM
487 #endif
488
489 #ifndef wxNO_WOSTREAM
490 #define HAVE_WOSTREAM
491 #endif
492
493 #undef wxNO_WOSTREAM
494 #endif /* HAVE_WOSTREAM */
495
496 /* ---------------------------------------------------------------------------- */
497 /* other C++ features */
498 /* ---------------------------------------------------------------------------- */
499
500 #ifndef HAVE_PARTIAL_SPECIALIZATION
501 /* be optimistic by default */
502 #define HAVE_PARTIAL_SPECIALIZATION
503 #endif
504
505 #ifdef __VISUALC__
506 #if __VISUALC__ < 1310
507 #undef HAVE_PARTIAL_SPECIALIZATION
508 #endif
509 #endif /* __VISUALC__ */
510
511
512 #ifndef HAVE_TEMPLATE_OVERLOAD_RESOLUTION
513 /* assume the compiler can use type or const expressions as template
514 arguments if it supports partial specialization -- except if it's a
515 Borland one which can't */
516 #if defined(HAVE_PARTIAL_SPECIALIZATION) && !defined(__BORLANDC__)
517 #define HAVE_TEMPLATE_OVERLOAD_RESOLUTION
518 #endif /* (HAVE_PARTIAL_SPECIALIZATION) && !defined(__BORLANDC__) */
519 #endif /* !defined(HAVE_TEMPLATE_OVERLOAD_RESOLUTION) */
520
521 /* ---------------------------------------------------------------------------- */
522 /* portable calling conventions macros */
523 /* ---------------------------------------------------------------------------- */
524
525 /* stdcall is used for all functions called by Windows under Windows */
526 #if defined(__WINDOWS__)
527 #if defined(__GNUWIN32__)
528 #define wxSTDCALL __attribute__((stdcall))
529 #else
530 /* both VC++ and Borland understand this */
531 #define wxSTDCALL _stdcall
532 #endif
533
534 #else /* Win */
535 /* no such stupidness under Unix */
536 #define wxSTDCALL
537 #endif /* platform */
538
539 /* LINKAGEMODE mode is empty for everything except OS/2 */
540 #ifndef LINKAGEMODE
541 #define LINKAGEMODE
542 #endif /* LINKAGEMODE */
543
544 /* wxCALLBACK should be used for the functions which are called back by */
545 /* Windows (such as compare function for wxListCtrl) */
546 #if defined(__WIN32__) && !defined(__WXMICROWIN__)
547 #define wxCALLBACK wxSTDCALL
548 #else
549 /* no stdcall under Unix nor Win16 */
550 #define wxCALLBACK
551 #endif /* platform */
552
553 /* generic calling convention for the extern "C" functions */
554
555 #if defined(__VISUALC__)
556 #define wxC_CALLING_CONV _cdecl
557 #elif defined(__VISAGECPP__)
558 #define wxC_CALLING_CONV _Optlink
559 #else /* !Visual C++ */
560 #define wxC_CALLING_CONV
561 #endif /* compiler */
562
563 /* callling convention for the qsort(3) callback */
564 #define wxCMPFUNC_CONV wxC_CALLING_CONV
565
566 /* compatibility :-( */
567 #define CMPFUNC_CONV wxCMPFUNC_CONV
568
569 /* DLL import/export declarations */
570 #include "wx/dlimpexp.h"
571
572 /* ---------------------------------------------------------------------------- */
573 /* Very common macros */
574 /* ---------------------------------------------------------------------------- */
575
576 /* Printf-like attribute definitions to obtain warnings with GNU C/C++ */
577 #ifndef WX_ATTRIBUTE_PRINTF
578 # if defined(__GNUC__) && !wxUSE_UNICODE
579 # define WX_ATTRIBUTE_PRINTF(m, n) __attribute__ ((__format__ (__printf__, m, n)))
580 # else
581 # define WX_ATTRIBUTE_PRINTF(m, n)
582 # endif
583
584 # define WX_ATTRIBUTE_PRINTF_1 WX_ATTRIBUTE_PRINTF(1, 2)
585 # define WX_ATTRIBUTE_PRINTF_2 WX_ATTRIBUTE_PRINTF(2, 3)
586 # define WX_ATTRIBUTE_PRINTF_3 WX_ATTRIBUTE_PRINTF(3, 4)
587 # define WX_ATTRIBUTE_PRINTF_4 WX_ATTRIBUTE_PRINTF(4, 5)
588 # define WX_ATTRIBUTE_PRINTF_5 WX_ATTRIBUTE_PRINTF(5, 6)
589 #endif /* !defined(WX_ATTRIBUTE_PRINTF) */
590
591 #ifndef WX_ATTRIBUTE_NORETURN
592 # if WX_HAS_CLANG_FEATURE(attribute_analyzer_noreturn)
593 # define WX_ATTRIBUTE_NORETURN __attribute__((analyzer_noreturn))
594 # elif defined( __GNUC__ )
595 # define WX_ATTRIBUTE_NORETURN __attribute__ ((noreturn))
596 # elif wxCHECK_VISUALC_VERSION(7)
597 # define WX_ATTRIBUTE_NORETURN __declspec(noreturn)
598 # else
599 # define WX_ATTRIBUTE_NORETURN
600 # endif
601 #endif
602
603 #if defined(__GNUC__)
604 #define WX_ATTRIBUTE_UNUSED __attribute__ ((unused))
605 #else
606 #define WX_ATTRIBUTE_UNUSED
607 #endif
608
609 /*
610 Macros for marking functions as being deprecated.
611
612 The preferred macro in the new code is wxDEPRECATED_MSG() which allows to
613 explain why is the function deprecated. Almost all the existing code uses
614 the older wxDEPRECATED() or its variants currently, but this will hopefully
615 change in the future.
616 */
617
618 /* The basic compiler-specific construct to generate a deprecation warning. */
619 #ifdef __clang__
620 #define wxDEPRECATED_DECL __attribute__((deprecated))
621 #elif wxCHECK_GCC_VERSION(3, 1)
622 #define wxDEPRECATED_DECL __attribute__((deprecated))
623 #elif defined(__VISUALC__) && (__VISUALC__ >= 1300)
624 #define wxDEPRECATED_DECL __declspec(deprecated)
625 #else
626 #define wxDEPRECATED_DECL
627 #endif
628
629 /*
630 Macro taking the deprecation message. It applies to the next declaration.
631
632 If the compiler doesn't support showing the message, this degrades to a
633 simple wxDEPRECATED(), i.e. at least gives a warning, if possible.
634 */
635 #if defined(__clang__) && defined(__has_extension)
636 #if __has_extension(attribute_deprecated_with_message)
637 #define wxDEPRECATED_MSG(msg) __attribute__((deprecated(msg)))
638 #else
639 #define wxDEPRECATED_MSG(msg) __attribute__((deprecated))
640 #endif
641 #elif wxCHECK_GCC_VERSION(4, 5)
642 #define wxDEPRECATED_MSG(msg) __attribute__((deprecated(msg)))
643 #elif wxCHECK_VISUALC_VERSION(8)
644 #define wxDEPRECATED_MSG(msg) __declspec(deprecated("deprecated: " msg))
645 #else
646 #define wxDEPRECATED_MSG(msg) wxDEPRECATED_DECL
647 #endif
648
649 /*
650 Macro taking the declaration that it deprecates. Prefer to use
651 wxDEPRECATED_MSG() instead as it's simpler (wrapping the entire declaration
652 makes the code unclear) and allows to specify the explanation.
653 */
654 #define wxDEPRECATED(x) wxDEPRECATED_DECL x
655
656 #if defined(__GNUC__) && !wxCHECK_GCC_VERSION(3, 4)
657 /*
658 We need to add dummy "inline" to allow gcc < 3.4 to handle the
659 deprecation attribute on the constructors.
660 */
661 #define wxDEPRECATED_CONSTRUCTOR(x) wxDEPRECATED( inline x)
662 #else
663 #define wxDEPRECATED_CONSTRUCTOR(x) wxDEPRECATED(x)
664 #endif
665
666 /*
667 Macro which marks the function as being deprecated but also defines it
668 inline.
669
670 Currently it's defined in the same trivial way in all cases but it could
671 need a special definition with some other compilers in the future which
672 explains why do we have it.
673 */
674 #define wxDEPRECATED_INLINE(func, body) wxDEPRECATED(func) { body }
675
676 /*
677 A macro to define a simple deprecated accessor.
678 */
679 #define wxDEPRECATED_ACCESSOR(func, what) wxDEPRECATED_INLINE(func, return what;)
680
681 /*
682 Special variant of the macro above which should be used for the functions
683 which are deprecated but called by wx itself: this often happens with
684 deprecated virtual functions which are called by the library.
685 */
686 #ifdef WXBUILDING
687 # define wxDEPRECATED_BUT_USED_INTERNALLY(x) x
688 #else
689 # define wxDEPRECATED_BUT_USED_INTERNALLY(x) wxDEPRECATED(x)
690 #endif
691
692 /*
693 Macros to suppress and restore gcc warnings, requires g++ >= 4.6 and don't
694 do anything otherwise.
695
696 Example of use:
697
698 wxGCC_WARNING_SUPPRESS(float-equal)
699 inline bool wxIsSameDouble(double x, double y) { return x == y; }
700 wxGCC_WARNING_RESTORE(float-equal)
701 */
702 #if wxCHECK_GCC_VERSION(4, 6)
703 # define wxGCC_WARNING_SUPPRESS(x) \
704 _Pragma (wxSTRINGIZE(GCC diagnostic push)) \
705 _Pragma (wxSTRINGIZE(GCC diagnostic ignored wxSTRINGIZE(wxCONCAT(-W,x))))
706 # define wxGCC_WARNING_RESTORE(x) \
707 _Pragma (wxSTRINGIZE(GCC diagnostic pop))
708 #else /* gcc < 4.6 or not gcc at all */
709 # define wxGCC_WARNING_SUPPRESS(x)
710 # define wxGCC_WARNING_RESTORE(x)
711 #endif
712
713 /* Specific macros for -Wcast-function-type warning new in gcc 8. */
714 #if wxCHECK_GCC_VERSION(8, 0)
715 #define wxGCC_WARNING_SUPPRESS_CAST_FUNCTION_TYPE() \
716 wxGCC_WARNING_SUPPRESS(cast-function-type)
717 #define wxGCC_WARNING_RESTORE_CAST_FUNCTION_TYPE() \
718 wxGCC_WARNING_RESTORE(cast-function-type)
719 #else
720 #define wxGCC_WARNING_SUPPRESS_CAST_FUNCTION_TYPE()
721 #define wxGCC_WARNING_RESTORE_CAST_FUNCTION_TYPE()
722 #endif
723
724 /*
725 Combination of the two variants above: should be used for deprecated
726 functions which are defined inline and are used by wxWidgets itself.
727 */
728 #ifdef WXBUILDING
729 # define wxDEPRECATED_BUT_USED_INTERNALLY_INLINE(func, body) func { body }
730 #else
731 # define wxDEPRECATED_BUT_USED_INTERNALLY_INLINE(func, body) \
732 wxDEPRECATED(func) { body }
733 #endif
734
735 /* NULL declaration: it must be defined as 0 for C++ programs (in particular, */
736 /* it must not be defined as "(void *)0" which is standard for C but completely */
737 /* breaks C++ code) */
738 #if !defined(__HANDHELDPC__)
739 #include <stddef.h>
740 #endif
741
742 #ifdef __cplusplus
743
744 // everybody gets the assert and other debug macros
745 #include "wx/debug.h"
746
747 // delete pointer if it is not NULL and NULL it afterwards
748 template <typename T>
wxDELETE(T * & ptr)749 inline void wxDELETE(T*& ptr)
750 {
751 typedef char TypeIsCompleteCheck[sizeof(T)] WX_ATTRIBUTE_UNUSED;
752
753 if ( ptr != NULL )
754 {
755 delete ptr;
756 ptr = NULL;
757 }
758 }
759
760 // delete an array and NULL it (see comments above)
761 template <typename T>
wxDELETEA(T * & ptr)762 inline void wxDELETEA(T*& ptr)
763 {
764 typedef char TypeIsCompleteCheck[sizeof(T)] WX_ATTRIBUTE_UNUSED;
765
766 if ( ptr != NULL )
767 {
768 delete [] ptr;
769 ptr = NULL;
770 }
771 }
772
773 // trivial implementation of std::swap() for primitive types
774 template <typename T>
wxSwap(T & first,T & second)775 inline void wxSwap(T& first, T& second)
776 {
777 T tmp(first);
778 first = second;
779 second = tmp;
780 }
781 #endif /*__cplusplus*/
782
783 /* size of statically declared array */
784 #define WXSIZEOF(array) (sizeof(array)/sizeof(array[0]))
785
786 /* symbolic constant used by all Find()-like functions returning positive */
787 /* integer on success as failure indicator */
788 #define wxNOT_FOUND (-1)
789
790 /* the default value for some length parameters meaning that the string is */
791 /* NUL-terminated */
792 #define wxNO_LEN ((size_t)-1)
793
794 /* ---------------------------------------------------------------------------- */
795 /* macros dealing with comparison operators */
796 /* ---------------------------------------------------------------------------- */
797
798 /*
799 Expands into m(op, args...) for each op in the set { ==, !=, <, <=, >, >= }.
800 */
801 #define wxFOR_ALL_COMPARISONS(m) \
802 m(==) m(!=) m(>=) m(<=) m(>) m(<)
803
804 #define wxFOR_ALL_COMPARISONS_1(m, x) \
805 m(==,x) m(!=,x) m(>=,x) m(<=,x) m(>,x) m(<,x)
806
807 #define wxFOR_ALL_COMPARISONS_2(m, x, y) \
808 m(==,x,y) m(!=,x,y) m(>=,x,y) m(<=,x,y) m(>,x,y) m(<,x,y)
809
810 #define wxFOR_ALL_COMPARISONS_3(m, x, y, z) \
811 m(==,x,y,z) m(!=,x,y,z) m(>=,x,y,z) m(<=,x,y,z) m(>,x,y,z) m(<,x,y,z)
812
813 /*
814 These are only used with wxDEFINE_COMPARISON_[BY_]REV: they pass both the
815 normal and the reversed comparison operators to the macro.
816 */
817 #define wxFOR_ALL_COMPARISONS_2_REV(m, x, y) \
818 m(==,x,y,==) m(!=,x,y,!=) m(>=,x,y,<=) \
819 m(<=,x,y,>=) m(>,x,y,<) m(<,x,y,>)
820
821 #define wxFOR_ALL_COMPARISONS_3_REV(m, x, y, z) \
822 m(==,x,y,z,==) m(!=,x,y,z,!=) m(>=,x,y,z,<=) \
823 m(<=,x,y,z,>=) m(>,x,y,z,<) m(<,x,y,z,>)
824
825
826 #define wxDEFINE_COMPARISON(op, T1, T2, cmp) \
827 inline bool operator op(T1 x, T2 y) { return cmp(x, y, op); }
828
829 #define wxDEFINE_COMPARISON_REV(op, T1, T2, cmp, oprev) \
830 inline bool operator op(T2 y, T1 x) { return cmp(x, y, oprev); }
831
832 #define wxDEFINE_COMPARISON_BY_REV(op, T1, T2, oprev) \
833 inline bool operator op(T1 x, T2 y) { return y oprev x; }
834
835 /*
836 Define all 6 comparison operators (==, !=, <, <=, >, >=) for the given
837 types in the specified order. The implementation is provided by the cmp
838 macro. Normally wxDEFINE_ALL_COMPARISONS should be used as comparison
839 operators are usually symmetric.
840 */
841 #define wxDEFINE_COMPARISONS(T1, T2, cmp) \
842 wxFOR_ALL_COMPARISONS_3(wxDEFINE_COMPARISON, T1, T2, cmp)
843
844 /*
845 Define all 6 comparison operators (==, !=, <, <=, >, >=) for the given
846 types in the specified order, implemented in terms of existing operators
847 for the reverse order.
848 */
849 #define wxDEFINE_COMPARISONS_BY_REV(T1, T2) \
850 wxFOR_ALL_COMPARISONS_2_REV(wxDEFINE_COMPARISON_BY_REV, T1, T2)
851
852 /*
853 This macro allows to define all 12 comparison operators (6 operators for
854 both orders of arguments) for the given types using the provided "cmp"
855 macro to implement the actual comparison: the macro is called with the 2
856 arguments names, the first of type T1 and the second of type T2, and the
857 comparison operator being implemented.
858 */
859 #define wxDEFINE_ALL_COMPARISONS(T1, T2, cmp) \
860 wxFOR_ALL_COMPARISONS_3(wxDEFINE_COMPARISON, T1, T2, cmp) \
861 wxFOR_ALL_COMPARISONS_3_REV(wxDEFINE_COMPARISON_REV, T1, T2, cmp)
862
863 /* ---------------------------------------------------------------------------- */
864 /* macros to avoid compiler warnings */
865 /* ---------------------------------------------------------------------------- */
866
867 /* Macro to cut down on compiler warnings. */
868 #if 1 /* there should be no more any compilers needing the "#else" version */
869 #define WXUNUSED(identifier) /* identifier */
870 #else /* stupid, broken compiler */
871 #define WXUNUSED(identifier) identifier
872 #endif
873
874 /* some arguments are not used in unicode mode */
875 #if wxUSE_UNICODE
876 #define WXUNUSED_IN_UNICODE(param) WXUNUSED(param)
877 #else
878 #define WXUNUSED_IN_UNICODE(param) param
879 #endif
880
881 /* some arguments are not used in WinCE build */
882 #ifdef __WXWINCE__
883 #define WXUNUSED_IN_WINCE(param) WXUNUSED(param)
884 #else
885 #define WXUNUSED_IN_WINCE(param) param
886 #endif
887
888 /* unused parameters in non stream builds */
889 #if wxUSE_STREAMS
890 #define WXUNUSED_UNLESS_STREAMS(param) param
891 #else
892 #define WXUNUSED_UNLESS_STREAMS(param) WXUNUSED(param)
893 #endif
894
895 /* some compilers give warning about a possibly unused variable if it is */
896 /* initialized in both branches of if/else and shut up if it is initialized */
897 /* when declared, but other compilers then give warnings about unused variable */
898 /* value -- this should satisfy both of them */
899 #if defined(__VISUALC__)
900 #define wxDUMMY_INITIALIZE(val) = val
901 #else
902 #define wxDUMMY_INITIALIZE(val)
903 #endif
904
905 /* sometimes the value of a variable is *really* not used, to suppress the */
906 /* resulting warning you may pass it to this function */
907 #ifdef __cplusplus
908 # ifdef __BORLANDC__
909 # define wxUnusedVar(identifier) identifier
910 # else
911 template <class T>
wxUnusedVar(const T & WXUNUSED (t))912 inline void wxUnusedVar(const T& WXUNUSED(t)) { }
913 # endif
914 #endif
915
916 /* ---------------------------------------------------------------------------- */
917 /* compiler specific settings */
918 /* ---------------------------------------------------------------------------- */
919
920 #if wxONLY_WATCOM_EARLIER_THAN(1,4)
921 typedef short mode_t;
922 #endif
923
924 /* where should i put this? we need to make sure of this as it breaks */
925 /* the <iostream> code. */
926 #if !wxUSE_IOSTREAMH && defined(__WXDEBUG__)
927 # ifdef wxUSE_DEBUG_NEW_ALWAYS
928 # undef wxUSE_DEBUG_NEW_ALWAYS
929 # define wxUSE_DEBUG_NEW_ALWAYS 0
930 # endif
931 #endif
932
933 /* ---------------------------------------------------------------------------- */
934 /* standard wxWidgets types */
935 /* ---------------------------------------------------------------------------- */
936
937 /* the type for screen and DC coordinates */
938 typedef int wxCoord;
939
940 enum { wxDefaultCoord = -1 };
941
942 /* ---------------------------------------------------------------------------- */
943 /* define fixed length types */
944 /* ---------------------------------------------------------------------------- */
945
946 #if defined(__MINGW32__)
947 #include <sys/types.h>
948 #endif
949
950 /* chars are always one byte (by definition), shorts are always two (in */
951 /* practice) */
952
953 /* 8bit */
954 typedef signed char wxInt8;
955 typedef unsigned char wxUint8;
956 typedef wxUint8 wxByte;
957
958
959 /* 16bit */
960 #ifdef SIZEOF_SHORT
961 #if SIZEOF_SHORT != 2
962 #error "wxWidgets assumes sizeof(short) == 2, please fix the code"
963 #endif
964 #else
965 #define SIZEOF_SHORT 2
966 #endif
967
968 typedef signed short wxInt16;
969 typedef unsigned short wxUint16;
970
971 typedef wxUint16 wxWord;
972
973 /*
974 things are getting more interesting with ints, longs and pointers
975
976 there are several different standard data models described by this table:
977
978 +-----------+----------------------------+
979 |type\model | LP64 ILP64 LLP64 ILP32 LP32|
980 +-----------+----------------------------+
981 |char | 8 8 8 8 8 |
982 |short | 16 16 16 16 16 |
983 |int | 32 64 32 32 16 |
984 |long | 64 64 32 32 32 |
985 |long long | 64 64 64 -- -- |
986 |void * | 64 64 64 32 32 |
987 +-----------+----------------------------+
988
989 Win16 used LP32 (but we don't support it any longer), Win32 obviously used
990 ILP32 and Win64 uses LLP64 (a.k.a. P64)
991
992 Under Unix LP64 is the most widely used (the only I've ever seen, in fact)
993 */
994
995 /* 32bit */
996 #if defined(__WINDOWS__)
997 #if defined(__WIN32__)
998 typedef int wxInt32;
999 typedef unsigned int wxUint32;
1000
1001 /*
1002 Win64 uses LLP64 model and so ints and longs have the same size as
1003 in Win32.
1004 */
1005 #ifndef SIZEOF_INT
1006 #define SIZEOF_INT 4
1007 #endif
1008
1009 #ifndef SIZEOF_LONG
1010 #define SIZEOF_LONG 4
1011 #endif
1012
1013 #ifndef SIZEOF_LONG_LONG
1014 #define SIZEOF_LONG_LONG 8
1015 #endif
1016
1017 #ifndef SIZEOF_WCHAR_T
1018 /* Windows uses UTF-16 */
1019 #define SIZEOF_WCHAR_T 2
1020 #endif
1021
1022 #ifndef SIZEOF_SIZE_T
1023 /*
1024 Under Win64 sizeof(size_t) == 8 and so it is neither unsigned
1025 int nor unsigned long!
1026 */
1027 #ifdef __WIN64__
1028 #define SIZEOF_SIZE_T 8
1029
1030 #undef wxSIZE_T_IS_UINT
1031 #else /* Win32 */
1032 #define SIZEOF_SIZE_T 4
1033
1034 #define wxSIZE_T_IS_UINT
1035 #endif
1036 #undef wxSIZE_T_IS_ULONG
1037 #endif
1038
1039 #ifndef SIZEOF_VOID_P
1040 #ifdef __WIN64__
1041 #define SIZEOF_VOID_P 8
1042 #else /* Win32 */
1043 #define SIZEOF_VOID_P 4
1044 #endif /* Win64/32 */
1045 #endif
1046 #else
1047 #error "Unsupported Windows version"
1048 #endif
1049 #else /* !Windows */
1050 /* SIZEOF_XXX are normally defined by configure */
1051 #ifdef SIZEOF_INT
1052 #if SIZEOF_INT == 8
1053 /* must be ILP64 data model, there is normally a special 32 bit */
1054 /* type in it but we don't know what it is... */
1055 #error "No 32bit int type on this platform"
1056 #elif SIZEOF_INT == 4
1057 typedef int wxInt32;
1058 typedef unsigned int wxUint32;
1059 #elif SIZEOF_INT == 2
1060 /* must be LP32 */
1061 #if SIZEOF_LONG != 4
1062 #error "No 32bit int type on this platform"
1063 #endif
1064
1065 typedef long wxInt32;
1066 typedef unsigned long wxUint32;
1067 #else
1068 /* wxWidgets is not ready for 128bit systems yet... */
1069 #error "Unknown sizeof(int) value, what are you compiling for?"
1070 #endif
1071 #else /* !defined(SIZEOF_INT) */
1072 /* assume default 32bit machine -- what else can we do? */
1073 wxCOMPILE_TIME_ASSERT( sizeof(int) == 4, IntMustBeExactly4Bytes);
1074 wxCOMPILE_TIME_ASSERT( sizeof(size_t) == 4, SizeTMustBeExactly4Bytes);
1075 wxCOMPILE_TIME_ASSERT( sizeof(void *) == 4, PtrMustBeExactly4Bytes);
1076
1077 #define SIZEOF_INT 4
1078 #define SIZEOF_SIZE_T 4
1079 #define SIZEOF_VOID_P 4
1080
1081 typedef int wxInt32;
1082 typedef unsigned int wxUint32;
1083
1084 #if defined(__MACH__) && !defined(SIZEOF_WCHAR_T)
1085 #define SIZEOF_WCHAR_T 4
1086 #endif
1087 #if !defined(SIZEOF_WCHAR_T)
1088 /* also assume that sizeof(wchar_t) == 2 (under Unix the most */
1089 /* common case is 4 but there configure would have defined */
1090 /* SIZEOF_WCHAR_T for us) */
1091 /* the most common case */
1092 wxCOMPILE_TIME_ASSERT( sizeof(wchar_t) == 2,
1093 Wchar_tMustBeExactly2Bytes);
1094
1095 #define SIZEOF_WCHAR_T 2
1096 #endif /* !defined(SIZEOF_WCHAR_T) */
1097 #endif
1098 #endif /* Win/!Win */
1099
1100 #ifndef SIZEOF_WCHAR_T
1101 #error "SIZEOF_WCHAR_T must be defined, but isn't"
1102 #endif
1103
1104 /* also define C99-like sized MIN/MAX constants */
1105 #define wxINT8_MIN CHAR_MIN
1106 #define wxINT8_MAX CHAR_MAX
1107 #define wxUINT8_MAX UCHAR_MAX
1108
1109 #define wxINT16_MIN SHRT_MIN
1110 #define wxINT16_MAX SHRT_MAX
1111 #define wxUINT16_MAX USHRT_MAX
1112
1113 #if SIZEOF_INT == 4
1114 #define wxINT32_MIN INT_MIN
1115 #define wxINT32_MAX INT_MAX
1116 #define wxUINT32_MAX UINT_MAX
1117 #elif SIZEOF_LONG == 4
1118 #define wxINT32_MIN LONG_MIN
1119 #define wxINT32_MAX LONG_MAX
1120 #define wxUINT32_MAX ULONG_MAX
1121 #else
1122 #error "Unknown 32 bit type"
1123 #endif
1124
1125 typedef wxUint32 wxDword;
1126
1127 #ifdef LLONG_MAX
1128 #define wxINT64_MIN LLONG_MIN
1129 #define wxINT64_MAX LLONG_MAX
1130 #define wxUINT64_MAX ULLONG_MAX
1131 #else
1132 #define wxINT64_MIN (wxLL(-9223372036854775807)-1)
1133 #define wxINT64_MAX wxLL(9223372036854775807)
1134 #define wxUINT64_MAX wxULL(0xFFFFFFFFFFFFFFFF)
1135 #endif
1136
1137 /* 64 bit */
1138
1139 /* NB: we #define and not typedef wxLongLong_t because we use "#ifdef */
1140 /* wxLongLong_t" in wx/longlong.h */
1141
1142 /* wxULongLong_t is set later (usually to unsigned wxLongLong_t) */
1143
1144 /* to avoid compilation problems on 64bit machines with ambiguous method calls */
1145 /* we will need to define this */
1146 #undef wxLongLongIsLong
1147
1148 /*
1149 First check for specific compilers which have known 64 bit integer types,
1150 this avoids clashes with SIZEOF_LONG[_LONG] being defined incorrectly for
1151 e.g. MSVC builds (Python.h defines it as 8 even for MSVC).
1152
1153 Also notice that we check for "long long" before checking for 64 bit long as
1154 we still want to use "long long" and not "long" for wxLongLong_t on 64 bit
1155 architectures to be able to pass wxLongLong_t to the standard functions
1156 prototyped as taking "long long" such as strtoll().
1157 */
1158 #if (defined(__VISUALC__) || defined(__INTELC__)) && defined(__WIN32__)
1159 #define wxLongLong_t __int64
1160 #define wxLongLongSuffix i64
1161 #define wxLongLongFmtSpec "I64"
1162 #elif defined(__BORLANDC__) && defined(__WIN32__) && (__BORLANDC__ >= 0x520)
1163 #define wxLongLong_t __int64
1164 #define wxLongLongSuffix i64
1165 #define wxLongLongFmtSpec "L"
1166 #elif (defined(__WATCOMC__) && (defined(__WIN32__) || defined(__DOS__) || defined(__OS2__)))
1167 #define wxLongLong_t __int64
1168 #define wxLongLongSuffix i64
1169 #define wxLongLongFmtSpec "L"
1170 #elif defined(__DIGITALMARS__)
1171 #define wxLongLong_t __int64
1172 #define wxLongLongSuffix LL
1173 #define wxLongLongFmtSpec "ll"
1174 #elif defined(__MINGW32__)
1175 #define wxLongLong_t long long
1176 #define wxLongLongSuffix ll
1177 #define wxLongLongFmtSpec "I64"
1178 #elif defined(__VISAGECPP__) && __IBMCPP__ >= 400
1179 #define wxLongLong_t long long
1180 #elif (defined(SIZEOF_LONG_LONG) && SIZEOF_LONG_LONG >= 8) || \
1181 defined(__GNUC__) || \
1182 defined(__CYGWIN__) || \
1183 defined(__WXMICROWIN__) || \
1184 (defined(__DJGPP__) && __DJGPP__ >= 2)
1185 #define wxLongLong_t long long
1186 #define wxLongLongSuffix ll
1187 #define wxLongLongFmtSpec "ll"
1188 #elif defined(SIZEOF_LONG) && (SIZEOF_LONG == 8)
1189 #define wxLongLong_t long
1190 #define wxLongLongSuffix l
1191 #define wxLongLongFmtSpec "l"
1192 #define wxLongLongIsLong
1193 #endif
1194
1195
1196 #ifdef wxLongLong_t
1197 #define wxULongLong_t unsigned wxLongLong_t
1198
1199 /*
1200 wxLL() and wxULL() macros allow to define 64 bit constants in a
1201 portable way.
1202 */
1203 #ifndef wxCOMPILER_BROKEN_CONCAT_OPER
1204 #define wxLL(x) wxCONCAT(x, wxLongLongSuffix)
1205 #define wxULL(x) wxCONCAT(x, wxCONCAT(u, wxLongLongSuffix))
1206 #else
1207 /*
1208 Currently only Borland compiler has broken concatenation operator
1209 and this compiler is known to use [u]i64 suffix.
1210 */
1211 #define wxLL(x) wxAPPEND_i64(x)
1212 #define wxULL(x) wxAPPEND_ui64(x)
1213 #endif
1214
1215 typedef wxLongLong_t wxInt64;
1216 typedef wxULongLong_t wxUint64;
1217
1218 #define wxHAS_INT64 1
1219
1220 #ifndef wxLongLongIsLong
1221 #define wxHAS_LONG_LONG_T_DIFFERENT_FROM_LONG
1222 #endif
1223 #elif wxUSE_LONGLONG
1224 /* these macros allow to define 64 bit constants in a portable way */
1225 #define wxLL(x) wxLongLong(x)
1226 #define wxULL(x) wxULongLong(x)
1227
1228 #define wxInt64 wxLongLong
1229 #define wxUint64 wxULongLong
1230
1231 #define wxHAS_INT64 1
1232
1233 #else /* !wxUSE_LONGLONG */
1234
1235 #define wxHAS_INT64 0
1236
1237 #endif
1238
1239 /*
1240 Helper macro for conditionally compiling some code only if wxLongLong_t is
1241 available and is a type different from the other integer types (i.e. not
1242 long).
1243 */
1244 #ifdef wxHAS_LONG_LONG_T_DIFFERENT_FROM_LONG
1245 #define wxIF_LONG_LONG_TYPE(x) x
1246 #else
1247 #define wxIF_LONG_LONG_TYPE(x)
1248 #endif
1249
1250
1251 /* Make sure ssize_t is defined (a signed type the same size as size_t). */
1252 /* (HAVE_SSIZE_T is not already defined by configure) */
1253 #ifndef HAVE_SSIZE_T
1254 #ifdef __MINGW32__
1255 #if defined(_SSIZE_T_) || defined(_SSIZE_T_DEFINED)
1256 #define HAVE_SSIZE_T
1257 #endif
1258 #elif wxCHECK_WATCOM_VERSION(1,4)
1259 #define HAVE_SSIZE_T
1260 #endif
1261 #endif /* !HAVE_SSIZE_T */
1262
1263 /* If we really don't have ssize_t, provide our own version. */
1264 #ifdef HAVE_SSIZE_T
1265 #ifdef __UNIX__
1266 #include <sys/types.h>
1267 #endif
1268 #else /* !HAVE_SSIZE_T */
1269 #if SIZEOF_SIZE_T == 4
1270 typedef wxInt32 ssize_t;
1271 #elif SIZEOF_SIZE_T == 8
1272 typedef wxInt64 ssize_t;
1273 #else
1274 #error "error defining ssize_t, size_t is not 4 or 8 bytes"
1275 #endif
1276
1277 /* prevent ssize_t redefinitions in other libraries */
1278 #define HAVE_SSIZE_T
1279 #endif
1280
1281 /*
1282 We can't rely on Windows _W64 being defined as windows.h may not be
1283 included so define our own equivalent: this should be used with types
1284 like WXLPARAM or WXWPARAM which are 64 bit under Win64 to avoid warnings
1285 each time we cast it to a pointer or a handle (which results in hundreds
1286 of warnings as Win32 API often passes pointers in them)
1287 */
1288 #if wxCHECK_VISUALC_VERSION(7)
1289 #define wxW64 __w64
1290 #else
1291 #define wxW64
1292 #endif
1293
1294 /*
1295 Define signed and unsigned integral types big enough to contain all of long,
1296 size_t and void *.
1297 */
1298 #if SIZEOF_LONG >= SIZEOF_VOID_P
1299 /*
1300 Normal case when long is the largest integral type.
1301 */
1302 typedef long wxIntPtr;
1303 typedef unsigned long wxUIntPtr;
1304 #elif SIZEOF_SIZE_T >= SIZEOF_VOID_P
1305 /*
1306 Win64 case: size_t is the only integral type big enough for "void *".
1307
1308 Notice that we must use __w64 to avoid warnings about casting pointers
1309 to wxIntPtr (which we do often as this is what it is defined for) in 32
1310 bit build with MSVC.
1311 */
1312 typedef wxW64 ssize_t wxIntPtr;
1313 typedef size_t wxUIntPtr;
1314 #else
1315 /*
1316 This should never happen for the current architectures but if you're
1317 using one where it does, please contact wx-dev@lists.wxwidgets.org.
1318 */
1319 #error "Pointers can't be stored inside integer types."
1320 #endif
1321
1322 #ifdef __cplusplus
1323 /* And also define a couple of simple functions to cast pointer to/from it. */
wxPtrToUInt(const void * p)1324 inline wxUIntPtr wxPtrToUInt(const void *p)
1325 {
1326 /*
1327 VC++ 7.1 gives warnings about casts such as below even when they're
1328 explicit with /Wp64 option, suppress them as we really know what we're
1329 doing here. Same thing with icc with -Wall.
1330 */
1331 #ifdef __VISUALC__
1332 #if __VISUALC__ >= 1200
1333 #pragma warning(push)
1334 #endif
1335 /* pointer truncation from '' to '' */
1336 #pragma warning(disable: 4311)
1337 #elif defined(__INTELC__)
1338 #pragma warning(push)
1339 /* conversion from pointer to same-sized integral type */
1340 #pragma warning(disable: 1684)
1341 #endif
1342
1343 return wx_reinterpret_cast(wxUIntPtr, p);
1344
1345 #if (defined(__VISUALC__) && __VISUALC__ >= 1200) || defined(__INTELC__)
1346 #pragma warning(pop)
1347 #endif
1348 }
1349
wxUIntToPtr(wxUIntPtr p)1350 inline void *wxUIntToPtr(wxUIntPtr p)
1351 {
1352 #ifdef __VISUALC__
1353 #if __VISUALC__ >= 1200
1354 #pragma warning(push)
1355 #endif
1356 /* conversion to type of greater size */
1357 #pragma warning(disable: 4312)
1358 #elif defined(__INTELC__)
1359 #pragma warning(push)
1360 /* invalid type conversion: "wxUIntPtr={unsigned long}" to "void *" */
1361 #pragma warning(disable: 171)
1362 #endif
1363
1364 return wx_reinterpret_cast(void *, p);
1365
1366 #if (defined(__VISUALC__) && __VISUALC__ >= 1200) || defined(__INTELC__)
1367 #pragma warning(pop)
1368 #endif
1369 }
1370 #endif /*__cplusplus*/
1371
1372
1373
1374 /* base floating point types */
1375 /* wxFloat32: 32 bit IEEE float ( 1 sign, 8 exponent bits, 23 fraction bits ) */
1376 /* wxFloat64: 64 bit IEEE float ( 1 sign, 11 exponent bits, 52 fraction bits ) */
1377 /* wxDouble: native fastest representation that has at least wxFloat64 */
1378 /* precision, so use the IEEE types for storage, and this for */
1379 /* calculations */
1380
1381 typedef float wxFloat32;
1382 typedef double wxFloat64;
1383
1384 typedef double wxDouble;
1385
1386 /*
1387 Some (non standard) compilers typedef wchar_t as an existing type instead
1388 of treating it as a real fundamental type, set wxWCHAR_T_IS_REAL_TYPE to 0
1389 for them and to 1 for all the others.
1390 */
1391 #ifndef wxWCHAR_T_IS_REAL_TYPE
1392 /*
1393 VC++ typedefs wchar_t as unsigned short by default until VC8, that is
1394 unless /Za or /Zc:wchar_t option is used in which case _WCHAR_T_DEFINED
1395 is defined.
1396 */
1397 # if defined(__VISUALC__) && !defined(_NATIVE_WCHAR_T_DEFINED)
1398 # define wxWCHAR_T_IS_REAL_TYPE 0
1399 # else /* compiler having standard-conforming wchar_t */
1400 # define wxWCHAR_T_IS_REAL_TYPE 1
1401 # endif
1402 #endif /* !defined(wxWCHAR_T_IS_REAL_TYPE) */
1403
1404 /* Helper macro for doing something dependent on whether wchar_t is or isn't a
1405 typedef inside another macro. */
1406 #if wxWCHAR_T_IS_REAL_TYPE
1407 #define wxIF_WCHAR_T_TYPE(x) x
1408 #else /* !wxWCHAR_T_IS_REAL_TYPE */
1409 #define wxIF_WCHAR_T_TYPE(x)
1410 #endif /* wxWCHAR_T_IS_REAL_TYPE/!wxWCHAR_T_IS_REAL_TYPE */
1411
1412 /*
1413 This constant should be used instead of NULL in vararg functions taking
1414 wxChar* arguments: passing NULL (which is the same as 0, unless the compiler
1415 defines it specially, e.g. like gcc does with its __null built-in) doesn't
1416 work in this case as va_arg() wouldn't interpret the integer 0 correctly
1417 when trying to convert it to a pointer on architectures where sizeof(int) is
1418 strictly less than sizeof(void *).
1419
1420 Examples of places where this must be used include wxFileTypeInfo ctor.
1421 */
1422 #define wxNullPtr ((void *)NULL)
1423
1424
1425 /* Define wxChar16 and wxChar32 */
1426
1427 #if SIZEOF_WCHAR_T == 2
1428 #define wxWCHAR_T_IS_WXCHAR16
1429 typedef wchar_t wxChar16;
1430 #else
1431 typedef wxUint16 wxChar16;
1432 #endif
1433
1434 #if SIZEOF_WCHAR_T == 4
1435 #define wxWCHAR_T_IS_WXCHAR32
1436 typedef wchar_t wxChar32;
1437 #else
1438 typedef wxUint32 wxChar32;
1439 #endif
1440
1441
1442 /*
1443 Helper macro expanding into the given "m" macro invoked with each of the
1444 integer types as parameter (notice that this does not include char/unsigned
1445 char and bool but does include wchar_t).
1446 */
1447 #define wxDO_FOR_INT_TYPES(m) \
1448 m(short) \
1449 m(unsigned short) \
1450 m(int) \
1451 m(unsigned int) \
1452 m(long) \
1453 m(unsigned long) \
1454 wxIF_LONG_LONG_TYPE( m(wxLongLong_t) ) \
1455 wxIF_LONG_LONG_TYPE( m(wxULongLong_t) ) \
1456 wxIF_WCHAR_T_TYPE( m(wchar_t) )
1457
1458 /*
1459 Same as wxDO_FOR_INT_TYPES() but does include char and unsigned char.
1460
1461 Notice that we use "char" and "unsigned char" here but not "signed char"
1462 which would be more correct as "char" could be unsigned by default. But
1463 wxWidgets code currently supposes that char is signed and we'd need to
1464 clean up assumptions about it, notably in wx/unichar.h, to be able to use
1465 "signed char" here.
1466 */
1467 #define wxDO_FOR_CHAR_INT_TYPES(m) \
1468 m(char) \
1469 m(unsigned char) \
1470 wxDO_FOR_INT_TYPES(m)
1471
1472 /*
1473 Same as wxDO_FOR_INT_TYPES() above except that m macro takes the
1474 type as the first argument and some extra argument, passed from this macro
1475 itself, as the second one.
1476 */
1477 #define wxDO_FOR_INT_TYPES_1(m, arg) \
1478 m(short, arg) \
1479 m(unsigned short, arg) \
1480 m(int, arg) \
1481 m(unsigned int, arg) \
1482 m(long, arg) \
1483 m(unsigned long, arg) \
1484 wxIF_LONG_LONG_TYPE( m(wxLongLong_t, arg) ) \
1485 wxIF_LONG_LONG_TYPE( m(wxULongLong_t, arg) ) \
1486 wxIF_WCHAR_T_TYPE( m(wchar_t, arg) )
1487
1488 /*
1489 Combination of wxDO_FOR_CHAR_INT_TYPES() and wxDO_FOR_INT_TYPES_1():
1490 invokes the given macro with the specified argument as its second parameter
1491 for all char and int types.
1492 */
1493 #define wxDO_FOR_CHAR_INT_TYPES_1(m, arg) \
1494 m(char, arg) \
1495 m(unsigned char, arg) \
1496 wxDO_FOR_INT_TYPES_1(m, arg)
1497
1498
1499 /* ---------------------------------------------------------------------------- */
1500 /* byte ordering related definition and macros */
1501 /* ---------------------------------------------------------------------------- */
1502
1503 /* byte sex */
1504
1505 #define wxBIG_ENDIAN 4321
1506 #define wxLITTLE_ENDIAN 1234
1507 #define wxPDP_ENDIAN 3412
1508
1509 #ifdef WORDS_BIGENDIAN
1510 #define wxBYTE_ORDER wxBIG_ENDIAN
1511 #else
1512 #define wxBYTE_ORDER wxLITTLE_ENDIAN
1513 #endif
1514
1515 /* byte swapping */
1516
1517 #define wxUINT16_SWAP_ALWAYS(val) \
1518 ((wxUint16) ( \
1519 (((wxUint16) (val) & (wxUint16) 0x00ffU) << 8) | \
1520 (((wxUint16) (val) & (wxUint16) 0xff00U) >> 8)))
1521
1522 #define wxINT16_SWAP_ALWAYS(val) \
1523 ((wxInt16) ( \
1524 (((wxUint16) (val) & (wxUint16) 0x00ffU) << 8) | \
1525 (((wxUint16) (val) & (wxUint16) 0xff00U) >> 8)))
1526
1527 #define wxUINT32_SWAP_ALWAYS(val) \
1528 ((wxUint32) ( \
1529 (((wxUint32) (val) & (wxUint32) 0x000000ffU) << 24) | \
1530 (((wxUint32) (val) & (wxUint32) 0x0000ff00U) << 8) | \
1531 (((wxUint32) (val) & (wxUint32) 0x00ff0000U) >> 8) | \
1532 (((wxUint32) (val) & (wxUint32) 0xff000000U) >> 24)))
1533
1534 #define wxINT32_SWAP_ALWAYS(val) \
1535 ((wxInt32) ( \
1536 (((wxUint32) (val) & (wxUint32) 0x000000ffU) << 24) | \
1537 (((wxUint32) (val) & (wxUint32) 0x0000ff00U) << 8) | \
1538 (((wxUint32) (val) & (wxUint32) 0x00ff0000U) >> 8) | \
1539 (((wxUint32) (val) & (wxUint32) 0xff000000U) >> 24)))
1540 /* machine specific byte swapping */
1541
1542 #ifdef wxLongLong_t
1543 #define wxUINT64_SWAP_ALWAYS(val) \
1544 ((wxUint64) ( \
1545 (((wxUint64) (val) & (wxUint64) wxULL(0x00000000000000ff)) << 56) | \
1546 (((wxUint64) (val) & (wxUint64) wxULL(0x000000000000ff00)) << 40) | \
1547 (((wxUint64) (val) & (wxUint64) wxULL(0x0000000000ff0000)) << 24) | \
1548 (((wxUint64) (val) & (wxUint64) wxULL(0x00000000ff000000)) << 8) | \
1549 (((wxUint64) (val) & (wxUint64) wxULL(0x000000ff00000000)) >> 8) | \
1550 (((wxUint64) (val) & (wxUint64) wxULL(0x0000ff0000000000)) >> 24) | \
1551 (((wxUint64) (val) & (wxUint64) wxULL(0x00ff000000000000)) >> 40) | \
1552 (((wxUint64) (val) & (wxUint64) wxULL(0xff00000000000000)) >> 56)))
1553
1554 #define wxINT64_SWAP_ALWAYS(val) \
1555 ((wxInt64) ( \
1556 (((wxUint64) (val) & (wxUint64) wxULL(0x00000000000000ff)) << 56) | \
1557 (((wxUint64) (val) & (wxUint64) wxULL(0x000000000000ff00)) << 40) | \
1558 (((wxUint64) (val) & (wxUint64) wxULL(0x0000000000ff0000)) << 24) | \
1559 (((wxUint64) (val) & (wxUint64) wxULL(0x00000000ff000000)) << 8) | \
1560 (((wxUint64) (val) & (wxUint64) wxULL(0x000000ff00000000)) >> 8) | \
1561 (((wxUint64) (val) & (wxUint64) wxULL(0x0000ff0000000000)) >> 24) | \
1562 (((wxUint64) (val) & (wxUint64) wxULL(0x00ff000000000000)) >> 40) | \
1563 (((wxUint64) (val) & (wxUint64) wxULL(0xff00000000000000)) >> 56)))
1564 #elif wxUSE_LONGLONG /* !wxLongLong_t */
1565 #define wxUINT64_SWAP_ALWAYS(val) \
1566 ((wxUint64) ( \
1567 ((wxULongLong(val) & wxULongLong(0L, 0x000000ffU)) << 56) | \
1568 ((wxULongLong(val) & wxULongLong(0L, 0x0000ff00U)) << 40) | \
1569 ((wxULongLong(val) & wxULongLong(0L, 0x00ff0000U)) << 24) | \
1570 ((wxULongLong(val) & wxULongLong(0L, 0xff000000U)) << 8) | \
1571 ((wxULongLong(val) & wxULongLong(0x000000ffL, 0U)) >> 8) | \
1572 ((wxULongLong(val) & wxULongLong(0x0000ff00L, 0U)) >> 24) | \
1573 ((wxULongLong(val) & wxULongLong(0x00ff0000L, 0U)) >> 40) | \
1574 ((wxULongLong(val) & wxULongLong(0xff000000L, 0U)) >> 56)))
1575
1576 #define wxINT64_SWAP_ALWAYS(val) \
1577 ((wxInt64) ( \
1578 ((wxLongLong(val) & wxLongLong(0L, 0x000000ffU)) << 56) | \
1579 ((wxLongLong(val) & wxLongLong(0L, 0x0000ff00U)) << 40) | \
1580 ((wxLongLong(val) & wxLongLong(0L, 0x00ff0000U)) << 24) | \
1581 ((wxLongLong(val) & wxLongLong(0L, 0xff000000U)) << 8) | \
1582 ((wxLongLong(val) & wxLongLong(0x000000ffL, 0U)) >> 8) | \
1583 ((wxLongLong(val) & wxLongLong(0x0000ff00L, 0U)) >> 24) | \
1584 ((wxLongLong(val) & wxLongLong(0x00ff0000L, 0U)) >> 40) | \
1585 ((wxLongLong(val) & wxLongLong(0xff000000L, 0U)) >> 56)))
1586 #endif /* wxLongLong_t/!wxLongLong_t */
1587
1588 #ifdef WORDS_BIGENDIAN
1589 #define wxUINT16_SWAP_ON_BE(val) wxUINT16_SWAP_ALWAYS(val)
1590 #define wxINT16_SWAP_ON_BE(val) wxINT16_SWAP_ALWAYS(val)
1591 #define wxUINT16_SWAP_ON_LE(val) (val)
1592 #define wxINT16_SWAP_ON_LE(val) (val)
1593 #define wxUINT32_SWAP_ON_BE(val) wxUINT32_SWAP_ALWAYS(val)
1594 #define wxINT32_SWAP_ON_BE(val) wxINT32_SWAP_ALWAYS(val)
1595 #define wxUINT32_SWAP_ON_LE(val) (val)
1596 #define wxINT32_SWAP_ON_LE(val) (val)
1597 #if wxHAS_INT64
1598 #define wxUINT64_SWAP_ON_BE(val) wxUINT64_SWAP_ALWAYS(val)
1599 #define wxUINT64_SWAP_ON_LE(val) (val)
1600 #define wxINT64_SWAP_ON_BE(val) wxINT64_SWAP_ALWAYS(val)
1601 #define wxINT64_SWAP_ON_LE(val) (val)
1602 #endif
1603 #else
1604 #define wxUINT16_SWAP_ON_LE(val) wxUINT16_SWAP_ALWAYS(val)
1605 #define wxINT16_SWAP_ON_LE(val) wxINT16_SWAP_ALWAYS(val)
1606 #define wxUINT16_SWAP_ON_BE(val) (val)
1607 #define wxINT16_SWAP_ON_BE(val) (val)
1608 #define wxUINT32_SWAP_ON_LE(val) wxUINT32_SWAP_ALWAYS(val)
1609 #define wxINT32_SWAP_ON_LE(val) wxINT32_SWAP_ALWAYS(val)
1610 #define wxUINT32_SWAP_ON_BE(val) (val)
1611 #define wxINT32_SWAP_ON_BE(val) (val)
1612 #if wxHAS_INT64
1613 #define wxUINT64_SWAP_ON_LE(val) wxUINT64_SWAP_ALWAYS(val)
1614 #define wxUINT64_SWAP_ON_BE(val) (val)
1615 #define wxINT64_SWAP_ON_LE(val) wxINT64_SWAP_ALWAYS(val)
1616 #define wxINT64_SWAP_ON_BE(val) (val)
1617 #endif
1618 #endif
1619
1620 /* ---------------------------------------------------------------------------- */
1621 /* template workarounds for buggy compilers */
1622 /* ---------------------------------------------------------------------------- */
1623
1624 #if defined(__GNUC__) && !wxCHECK_GCC_VERSION( 3, 4 )
1625 /* GCC <= 3.4 has buggy template support */
1626 # define wxUSE_MEMBER_TEMPLATES 0
1627 #endif
1628
1629 #if defined(_MSC_VER) && _MSC_VER <= 1200
1630 /* MSVC <= 6.0 has buggy template support */
1631 # define wxUSE_MEMBER_TEMPLATES 0
1632 # define wxUSE_FUNC_TEMPLATE_POINTER 0
1633 #endif
1634
1635 #ifndef wxUSE_MEMBER_TEMPLATES
1636 # define wxUSE_MEMBER_TEMPLATES 1
1637 #endif
1638
1639 #ifndef wxUSE_FUNC_TEMPLATE_POINTER
1640 # define wxUSE_FUNC_TEMPLATE_POINTER 1
1641 #endif
1642
1643 #if wxUSE_MEMBER_TEMPLATES
1644 # define wxTEMPLATED_MEMBER_CALL( method, type ) method<type>()
1645 # define wxTEMPLATED_MEMBER_FIX( type )
1646 #else
1647 # define wxTEMPLATED_MEMBER_CALL( method, type ) method((type*)NULL)
1648 # define wxTEMPLATED_MEMBER_FIX( type ) type* =NULL
1649 #endif
1650
1651 #if defined(_MSC_VER) && _MSC_VER <= 1200
1652 # define wxTEMPLATED_FUNCTION_FIX( type ), wxTEMPLATED_MEMBER_FIX(type)
1653 # define wxINFUNC_CLASS_TYPE_FIX( type ) typedef type type;
1654 #else
1655 # define wxTEMPLATED_FUNCTION_FIX( type )
1656 # define wxINFUNC_CLASS_TYPE_FIX( type )
1657 #endif
1658
1659 /* ---------------------------------------------------------------------------- */
1660 /* Geometric flags */
1661 /* ---------------------------------------------------------------------------- */
1662
1663 enum wxGeometryCentre
1664 {
1665 wxCENTRE = 0x0001,
1666 wxCENTER = wxCENTRE
1667 };
1668
1669 /* centering into frame rather than screen (obsolete) */
1670 #define wxCENTER_FRAME 0x0000
1671 /* centre on screen rather than parent */
1672 #define wxCENTRE_ON_SCREEN 0x0002
1673 #define wxCENTER_ON_SCREEN wxCENTRE_ON_SCREEN
1674
1675 enum wxOrientation
1676 {
1677 /* don't change the values of these elements, they are used elsewhere */
1678 wxHORIZONTAL = 0x0004,
1679 wxVERTICAL = 0x0008,
1680
1681 wxBOTH = wxVERTICAL | wxHORIZONTAL,
1682
1683 /* a mask to extract orientation from the combination of flags */
1684 wxORIENTATION_MASK = wxBOTH
1685 };
1686
1687 enum wxDirection
1688 {
1689 wxLEFT = 0x0010,
1690 wxRIGHT = 0x0020,
1691 wxUP = 0x0040,
1692 wxDOWN = 0x0080,
1693
1694 wxTOP = wxUP,
1695 wxBOTTOM = wxDOWN,
1696
1697 wxNORTH = wxUP,
1698 wxSOUTH = wxDOWN,
1699 wxWEST = wxLEFT,
1700 wxEAST = wxRIGHT,
1701
1702 wxALL = (wxUP | wxDOWN | wxRIGHT | wxLEFT),
1703
1704 /* a mask to extract direction from the combination of flags */
1705 wxDIRECTION_MASK = wxALL
1706 };
1707
1708 enum wxAlignment
1709 {
1710 /*
1711 0 is a valid wxAlignment value (both wxALIGN_LEFT and wxALIGN_TOP
1712 use it) so define a symbolic name for an invalid alignment value
1713 which can be assumed to be different from anything else
1714 */
1715 wxALIGN_INVALID = -1,
1716
1717 wxALIGN_NOT = 0x0000,
1718 wxALIGN_CENTER_HORIZONTAL = 0x0100,
1719 wxALIGN_CENTRE_HORIZONTAL = wxALIGN_CENTER_HORIZONTAL,
1720 wxALIGN_LEFT = wxALIGN_NOT,
1721 wxALIGN_TOP = wxALIGN_NOT,
1722 wxALIGN_RIGHT = 0x0200,
1723 wxALIGN_BOTTOM = 0x0400,
1724 wxALIGN_CENTER_VERTICAL = 0x0800,
1725 wxALIGN_CENTRE_VERTICAL = wxALIGN_CENTER_VERTICAL,
1726
1727 wxALIGN_CENTER = (wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL),
1728 wxALIGN_CENTRE = wxALIGN_CENTER,
1729
1730 /* a mask to extract alignment from the combination of flags */
1731 wxALIGN_MASK = 0x0f00
1732 };
1733
1734 /* misc. flags for wxSizer items */
1735 enum wxSizerFlagBits
1736 {
1737 /*
1738 wxADJUST_MINSIZE doesn't do anything any more but we still define
1739 it for compatibility. Notice that it may be also predefined (as 0,
1740 hopefully) in the user code in order to use it even in
1741 !WXWIN_COMPATIBILITY_2_8 builds so don't redefine it in such case.
1742 */
1743 #if WXWIN_COMPATIBILITY_2_8 && !defined(wxADJUST_MINSIZE)
1744 wxADJUST_MINSIZE = 0,
1745 #endif
1746 wxFIXED_MINSIZE = 0x8000,
1747 wxRESERVE_SPACE_EVEN_IF_HIDDEN = 0x0002,
1748
1749 /* a mask to extract wxSizerFlagBits from combination of flags */
1750 wxSIZER_FLAG_BITS_MASK = 0x8002
1751 };
1752
1753 enum wxStretch
1754 {
1755 wxSTRETCH_NOT = 0x0000,
1756 wxSHRINK = 0x1000,
1757 wxGROW = 0x2000,
1758 wxEXPAND = wxGROW,
1759 wxSHAPED = 0x4000,
1760 wxTILE = wxSHAPED | wxFIXED_MINSIZE,
1761
1762 /* a mask to extract stretch from the combination of flags */
1763 wxSTRETCH_MASK = 0x7000 /* sans wxTILE */
1764 };
1765
1766 /* border flags: the values are chosen for backwards compatibility */
1767 enum wxBorder
1768 {
1769 /* this is different from wxBORDER_NONE as by default the controls do have */
1770 /* border */
1771 wxBORDER_DEFAULT = 0,
1772
1773 wxBORDER_NONE = 0x00200000,
1774 wxBORDER_STATIC = 0x01000000,
1775 wxBORDER_SIMPLE = 0x02000000,
1776 wxBORDER_RAISED = 0x04000000,
1777 wxBORDER_SUNKEN = 0x08000000,
1778 wxBORDER_DOUBLE = 0x10000000, /* deprecated */
1779 wxBORDER_THEME = wxBORDER_DOUBLE,
1780
1781 /* a mask to extract border style from the combination of flags */
1782 wxBORDER_MASK = 0x1f200000
1783 };
1784
1785 /* This makes it easier to specify a 'normal' border for a control */
1786 #if defined(__SMARTPHONE__) || defined(__POCKETPC__)
1787 #define wxDEFAULT_CONTROL_BORDER wxBORDER_SIMPLE
1788 #else
1789 #define wxDEFAULT_CONTROL_BORDER wxBORDER_SUNKEN
1790 #endif
1791
1792 /* ---------------------------------------------------------------------------- */
1793 /* Window style flags */
1794 /* ---------------------------------------------------------------------------- */
1795
1796 /*
1797 * Values are chosen so they can be |'ed in a bit list.
1798 * Some styles are used across more than one group,
1799 * so the values mustn't clash with others in the group.
1800 * Otherwise, numbers can be reused across groups.
1801 */
1802
1803 /*
1804 Summary of the bits used by various styles.
1805
1806 High word, containing styles which can be used with many windows:
1807
1808 +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
1809 |31|30|29|28|27|26|25|24|23|22|21|20|19|18|17|16|
1810 +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
1811 | | | | | | | | | | | | | | | |
1812 | | | | | | | | | | | | | | | \_ wxFULL_REPAINT_ON_RESIZE
1813 | | | | | | | | | | | | | | \____ wxPOPUP_WINDOW
1814 | | | | | | | | | | | | | \_______ wxWANTS_CHARS
1815 | | | | | | | | | | | | \__________ wxTAB_TRAVERSAL
1816 | | | | | | | | | | | \_____________ wxTRANSPARENT_WINDOW
1817 | | | | | | | | | | \________________ wxBORDER_NONE
1818 | | | | | | | | | \___________________ wxCLIP_CHILDREN
1819 | | | | | | | | \______________________ wxALWAYS_SHOW_SB
1820 | | | | | | | \_________________________ wxBORDER_STATIC
1821 | | | | | | \____________________________ wxBORDER_SIMPLE
1822 | | | | | \_______________________________ wxBORDER_RAISED
1823 | | | | \__________________________________ wxBORDER_SUNKEN
1824 | | | \_____________________________________ wxBORDER_{DOUBLE,THEME}
1825 | | \________________________________________ wxCAPTION/wxCLIP_SIBLINGS
1826 | \___________________________________________ wxHSCROLL
1827 \______________________________________________ wxVSCROLL
1828
1829
1830 Low word style bits is class-specific meaning that the same bit can have
1831 different meanings for different controls (e.g. 0x10 is wxCB_READONLY
1832 meaning that the control can't be modified for wxComboBox but wxLB_SORT
1833 meaning that the control should be kept sorted for wxListBox, while
1834 wxLB_SORT has a different value -- and this is just fine).
1835 */
1836
1837 /*
1838 * Window (Frame/dialog/subwindow/panel item) style flags
1839 */
1840
1841 /* The cast is needed to avoid g++ -Wnarrowing warnings when initializing
1842 * values of int type with wxVSCROLL on 32 bit platforms, where its value is
1843 * greater than INT_MAX.
1844 */
1845 #define wxVSCROLL ((int)0x80000000)
1846 #define wxHSCROLL 0x40000000
1847 #define wxCAPTION 0x20000000
1848
1849 /* New styles (border styles are now in their own enum) */
1850 #define wxDOUBLE_BORDER wxBORDER_DOUBLE
1851 #define wxSUNKEN_BORDER wxBORDER_SUNKEN
1852 #define wxRAISED_BORDER wxBORDER_RAISED
1853 #define wxBORDER wxBORDER_SIMPLE
1854 #define wxSIMPLE_BORDER wxBORDER_SIMPLE
1855 #define wxSTATIC_BORDER wxBORDER_STATIC
1856 #define wxNO_BORDER wxBORDER_NONE
1857
1858 /* wxALWAYS_SHOW_SB: instead of hiding the scrollbar when it is not needed, */
1859 /* disable it - but still show (see also wxLB_ALWAYS_SB style) */
1860 /* */
1861 /* NB: as this style is only supported by wxUniversal and wxMSW so far */
1862 #define wxALWAYS_SHOW_SB 0x00800000
1863
1864 /* Clip children when painting, which reduces flicker in e.g. frames and */
1865 /* splitter windows, but can't be used in a panel where a static box must be */
1866 /* 'transparent' (panel paints the background for it) */
1867 #define wxCLIP_CHILDREN 0x00400000
1868
1869 /* Note we're reusing the wxCAPTION style because we won't need captions */
1870 /* for subwindows/controls */
1871 #define wxCLIP_SIBLINGS 0x20000000
1872
1873 #define wxTRANSPARENT_WINDOW 0x00100000
1874
1875 /* Add this style to a panel to get tab traversal working outside of dialogs */
1876 /* (on by default for wxPanel, wxDialog, wxScrolledWindow) */
1877 #define wxTAB_TRAVERSAL 0x00080000
1878
1879 /* Add this style if the control wants to get all keyboard messages (under */
1880 /* Windows, it won't normally get the dialog navigation key events) */
1881 #define wxWANTS_CHARS 0x00040000
1882
1883 /* Make window retained (Motif only, see src/generic/scrolwing.cpp)
1884 * This is non-zero only under wxMotif, to avoid a clash with wxPOPUP_WINDOW
1885 * on other platforms
1886 */
1887
1888 #ifdef __WXMOTIF__
1889 #define wxRETAINED 0x00020000
1890 #else
1891 #define wxRETAINED 0x00000000
1892 #endif
1893 #define wxBACKINGSTORE wxRETAINED
1894
1895 /* set this flag to create a special popup window: it will be always shown on */
1896 /* top of other windows, will capture the mouse and will be dismissed when the */
1897 /* mouse is clicked outside of it or if it loses focus in any other way */
1898 #define wxPOPUP_WINDOW 0x00020000
1899
1900 /* force a full repaint when the window is resized (instead of repainting just */
1901 /* the invalidated area) */
1902 #define wxFULL_REPAINT_ON_RESIZE 0x00010000
1903
1904 /* obsolete: now this is the default behaviour */
1905 /* */
1906 /* don't invalidate the whole window (resulting in a PAINT event) when the */
1907 /* window is resized (currently, makes sense for wxMSW only) */
1908 #define wxNO_FULL_REPAINT_ON_RESIZE 0
1909
1910 /* A mask which can be used to filter (out) all wxWindow-specific styles.
1911 */
1912 #define wxWINDOW_STYLE_MASK \
1913 (wxVSCROLL|wxHSCROLL|wxBORDER_MASK|wxALWAYS_SHOW_SB|wxCLIP_CHILDREN| \
1914 wxCLIP_SIBLINGS|wxTRANSPARENT_WINDOW|wxTAB_TRAVERSAL|wxWANTS_CHARS| \
1915 wxRETAINED|wxPOPUP_WINDOW|wxFULL_REPAINT_ON_RESIZE)
1916
1917 /*
1918 * Extra window style flags (use wxWS_EX prefix to make it clear that they
1919 * should be passed to wxWindow::SetExtraStyle(), not SetWindowStyle())
1920 */
1921
1922 /* by default, TransferDataTo/FromWindow() only work on direct children of the */
1923 /* window (compatible behaviour), set this flag to make them recursively */
1924 /* descend into all subwindows */
1925 #define wxWS_EX_VALIDATE_RECURSIVELY 0x00000001
1926
1927 /* wxCommandEvents and the objects of the derived classes are forwarded to the */
1928 /* parent window and so on recursively by default. Using this flag for the */
1929 /* given window allows to block this propagation at this window, i.e. prevent */
1930 /* the events from being propagated further upwards. The dialogs have this */
1931 /* flag on by default. */
1932 #define wxWS_EX_BLOCK_EVENTS 0x00000002
1933
1934 /* don't use this window as an implicit parent for the other windows: this must */
1935 /* be used with transient windows as otherwise there is the risk of creating a */
1936 /* dialog/frame with this window as a parent which would lead to a crash if the */
1937 /* parent is destroyed before the child */
1938 #define wxWS_EX_TRANSIENT 0x00000004
1939
1940 /* don't paint the window background, we'll assume it will */
1941 /* be done by a theming engine. This is not yet used but could */
1942 /* possibly be made to work in the future, at least on Windows */
1943 #define wxWS_EX_THEMED_BACKGROUND 0x00000008
1944
1945 /* this window should always process idle events */
1946 #define wxWS_EX_PROCESS_IDLE 0x00000010
1947
1948 /* this window should always process UI update events */
1949 #define wxWS_EX_PROCESS_UI_UPDATES 0x00000020
1950
1951 /* Draw the window in a metal theme on Mac */
1952 #define wxFRAME_EX_METAL 0x00000040
1953 #define wxDIALOG_EX_METAL 0x00000040
1954
1955 /* Use this style to add a context-sensitive help to the window (currently for */
1956 /* Win32 only and it doesn't work if wxMINIMIZE_BOX or wxMAXIMIZE_BOX are used) */
1957 #define wxWS_EX_CONTEXTHELP 0x00000080
1958
1959 /* synonyms for wxWS_EX_CONTEXTHELP for compatibility */
1960 #define wxFRAME_EX_CONTEXTHELP wxWS_EX_CONTEXTHELP
1961 #define wxDIALOG_EX_CONTEXTHELP wxWS_EX_CONTEXTHELP
1962
1963 /* Create a window which is attachable to another top level window */
1964 #define wxFRAME_DRAWER 0x0020
1965
1966 /*
1967 * MDI parent frame style flags
1968 * Can overlap with some of the above.
1969 */
1970
1971 #define wxFRAME_NO_WINDOW_MENU 0x0100
1972
1973 /*
1974 * wxMenuBar style flags
1975 */
1976 /* use native docking */
1977 #define wxMB_DOCKABLE 0x0001
1978
1979 /*
1980 * wxMenu style flags
1981 */
1982 #define wxMENU_TEAROFF 0x0001
1983
1984 /*
1985 * Apply to all panel items
1986 */
1987 #define wxCOLOURED 0x0800
1988 #define wxFIXED_LENGTH 0x0400
1989
1990 /*
1991 * Styles for wxListBox
1992 */
1993 #define wxLB_SORT 0x0010
1994 #define wxLB_SINGLE 0x0020
1995 #define wxLB_MULTIPLE 0x0040
1996 #define wxLB_EXTENDED 0x0080
1997 /* wxLB_OWNERDRAW is Windows-only */
1998 #define wxLB_NEEDED_SB 0x0000
1999 #define wxLB_OWNERDRAW 0x0100
2000 #define wxLB_ALWAYS_SB 0x0200
2001 #define wxLB_NO_SB 0x0400
2002 #define wxLB_HSCROLL wxHSCROLL
2003 /* always show an entire number of rows */
2004 #define wxLB_INT_HEIGHT 0x0800
2005
2006 #if WXWIN_COMPATIBILITY_2_6
2007 /* deprecated synonyms */
2008 #define wxPROCESS_ENTER 0x0400 /* wxTE_PROCESS_ENTER */
2009 #define wxPASSWORD 0x0800 /* wxTE_PASSWORD */
2010 #endif
2011
2012 /*
2013 * wxComboBox style flags
2014 */
2015 #define wxCB_SIMPLE 0x0004
2016 #define wxCB_SORT 0x0008
2017 #define wxCB_READONLY 0x0010
2018 #define wxCB_DROPDOWN 0x0020
2019
2020 /*
2021 * wxRadioBox style flags
2022 */
2023 /* should we number the items from left to right or from top to bottom in a 2d */
2024 /* radiobox? */
2025 #define wxRA_LEFTTORIGHT 0x0001
2026 #define wxRA_TOPTOBOTTOM 0x0002
2027
2028 /* New, more intuitive names to specify majorDim argument */
2029 #define wxRA_SPECIFY_COLS wxHORIZONTAL
2030 #define wxRA_SPECIFY_ROWS wxVERTICAL
2031
2032 /* Old names for compatibility */
2033 #define wxRA_HORIZONTAL wxHORIZONTAL
2034 #define wxRA_VERTICAL wxVERTICAL
2035
2036 /*
2037 * wxRadioButton style flag
2038 */
2039 #define wxRB_GROUP 0x0004
2040 #define wxRB_SINGLE 0x0008
2041
2042 /*
2043 * wxScrollBar flags
2044 */
2045 #define wxSB_HORIZONTAL wxHORIZONTAL
2046 #define wxSB_VERTICAL wxVERTICAL
2047
2048 /*
2049 * wxSpinButton flags.
2050 * Note that a wxSpinCtrl is sometimes defined as a wxTextCtrl, and so the
2051 * flags shouldn't overlap with wxTextCtrl flags that can be used for a single
2052 * line controls (currently we reuse wxTE_CHARWRAP and wxTE_RICH2 neither of
2053 * which makes sense for them).
2054 */
2055 #define wxSP_HORIZONTAL wxHORIZONTAL /* 4 */
2056 #define wxSP_VERTICAL wxVERTICAL /* 8 */
2057 #define wxSP_ARROW_KEYS 0x4000
2058 #define wxSP_WRAP 0x8000
2059
2060 /*
2061 * wxTabCtrl flags
2062 */
2063 #define wxTC_RIGHTJUSTIFY 0x0010
2064 #define wxTC_FIXEDWIDTH 0x0020
2065 #define wxTC_TOP 0x0000 /* default */
2066 #define wxTC_LEFT 0x0020
2067 #define wxTC_RIGHT 0x0040
2068 #define wxTC_BOTTOM 0x0080
2069 #define wxTC_MULTILINE 0x0200 /* == wxNB_MULTILINE */
2070 #define wxTC_OWNERDRAW 0x0400
2071
2072 /*
2073 * wxStaticBitmap flags
2074 */
2075 #define wxBI_EXPAND wxEXPAND
2076
2077 /*
2078 * wxStaticLine flags
2079 */
2080 #define wxLI_HORIZONTAL wxHORIZONTAL
2081 #define wxLI_VERTICAL wxVERTICAL
2082
2083
2084 /*
2085 * extended dialog specifiers. these values are stored in a different
2086 * flag and thus do not overlap with other style flags. note that these
2087 * values do not correspond to the return values of the dialogs (for
2088 * those values, look at the wxID_XXX defines).
2089 */
2090
2091 /* wxCENTRE already defined as 0x00000001 */
2092 #define wxYES 0x00000002
2093 #define wxOK 0x00000004
2094 #define wxNO 0x00000008
2095 #define wxYES_NO (wxYES | wxNO)
2096 #define wxCANCEL 0x00000010
2097 #define wxAPPLY 0x00000020
2098 #define wxCLOSE 0x00000040
2099
2100 #define wxOK_DEFAULT 0x00000000 /* has no effect (default) */
2101 #define wxYES_DEFAULT 0x00000000 /* has no effect (default) */
2102 #define wxNO_DEFAULT 0x00000080 /* only valid with wxYES_NO */
2103 #define wxCANCEL_DEFAULT 0x80000000 /* only valid with wxCANCEL */
2104
2105 #define wxICON_EXCLAMATION 0x00000100
2106 #define wxICON_HAND 0x00000200
2107 #define wxICON_WARNING wxICON_EXCLAMATION
2108 #define wxICON_ERROR wxICON_HAND
2109 #define wxICON_QUESTION 0x00000400
2110 #define wxICON_INFORMATION 0x00000800
2111 #define wxICON_STOP wxICON_HAND
2112 #define wxICON_ASTERISK wxICON_INFORMATION
2113
2114 #define wxHELP 0x00001000
2115 #define wxFORWARD 0x00002000
2116 #define wxBACKWARD 0x00004000
2117 #define wxRESET 0x00008000
2118 #define wxMORE 0x00010000
2119 #define wxSETUP 0x00020000
2120 #define wxICON_NONE 0x00040000
2121 #define wxICON_AUTH_NEEDED 0x00080000
2122
2123 #define wxICON_MASK \
2124 (wxICON_EXCLAMATION|wxICON_HAND|wxICON_QUESTION|wxICON_INFORMATION|wxICON_NONE|wxICON_AUTH_NEEDED)
2125
2126 /*
2127 * Background styles. See wxWindow::SetBackgroundStyle
2128 */
2129 enum wxBackgroundStyle
2130 {
2131 /*
2132 background is erased in the EVT_ERASE_BACKGROUND handler or using
2133 the system default background if no such handler is defined (this
2134 is the default style)
2135 */
2136 wxBG_STYLE_ERASE,
2137
2138 /*
2139 background is erased by the system, no EVT_ERASE_BACKGROUND event
2140 is generated at all
2141 */
2142 wxBG_STYLE_SYSTEM,
2143
2144 /*
2145 background is erased in EVT_PAINT handler and not erased at all
2146 before it, this should be used if the paint handler paints over
2147 the entire window to avoid flicker
2148 */
2149 wxBG_STYLE_PAINT,
2150
2151 /*
2152 Indicates that the window background is not erased, letting the parent
2153 window show through.
2154 */
2155 wxBG_STYLE_TRANSPARENT,
2156
2157 /* this style is deprecated and doesn't do anything, don't use */
2158 wxBG_STYLE_COLOUR,
2159
2160 /*
2161 this style is deprecated and is synonymous with
2162 wxBG_STYLE_PAINT, use the new name
2163 */
2164 wxBG_STYLE_CUSTOM = wxBG_STYLE_PAINT
2165 };
2166
2167 /*
2168 * Key types used by (old style) lists and hashes.
2169 */
2170 enum wxKeyType
2171 {
2172 wxKEY_NONE,
2173 wxKEY_INTEGER,
2174 wxKEY_STRING
2175 };
2176
2177 /* ---------------------------------------------------------------------------- */
2178 /* standard IDs */
2179 /* ---------------------------------------------------------------------------- */
2180
2181 /* Standard menu IDs */
2182 enum wxStandardID
2183 {
2184 /*
2185 These ids delimit the range used by automatically-generated ids
2186 (i.e. those used when wxID_ANY is specified during construction).
2187 */
2188 #if defined(__WXMSW__) || wxUSE_AUTOID_MANAGEMENT
2189 /*
2190 On MSW the range is always restricted no matter if id management
2191 is used or not because the native window ids are limited to short
2192 range. On other platforms the range is only restricted if id
2193 management is used so the reference count buffer won't be so big.
2194 */
2195 wxID_AUTO_LOWEST = -32000,
2196 wxID_AUTO_HIGHEST = -2000,
2197 #else
2198 wxID_AUTO_LOWEST = -1000000,
2199 wxID_AUTO_HIGHEST = -2000,
2200 #endif
2201
2202 /* no id matches this one when compared to it */
2203 wxID_NONE = -3,
2204
2205 /* id for a separator line in the menu (invalid for normal item) */
2206 wxID_SEPARATOR = -2,
2207
2208 /* any id: means that we don't care about the id, whether when installing
2209 * an event handler or when creating a new window */
2210 wxID_ANY = -1,
2211
2212
2213 /* all predefined ids are between wxID_LOWEST and wxID_HIGHEST */
2214 wxID_LOWEST = 4999,
2215
2216 wxID_OPEN,
2217 wxID_CLOSE,
2218 wxID_NEW,
2219 wxID_SAVE,
2220 wxID_SAVEAS,
2221 wxID_REVERT,
2222 wxID_EXIT,
2223 wxID_UNDO,
2224 wxID_REDO,
2225 wxID_HELP,
2226 wxID_PRINT,
2227 wxID_PRINT_SETUP,
2228 wxID_PAGE_SETUP,
2229 wxID_PREVIEW,
2230 wxID_ABOUT,
2231 wxID_HELP_CONTENTS,
2232 wxID_HELP_INDEX,
2233 wxID_HELP_SEARCH,
2234 wxID_HELP_COMMANDS,
2235 wxID_HELP_PROCEDURES,
2236 wxID_HELP_CONTEXT,
2237 wxID_CLOSE_ALL,
2238 wxID_PREFERENCES,
2239
2240 wxID_EDIT = 5030,
2241 wxID_CUT,
2242 wxID_COPY,
2243 wxID_PASTE,
2244 wxID_CLEAR,
2245 wxID_FIND,
2246 wxID_DUPLICATE,
2247 wxID_SELECTALL,
2248 wxID_DELETE,
2249 wxID_REPLACE,
2250 wxID_REPLACE_ALL,
2251 wxID_PROPERTIES,
2252
2253 wxID_VIEW_DETAILS,
2254 wxID_VIEW_LARGEICONS,
2255 wxID_VIEW_SMALLICONS,
2256 wxID_VIEW_LIST,
2257 wxID_VIEW_SORTDATE,
2258 wxID_VIEW_SORTNAME,
2259 wxID_VIEW_SORTSIZE,
2260 wxID_VIEW_SORTTYPE,
2261
2262 wxID_FILE = 5050,
2263 wxID_FILE1,
2264 wxID_FILE2,
2265 wxID_FILE3,
2266 wxID_FILE4,
2267 wxID_FILE5,
2268 wxID_FILE6,
2269 wxID_FILE7,
2270 wxID_FILE8,
2271 wxID_FILE9,
2272
2273 /* Standard button and menu IDs */
2274 wxID_OK = 5100,
2275 wxID_CANCEL,
2276 wxID_APPLY,
2277 wxID_YES,
2278 wxID_NO,
2279 wxID_STATIC,
2280 wxID_FORWARD,
2281 wxID_BACKWARD,
2282 wxID_DEFAULT,
2283 wxID_MORE,
2284 wxID_SETUP,
2285 wxID_RESET,
2286 wxID_CONTEXT_HELP,
2287 wxID_YESTOALL,
2288 wxID_NOTOALL,
2289 wxID_ABORT,
2290 wxID_RETRY,
2291 wxID_IGNORE,
2292 wxID_ADD,
2293 wxID_REMOVE,
2294
2295 wxID_UP,
2296 wxID_DOWN,
2297 wxID_HOME,
2298 wxID_REFRESH,
2299 wxID_STOP,
2300 wxID_INDEX,
2301
2302 wxID_BOLD,
2303 wxID_ITALIC,
2304 wxID_JUSTIFY_CENTER,
2305 wxID_JUSTIFY_FILL,
2306 wxID_JUSTIFY_RIGHT,
2307 wxID_JUSTIFY_LEFT,
2308 wxID_UNDERLINE,
2309 wxID_INDENT,
2310 wxID_UNINDENT,
2311 wxID_ZOOM_100,
2312 wxID_ZOOM_FIT,
2313 wxID_ZOOM_IN,
2314 wxID_ZOOM_OUT,
2315 wxID_UNDELETE,
2316 wxID_REVERT_TO_SAVED,
2317 wxID_CDROM,
2318 wxID_CONVERT,
2319 wxID_EXECUTE,
2320 wxID_FLOPPY,
2321 wxID_HARDDISK,
2322 wxID_BOTTOM,
2323 wxID_FIRST,
2324 wxID_LAST,
2325 wxID_TOP,
2326 wxID_INFO,
2327 wxID_JUMP_TO,
2328 wxID_NETWORK,
2329 wxID_SELECT_COLOR,
2330 wxID_SELECT_FONT,
2331 wxID_SORT_ASCENDING,
2332 wxID_SORT_DESCENDING,
2333 wxID_SPELL_CHECK,
2334 wxID_STRIKETHROUGH,
2335
2336 /* System menu IDs (used by wxUniv): */
2337 wxID_SYSTEM_MENU = 5200,
2338 wxID_CLOSE_FRAME,
2339 wxID_MOVE_FRAME,
2340 wxID_RESIZE_FRAME,
2341 wxID_MAXIMIZE_FRAME,
2342 wxID_ICONIZE_FRAME,
2343 wxID_RESTORE_FRAME,
2344
2345 /* MDI window menu ids */
2346 wxID_MDI_WINDOW_FIRST = 5230,
2347 wxID_MDI_WINDOW_CASCADE = wxID_MDI_WINDOW_FIRST,
2348 wxID_MDI_WINDOW_TILE_HORZ,
2349 wxID_MDI_WINDOW_TILE_VERT,
2350 wxID_MDI_WINDOW_ARRANGE_ICONS,
2351 wxID_MDI_WINDOW_PREV,
2352 wxID_MDI_WINDOW_NEXT,
2353 wxID_MDI_WINDOW_LAST = wxID_MDI_WINDOW_NEXT,
2354
2355 /* OS X system menu ids */
2356 wxID_OSX_MENU_FIRST = 5250,
2357 wxID_OSX_HIDE = wxID_OSX_MENU_FIRST,
2358 wxID_OSX_HIDEOTHERS,
2359 wxID_OSX_SHOWALL,
2360 #if wxABI_VERSION >= 30001
2361 wxID_OSX_SERVICES,
2362 wxID_OSX_MENU_LAST = wxID_OSX_SERVICES,
2363 #else
2364 wxID_OSX_MENU_LAST = wxID_OSX_SHOWALL,
2365 #endif
2366
2367 /* IDs used by generic file dialog (13 consecutive starting from this value) */
2368 wxID_FILEDLGG = 5900,
2369
2370 /* IDs used by generic file ctrl (4 consecutive starting from this value) */
2371 wxID_FILECTRL = 5950,
2372
2373 wxID_HIGHEST = 5999
2374 };
2375
2376 /* ---------------------------------------------------------------------------- */
2377 /* wxWindowID type (after wxID_XYZ enum, platform detection, and dlimpexp.h) */
2378 /* ---------------------------------------------------------------------------- */
2379
2380 /* special care should be taken with this type under Windows where the real */
2381 /* window id is unsigned, so we must always do the cast before comparing them */
2382 /* (or else they would be always different!). Using wxGetWindowId() which does */
2383 /* the cast itself is recommended. Note that this type can't be unsigned */
2384 /* because wxID_ANY == -1 is a valid (and largely used) value for window id. */
2385 #if defined(__cplusplus) && wxUSE_GUI
2386 #include "wx/windowid.h"
2387 #endif
2388
2389 /* ---------------------------------------------------------------------------- */
2390 /* other constants */
2391 /* ---------------------------------------------------------------------------- */
2392
2393 /* menu and toolbar item kinds */
2394 enum wxItemKind
2395 {
2396 wxITEM_SEPARATOR = -1,
2397 wxITEM_NORMAL,
2398 wxITEM_CHECK,
2399 wxITEM_RADIO,
2400 wxITEM_DROPDOWN,
2401 wxITEM_MAX
2402 };
2403
2404 /*
2405 * The possible states of a 3-state checkbox (Compatible
2406 * with the 2-state checkbox).
2407 */
2408 enum wxCheckBoxState
2409 {
2410 wxCHK_UNCHECKED,
2411 wxCHK_CHECKED,
2412 wxCHK_UNDETERMINED /* 3-state checkbox only */
2413 };
2414
2415
2416 /* hit test results */
2417 enum wxHitTest
2418 {
2419 wxHT_NOWHERE,
2420
2421 /* scrollbar */
2422 wxHT_SCROLLBAR_FIRST = wxHT_NOWHERE,
2423 wxHT_SCROLLBAR_ARROW_LINE_1, /* left or upper arrow to scroll by line */
2424 wxHT_SCROLLBAR_ARROW_LINE_2, /* right or down */
2425 wxHT_SCROLLBAR_ARROW_PAGE_1, /* left or upper arrow to scroll by page */
2426 wxHT_SCROLLBAR_ARROW_PAGE_2, /* right or down */
2427 wxHT_SCROLLBAR_THUMB, /* on the thumb */
2428 wxHT_SCROLLBAR_BAR_1, /* bar to the left/above the thumb */
2429 wxHT_SCROLLBAR_BAR_2, /* bar to the right/below the thumb */
2430 wxHT_SCROLLBAR_LAST,
2431
2432 /* window */
2433 wxHT_WINDOW_OUTSIDE, /* not in this window at all */
2434 wxHT_WINDOW_INSIDE, /* in the client area */
2435 wxHT_WINDOW_VERT_SCROLLBAR, /* on the vertical scrollbar */
2436 wxHT_WINDOW_HORZ_SCROLLBAR, /* on the horizontal scrollbar */
2437 wxHT_WINDOW_CORNER, /* on the corner between 2 scrollbars */
2438
2439 wxHT_MAX
2440 };
2441
2442 /* ---------------------------------------------------------------------------- */
2443 /* Possible SetSize flags */
2444 /* ---------------------------------------------------------------------------- */
2445
2446 /* Use internally-calculated width if -1 */
2447 #define wxSIZE_AUTO_WIDTH 0x0001
2448 /* Use internally-calculated height if -1 */
2449 #define wxSIZE_AUTO_HEIGHT 0x0002
2450 /* Use internally-calculated width and height if each is -1 */
2451 #define wxSIZE_AUTO (wxSIZE_AUTO_WIDTH|wxSIZE_AUTO_HEIGHT)
2452 /* Ignore missing (-1) dimensions (use existing). */
2453 /* For readability only: test for wxSIZE_AUTO_WIDTH/HEIGHT in code. */
2454 #define wxSIZE_USE_EXISTING 0x0000
2455 /* Allow -1 as a valid position */
2456 #define wxSIZE_ALLOW_MINUS_ONE 0x0004
2457 /* Don't do parent client adjustments (for implementation only) */
2458 #define wxSIZE_NO_ADJUSTMENTS 0x0008
2459 /* Change the window position even if it seems to be already correct */
2460 #define wxSIZE_FORCE 0x0010
2461 /* Emit size event even if size didn't change */
2462 #define wxSIZE_FORCE_EVENT 0x0020
2463
2464 /* ---------------------------------------------------------------------------- */
2465 /* GDI descriptions */
2466 /* ---------------------------------------------------------------------------- */
2467
2468 // Hatch styles used by both pen and brush styles.
2469 //
2470 // NB: Do not use these constants directly, they're for internal use only, use
2471 // wxBRUSHSTYLE_XXX_HATCH and wxPENSTYLE_XXX_HATCH instead.
2472 enum wxHatchStyle
2473 {
2474 wxHATCHSTYLE_INVALID = -1,
2475
2476 /*
2477 The value of the first style is chosen to fit with
2478 wxDeprecatedGUIConstants values below, don't change it.
2479 */
2480 wxHATCHSTYLE_FIRST = 111,
2481 wxHATCHSTYLE_BDIAGONAL = wxHATCHSTYLE_FIRST,
2482 wxHATCHSTYLE_CROSSDIAG,
2483 wxHATCHSTYLE_FDIAGONAL,
2484 wxHATCHSTYLE_CROSS,
2485 wxHATCHSTYLE_HORIZONTAL,
2486 wxHATCHSTYLE_VERTICAL,
2487 wxHATCHSTYLE_LAST = wxHATCHSTYLE_VERTICAL
2488 };
2489
2490 /*
2491 WARNING: the following styles are deprecated; use the
2492 wxFontFamily, wxFontStyle, wxFontWeight, wxBrushStyle,
2493 wxPenStyle, wxPenCap, wxPenJoin enum values instead!
2494 */
2495
2496 #if FUTURE_WXWIN_COMPATIBILITY_3_0
2497
2498 /* don't use any elements of this enum in the new code */
2499 enum wxDeprecatedGUIConstants
2500 {
2501 /* Text font families */
2502 wxDEFAULT = 70,
2503 wxDECORATIVE,
2504 wxROMAN,
2505 wxSCRIPT,
2506 wxSWISS,
2507 wxMODERN,
2508 wxTELETYPE, /* @@@@ */
2509
2510 /* Proportional or Fixed width fonts (not yet used) */
2511 wxVARIABLE = 80,
2512 wxFIXED,
2513
2514 wxNORMAL = 90,
2515 wxLIGHT,
2516 wxBOLD,
2517 /* Also wxNORMAL for normal (non-italic text) */
2518 wxITALIC,
2519 wxSLANT,
2520
2521 /* Pen styles */
2522 wxSOLID = 100,
2523 wxDOT,
2524 wxLONG_DASH,
2525 wxSHORT_DASH,
2526 wxDOT_DASH,
2527 wxUSER_DASH,
2528
2529 wxTRANSPARENT,
2530
2531 /* Brush & Pen Stippling. Note that a stippled pen cannot be dashed!! */
2532 /* Note also that stippling a Pen IS meaningful, because a Line is */
2533 wxSTIPPLE_MASK_OPAQUE, /* mask is used for blitting monochrome using text fore and back ground colors */
2534 wxSTIPPLE_MASK, /* mask is used for masking areas in the stipple bitmap (TO DO) */
2535 /* drawn with a Pen, and without any Brush -- and it can be stippled. */
2536 wxSTIPPLE = 110,
2537
2538 wxBDIAGONAL_HATCH = wxHATCHSTYLE_BDIAGONAL,
2539 wxCROSSDIAG_HATCH = wxHATCHSTYLE_CROSSDIAG,
2540 wxFDIAGONAL_HATCH = wxHATCHSTYLE_FDIAGONAL,
2541 wxCROSS_HATCH = wxHATCHSTYLE_CROSS,
2542 wxHORIZONTAL_HATCH = wxHATCHSTYLE_HORIZONTAL,
2543 wxVERTICAL_HATCH = wxHATCHSTYLE_VERTICAL,
2544 wxFIRST_HATCH = wxHATCHSTYLE_FIRST,
2545 wxLAST_HATCH = wxHATCHSTYLE_LAST
2546 };
2547 #endif
2548
2549 /* ToolPanel in wxFrame (VZ: unused?) */
2550 enum
2551 {
2552 wxTOOL_TOP = 1,
2553 wxTOOL_BOTTOM,
2554 wxTOOL_LEFT,
2555 wxTOOL_RIGHT
2556 };
2557
2558 /* the values of the format constants should be the same as corresponding */
2559 /* CF_XXX constants in Windows API */
2560 enum wxDataFormatId
2561 {
2562 wxDF_INVALID = 0,
2563 wxDF_TEXT = 1, /* CF_TEXT */
2564 wxDF_BITMAP = 2, /* CF_BITMAP */
2565 wxDF_METAFILE = 3, /* CF_METAFILEPICT */
2566 wxDF_SYLK = 4,
2567 wxDF_DIF = 5,
2568 wxDF_TIFF = 6,
2569 wxDF_OEMTEXT = 7, /* CF_OEMTEXT */
2570 wxDF_DIB = 8, /* CF_DIB */
2571 wxDF_PALETTE = 9,
2572 wxDF_PENDATA = 10,
2573 wxDF_RIFF = 11,
2574 wxDF_WAVE = 12,
2575 wxDF_UNICODETEXT = 13,
2576 wxDF_ENHMETAFILE = 14,
2577 wxDF_FILENAME = 15, /* CF_HDROP */
2578 wxDF_LOCALE = 16,
2579 wxDF_PRIVATE = 20,
2580 wxDF_HTML = 30, /* Note: does not correspond to CF_ constant */
2581 wxDF_MAX
2582 };
2583
2584 /* Key codes */
2585 enum wxKeyCode
2586 {
2587 WXK_NONE = 0,
2588
2589 WXK_CONTROL_A = 1,
2590 WXK_CONTROL_B,
2591 WXK_CONTROL_C,
2592 WXK_CONTROL_D,
2593 WXK_CONTROL_E,
2594 WXK_CONTROL_F,
2595 WXK_CONTROL_G,
2596 WXK_CONTROL_H,
2597 WXK_CONTROL_I,
2598 WXK_CONTROL_J,
2599 WXK_CONTROL_K,
2600 WXK_CONTROL_L,
2601 WXK_CONTROL_M,
2602 WXK_CONTROL_N,
2603 WXK_CONTROL_O,
2604 WXK_CONTROL_P,
2605 WXK_CONTROL_Q,
2606 WXK_CONTROL_R,
2607 WXK_CONTROL_S,
2608 WXK_CONTROL_T,
2609 WXK_CONTROL_U,
2610 WXK_CONTROL_V,
2611 WXK_CONTROL_W,
2612 WXK_CONTROL_X,
2613 WXK_CONTROL_Y,
2614 WXK_CONTROL_Z,
2615
2616 WXK_BACK = 8, /* backspace */
2617 WXK_TAB = 9,
2618 WXK_RETURN = 13,
2619 WXK_ESCAPE = 27,
2620
2621 /* values from 33 to 126 are reserved for the standard ASCII characters */
2622
2623 WXK_SPACE = 32,
2624 WXK_DELETE = 127,
2625
2626 /* values from 128 to 255 are reserved for ASCII extended characters
2627 (note that there isn't a single fixed standard for the meaning
2628 of these values; avoid them in portable apps!) */
2629
2630 /* These are not compatible with unicode characters.
2631 If you want to get a unicode character from a key event, use
2632 wxKeyEvent::GetUnicodeKey */
2633 WXK_START = 300,
2634 WXK_LBUTTON,
2635 WXK_RBUTTON,
2636 WXK_CANCEL,
2637 WXK_MBUTTON,
2638 WXK_CLEAR,
2639 WXK_SHIFT,
2640 WXK_ALT,
2641 WXK_CONTROL,
2642 WXK_MENU,
2643 WXK_PAUSE,
2644 WXK_CAPITAL,
2645 WXK_END,
2646 WXK_HOME,
2647 WXK_LEFT,
2648 WXK_UP,
2649 WXK_RIGHT,
2650 WXK_DOWN,
2651 WXK_SELECT,
2652 WXK_PRINT,
2653 WXK_EXECUTE,
2654 WXK_SNAPSHOT,
2655 WXK_INSERT,
2656 WXK_HELP,
2657 WXK_NUMPAD0,
2658 WXK_NUMPAD1,
2659 WXK_NUMPAD2,
2660 WXK_NUMPAD3,
2661 WXK_NUMPAD4,
2662 WXK_NUMPAD5,
2663 WXK_NUMPAD6,
2664 WXK_NUMPAD7,
2665 WXK_NUMPAD8,
2666 WXK_NUMPAD9,
2667 WXK_MULTIPLY,
2668 WXK_ADD,
2669 WXK_SEPARATOR,
2670 WXK_SUBTRACT,
2671 WXK_DECIMAL,
2672 WXK_DIVIDE,
2673 WXK_F1,
2674 WXK_F2,
2675 WXK_F3,
2676 WXK_F4,
2677 WXK_F5,
2678 WXK_F6,
2679 WXK_F7,
2680 WXK_F8,
2681 WXK_F9,
2682 WXK_F10,
2683 WXK_F11,
2684 WXK_F12,
2685 WXK_F13,
2686 WXK_F14,
2687 WXK_F15,
2688 WXK_F16,
2689 WXK_F17,
2690 WXK_F18,
2691 WXK_F19,
2692 WXK_F20,
2693 WXK_F21,
2694 WXK_F22,
2695 WXK_F23,
2696 WXK_F24,
2697 WXK_NUMLOCK,
2698 WXK_SCROLL,
2699 WXK_PAGEUP,
2700 WXK_PAGEDOWN,
2701 #if WXWIN_COMPATIBILITY_2_6
2702 WXK_PRIOR = WXK_PAGEUP,
2703 WXK_NEXT = WXK_PAGEDOWN,
2704 #endif
2705
2706 WXK_NUMPAD_SPACE,
2707 WXK_NUMPAD_TAB,
2708 WXK_NUMPAD_ENTER,
2709 WXK_NUMPAD_F1,
2710 WXK_NUMPAD_F2,
2711 WXK_NUMPAD_F3,
2712 WXK_NUMPAD_F4,
2713 WXK_NUMPAD_HOME,
2714 WXK_NUMPAD_LEFT,
2715 WXK_NUMPAD_UP,
2716 WXK_NUMPAD_RIGHT,
2717 WXK_NUMPAD_DOWN,
2718 WXK_NUMPAD_PAGEUP,
2719 WXK_NUMPAD_PAGEDOWN,
2720 #if WXWIN_COMPATIBILITY_2_6
2721 WXK_NUMPAD_PRIOR = WXK_NUMPAD_PAGEUP,
2722 WXK_NUMPAD_NEXT = WXK_NUMPAD_PAGEDOWN,
2723 #endif
2724 WXK_NUMPAD_END,
2725 WXK_NUMPAD_BEGIN,
2726 WXK_NUMPAD_INSERT,
2727 WXK_NUMPAD_DELETE,
2728 WXK_NUMPAD_EQUAL,
2729 WXK_NUMPAD_MULTIPLY,
2730 WXK_NUMPAD_ADD,
2731 WXK_NUMPAD_SEPARATOR,
2732 WXK_NUMPAD_SUBTRACT,
2733 WXK_NUMPAD_DECIMAL,
2734 WXK_NUMPAD_DIVIDE,
2735
2736 WXK_WINDOWS_LEFT,
2737 WXK_WINDOWS_RIGHT,
2738 WXK_WINDOWS_MENU ,
2739 #ifdef __WXOSX__
2740 WXK_RAW_CONTROL,
2741 #else
2742 WXK_RAW_CONTROL = WXK_CONTROL,
2743 #endif
2744 WXK_COMMAND = WXK_CONTROL,
2745
2746 /* Hardware-specific buttons */
2747 WXK_SPECIAL1 = 193,
2748 WXK_SPECIAL2,
2749 WXK_SPECIAL3,
2750 WXK_SPECIAL4,
2751 WXK_SPECIAL5,
2752 WXK_SPECIAL6,
2753 WXK_SPECIAL7,
2754 WXK_SPECIAL8,
2755 WXK_SPECIAL9,
2756 WXK_SPECIAL10,
2757 WXK_SPECIAL11,
2758 WXK_SPECIAL12,
2759 WXK_SPECIAL13,
2760 WXK_SPECIAL14,
2761 WXK_SPECIAL15,
2762 WXK_SPECIAL16,
2763 WXK_SPECIAL17,
2764 WXK_SPECIAL18,
2765 WXK_SPECIAL19,
2766 WXK_SPECIAL20
2767 };
2768
2769 /* This enum contains bit mask constants used in wxKeyEvent */
2770 enum wxKeyModifier
2771 {
2772 wxMOD_NONE = 0x0000,
2773 wxMOD_ALT = 0x0001,
2774 wxMOD_CONTROL = 0x0002,
2775 wxMOD_ALTGR = wxMOD_ALT | wxMOD_CONTROL,
2776 wxMOD_SHIFT = 0x0004,
2777 wxMOD_META = 0x0008,
2778 wxMOD_WIN = wxMOD_META,
2779 #if defined(__WXMAC__) || defined(__WXCOCOA__)
2780 wxMOD_RAW_CONTROL = 0x0010,
2781 #else
2782 wxMOD_RAW_CONTROL = wxMOD_CONTROL,
2783 #endif
2784 wxMOD_CMD = wxMOD_CONTROL,
2785 wxMOD_ALL = 0xffff
2786 };
2787
2788 /* Shortcut for easier dialog-unit-to-pixel conversion */
2789 #define wxDLG_UNIT(parent, pt) parent->ConvertDialogToPixels(pt)
2790
2791 /* Paper types */
2792 typedef enum
2793 {
2794 wxPAPER_NONE, /* Use specific dimensions */
2795 wxPAPER_LETTER, /* Letter, 8 1/2 by 11 inches */
2796 wxPAPER_LEGAL, /* Legal, 8 1/2 by 14 inches */
2797 wxPAPER_A4, /* A4 Sheet, 210 by 297 millimeters */
2798 wxPAPER_CSHEET, /* C Sheet, 17 by 22 inches */
2799 wxPAPER_DSHEET, /* D Sheet, 22 by 34 inches */
2800 wxPAPER_ESHEET, /* E Sheet, 34 by 44 inches */
2801 wxPAPER_LETTERSMALL, /* Letter Small, 8 1/2 by 11 inches */
2802 wxPAPER_TABLOID, /* Tabloid, 11 by 17 inches */
2803 wxPAPER_LEDGER, /* Ledger, 17 by 11 inches */
2804 wxPAPER_STATEMENT, /* Statement, 5 1/2 by 8 1/2 inches */
2805 wxPAPER_EXECUTIVE, /* Executive, 7 1/4 by 10 1/2 inches */
2806 wxPAPER_A3, /* A3 sheet, 297 by 420 millimeters */
2807 wxPAPER_A4SMALL, /* A4 small sheet, 210 by 297 millimeters */
2808 wxPAPER_A5, /* A5 sheet, 148 by 210 millimeters */
2809 wxPAPER_B4, /* B4 sheet, 250 by 354 millimeters */
2810 wxPAPER_B5, /* B5 sheet, 182-by-257-millimeter paper */
2811 wxPAPER_FOLIO, /* Folio, 8-1/2-by-13-inch paper */
2812 wxPAPER_QUARTO, /* Quarto, 215-by-275-millimeter paper */
2813 wxPAPER_10X14, /* 10-by-14-inch sheet */
2814 wxPAPER_11X17, /* 11-by-17-inch sheet */
2815 wxPAPER_NOTE, /* Note, 8 1/2 by 11 inches */
2816 wxPAPER_ENV_9, /* #9 Envelope, 3 7/8 by 8 7/8 inches */
2817 wxPAPER_ENV_10, /* #10 Envelope, 4 1/8 by 9 1/2 inches */
2818 wxPAPER_ENV_11, /* #11 Envelope, 4 1/2 by 10 3/8 inches */
2819 wxPAPER_ENV_12, /* #12 Envelope, 4 3/4 by 11 inches */
2820 wxPAPER_ENV_14, /* #14 Envelope, 5 by 11 1/2 inches */
2821 wxPAPER_ENV_DL, /* DL Envelope, 110 by 220 millimeters */
2822 wxPAPER_ENV_C5, /* C5 Envelope, 162 by 229 millimeters */
2823 wxPAPER_ENV_C3, /* C3 Envelope, 324 by 458 millimeters */
2824 wxPAPER_ENV_C4, /* C4 Envelope, 229 by 324 millimeters */
2825 wxPAPER_ENV_C6, /* C6 Envelope, 114 by 162 millimeters */
2826 wxPAPER_ENV_C65, /* C65 Envelope, 114 by 229 millimeters */
2827 wxPAPER_ENV_B4, /* B4 Envelope, 250 by 353 millimeters */
2828 wxPAPER_ENV_B5, /* B5 Envelope, 176 by 250 millimeters */
2829 wxPAPER_ENV_B6, /* B6 Envelope, 176 by 125 millimeters */
2830 wxPAPER_ENV_ITALY, /* Italy Envelope, 110 by 230 millimeters */
2831 wxPAPER_ENV_MONARCH, /* Monarch Envelope, 3 7/8 by 7 1/2 inches */
2832 wxPAPER_ENV_PERSONAL, /* 6 3/4 Envelope, 3 5/8 by 6 1/2 inches */
2833 wxPAPER_FANFOLD_US, /* US Std Fanfold, 14 7/8 by 11 inches */
2834 wxPAPER_FANFOLD_STD_GERMAN, /* German Std Fanfold, 8 1/2 by 12 inches */
2835 wxPAPER_FANFOLD_LGL_GERMAN, /* German Legal Fanfold, 8 1/2 by 13 inches */
2836
2837 wxPAPER_ISO_B4, /* B4 (ISO) 250 x 353 mm */
2838 wxPAPER_JAPANESE_POSTCARD, /* Japanese Postcard 100 x 148 mm */
2839 wxPAPER_9X11, /* 9 x 11 in */
2840 wxPAPER_10X11, /* 10 x 11 in */
2841 wxPAPER_15X11, /* 15 x 11 in */
2842 wxPAPER_ENV_INVITE, /* Envelope Invite 220 x 220 mm */
2843 wxPAPER_LETTER_EXTRA, /* Letter Extra 9 \275 x 12 in */
2844 wxPAPER_LEGAL_EXTRA, /* Legal Extra 9 \275 x 15 in */
2845 wxPAPER_TABLOID_EXTRA, /* Tabloid Extra 11.69 x 18 in */
2846 wxPAPER_A4_EXTRA, /* A4 Extra 9.27 x 12.69 in */
2847 wxPAPER_LETTER_TRANSVERSE, /* Letter Transverse 8 \275 x 11 in */
2848 wxPAPER_A4_TRANSVERSE, /* A4 Transverse 210 x 297 mm */
2849 wxPAPER_LETTER_EXTRA_TRANSVERSE, /* Letter Extra Transverse 9\275 x 12 in */
2850 wxPAPER_A_PLUS, /* SuperA/SuperA/A4 227 x 356 mm */
2851 wxPAPER_B_PLUS, /* SuperB/SuperB/A3 305 x 487 mm */
2852 wxPAPER_LETTER_PLUS, /* Letter Plus 8.5 x 12.69 in */
2853 wxPAPER_A4_PLUS, /* A4 Plus 210 x 330 mm */
2854 wxPAPER_A5_TRANSVERSE, /* A5 Transverse 148 x 210 mm */
2855 wxPAPER_B5_TRANSVERSE, /* B5 (JIS) Transverse 182 x 257 mm */
2856 wxPAPER_A3_EXTRA, /* A3 Extra 322 x 445 mm */
2857 wxPAPER_A5_EXTRA, /* A5 Extra 174 x 235 mm */
2858 wxPAPER_B5_EXTRA, /* B5 (ISO) Extra 201 x 276 mm */
2859 wxPAPER_A2, /* A2 420 x 594 mm */
2860 wxPAPER_A3_TRANSVERSE, /* A3 Transverse 297 x 420 mm */
2861 wxPAPER_A3_EXTRA_TRANSVERSE, /* A3 Extra Transverse 322 x 445 mm */
2862
2863 wxPAPER_DBL_JAPANESE_POSTCARD,/* Japanese Double Postcard 200 x 148 mm */
2864 wxPAPER_A6, /* A6 105 x 148 mm */
2865 wxPAPER_JENV_KAKU2, /* Japanese Envelope Kaku #2 */
2866 wxPAPER_JENV_KAKU3, /* Japanese Envelope Kaku #3 */
2867 wxPAPER_JENV_CHOU3, /* Japanese Envelope Chou #3 */
2868 wxPAPER_JENV_CHOU4, /* Japanese Envelope Chou #4 */
2869 wxPAPER_LETTER_ROTATED, /* Letter Rotated 11 x 8 1/2 in */
2870 wxPAPER_A3_ROTATED, /* A3 Rotated 420 x 297 mm */
2871 wxPAPER_A4_ROTATED, /* A4 Rotated 297 x 210 mm */
2872 wxPAPER_A5_ROTATED, /* A5 Rotated 210 x 148 mm */
2873 wxPAPER_B4_JIS_ROTATED, /* B4 (JIS) Rotated 364 x 257 mm */
2874 wxPAPER_B5_JIS_ROTATED, /* B5 (JIS) Rotated 257 x 182 mm */
2875 wxPAPER_JAPANESE_POSTCARD_ROTATED,/* Japanese Postcard Rotated 148 x 100 mm */
2876 wxPAPER_DBL_JAPANESE_POSTCARD_ROTATED,/* Double Japanese Postcard Rotated 148 x 200 mm */
2877 wxPAPER_A6_ROTATED, /* A6 Rotated 148 x 105 mm */
2878 wxPAPER_JENV_KAKU2_ROTATED, /* Japanese Envelope Kaku #2 Rotated */
2879 wxPAPER_JENV_KAKU3_ROTATED, /* Japanese Envelope Kaku #3 Rotated */
2880 wxPAPER_JENV_CHOU3_ROTATED, /* Japanese Envelope Chou #3 Rotated */
2881 wxPAPER_JENV_CHOU4_ROTATED, /* Japanese Envelope Chou #4 Rotated */
2882 wxPAPER_B6_JIS, /* B6 (JIS) 128 x 182 mm */
2883 wxPAPER_B6_JIS_ROTATED, /* B6 (JIS) Rotated 182 x 128 mm */
2884 wxPAPER_12X11, /* 12 x 11 in */
2885 wxPAPER_JENV_YOU4, /* Japanese Envelope You #4 */
2886 wxPAPER_JENV_YOU4_ROTATED, /* Japanese Envelope You #4 Rotated */
2887 wxPAPER_P16K, /* PRC 16K 146 x 215 mm */
2888 wxPAPER_P32K, /* PRC 32K 97 x 151 mm */
2889 wxPAPER_P32KBIG, /* PRC 32K(Big) 97 x 151 mm */
2890 wxPAPER_PENV_1, /* PRC Envelope #1 102 x 165 mm */
2891 wxPAPER_PENV_2, /* PRC Envelope #2 102 x 176 mm */
2892 wxPAPER_PENV_3, /* PRC Envelope #3 125 x 176 mm */
2893 wxPAPER_PENV_4, /* PRC Envelope #4 110 x 208 mm */
2894 wxPAPER_PENV_5, /* PRC Envelope #5 110 x 220 mm */
2895 wxPAPER_PENV_6, /* PRC Envelope #6 120 x 230 mm */
2896 wxPAPER_PENV_7, /* PRC Envelope #7 160 x 230 mm */
2897 wxPAPER_PENV_8, /* PRC Envelope #8 120 x 309 mm */
2898 wxPAPER_PENV_9, /* PRC Envelope #9 229 x 324 mm */
2899 wxPAPER_PENV_10, /* PRC Envelope #10 324 x 458 mm */
2900 wxPAPER_P16K_ROTATED, /* PRC 16K Rotated */
2901 wxPAPER_P32K_ROTATED, /* PRC 32K Rotated */
2902 wxPAPER_P32KBIG_ROTATED, /* PRC 32K(Big) Rotated */
2903 wxPAPER_PENV_1_ROTATED, /* PRC Envelope #1 Rotated 165 x 102 mm */
2904 wxPAPER_PENV_2_ROTATED, /* PRC Envelope #2 Rotated 176 x 102 mm */
2905 wxPAPER_PENV_3_ROTATED, /* PRC Envelope #3 Rotated 176 x 125 mm */
2906 wxPAPER_PENV_4_ROTATED, /* PRC Envelope #4 Rotated 208 x 110 mm */
2907 wxPAPER_PENV_5_ROTATED, /* PRC Envelope #5 Rotated 220 x 110 mm */
2908 wxPAPER_PENV_6_ROTATED, /* PRC Envelope #6 Rotated 230 x 120 mm */
2909 wxPAPER_PENV_7_ROTATED, /* PRC Envelope #7 Rotated 230 x 160 mm */
2910 wxPAPER_PENV_8_ROTATED, /* PRC Envelope #8 Rotated 309 x 120 mm */
2911 wxPAPER_PENV_9_ROTATED, /* PRC Envelope #9 Rotated 324 x 229 mm */
2912 wxPAPER_PENV_10_ROTATED, /* PRC Envelope #10 Rotated 458 x 324 m */
2913 wxPAPER_A0, /* A0 Sheet 841 x 1189 mm */
2914 wxPAPER_A1 /* A1 Sheet 594 x 841 mm */
2915 } wxPaperSize;
2916
2917 /* Printing orientation */
2918 enum wxPrintOrientation
2919 {
2920 wxPORTRAIT = 1,
2921 wxLANDSCAPE
2922 };
2923
2924 /* Duplex printing modes
2925 */
2926
2927 enum wxDuplexMode
2928 {
2929 wxDUPLEX_SIMPLEX, /* Non-duplex */
2930 wxDUPLEX_HORIZONTAL,
2931 wxDUPLEX_VERTICAL
2932 };
2933
2934 /* Print quality.
2935 */
2936
2937 #define wxPRINT_QUALITY_HIGH -1
2938 #define wxPRINT_QUALITY_MEDIUM -2
2939 #define wxPRINT_QUALITY_LOW -3
2940 #define wxPRINT_QUALITY_DRAFT -4
2941
2942 typedef int wxPrintQuality;
2943
2944 /* Print mode (currently PostScript only)
2945 */
2946
2947 enum wxPrintMode
2948 {
2949 wxPRINT_MODE_NONE = 0,
2950 wxPRINT_MODE_PREVIEW = 1, /* Preview in external application */
2951 wxPRINT_MODE_FILE = 2, /* Print to file */
2952 wxPRINT_MODE_PRINTER = 3, /* Send to printer */
2953 wxPRINT_MODE_STREAM = 4 /* Send postscript data into a stream */
2954 };
2955
2956 /* ---------------------------------------------------------------------------- */
2957 /* UpdateWindowUI flags */
2958 /* ---------------------------------------------------------------------------- */
2959
2960 enum wxUpdateUI
2961 {
2962 wxUPDATE_UI_NONE = 0x0000,
2963 wxUPDATE_UI_RECURSE = 0x0001,
2964 wxUPDATE_UI_FROMIDLE = 0x0002 /* Invoked from On(Internal)Idle */
2965 };
2966
2967
2968 /* ---------------------------------------------------------------------------- */
2969 /* wxList types */
2970 /* ---------------------------------------------------------------------------- */
2971
2972 /* type of compare function for list sort operation (as in 'qsort'): it should
2973 return a negative value, 0 or positive value if the first element is less
2974 than, equal or greater than the second */
2975
2976 typedef int (* LINKAGEMODE wxSortCompareFunction)(const void *elem1, const void *elem2);
2977
2978 /* wxList iterator function */
2979 typedef int (* LINKAGEMODE wxListIterateFunction)(void *current);
2980
2981
2982 /* ---------------------------------------------------------------------------- */
2983 /* miscellaneous */
2984 /* ---------------------------------------------------------------------------- */
2985
2986 /* define this macro if font handling is done using the X font names */
2987 #if (defined(__WXGTK__) && !defined(__WXGTK20__)) || defined(__X__)
2988 #define _WX_X_FONTLIKE
2989 #endif
2990
2991 /* macro to specify "All Files" on different platforms */
2992 #if defined(__WXMSW__) || defined(__WXPM__)
2993 # define wxALL_FILES_PATTERN wxT("*.*")
2994 # define wxALL_FILES gettext_noop("All files (*.*)|*.*")
2995 #else
2996 # define wxALL_FILES_PATTERN wxT("*")
2997 # define wxALL_FILES gettext_noop("All files (*)|*")
2998 #endif
2999
3000 #if defined(__CYGWIN__) && defined(__WXMSW__)
3001 # if wxUSE_STD_CONTAINERS || defined(wxUSE_STD_STRING)
3002 /*
3003 NASTY HACK because the gethostname in sys/unistd.h which the gnu
3004 stl includes and wx builds with by default clash with each other
3005 (windows version 2nd param is int, sys/unistd.h version is unsigned
3006 int).
3007 */
3008 # define gethostname gethostnameHACK
3009 # include <unistd.h>
3010 # undef gethostname
3011 # endif
3012 #endif
3013
3014 /* --------------------------------------------------------------------------- */
3015 /* macros that enable wxWidgets apps to be compiled in absence of the */
3016 /* system headers, although some platform specific types are used in the */
3017 /* platform specific (implementation) parts of the headers */
3018 /* --------------------------------------------------------------------------- */
3019
3020 #ifdef __DARWIN__
3021 #define DECLARE_WXOSX_OPAQUE_CFREF( name ) typedef struct __##name* name##Ref;
3022 #define DECLARE_WXOSX_OPAQUE_CONST_CFREF( name ) typedef const struct __##name* name##Ref;
3023 #endif
3024
3025 #ifdef __WXMAC__
3026
3027 #define WX_OPAQUE_TYPE( name ) struct wxOpaque##name
3028
3029 typedef void* WXHBITMAP;
3030 typedef void* WXHCURSOR;
3031 typedef void* WXRECTPTR;
3032 typedef void* WXPOINTPTR;
3033 typedef void* WXHWND;
3034 typedef void* WXEVENTREF;
3035 typedef void* WXEVENTHANDLERREF;
3036 typedef void* WXEVENTHANDLERCALLREF;
3037 typedef void* WXAPPLEEVENTREF;
3038
3039 typedef unsigned int WXUINT;
3040 typedef unsigned long WXDWORD;
3041 typedef unsigned short WXWORD;
3042
3043 typedef WX_OPAQUE_TYPE(PicHandle ) * WXHMETAFILE ;
3044 #if wxOSX_USE_CARBON
3045 typedef struct OpaqueControlRef* WXWidget ;
3046 typedef struct OpaqueWindowPtr* WXWindow ;
3047 typedef struct __AGLPixelFormatRec *WXGLPixelFormat;
3048 typedef struct __AGLContextRec *WXGLContext;
3049 #endif
3050
3051 typedef void* WXDisplay;
3052
3053 /*
3054 * core frameworks
3055 */
3056
3057 typedef const void * CFTypeRef;
3058
3059 /* typedef const struct __CFString * CFStringRef; */
3060
3061 DECLARE_WXOSX_OPAQUE_CONST_CFREF( CFString )
3062 typedef struct __CFString * CFMutableStringRef;
3063
3064 DECLARE_WXOSX_OPAQUE_CFREF( CFRunLoopSource )
3065 DECLARE_WXOSX_OPAQUE_CONST_CFREF( CTFont )
3066 DECLARE_WXOSX_OPAQUE_CONST_CFREF( CTFontDescriptor )
3067
3068 #define DECLARE_WXOSX_OPAQUE_CGREF( name ) typedef struct name* name##Ref;
3069
3070 DECLARE_WXOSX_OPAQUE_CGREF( CGColor )
3071 DECLARE_WXOSX_OPAQUE_CGREF( CGImage )
3072 DECLARE_WXOSX_OPAQUE_CGREF( CGContext )
3073 DECLARE_WXOSX_OPAQUE_CGREF( CGFont )
3074
3075 typedef CGColorRef WXCOLORREF;
3076 typedef CGImageRef WXCGIMAGEREF;
3077 typedef CGContextRef WXHDC;
3078
3079 /*
3080 * carbon
3081 */
3082
3083 typedef const struct __HIShape * HIShapeRef;
3084 typedef struct __HIShape * HIMutableShapeRef;
3085
3086 #define DECLARE_WXMAC_OPAQUE_REF( name ) typedef struct Opaque##name* name;
3087
3088 DECLARE_WXMAC_OPAQUE_REF( PasteboardRef )
3089 DECLARE_WXMAC_OPAQUE_REF( IconRef )
3090 DECLARE_WXMAC_OPAQUE_REF( MenuRef )
3091
3092 typedef IconRef WXHICON ;
3093 typedef HIShapeRef WXHRGN;
3094 #if wxOSX_USE_CARBON
3095 typedef MenuRef WXHMENU;
3096 #endif
3097
3098 #endif
3099
3100 #if defined( __WXCOCOA__ ) || defined(__WXMAC__)
3101
3102 /* Definitions of 32-bit/64-bit types
3103 * These are typedef'd exactly the same way in newer OS X headers so
3104 * redefinition when real headers are included should not be a problem. If
3105 * it is, the types are being defined wrongly here.
3106 * The purpose of these types is so they can be used from public wx headers.
3107 * and also because the older (pre-Leopard) headers don't define them.
3108 */
3109
3110 /* NOTE: We don't pollute namespace with CGFLOAT_MIN/MAX/IS_DOUBLE macros
3111 * since they are unlikely to be needed in a public header.
3112 */
3113 #if defined(__LP64__) && __LP64__
3114 typedef double CGFloat;
3115 #else
3116 typedef float CGFloat;
3117 #endif
3118
3119 #if (defined(__LP64__) && __LP64__) || (defined(NS_BUILD_32_LIKE_64) && NS_BUILD_32_LIKE_64)
3120 typedef long NSInteger;
3121 typedef unsigned long NSUInteger;
3122 #else
3123 typedef int NSInteger;
3124 typedef unsigned int NSUInteger;
3125 #endif
3126
3127 /* Objective-C type declarations.
3128 * These are to be used in public headers in lieu of NSSomething* because
3129 * Objective-C class names are not available in C/C++ code.
3130 */
3131
3132 /* NOTE: This ought to work with other compilers too, but I'm being cautious */
3133 #if (defined(__GNUC__) && defined(__APPLE__))
3134 /* It's desirable to have type safety for Objective-C(++) code as it does
3135 at least catch typos of method names among other things. However, it
3136 is not possible to declare an Objective-C class from plain old C or C++
3137 code. Furthermore, because of C++ name mangling, the type name must
3138 be the same for both C++ and Objective-C++ code. Therefore, we define
3139 what should be a pointer to an Objective-C class as a pointer to a plain
3140 old C struct with the same name. Unfortunately, because the compiler
3141 does not see a struct as an Objective-C class we cannot declare it
3142 as a struct in Objective-C(++) mode.
3143 */
3144 #if defined(__OBJC__)
3145 #define DECLARE_WXCOCOA_OBJC_CLASS(klass) \
3146 @class klass; \
3147 typedef klass *WX_##klass
3148 #else /* not defined(__OBJC__) */
3149 #define DECLARE_WXCOCOA_OBJC_CLASS(klass) \
3150 typedef struct klass *WX_##klass
3151 #endif /* defined(__OBJC__) */
3152
3153 #else /* not Apple's gcc */
3154 #warning "Objective-C types will not be checked by the compiler."
3155 /* NOTE: typedef struct objc_object *id; */
3156 /* IOW, we're declaring these using the id type without using that name, */
3157 /* since "id" is used extensively not only within wxWidgets itself, but */
3158 /* also in wxWidgets application code. The following works fine when */
3159 /* compiling C(++) code, and works without typesafety for Obj-C(++) code */
3160 #define DECLARE_WXCOCOA_OBJC_CLASS(klass) \
3161 typedef struct objc_object *WX_##klass
3162
3163 #endif /* (defined(__GNUC__) && defined(__APPLE__)) */
3164
3165 DECLARE_WXCOCOA_OBJC_CLASS(NSApplication);
3166 DECLARE_WXCOCOA_OBJC_CLASS(NSBitmapImageRep);
3167 DECLARE_WXCOCOA_OBJC_CLASS(NSBox);
3168 DECLARE_WXCOCOA_OBJC_CLASS(NSButton);
3169 DECLARE_WXCOCOA_OBJC_CLASS(NSColor);
3170 DECLARE_WXCOCOA_OBJC_CLASS(NSColorPanel);
3171 DECLARE_WXCOCOA_OBJC_CLASS(NSControl);
3172 DECLARE_WXCOCOA_OBJC_CLASS(NSCursor);
3173 DECLARE_WXCOCOA_OBJC_CLASS(NSEvent);
3174 DECLARE_WXCOCOA_OBJC_CLASS(NSFont);
3175 DECLARE_WXCOCOA_OBJC_CLASS(NSFontDescriptor);
3176 DECLARE_WXCOCOA_OBJC_CLASS(NSFontPanel);
3177 DECLARE_WXCOCOA_OBJC_CLASS(NSImage);
3178 DECLARE_WXCOCOA_OBJC_CLASS(NSLayoutManager);
3179 DECLARE_WXCOCOA_OBJC_CLASS(NSMenu);
3180 DECLARE_WXCOCOA_OBJC_CLASS(NSMenuExtra);
3181 DECLARE_WXCOCOA_OBJC_CLASS(NSMenuItem);
3182 DECLARE_WXCOCOA_OBJC_CLASS(NSMutableArray);
3183 DECLARE_WXCOCOA_OBJC_CLASS(NSNotification);
3184 DECLARE_WXCOCOA_OBJC_CLASS(NSObject);
3185 DECLARE_WXCOCOA_OBJC_CLASS(NSPanel);
3186 DECLARE_WXCOCOA_OBJC_CLASS(NSResponder);
3187 DECLARE_WXCOCOA_OBJC_CLASS(NSScrollView);
3188 DECLARE_WXCOCOA_OBJC_CLASS(NSSound);
3189 DECLARE_WXCOCOA_OBJC_CLASS(NSStatusItem);
3190 DECLARE_WXCOCOA_OBJC_CLASS(NSTableColumn);
3191 DECLARE_WXCOCOA_OBJC_CLASS(NSTableView);
3192 DECLARE_WXCOCOA_OBJC_CLASS(NSTextContainer);
3193 DECLARE_WXCOCOA_OBJC_CLASS(NSTextField);
3194 DECLARE_WXCOCOA_OBJC_CLASS(NSTextStorage);
3195 DECLARE_WXCOCOA_OBJC_CLASS(NSThread);
3196 DECLARE_WXCOCOA_OBJC_CLASS(NSWindow);
3197 DECLARE_WXCOCOA_OBJC_CLASS(NSView);
3198 DECLARE_WXCOCOA_OBJC_CLASS(NSOpenGLContext);
3199 DECLARE_WXCOCOA_OBJC_CLASS(NSOpenGLPixelFormat);
3200 DECLARE_WXCOCOA_OBJC_CLASS( NSPrintInfo );
3201 #ifndef __WXMAC__
3202 typedef WX_NSView WXWidget; /* wxWidgets BASE definition */
3203 #endif
3204 #endif /* __WXCOCOA__ || ( __WXMAC__ &__DARWIN__)*/
3205
3206 #ifdef __WXMAC__
3207
3208 DECLARE_WXCOCOA_OBJC_CLASS(NSString);
3209
3210 #if wxOSX_USE_COCOA
3211
3212 typedef WX_NSWindow WXWindow;
3213 typedef WX_NSView WXWidget;
3214 typedef WX_NSMenu WXHMENU;
3215 typedef WX_NSOpenGLPixelFormat WXGLPixelFormat;
3216 typedef WX_NSOpenGLContext WXGLContext;
3217
3218 #elif wxOSX_USE_IPHONE
3219
3220 DECLARE_WXCOCOA_OBJC_CLASS(UIWindow);
3221 DECLARE_WXCOCOA_OBJC_CLASS(UIView);
3222 DECLARE_WXCOCOA_OBJC_CLASS(UIFont);
3223 DECLARE_WXCOCOA_OBJC_CLASS(UIImage);
3224 DECLARE_WXCOCOA_OBJC_CLASS(UIEvent);
3225 DECLARE_WXCOCOA_OBJC_CLASS(NSSet);
3226 DECLARE_WXCOCOA_OBJC_CLASS(EAGLContext);
3227 DECLARE_WXCOCOA_OBJC_CLASS(UIWebView);
3228
3229 typedef WX_UIWindow WXWindow;
3230 typedef WX_UIView WXWidget;
3231 typedef WX_EAGLContext WXGLContext;
3232 typedef WX_NSString* WXGLPixelFormat;
3233 typedef WX_UIWebView OSXWebViewPtr;
3234
3235 #endif
3236
3237 #if wxOSX_USE_COCOA_OR_CARBON
3238 DECLARE_WXCOCOA_OBJC_CLASS(WebView);
3239 typedef WX_WebView OSXWebViewPtr;
3240 #endif
3241
3242
3243 #endif /* __WXMAC__ */
3244
3245 /* ABX: check __WIN32__ instead of __WXMSW__ for the same MSWBase in any Win32 port */
3246 #if defined(__WIN32__)
3247
3248 /* Stand-ins for Windows types to avoid #including all of windows.h */
3249
3250 #ifndef NO_STRICT
3251 #define WX_MSW_DECLARE_HANDLE(type) typedef struct type##__ * WX##type
3252 #else
3253 #define WX_MSW_DECLARE_HANDLE(type) typedef void * WX##type
3254 #endif
3255
3256 typedef void* WXHANDLE;
3257 WX_MSW_DECLARE_HANDLE(HWND);
3258 WX_MSW_DECLARE_HANDLE(HICON);
3259 WX_MSW_DECLARE_HANDLE(HFONT);
3260 WX_MSW_DECLARE_HANDLE(HMENU);
3261 WX_MSW_DECLARE_HANDLE(HPEN);
3262 WX_MSW_DECLARE_HANDLE(HBRUSH);
3263 WX_MSW_DECLARE_HANDLE(HPALETTE);
3264 WX_MSW_DECLARE_HANDLE(HCURSOR);
3265 WX_MSW_DECLARE_HANDLE(HRGN);
3266 WX_MSW_DECLARE_HANDLE(RECTPTR);
3267 WX_MSW_DECLARE_HANDLE(HACCEL);
3268 WX_MSW_DECLARE_HANDLE(HINSTANCE);
3269 WX_MSW_DECLARE_HANDLE(HBITMAP);
3270 WX_MSW_DECLARE_HANDLE(HIMAGELIST);
3271 WX_MSW_DECLARE_HANDLE(HGLOBAL);
3272 WX_MSW_DECLARE_HANDLE(HDC);
3273 typedef WXHINSTANCE WXHMODULE;
3274
3275 #undef WX_MSW_DECLARE_HANDLE
3276
3277 typedef unsigned int WXUINT;
3278 typedef unsigned long WXDWORD;
3279 typedef unsigned short WXWORD;
3280
3281 typedef unsigned long WXCOLORREF;
3282 typedef void * WXRGNDATA;
3283 typedef struct tagMSG WXMSG;
3284 typedef void * WXHCONV;
3285 typedef void * WXHKEY;
3286 typedef void * WXHTREEITEM;
3287
3288 typedef void * WXDRAWITEMSTRUCT;
3289 typedef void * WXMEASUREITEMSTRUCT;
3290 typedef void * WXLPCREATESTRUCT;
3291
3292 #ifdef __WXMSW__
3293 typedef WXHWND WXWidget;
3294 #endif
3295
3296 #ifdef __WIN64__
3297 typedef wxUint64 WXWPARAM;
3298 typedef wxInt64 WXLPARAM;
3299 typedef wxInt64 WXLRESULT;
3300 #else
3301 typedef wxW64 unsigned int WXWPARAM;
3302 typedef wxW64 long WXLPARAM;
3303 typedef wxW64 long WXLRESULT;
3304 #endif
3305
3306 #if defined(__GNUWIN32__) || defined(__WXMICROWIN__)
3307 typedef int (*WXFARPROC)();
3308 #else
3309 typedef int (__stdcall *WXFARPROC)();
3310 #endif
3311 #endif /* __WIN32__ */
3312
3313
3314 #if defined(__OS2__)
3315 typedef unsigned long DWORD;
3316 typedef unsigned short WORD;
3317 #endif
3318
3319 #if defined(__WXPM__) || defined(__EMX__)
3320 #ifdef __WXPM__
3321 /* Stand-ins for OS/2 types, to avoid #including all of os2.h */
3322 typedef unsigned long WXHWND;
3323 typedef unsigned long WXHANDLE;
3324 typedef unsigned long WXHICON;
3325 typedef unsigned long WXHFONT;
3326 typedef unsigned long WXHMENU;
3327 typedef unsigned long WXHPEN;
3328 typedef unsigned long WXHBRUSH;
3329 typedef unsigned long WXHPALETTE;
3330 typedef unsigned long WXHCURSOR;
3331 typedef unsigned long WXHRGN;
3332 typedef unsigned long WXHACCEL;
3333 typedef unsigned long WXHINSTANCE;
3334 typedef unsigned long WXHMODULE;
3335 typedef unsigned long WXHBITMAP;
3336 typedef unsigned long WXHDC;
3337 typedef unsigned int WXUINT;
3338 typedef unsigned long WXDWORD;
3339 typedef unsigned short WXWORD;
3340
3341 typedef unsigned long WXCOLORREF;
3342 typedef void * WXMSG;
3343 typedef unsigned long WXHTREEITEM;
3344
3345 typedef void * WXDRAWITEMSTRUCT;
3346 typedef void * WXMEASUREITEMSTRUCT;
3347 typedef void * WXLPCREATESTRUCT;
3348
3349 typedef WXHWND WXWidget;
3350 #endif
3351 #ifdef __EMX__
3352 /* Need a well-known type for WXFARPROC
3353 below. MPARAM is typedef'ed too late. */
3354 #define WXWPARAM void *
3355 #define WXLPARAM void *
3356 #else
3357 #define WXWPARAM MPARAM
3358 #define WXLPARAM MPARAM
3359 #endif
3360 #define RECT RECTL
3361 #define LOGFONT FATTRS
3362 #define LOWORD SHORT1FROMMP
3363 #define HIWORD SHORT2FROMMP
3364
3365 typedef unsigned long WXMPARAM;
3366 typedef unsigned long WXMSGID;
3367 typedef void* WXRESULT;
3368 /* typedef int (*WXFARPROC)(); */
3369 /* some windows handles not defined by PM */
3370 typedef unsigned long HANDLE;
3371 typedef unsigned long HICON;
3372 typedef unsigned long HFONT;
3373 typedef unsigned long HMENU;
3374 typedef unsigned long HPEN;
3375 typedef unsigned long HBRUSH;
3376 typedef unsigned long HPALETTE;
3377 typedef unsigned long HCURSOR;
3378 typedef unsigned long HINSTANCE;
3379 typedef unsigned long HIMAGELIST;
3380 typedef unsigned long HGLOBAL;
3381 #endif /* WXPM || EMX */
3382
3383 #if defined (__WXPM__)
3384 /* WIN32 graphics types for OS/2 GPI */
3385
3386 /* RGB under OS2 is more like a PALETTEENTRY struct under Windows so we need a real RGB def */
3387 #define OS2RGB(r,g,b) ((DWORD)((unsigned char)(b) | ((unsigned char)(g) << 8)) | ((unsigned char)(r) << 16))
3388
3389 typedef unsigned long COLORREF;
3390 #define GetRValue(rgb) ((unsigned char)((rgb) >> 16))
3391 #define GetGValue(rgb) ((unsigned char)(((unsigned short)(rgb)) >> 8))
3392 #define GetBValue(rgb) ((unsigned char)(rgb))
3393 #define PALETTEINDEX(i) ((COLORREF)(0x01000000 | (DWORD)(WORD)(i)))
3394 #define PALETTERGB(r,g,b) (0x02000000 | OS2RGB(r,g,b))
3395 /* OS2's RGB/RGB2 is backwards from this */
3396 typedef struct tagPALETTEENTRY
3397 {
3398 char bRed;
3399 char bGreen;
3400 char bBlue;
3401 char bFlags;
3402 } PALETTEENTRY;
3403 typedef struct tagLOGPALETTE
3404 {
3405 WORD palVersion;
3406 WORD palNumentries;
3407 WORD PALETTEENTRY[1];
3408 } LOGPALETTE;
3409
3410 #if (defined(__VISAGECPP__) && (__IBMCPP__ < 400)) || defined (__WATCOMC__)
3411 /* VA 3.0 for some reason needs base data types when typedefing a proc proto??? */
3412 typedef void* (_System *WXFARPROC)(unsigned long, unsigned long, void*, void*);
3413 #else
3414 #if defined(__EMX__) && !defined(_System)
3415 #define _System
3416 #endif
3417 typedef WXRESULT (_System *WXFARPROC)(WXHWND, WXMSGID, WXWPARAM, WXLPARAM);
3418 #endif
3419
3420 #endif /* __WXPM__ */
3421
3422
3423 #if defined(__WXMOTIF__) || defined(__WXX11__)
3424 /* Stand-ins for X/Xt/Motif types */
3425 typedef void* WXWindow;
3426 typedef void* WXWidget;
3427 typedef void* WXAppContext;
3428 typedef void* WXColormap;
3429 typedef void* WXColor;
3430 typedef void WXDisplay;
3431 typedef void WXEvent;
3432 typedef void* WXCursor;
3433 typedef void* WXPixmap;
3434 typedef void* WXFontStructPtr;
3435 typedef void* WXGC;
3436 typedef void* WXRegion;
3437 typedef void* WXFont;
3438 typedef void* WXImage;
3439 typedef void* WXFontList;
3440 typedef void* WXFontSet;
3441 typedef void* WXRendition;
3442 typedef void* WXRenderTable;
3443 typedef void* WXFontType; /* either a XmFontList or XmRenderTable */
3444 typedef void* WXString;
3445
3446 typedef unsigned long Atom; /* this might fail on a few architectures */
3447 typedef long WXPixel; /* safety catch in src/motif/colour.cpp */
3448
3449 #endif /* Motif */
3450
3451 #ifdef __WXGTK__
3452
3453 /* Stand-ins for GLIB types */
3454 typedef struct _GSList GSList;
3455
3456 /* Stand-ins for GDK types */
3457 typedef struct _GdkColor GdkColor;
3458 typedef struct _GdkCursor GdkCursor;
3459 typedef struct _GdkDragContext GdkDragContext;
3460
3461 #if defined(__WXGTK20__)
3462 typedef struct _GdkAtom* GdkAtom;
3463 #else
3464 typedef unsigned long GdkAtom;
3465 #endif
3466
3467 #if !defined(__WXGTK3__)
3468 typedef struct _GdkColormap GdkColormap;
3469 typedef struct _GdkFont GdkFont;
3470 typedef struct _GdkGC GdkGC;
3471 typedef struct _GdkRegion GdkRegion;
3472 #endif
3473
3474 #if defined(__WXGTK3__)
3475 typedef struct _GdkWindow GdkWindow;
3476 #elif defined(__WXGTK20__)
3477 typedef struct _GdkDrawable GdkWindow;
3478 typedef struct _GdkDrawable GdkPixmap;
3479 #else
3480 typedef struct _GdkWindow GdkWindow;
3481 typedef struct _GdkWindow GdkBitmap;
3482 typedef struct _GdkWindow GdkPixmap;
3483 #endif
3484
3485 /* Stand-ins for GTK types */
3486 typedef struct _GtkWidget GtkWidget;
3487 typedef struct _GtkRcStyle GtkRcStyle;
3488 typedef struct _GtkAdjustment GtkAdjustment;
3489 typedef struct _GtkToolbar GtkToolbar;
3490 typedef struct _GtkNotebook GtkNotebook;
3491 typedef struct _GtkNotebookPage GtkNotebookPage;
3492 typedef struct _GtkAccelGroup GtkAccelGroup;
3493 typedef struct _GtkSelectionData GtkSelectionData;
3494 typedef struct _GtkTextBuffer GtkTextBuffer;
3495 typedef struct _GtkRange GtkRange;
3496 typedef struct _GtkCellRenderer GtkCellRenderer;
3497
3498 typedef GtkWidget *WXWidget;
3499
3500 #ifndef __WXGTK20__
3501 #define GTK_OBJECT_GET_CLASS(object) (GTK_OBJECT(object)->klass)
3502 #define GTK_CLASS_TYPE(klass) ((klass)->type)
3503 #endif
3504
3505 #endif /* __WXGTK__ */
3506
3507 #if defined(__WXGTK20__) || (defined(__WXX11__) && wxUSE_UNICODE)
3508 #define wxUSE_PANGO 1
3509 #else
3510 #define wxUSE_PANGO 0
3511 #endif
3512
3513 #if wxUSE_PANGO
3514 /* Stand-ins for Pango types */
3515 typedef struct _PangoContext PangoContext;
3516 typedef struct _PangoLayout PangoLayout;
3517 typedef struct _PangoFontDescription PangoFontDescription;
3518 #endif
3519
3520 #ifdef __WXDFB__
3521 /* DirectFB doesn't have the concept of non-TLW window, so use
3522 something arbitrary */
3523 typedef const void* WXWidget;
3524 #endif /* DFB */
3525
3526 /* This is required because of clashing macros in windows.h, which may be */
3527 /* included before or after wxWidgets classes, and therefore must be */
3528 /* disabled here before any significant wxWidgets headers are included. */
3529 #ifdef __cplusplus
3530 #ifdef __WINDOWS__
3531 #include "wx/msw/winundef.h"
3532 #endif /* __WINDOWS__ */
3533 #endif /* __cplusplus */
3534
3535
3536 /* include the feature test macros */
3537 #include "wx/features.h"
3538
3539 /* --------------------------------------------------------------------------- */
3540 /* macros to define a class without copy ctor nor assignment operator */
3541 /* --------------------------------------------------------------------------- */
3542
3543 #define wxDECLARE_NO_COPY_CLASS(classname) \
3544 private: \
3545 classname(const classname&); \
3546 classname& operator=(const classname&)
3547
3548 #define wxDECLARE_NO_COPY_TEMPLATE_CLASS(classname, arg) \
3549 private: \
3550 classname(const classname<arg>&); \
3551 classname& operator=(const classname<arg>&)
3552
3553 #define wxDECLARE_NO_COPY_TEMPLATE_CLASS_2(classname, arg1, arg2) \
3554 private: \
3555 classname(const classname<arg1, arg2>&); \
3556 classname& operator=(const classname<arg1, arg2>&)
3557
3558 #define wxDECLARE_NO_ASSIGN_CLASS(classname) \
3559 private: \
3560 classname& operator=(const classname&)
3561
3562 /* deprecated variants _not_ requiring a semicolon after them */
3563 #define DECLARE_NO_COPY_CLASS(classname) \
3564 wxDECLARE_NO_COPY_CLASS(classname);
3565 #define DECLARE_NO_COPY_TEMPLATE_CLASS(classname, arg) \
3566 wxDECLARE_NO_COPY_TEMPLATE_CLASS(classname, arg);
3567 #define DECLARE_NO_ASSIGN_CLASS(classname) \
3568 wxDECLARE_NO_ASSIGN_CLASS(classname);
3569
3570 /* --------------------------------------------------------------------------- */
3571 /* If a manifest is being automatically generated, add common controls 6 to it */
3572 /* --------------------------------------------------------------------------- */
3573
3574 #if wxUSE_GUI && \
3575 (!defined wxUSE_NO_MANIFEST || wxUSE_NO_MANIFEST == 0 ) && \
3576 ( defined _MSC_FULL_VER && _MSC_FULL_VER >= 140040130 )
3577
3578 #define WX_CC_MANIFEST(cpu) \
3579 "/manifestdependency:\"type='win32' \
3580 name='Microsoft.Windows.Common-Controls' \
3581 version='6.0.0.0' \
3582 processorArchitecture='" cpu "' \
3583 publicKeyToken='6595b64144ccf1df' \
3584 language='*'\""
3585
3586 #if defined _M_IX86
3587 #pragma comment(linker, WX_CC_MANIFEST("x86"))
3588 #elif defined _M_X64
3589 #pragma comment(linker, WX_CC_MANIFEST("amd64"))
3590 #elif defined _M_IA64
3591 #pragma comment(linker, WX_CC_MANIFEST("ia64"))
3592 #else
3593 #pragma comment(linker, WX_CC_MANIFEST("*"))
3594 #endif
3595
3596 #endif /* !wxUSE_NO_MANIFEST && _MSC_FULL_VER >= 140040130 */
3597
3598 /* wxThread and wxProcess priorities */
3599 enum
3600 {
3601 wxPRIORITY_MIN = 0u, /* lowest possible priority */
3602 wxPRIORITY_DEFAULT = 50u, /* normal priority */
3603 wxPRIORITY_MAX = 100u /* highest possible priority */
3604 };
3605
3606 #endif
3607 /* _WX_DEFS_H_ */
3608