X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/e84c7178fe172e4c008b1d7633c6eb1bb2256675..9c54e4ae1f401a9c337b97b588e5a356d79cbe82:/include/wx/defs.h diff --git a/include/wx/defs.h b/include/wx/defs.h index 19c363d5aa..d4c2f50058 100644 --- a/include/wx/defs.h +++ b/include/wx/defs.h @@ -16,6 +16,10 @@ #pragma interface "defs.h" #endif +#ifndef __cplusplus + #error "This header is for C++ code only" +#endif + // ---------------------------------------------------------------------------- // compiler and OS identification // ---------------------------------------------------------------------------- @@ -350,165 +354,8 @@ typedef int wxWindowID; // compatibility :-( #define CMPFUNC_CONV wxCMPFUNC_CONV -// ---------------------------------------------------------------------------- -// Making or using wxWindows as a Windows DLL -// ---------------------------------------------------------------------------- - -#if defined(__WXMSW__) - // __declspec works in BC++ 5 and later, Watcom C++ 11.0 and later as well - // as VC++ and gcc - #if defined(__VISUALC__) || defined(__BORLANDC__) || defined(__GNUC__) || defined(__WATCOMC__) - #define WXEXPORT __declspec(dllexport) - #define WXIMPORT __declspec(dllimport) - #else // compiler doesn't support __declspec() - #define WXEXPORT - #define WXIMPORT - #endif -#elif defined(__WXPM__) - #if defined (__WATCOMC__) - #define WXEXPORT __declspec(dllexport) - // __declspec(dllimport) prepends __imp to imported symbols. We do NOT - // want that! - #define WXIMPORT - #elif (!(defined(__VISAGECPP__) && (__IBMCPP__ < 400 || __IBMC__ < 400 ))) - #define WXEXPORT _Export - #define WXIMPORT _Export - #endif -#elif defined(__WXMAC__) || defined(__WXCOCOA__) - #ifdef __MWERKS__ - #define WXEXPORT __declspec(export) - #define WXIMPORT __declspec(import) - #endif -#endif - -// for other platforms/compilers we don't anything -#ifndef WXEXPORT - #define WXEXPORT - #define WXIMPORT -#endif - -/* - We support building wxWindows as a set of several libraries but we don't - support arbitrary combinations of libs/DLLs: either we build all of them as - DLLs (in which case WXMAKINGDLL is defined) or none (it isn't). - - However we have a problem because we need separate WXDLLEXPORT versions for - different libraries as, for example, wxString class should be dllexported - when compiled in wxBase and dllimported otherwise, so we do define separate - WXMAKING/USINGDLL_XYZ constants for each component XYZ. - */ -#ifdef WXMAKINGDLL - #if wxUSE_BASE - #define WXMAKINGDLL_BASE - #endif - - #define WXMAKINGDLL_NET - #define WXMAKINGDLL_CORE - #define WXMAKINGDLL_ADV - #define WXMAKINGDLL_ODBC - #define WXMAKINGDLL_DBGRID - #define WXMAKINGDLL_HTML - #define WXMAKINGDLL_XML -#endif // WXMAKINGDLL - -// WXDLLEXPORT maps to export declaration when building the DLL, to import -// declaration if using it or to nothing at all if we don't use wxWin as DLL -#ifdef WXMAKINGDLL_BASE - #define WXDLLIMPEXP_BASE WXEXPORT - #define WXDLLIMPEXP_DATA_BASE(type) WXEXPORT type -#elif defined(WXUSINGDLL) - #define WXDLLIMPEXP_BASE WXIMPORT - #define WXDLLIMPEXP_DATA_BASE(type) WXIMPORT type -#else // not making nor using DLL - #define WXDLLIMPEXP_BASE - #define WXDLLIMPEXP_DATA_BASE(type) type -#endif - -#ifdef WXMAKINGDLL_NET - #define WXDLLIMPEXP_NET WXEXPORT - #define WXDLLIMPEXP_DATA_NET(type) WXEXPORT type -#elif defined(WXUSINGDLL) - #define WXDLLIMPEXP_NET WXIMPORT - #define WXDLLIMPEXP_DATA_NET(type) WXIMPORT type -#else // not making nor using DLL - #define WXDLLIMPEXP_NET - #define WXDLLIMPEXP_DATA_NET(type) type -#endif - -#ifdef WXMAKINGDLL_CORE - #define WXDLLIMPEXP_CORE WXEXPORT - #define WXDLLIMPEXP_DATA_CORE(type) WXEXPORT type -#elif defined(WXUSINGDLL) - #define WXDLLIMPEXP_CORE WXIMPORT - #define WXDLLIMPEXP_DATA_CORE(type) WXIMPORT type -#else // not making nor using DLL - #define WXDLLIMPEXP_CORE - #define WXDLLIMPEXP_DATA_CORE(type) type -#endif - -#ifdef WXMAKINGDLL_ADV - #define WXDLLIMPEXP_ADV WXEXPORT - #define WXDLLIMPEXP_DATA_ADV(type) WXEXPORT type -#elif defined(WXUSINGDLL) - #define WXDLLIMPEXP_ADV WXIMPORT - #define WXDLLIMPEXP_DATA_ADV(type) WXIMPORT type -#else // not making nor using DLL - #define WXDLLIMPEXP_ADV - #define WXDLLIMPEXP_DATA_ADV(type) type -#endif - -#ifdef WXMAKINGDLL_ODBC - #define WXDLLIMPEXP_ODBC WXEXPORT - #define WXDLLIMPEXP_DATA_ODBC(type) WXEXPORT type -#elif defined(WXUSINGDLL) - #define WXDLLIMPEXP_ODBC WXIMPORT - #define WXDLLIMPEXP_DATA_ODBC(type) WXIMPORT type -#else // not making nor using DLL - #define WXDLLIMPEXP_ODBC - #define WXDLLIMPEXP_DATA_ODBC(type) type -#endif - -#ifdef WXMAKINGDLL_DBGRID - #define WXDLLIMPEXP_DBGRID WXEXPORT - #define WXDLLIMPEXP_DATA_DBGRID(type) WXEXPORT type -#elif defined(WXUSINGDLL) - #define WXDLLIMPEXP_DBGRID WXIMPORT - #define WXDLLIMPEXP_DATA_DBGRID(type) WXIMPORT type -#else // not making nor using DLL - #define WXDLLIMPEXP_DBGRID - #define WXDLLIMPEXP_DATA_DBGRID(type) type -#endif - -#ifdef WXMAKINGDLL_HTML - #define WXDLLIMPEXP_HTML WXEXPORT - #define WXDLLIMPEXP_DATA_HTML(type) WXEXPORT type -#elif defined(WXUSINGDLL) - #define WXDLLIMPEXP_HTML WXIMPORT - #define WXDLLIMPEXP_DATA_HTML(type) WXIMPORT type -#else // not making nor using DLL - #define WXDLLIMPEXP_HTML - #define WXDLLIMPEXP_DATA_HTML(type) type -#endif - -#ifdef WXMAKINGDLL_GL - #define WXDLLIMPEXP_GL WXEXPORT -#elif defined(WXUSINGDLL) - #define WXDLLIMPEXP_GL WXIMPORT -#else // not making nor using DLL - #define WXDLLIMPEXP_GL -#endif - -#ifdef WXMAKINGDLL_XML - #define WXDLLIMPEXP_XML WXEXPORT -#elif defined(WXUSINGDLL) - #define WXDLLIMPEXP_XML WXIMPORT -#else // not making nor using DLL - #define WXDLLIMPEXP_XML -#endif - -// for backwards compatibility, define suffix-less versions too -#define WXDLLEXPORT WXDLLIMPEXP_CORE -#define WXDLLEXPORT_DATA WXDLLIMPEXP_DATA_CORE +// DLL import/export declarations +#include "wx/dlimpexp.h" // ---------------------------------------------------------------------------- // Very common macros @@ -545,29 +392,13 @@ typedef int wxWindowID; #endif // everybody gets the assert and other debug macros -#ifdef __cplusplus #include "wx/debug.h" -#endif // 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) #include -// Macro to cut down on compiler warnings. -#if REMOVE_UNUSED_ARG - #define WXUNUSED(identifier) /* identifier */ -#else // stupid, broken compiler - #define WXUNUSED(identifier) identifier -#endif - -// some arguments are only used in debug mode, but unused in release one -#ifdef __WXDEBUG__ - #define WXUNUSED_UNLESS_DEBUG(param) param -#else - #define WXUNUSED_UNLESS_DEBUG(param) WXUNUSED(param) -#endif - // delete pointer if it is not NULL and NULL it afterwards // (checking that it's !NULL before passing it to delete is just a // a question of style, because delete will do it itself anyhow, but it might @@ -596,6 +427,43 @@ typedef int wxWindowID; // integer on success as failure indicator #define wxNOT_FOUND (-1) +// ---------------------------------------------------------------------------- +// macros to avoid compiler warnings +// ---------------------------------------------------------------------------- + +// Macro to cut down on compiler warnings. +#if 1 // there should be no more any compilers needing the "#else" version + #define WXUNUSED(identifier) /* identifier */ +#else // stupid, broken compiler + #define WXUNUSED(identifier) identifier +#endif + +// some arguments are only used in debug mode, but unused in release one +#ifdef __WXDEBUG__ + #define WXUNUSED_UNLESS_DEBUG(param) param +#else + #define WXUNUSED_UNLESS_DEBUG(param) WXUNUSED(param) +#endif + +// some compilers give warning about a possibly unused variable if it is +// initialized in both branches of if/else and shut up if it is initialized +// when declared, but other compilers then give warnings about unused variable +// value -- this should satisfy both of them +#if defined(__VISUALC__) + #define wxDUMMY_INITIALIZE(val) = val +#else + #define wxDUMMY_INITIALIZE(val) +#endif + +// sometimes the value of a variable is *really* not used, to suppress the +// resulting warning you may pass it to this function +#ifdef __BORLANDC__ +#define wxUnusedVar(identifier) identifier +#else +template +inline void wxUnusedVar(const T& WXUNUSED(t)) { } +#endif + // ---------------------------------------------------------------------------- // compiler specific settings // ---------------------------------------------------------------------------- @@ -619,6 +487,10 @@ typedef int wxWindowID; #define except(x) catch(...) #endif // Metrowerks +#if defined(__WATCOMC__) + typedef short mode_t; +#endif + // where should i put this? we need to make sure of this as it breaks // the code. #if !wxUSE_IOSTREAMH && defined(__WXDEBUG__) @@ -810,6 +682,9 @@ typedef wxUint16 wxWord; typedef int wxInt32; typedef unsigned int wxUint32; + #if defined(__MACH__) && !defined(SIZEOF_WCHAR_T) + #define SIZEOF_WCHAR_T 4 + #endif #if wxUSE_WCHAR_T && !defined(SIZEOF_WCHAR_T) // also assume that sizeof(wchar_t) == 2 (under Unix the most // common case is 4 but there configure would have defined @@ -843,7 +718,7 @@ typedef wxUint32 wxDword; #define wxLongLongSuffix l #define wxLongLongFmtSpec _T("l") #define wxLongLongIsLong -#elif (defined(__VISUALC__) && defined(__WIN32__)) || defined( __VMS__ ) +#elif (defined(__VISUALC__) && defined(__WIN32__)) #define wxLongLong_t __int64 #define wxLongLongSuffix i64 #define wxLongLongFmtSpec _T("I64") @@ -855,6 +730,10 @@ typedef wxUint32 wxDword; #define wxLongLong_t __int64 #define wxLongLongSuffix i64 #define wxLongLongFmtSpec _T("Ld") +#elif defined(__DIGITALMARS__) + #define wxLongLong_t __int64 + #define wxLongLongSuffix LL + #define wxLongLongFmtSpec _T("ll") #elif (defined(SIZEOF_LONG_LONG) && SIZEOF_LONG_LONG >= 8) || \ defined(__MINGW32__) || \ defined(__GNUC__) || \ @@ -1215,9 +1094,15 @@ enum wxBorder // mouse is clicked outside of it or if it loses focus in any other way #define wxPOPUP_WINDOW 0x00020000 +// force a full repaint when the window is resized (instead of repainting just +// the invalidated area) +#define wxFULL_REPAINT_ON_RESIZE 0x00010000 + +// obsolete: now this is the default behaviour +// // don't invalidate the whole window (resulting in a PAINT event) when the // window is resized (currently, makes sense for wxMSW only) -#define wxNO_FULL_REPAINT_ON_RESIZE 0x00010000 +#define wxNO_FULL_REPAINT_ON_RESIZE 0 /* * Extra window style flags (use wxWS_EX prefix to make it clear that they