X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/3ca6a5f04692678cd2d9f3ea0843fc3f5a0b254f..bedaf53eaf4e2a860b34d4ff5e0b1928ce8fa5c9:/include/wx/defs.h diff --git a/include/wx/defs.h b/include/wx/defs.h index cf69eb5312..96eac20814 100644 --- a/include/wx/defs.h +++ b/include/wx/defs.h @@ -20,6 +20,50 @@ // compiler and OS identification // ---------------------------------------------------------------------------- +// first define Windows symbols if they're not defined on the command line: we +// can autodetect everything we need if _WIN32 is defined +#if defined(_WIN32) || defined(WIN32) || defined(__NT__) + #ifndef __WXMSW__ + #define __WXMSW__ + #endif + + #ifndef __WIN32__ + #define __WIN32__ + #endif + + // Win95 means Win95-style UI, i.e. Win9x/NT 4+ + #if !defined(__WIN95__) && defined(WINVER) && (WINVER >= 0x0400) + #define __WIN95__ + #endif +#endif // Win32 + +#ifdef __WXWINE__ + #ifndef __WIN32__ + #define __WIN32__ + #endif + #ifndef __WIN95__ + #define __WIN95__ + #endif + #ifndef STRICT + #define STRICT + #endif +#endif // WINE + +#if defined(TWIN32) && !defined(__TWIN32__) + #define __TWIN32__ +#endif // Twin32 + +#include "wx/setup.h" + +// just in case they were defined in setup.h +#ifdef PACKAGE +#undef PACKAGE +#endif + +#ifdef VERSION +#undef VERSION +#endif + // OS: first test for generic Unix defines, then for particular flavours and // finally for Unix-like systems #if defined(__UNIX__) || defined(__unix) || defined(__unix__) || \ @@ -52,8 +96,50 @@ #define OS2EMX_PLAIN_CHAR #endif -#elif defined(applec) || defined(THINK_C) || ( defined( __MWERKS__ ) && !defined(__INTEL__) ) - // MacOS + // define __HPUX__ for HP-UX where standard macro is __hpux + #if defined(__hpux) && !defined(__HPUX__) + #define __HPUX__ + #endif // HP-UX + + #if defined(__APPLE__) + // MacOS X + #ifndef __WXMAC__ + #define __WXMAC__ + #endif + #ifndef __WXMAC_X__ + // This define really should not be necessary since __WXMAC__ + // combined with __UNIX__ is sufficient to differentiate + // Classic Mac OS from Mac OS X. However, some code has been + // added to workaround defects(?) in the bundled gcc compiler + // and these corrections are identified by __WXMAC_X__ + #define __WXMAC_X__ + #endif + + #define PM_USE_SESSION_APIS 0 + #include + #endif // __APPLE__ +#elif defined(applec) || \ + defined(THINK_C) || \ + (defined(__MWERKS__) && !defined(__INTEL__)) + // MacOS +#elif defined(__WXMAC__) && defined(__APPLE__) + // MacOS X + #define __UNIX_LIKE__ + + #ifndef __WXMAC__ + #define __WXMAC__ + #endif + #ifndef __WXMAC_X__ + // This define really should not be necessary since __WXMAC__ + // combined with __UNIX__ is sufficient to differentiate + // Classic Mac OS from Mac OS X. However, some code has been + // added to workaround defects(?) in the bundled gcc compiler + // and these corrections are identified by __WXMAC_X__ + #define __WXMAC_X__ + #endif + + #define PM_USE_SESSION_APIS 0 + #include #elif defined(__OS2__) #if defined(__IBMCPP__) #define __VISAGEAVER__ __IBMCPP__ @@ -75,6 +161,11 @@ #define __WINDOWS__ #endif // Windows + // to be changed for Win64! + #ifndef __WIN32__ + #define __WIN16__ + #endif + // define another standard symbol for Microsoft Visual C++: the standard one // (_MSC_VER) is also defined by Metrowerks compiler #if defined(_MSC_VER) && !defined(__MWERKS__) @@ -82,12 +173,17 @@ #elif defined(__BCPLUSPLUS__) && !defined(__BORLANDC__) #define __BORLANDC__ #elif defined(__WATCOMC__) - //#define __WATCOMC__ #elif defined(__SC__) #define __SYMANTECC__ #endif // compiler #endif // OS +// if we're on a Unix system but didn't use configure (so that setup.h didn't +// define __UNIX__), do define __UNIX__ now +#if !defined(__UNIX__) && defined(__UNIX_LIKE__) + #define __UNIX__ +#endif // Unix + // LINKAGEMODE mode is empty for everyting except OS/2 #ifndef LINKAGEMODE #define LINKAGEMODE @@ -111,6 +207,12 @@ #endif #endif // __VISUALC__ +// suppress some Watcom C++ warnings +#ifdef __WATCOMC__ +# pragma warning 849 9 // Disable 'virtual function hidden' +# pragma warning 549 9 // Disable 'operand contains compiler generated information' +#endif // __VISUALC__ + // suppress some Salford C++ warnings #ifdef __SALFORDC__ # pragma suppress 353 // Possible nested comments @@ -140,28 +242,15 @@ #define va_list __gnuc_va_list #endif // HP-UX -// Cygwin / Mingw32 with gcc >= 2.95 use new windows headers which -// are more ms-like (header author is Anders Norlander, hence the name) -#if (defined(__MINGW32__) || defined(__CYGWIN__)) && ((__GNUC__>2) ||((__GNUC__==2) && (__GNUC_MINOR__>=95))) - #ifndef wxUSE_NORLANDER_HEADERS - #define wxUSE_NORLANDER_HEADERS 1 - #endif +// This macro can be used to check that the version of mingw32 compiler is +// at least maj.min +#if defined( __GNUWIN32__ ) || defined( __MINGW32__ ) || defined( __CYGWIN__ ) + #include "wx/msw/gccpriv.h" #else - #ifndef wxUSE_NORLANDER_HEADERS - #define wxUSE_NORLANDER_HEADERS 0 - #endif -#endif - -// "old" GNUWIN32 is the one without Norlander's headers: it lacks the -// standard Win32 headers and we define the used stuff ourselves for it -// in wx/msw/gnuwin32/extra.h -#if defined(__GNUC__) && !wxUSE_NORLANDER_HEADERS - #define __GNUWIN32_OLD__ + #undef wxCHECK_W32API_VERSION + #define wxCHECK_W32API_VERSION(maj, min) (0) #endif -////////////////////////////////////////////////////////////////////////////////// -// Currently Only MS-Windows/NT, XView and Motif are supported -// #if defined(__HPUX__) && !defined(__WXGTK__) #ifndef __WXMOTIF__ #define __WXMOTIF__ @@ -172,73 +261,19 @@ #define __X__ #endif -#ifdef __WXMSW__ - -#if defined(_WIN32) || defined(WIN32) || defined(__NT__) - #ifndef __WIN32__ - #define __WIN32__ - #endif -#endif - -#ifdef __WXWINE__ - #ifndef __WIN32__ - #define __WIN32__ - #endif - #ifndef __WIN95__ - #define __WIN95__ - #endif - #ifndef STRICT - #define STRICT - #endif -#endif - -#ifndef __WIN32__ -#define __WIN16__ -#endif - -#if !defined(__WIN95__) && (WINVER >= 0x0400) -#define __WIN95__ -#endif - -#if defined(TWIN32) && !defined(__TWIN32__) -#define __TWIN32__ -#endif - -#endif // wxMSW - // Make sure the environment is set correctly #if defined(__WXMSW__) && defined(__X__) #error "Target can't be both X and Windows" #elif !defined(__WXMOTIF__) && !defined(__WXMSW__) && !defined(__WXGTK__) && \ !defined(__WXPM__) && !defined(__WXMAC__) && !defined(__X__) && \ !defined(__WXQT__) && !defined(__WXSTUBS__) && wxUSE_GUI - #error "No Target! Use -D[__WXMOTIF__|__WXGTK__|__WXMSW__|__WXMAC__|__WXQT__|__WXPM__|__WXSTUBS__]" + #ifdef __UNIX__ + #error "No Target! You should wx-config program for compilation flags!" + #else // !Unix + #error "No Target! You should supplied makefiles for compilation!" + #endif // Unix/!Unix #endif -// ---------------------------------------------------------------------------- -// wxWindows options -// ---------------------------------------------------------------------------- - -#include - -#include "wx/setup.h" - -// just in case they were defined in setup.h -#undef PACKAGE -#undef VERSION - -// this has to be done after including setup.h which might -// define __HPUX__ 1 itself -#if defined(__hpux) && !defined(__HPUX__) - #define __HPUX__ -#endif // HP-UX - -// if we're on a Unix system but didn't use configure (so that setup.h didn't -// define __UNIX__), do define __UNIX__ now -#if !defined(__UNIX__) && defined(__UNIX_LIKE__) - #define __UNIX__ -#endif // Unix - #include "wx/version.h" // ---------------------------------------------------------------------------- @@ -384,8 +419,8 @@ typedef int wxWindowID; #if defined(__WXMSW__) -// __declspec works in BC++ 5 and later, as well as VC++ and gcc -#if defined(__VISUALC__) || defined(__BORLANDC__) || defined(__GNUC__) +// __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__) # ifdef WXMAKINGDLL # define WXDLLEXPORT __declspec( dllexport ) # define WXDLLEXPORT_DATA(type) __declspec( dllexport ) type @@ -447,8 +482,10 @@ typedef int wxWindowID; # define WXDLLIMPORT #endif +#ifdef __cplusplus class WXDLLEXPORT wxObject; class WXDLLEXPORT wxEvent; +#endif /** symbolic constant used by all Find()-like functions returning positive integer on success as failure indicator */ @@ -459,7 +496,12 @@ class WXDLLEXPORT wxEvent; // ---------------------------------------------------------------------------- // everybody gets the assert and other debug macros +#ifdef __cplusplus #include "wx/debug.h" +#endif + +// NULL declaration +#include //@{ /// delete pointer if it is not NULL and NULL it afterwards @@ -528,7 +570,9 @@ class WXDLLEXPORT wxEvent; #endif // Callback function type definition +#ifdef __cplusplus typedef void (*wxFunction) (wxObject&, wxEvent&); +#endif // ---------------------------------------------------------------------------- // OS mnemonics -- Identify the running OS (useful for Windows) @@ -691,7 +735,7 @@ typedef float wxFloat32 ; = { 0xE158 }; #pragma parameter __D0 wxINT16_SWAP_ALWAYS(__D0) - pascal wxInt16 wxUINT16_SWAP_ALWAYS(wxInt16 value) + pascal wxInt16 wxINT16_SWAP_ALWAYS(wxInt16 value) = { 0xE158 }; #pragma parameter __D0 wxUINT32_SWAP_ALWAYS (__D0) @@ -699,7 +743,7 @@ typedef float wxFloat32 ; = { 0xE158, 0x4840, 0xE158 }; #pragma parameter __D0 wxINT32_SWAP_ALWAYS (__D0) - pascal wxInt32 wxUINT32_SWAP_ALWAYS(wxInt32 value) + pascal wxInt32 wxINT32_SWAP_ALWAYS(wxInt32 value) = { 0xE158, 0x4840, 0xE158 }; #endif @@ -814,7 +858,8 @@ enum wxStretch wxSHRINK = 0x1000, wxGROW = 0x2000, wxEXPAND = wxGROW, - wxSHAPED = 0x4000 + wxSHAPED = 0x4000, + wxADJUST_MINSIZE = 0x8000 }; // ---------------------------------------------------------------------------- @@ -862,6 +907,9 @@ enum wxStretch // splitter windows, but can't be used in a panel where a static box must be // 'transparent' (panel paints the background for it) #define wxCLIP_CHILDREN 0x00400000 +// Note we're reusing the wxCAPTION style because we won't need captions +// for subwindows/controls +#define wxCLIP_SIBLINGS 0x20000000 // Add this style to a panel to get tab traversal working outside of dialogs // (on by default for wxPanel, wxDialog, wxScrolledWindow) @@ -904,15 +952,24 @@ enum wxStretch #define wxTINY_CAPTION_VERT 0x0080 #define wxRESIZE_BORDER 0x0040 +#define wxDIALOG_NO_PARENT 0x0001 // Don't make owned by apps top window +#define wxFRAME_NO_TASKBAR 0x0002 // No taskbar button (MSW only) +#define wxFRAME_TOOL_WINDOW 0x0004 // No taskbar button, no system menu + // deprecated versions defined for compatibility reasons #define wxRESIZE_BOX wxMAXIMIZE_BOX #define wxTHICK_FRAME wxRESIZE_BORDER +// obsolete styles, unused any more #define wxDIALOG_MODAL 0x0020 #define wxDIALOG_MODELESS 0x0000 -// Add for normal Windows frame behaviour -#define wxFRAME_FLOAT_ON_PARENT 0x0020 +// deprecated flag, don't use any more, defined for compatibility only +#define wxFRAME_FLOAT_ON_PARENT 0 + +// Context-sensitive help +#define wxFRAME_EX_CONTEXTHELP 0x00000004 +#define wxDIALOG_EX_CONTEXTHELP 0x00000004 /* * MDI parent frame style flags @@ -1093,6 +1150,8 @@ enum wxStretch /* * wxListCtrl flags */ +#define wxLC_VRULES 0x0001 +#define wxLC_HRULES 0x0002 #define wxLC_ICON 0x0004 #define wxLC_SMALL_ICON 0x0008 #define wxLC_LIST 0x0010 @@ -1142,12 +1201,6 @@ enum wxStretch #define wxSP_FULLSASH 0x0400 #define wxSP_3D (wxSP_3DBORDER | wxSP_3DSASH) -/* - * wxFrame extra flags - */ -// No title on taskbar -#define wxFRAME_TOOL_WINDOW 0x0004 - /* * wxTabCtrl flags */ @@ -1301,6 +1354,12 @@ enum wxStretch #define wxID_MORE 5109 #define wxID_SETUP 5110 #define wxID_RESET 5111 +#define wxID_CONTEXT_HELP 5112 +#define wxID_YESTOALL 5113 +#define wxID_NOTOALL 5114 +#define wxID_ABORT 5115 +#define wxID_RETRY 5116 +#define wxID_IGNORE 5117 // IDs used by generic file dialog (11 consecutive starting from this value) #define wxID_FILEDLGG 5900 @@ -1678,9 +1737,16 @@ typedef enum { wxPRINT_MODE_PRINTER = 3 // Send to printer } wxPrintMode; -// --------------------------------------------------------------------------- -// Macro to specify "All Files" on different platforms -// --------------------------------------------------------------------------- +// ---------------------------------------------------------------------------- +// miscellaneous +// ---------------------------------------------------------------------------- + +// define this macro if font handling is done using the X font names +#if defined(__WXGTK__) || defined(__X__) + #define _WX_X_FONTLIKE +#endif + +// macro to specify "All Files" on different platforms #if defined(__WXMSW__) # define wxALL_FILES_PATTERN "*.*" # define wxALL_FILES gettext_noop("All files (*.*)|*.*") @@ -1688,6 +1754,7 @@ typedef enum { # define wxALL_FILES_PATTERN "*" # define wxALL_FILES gettext_noop("All files (*)|*") #endif + // --------------------------------------------------------------------------- // macros that enable wxWindows apps to be compiled in absence of the // sytem headers, although some platform specific types are used in the @@ -1793,7 +1860,7 @@ typedef void * WXLPCREATESTRUCT; typedef unsigned long WXMPARAM; typedef unsigned long WXMSGID; typedef void* WXRESULT; -typedef int (*WXFARPROC)(); +//typedef int (*WXFARPROC)(); // some windows handles not defined by PM typedef unsigned long HANDLE; typedef unsigned long HICON; @@ -1812,7 +1879,7 @@ typedef unsigned short WORD; // WIN32 graphics types for OS/2 GPI // RGB under OS2 is more like a PALETTEENTRY struct under Windows so we need a real RGB def -#define OS2RGB(r,g,b) ((DWORD ((BYTE) (r) | ((WORD) (g) << 8)) | (((DWORD)(BYTE)(b)) << 16))) +#define OS2RGB(r,g,b) ((DWORD ((BYTE) (b) | ((WORD) (g) << 8)) | (((DWORD)(BYTE)(r)) << 16))) typedef unsigned long COLORREF; #define GetBValue(rgb) ((BYTE)((rgb) >> 16)) @@ -1840,6 +1907,13 @@ typedef struct tagLOGPALETTE typedef int (*WXFARPROC)(); #elif defined(__WIN32__) typedef int (__stdcall *WXFARPROC)(); +#elif defined(__WXPM__) +# if defined(__VISAGECPP__) && (__IBMCPP__ < 400 || __IBMC__ < 400 ) + // VA 3.0 for some reason needs base data types when typedefing a proc proto??? + typedef void* (_System *WXFARPROC)(unsigned long, unsigned long, void*, void*); +# else + typedef WXRESULT (_System *WXFARPROC)(WXHWND, WXMSGID, WXWPARAM, WXLPARAM); +# endif #else typedef int (*WXFARPROC)(); #endif