X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/a047aff270905b377a81657a90f92eb3297157d0..28dd9a9d035b5435897d626d1b57b4308daa0371:/include/wx/defs.h?ds=sidebyside diff --git a/include/wx/defs.h b/include/wx/defs.h index 43c15e50f3..24ec7619bb 100644 --- a/include/wx/defs.h +++ b/include/wx/defs.h @@ -71,6 +71,12 @@ # pragma warning(disable:4512) /* operator=() couldn't be generated */ # pragma warning(disable:4710) /* function not inlined */ + /* There are too many false positivies for this one, particularly when + using templates like wxVector */ + /* class 'foo' needs to have dll-interface to be used by clients of + class 'bar'" */ +# pragma warning(disable:4251) + /* For VC++ 5.0 for release mode, the warning 'C4702: unreachable code */ /* is buggy, and occurs for code that does actually get executed */ # if !defined __WXDEBUG__ && __VISUALC__ <= 1100 @@ -83,11 +89,24 @@ # pragma warning(disable:4003) /* not enough actual parameters for macro */ # endif + /* + When compiling with VC++ 7 /Wp64 option we get thousands of warnings for + conversion from size_t to int or long. Some precious few of them might + be worth looking into but unfortunately it seems infeasible to fix all + the other, harmless ones (e.g. inserting static_cast(s.length()) + everywhere this method is used though we are quite sure that using >4GB + strings is a bad idea anyhow) so just disable it globally for now. + */ + #if wxCHECK_VISUALC_VERSION(7) + /* conversion from 'size_t' to 'unsigned long', possible loss of data */ + #pragma warning(disable:4267) + #endif /* VC++ 7 or later */ + /* VC++ 8 gives a warning when using standard functions such as sprintf, localtime, ... -- stop this madness, unless the user had already done it */ - #if __VISUALC__ >= 1400 + #if wxCHECK_VISUALC_VERSION(8) #ifndef _CRT_SECURE_NO_DEPRECATE #define _CRT_SECURE_NO_DEPRECATE 1 #endif @@ -97,15 +116,6 @@ #endif /* VC++ 8 */ #endif /* __VISUALC__ */ -/* suppress some Salford C++ warnings */ -#ifdef __SALFORDC__ -# pragma suppress 353 /* Possible nested comments */ -# pragma suppress 593 /* Define not used */ -# pragma suppress 61 /* enum has no name (doesn't suppress!) */ -# pragma suppress 106 /* unnamed, unused parameter */ -# pragma suppress 571 /* Virtual function hiding */ -#endif /* __SALFORDC__ */ - /* suppress some Borland C++ warnings */ #ifdef __BORLANDC__ # pragma warn -inl /* Functions containing reserved words and certain constructs are not expanded inline */ @@ -198,6 +208,9 @@ #define false ((bool)0) #endif #define HAVE_BOOL + #elif defined(__WXPALMOS__) + /* Palm OS supports bool */ + #define HAVE_BOOL #endif /* compilers */ #endif /* HAVE_BOOL */ @@ -233,12 +246,6 @@ typedef short int WXTYPE; -/* special care should be taken with this type under Windows where the real */ -/* window id is unsigned, so we must always do the cast before comparing them */ -/* (or else they would be always different!). Using wxGetWindowId() which does */ -/* the cast itself is recommended. Note that this type can't be unsigned */ -/* because wxID_ANY == -1 is a valid (and largely used) value for window id. */ -typedef int wxWindowID; /* ---------------------------------------------------------------------------- */ /* other feature tests */ @@ -443,6 +450,28 @@ typedef int wxWindowID; #endif /* HAVE_VARIADIC_MACROS */ +#ifndef HAVE_WOSTREAM + // Mingw <=3.4 doesn't have std::wostream + #if !defined(__MINGW32__) || wxCHECK_GCC_VERSION(4,0) + #define HAVE_WOSTREAM + #endif +#endif /* HAVE_WOSTREAM */ + +// ---------------------------------------------------------------------------- +// other C++ features +// ---------------------------------------------------------------------------- + +#ifndef HAVE_PARTIAL_SPECIALIZATION + // be optimistic by default + #define HAVE_PARTIAL_SPECIALIZATION +#endif + +#ifdef __VISUALC__ + #if __VISUALC__ < 1310 + #undef HAVE_PARTIAL_SPECIALIZATION + #endif +#endif // __VISUALC__ + /* ---------------------------------------------------------------------------- */ /* portable calling conventions macros */ /* ---------------------------------------------------------------------------- */ @@ -516,13 +545,23 @@ typedef int wxWindowID; /* Macro to issue warning when using deprecated functions with gcc3 or MSVC7: */ #if wxCHECK_GCC_VERSION(3, 1) - #define wxDEPRECATED(x) x __attribute__ ((deprecated)) + #define wxDEPRECATED(x) __attribute__((deprecated)) x #elif defined(__VISUALC__) && (__VISUALC__ >= 1300) #define wxDEPRECATED(x) __declspec(deprecated) x #else #define wxDEPRECATED(x) x #endif +/* + Macro which marks the function as being deprecated but also defines it + inline. + + Currently it's defined in the same trivial way in all cases but it could + need a special definition with some other compilers in the future which + explains why do we have it. + */ +#define wxDEPRECATED_INLINE(func, body) wxDEPRECATED(func) { body } + /* Special variant of the macro above which should be used for the functions which are deprecated but called by wx itself: this often happens with @@ -540,7 +579,7 @@ typedef int wxWindowID; /* NULL declaration: it must be defined as 0 for C++ programs (in particular, */ /* it must not be defined as "(void *)0" which is standard for C but completely */ /* breaks C++ code) */ -#ifndef __HANDHELDPC__ +#if !defined(__HANDHELDPC__) && !defined(__PALMOS__) #include #endif @@ -728,7 +767,9 @@ enum { wxDefaultCoord = -1 }; /* ---------------------------------------------------------------------------- */ #if defined(__WXPALMOS__) || defined(__MINGW32__) + #if !defined(__MWERKS__) #include + #endif #endif /* chars are always one byte (by definition), shorts are always two (in */ @@ -784,7 +825,9 @@ typedef wxUint16 wxWord; #define SIZEOF_LONG 4 #define SIZEOF_WCHAR_T 2 #define SIZEOF_SIZE_T 4 - #define wxSIZE_T_IS_UINT + #ifdef __WXPALMOS6__ + #define wxSIZE_T_IS_UINT + #endif #define SIZEOF_VOID_P 4 #define SIZEOF_SIZE_T 4 #elif defined(__WINDOWS__) @@ -913,18 +956,28 @@ typedef wxUint32 wxDword; #define wxINT64_MIN LLONG_MIN #else #define wxINT64_MAX wxLL(9223372036854775807) - #define wxINT64_MIN wxLL(-9223372036854775807-1) + #define wxINT64_MIN (wxLL(-9223372036854775807)-1) #endif /* Define an integral type big enough to contain all of long, size_t and void *. */ -#if SIZEOF_LONG >= SIZEOF_VOID_P && SIZEOF_LONG >= SIZEOF_SIZE_T - /* normal case */ - typedef unsigned long wxUIntPtr; -#elif SIZEOF_SIZE_T >= SIZEOF_VOID_P - /* Win64 case */ +#if SIZEOF_SIZE_T >= SIZEOF_VOID_P + /* + Win64 case: size_t is the only integral type big enough for "void *". + + Notice that wxUIntPtr should be also defined as size_t when building + under Win32 with MSVC with /Wp64 option as otherwise any conversion + between ints and pointers results in a warning 4311 or 4312, even if it + is safe under Win32. Using size_t (declared with __w64) allows to avoid + them. + */ typedef size_t wxUIntPtr; +#elif SIZEOF_LONG >= SIZEOF_VOID_P + /* + Normal case when long is the largest integral type. + */ + typedef unsigned long wxUIntPtr; #else /* This should never happen for the current architectures but if you're @@ -1035,7 +1088,11 @@ inline void *wxUIntToPtr(wxUIntPtr p) #error "See the documentation on the 'longlong' pragma." #endif #elif defined(__WXPALMOS__) - #define wxLongLong_t int64_t + #if defined(__WXPALMOS6__) + #define wxLongLong_t int64_t + #else + #define wxLongLong_t long long + #endif /* __WXPALMOS6__ */ #define wxLongLongSuffix ll #define wxLongLongFmtSpec _T("ll") #elif defined(__VISAGECPP__) && __IBMCPP__ >= 400 @@ -1059,7 +1116,11 @@ inline void *wxUIntToPtr(wxUIntPtr p) #ifdef wxLongLong_t #ifdef __WXPALMOS__ + #if defined(__WXPALMOS6__) #define wxULongLong_t uint64_t + #else + #define wxULongLong_t unsigned long long + #endif /* __WXPALMOS6__ */ #else #define wxULongLong_t unsigned wxLongLong_t #endif @@ -1407,7 +1468,7 @@ enum wxBorder wxBORDER_RAISED = 0x04000000, wxBORDER_SUNKEN = 0x08000000, wxBORDER_DOUBLE = 0x10000000, /* deprecated */ - wxBORDER_THEME = 0x10000000, + wxBORDER_THEME = wxBORDER_DOUBLE, /* a mask to extract border style from the combination of flags */ wxBORDER_MASK = 0x1f200000 @@ -1728,7 +1789,8 @@ enum wxBackgroundStyle { wxBG_STYLE_SYSTEM, wxBG_STYLE_COLOUR, - wxBG_STYLE_CUSTOM + wxBG_STYLE_CUSTOM, + wxBG_STYLE_TRANSPARENT }; /* @@ -1748,6 +1810,24 @@ enum wxKeyType /* Standard menu IDs */ enum { + /* + These ids delimit the range used by automatically-generated ids + (i.e. those used when wxID_ANY is specified during construction). + */ +#if defined(__WXMSW__) || wxUSE_AUTOID_MANAGEMENT + /* + On MSW the range is always restricted no matter if id management + is used or not because the native window ids are limited to short + range. On other platforms the range is only restricted if id + management is used so the reference count buffer won't be so big. + */ + wxID_AUTO_LOWEST = -32000, + wxID_AUTO_HIGHEST = -2000, +#else + wxID_AUTO_LOWEST = -1000000, + wxID_AUTO_HIGHEST = -2000, +#endif + /* no id matches this one when compared to it */ wxID_NONE = -3, @@ -1875,10 +1955,26 @@ enum /* IDs used by generic file dialog (13 consecutive starting from this value) */ wxID_FILEDLGG = 5900, + + /* IDs used by generic file ctrl (4 consecutive starting from this value) */ + wxID_FILECTRL = 5950, wxID_HIGHEST = 5999 }; +/* ---------------------------------------------------------------------------- */ +/* wxWindowID type (after wxID_XYZ enum, platform detection, and dlimpexp.h) */ +/* ---------------------------------------------------------------------------- */ + +/* special care should be taken with this type under Windows where the real */ +/* window id is unsigned, so we must always do the cast before comparing them */ +/* (or else they would be always different!). Using wxGetWindowId() which does */ +/* the cast itself is recommended. Note that this type can't be unsigned */ +/* because wxID_ANY == -1 is a valid (and largely used) value for window id. */ +#ifdef __cplusplus + #include "wx/windowid.h" +#endif + /* ---------------------------------------------------------------------------- */ /* other constants */ /* ---------------------------------------------------------------------------- */ @@ -2466,11 +2562,8 @@ enum wxUpdateUI #define WX_OPAQUE_TYPE( name ) struct wxOpaque##name -typedef unsigned char WXCOLORREF[6]; -typedef void* WXCGIMAGEREF; typedef void* WXHBITMAP; typedef void* WXHCURSOR; -typedef void* WXHRGN; typedef void* WXRECTPTR; typedef void* WXPOINTPTR; typedef void* WXHWND; @@ -2478,54 +2571,57 @@ typedef void* WXEVENTREF; typedef void* WXEVENTHANDLERREF; typedef void* WXEVENTHANDLERCALLREF; typedef void* WXAPPLEEVENTREF; -typedef void* WXHDC; typedef void* WXHMENU; + typedef unsigned int WXUINT; typedef unsigned long WXDWORD; typedef unsigned short WXWORD; -typedef WX_OPAQUE_TYPE(CIconHandle ) * WXHICON ; typedef WX_OPAQUE_TYPE(PicHandle ) * WXHMETAFILE ; - - -/* typedef void* WXWidget; */ -/* typedef void* WXWindow; */ typedef WX_OPAQUE_TYPE(ControlRef ) * WXWidget ; typedef WX_OPAQUE_TYPE(WindowRef) * WXWindow ; + typedef void* WXDisplay; -/* typedef WindowPtr WXHWND; */ -/* typedef Handle WXHANDLE; */ -/* typedef CIconHandle WXHICON; */ -/* typedef unsigned long WXHFONT; */ -/* typedef MenuHandle WXHMENU; */ -/* typedef unsigned long WXHPEN; */ -/* typedef unsigned long WXHBRUSH; */ -/* typedef unsigned long WXHPALETTE; */ -/* typedef CursHandle WXHCURSOR; */ -/* typedef RgnHandle WXHRGN; */ -/* typedef unsigned long WXHACCEL; */ -/* typedef unsigned long WXHINSTANCE; */ -/* typedef unsigned long WXHIMAGELIST; */ -/* typedef unsigned long WXHGLOBAL; */ -/* typedef GrafPtr WXHDC; */ -/* typedef unsigned int WXWPARAM; */ -/* typedef long WXLPARAM; */ -/* typedef void * WXRGNDATA; */ -/* typedef void * WXMSG; */ -/* typedef unsigned long WXHCONV; */ -/* typedef unsigned long WXHKEY; */ -/* typedef void * WXDRAWITEMSTRUCT; */ -/* typedef void * WXMEASUREITEMSTRUCT; */ -/* typedef void * WXLPCREATESTRUCT; */ -/* typedef int (*WXFARPROC)(); */ - -/* typedef WindowPtr WXWindow; */ -/* typedef ControlHandle WXWidget; */ - -#endif - -#ifdef __WXCOCOA__ +/* + * core frameworks + */ + +typedef const void * CFTypeRef; + +typedef const struct __CFString * CFStringRef; +typedef struct __CFString * CFMutableStringRef; + +typedef struct __CFRunLoopSource * CFRunLoopSourceRef; + +#define DECLARE_WXMAC_OPAQUE_CGREF( name ) typedef struct name* name##Ref; + +DECLARE_WXMAC_OPAQUE_CGREF( CGColor ) +DECLARE_WXMAC_OPAQUE_CGREF( CGImage ) +DECLARE_WXMAC_OPAQUE_CGREF( CGContext ) + +typedef CGColorRef WXCOLORREF; +typedef CGImageRef WXCGIMAGEREF; +typedef CGContextRef WXHDC; + +/* + * carbon + */ + +typedef const struct __HIShape * HIShapeRef; +typedef struct __HIShape * HIMutableShapeRef; + +#define DECLARE_WXMAC_OPAQUE_REF( name ) typedef struct Opaque##name* name; + +DECLARE_WXMAC_OPAQUE_REF( PasteboardRef ) +DECLARE_WXMAC_OPAQUE_REF( IconRef ) + +typedef IconRef WXHICON ; +typedef HIShapeRef WXHRGN; + +#endif + +#if defined( __WXCOCOA__ ) || defined(__WXMAC__) /* Definitions of 32-bit/64-bit types * These are typedef'd exactly the same way in newer OS X headers so @@ -2539,9 +2635,9 @@ typedef void* WXDisplay; * since they are unlikely to be needed in a public header. */ #if defined(__LP64__) && __LP64__ - typedef double CGFloat; + typedef double CGFloat; #else - typedef float CGFloat; + typedef float CGFloat; #endif #if (defined(__LP64__) && __LP64__) || (defined(NS_BUILD_32_LIKE_64) && NS_BUILD_32_LIKE_64) @@ -2620,8 +2716,14 @@ DECLARE_WXCOCOA_OBJC_CLASS(NSTextStorage); DECLARE_WXCOCOA_OBJC_CLASS(NSThread); DECLARE_WXCOCOA_OBJC_CLASS(NSWindow); DECLARE_WXCOCOA_OBJC_CLASS(NSView); +#ifdef __WXMAC__ +// things added for __WXMAC__ +DECLARE_WXCOCOA_OBJC_CLASS(NSString); +#else +// things only for __WXCOCOA__ typedef WX_NSView WXWidget; /* wxWidgets BASE definition */ -#endif /* __WXCOCOA__ */ +#endif +#endif /* __WXCOCOA__ || ( __WXMAC__ &__DARWIN__)*/ #if defined(__WXPALMOS__) @@ -2945,35 +3047,8 @@ typedef const void* WXWidget; /* included before or after wxWidgets classes, and therefore must be */ /* disabled here before any significant wxWidgets headers are included. */ #ifdef __WXMSW__ -#ifdef GetClassInfo -#undef GetClassInfo -#endif - -#ifdef GetClassName -#undef GetClassName -#endif - -#ifdef DrawText -#undef DrawText -#endif - -#ifdef GetCharWidth -#undef GetCharWidth -#endif - -#ifdef StartDoc -#undef StartDoc -#endif - -#ifdef FindWindow -#undef FindWindow -#endif - -#ifdef FindResource -#undef FindResource -#endif -#endif - /* __WXMSW__ */ +#include "wx/msw/winundef.h" +#endif /* __WXMSW__ */ /* include the feature test macros */