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