X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/83874e15474164056d1b315fe5ec808fd6da1fea..594f0f5bf1355fb8d58f403d3ebacc1c1767c429:/include/wx/defs.h

diff --git a/include/wx/defs.h b/include/wx/defs.h
index d814dfcd49..7fbae0d9ed 100644
--- a/include/wx/defs.h
+++ b/include/wx/defs.h
@@ -37,6 +37,12 @@
     #endif
 #endif // Win32
 
+#if defined(__WXMSW__) || defined(__WIN32__)
+    #if !defined(__WINDOWS__)
+        #define __WINDOWS__
+    #endif
+#endif
+
 #ifdef __WXWINE__
     #ifndef __WIN32__
         #define __WIN32__
@@ -55,6 +61,9 @@
 
 #include "wx/setup.h"
 
+// check the consistency of the settings in setup.h
+#include "wx/chkconf.h"
+
 // old C++ headers (like <iostream.h>) declare classes in the global namespace
 // while the new, standard ones (like <iostream>) do it in std:: namespace
 //
@@ -112,41 +121,26 @@
         #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
+    #if defined(__WXMAC__) && defined(__DARWIN__)
+        // Mac OS X
+
+        // Some code has been added to workaround defects(?) in the
+        // bundled gcc compiler. These corrections are identified by:
+        // __DARWIN__ for corrections necessary for Darwin (wxMac, wxMotif)
 
         #include <Carbon/Carbon.h>
-    #endif // __APPLE__
+    #endif // __WXMAC__ && __DARWIN__
 #elif defined(applec) || \
       defined(THINK_C) || \
       (defined(__MWERKS__) && !defined(__INTEL__))
       // MacOS
-#elif defined(__WXMAC__) && defined(__APPLE__)
-    // MacOS X
+#elif defined(__WXMAC__) && defined(__DARWIN__)
+    // Mac OS 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
+    // Some code has been added to workaround defects(?) in the
+    // bundled gcc compiler. These corrections are identified by:
+    // __DARWIN__ for corrections necessary for Darwin (wxMac, wxMotif)
 
     #include <Carbon/Carbon.h>
 #elif defined(__OS2__)
@@ -282,7 +276,7 @@
     #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(__WXMGL__) && wxUSE_GUI
+      !defined(__WXMGL__) && wxUSE_GUI
     #ifdef __UNIX__
         #error "No Target! You should use wx-config program for compilation flags!"
     #else // !Unix
@@ -300,7 +294,10 @@
 // compatibility code
 #if !wxUSE_GUI
     #undef WXWIN_COMPATIBILITY_2
+    #undef WXWIN_COMPATIBILITY_2_2
+
     #define WXWIN_COMPATIBILITY_2 0
+    #define WXWIN_COMPATIBILITY_2_2 0
 #endif // !GUI
 
 // ============================================================================
@@ -375,20 +372,6 @@ typedef short int WXTYPE;
 // because -1 is a valid (and largely used) value for window id.
 typedef int wxWindowID;
 
-// 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
-
 // ----------------------------------------------------------------------------
 // portable calling conventions macros
 // ----------------------------------------------------------------------------
@@ -409,7 +392,7 @@ typedef int wxWindowID;
 
 // wxCALLBACK should be used for the functions which are called back by
 // Windows (such as compare function for wxListCtrl)
-#if defined(__WIN32__)
+#if defined(__WIN32__) && !defined(__WXMICROWIN__)
     #define wxCALLBACK wxSTDCALL
 #else
     // no stdcall under Unix nor Win16
@@ -503,8 +486,8 @@ class WXDLLEXPORT wxObject;
 class WXDLLEXPORT wxEvent;
 #endif
 
- /** symbolic constant used by all Find()-like functions returning positive
-      integer on success as failure indicator */
+// symbolic constant used by all Find()-like functions returning positive
+// integer on success as failure indicator
 #define wxNOT_FOUND       (-1)
 
 // ----------------------------------------------------------------------------
@@ -516,38 +499,36 @@ class WXDLLEXPORT wxEvent;
 #include "wx/debug.h"
 #endif
 
-// NULL declaration
+// 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 <stddef.h>
 
-//@{
-/// delete pointer if it is not NULL and NULL it afterwards
+// 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
 //  be considered as an error by some overzealous debugging implementations of
 //  the library, so we do it ourselves)
-#if defined(__SGI_CC__)
-// Okay this is bad styling, but the native SGI compiler is very picky, it
-// wont let you compare/assign between a NULL (void *) and another pointer
-// type. To be really clean we'd need to pass in another argument, the type
-// of p.
-// Also note the use of 0L, this would allow future possible 64bit support
-// (as yet untested) by ensuring that we zero all the bits in a pointer
-// (which is always the same length as a long (at least with the LP64 standard)
-// --- offer aug 98
-#define wxDELETE(p)      if ( (p) ) { delete (p); p = 0L; }
-#else
 #define wxDELETE(p)      if ( (p) != NULL ) { delete p; p = NULL; }
-#endif /* __SGI__CC__ */
 
 // delete an array and NULL it (see comments above)
-#if defined(__SGI_CC__)
-// see above comment.
-#define wxDELETEA(p)      if ( (p) ) { delete [] (p); p = 0L; }
-#else
-#define wxDELETEA(p)      if ( ((void *) (p)) != NULL ) { delete [] p; p = NULL; }
-#endif /* __SGI__CC__ */
+#define wxDELETEA(p)     if ( (p) ) { delete [] (p); p = NULL; }
 
-/// size of statically declared array
+// size of statically declared array
 #define WXSIZEOF(array)   (sizeof(array)/sizeof(array[0]))
 
 // ----------------------------------------------------------------------------
@@ -609,7 +590,6 @@ enum
     wxGTK_WIN32,              // GTK on Win32
     wxGTK_OS2,                // GTK on OS/2
     wxGTK_BEOS,               // GTK on BeOS
-    wxQT,                     // Qt
     wxGEOS,                   // GEOS
     wxOS2_PM,                 // OS/2 Workplace
     wxWINDOWS,                // Windows or WfW
@@ -990,6 +970,13 @@ enum wxBorder
 // descend into all subwindows
 #define wxWS_EX_VALIDATE_RECURSIVELY    0x00000001
 
+// wxCommandEvents and the objects of the derived classes are forwarded to the
+// parent window and so on recursively by default. Using this flag for the
+// given window allows to block this propagation at this window, i.e. prevent
+// the events from being propagated further upwards. The dialogs have this
+// flag on by default.
+#define wxWS_EX_BLOCK_EVENTS            0x00000002
+
 /*
  * wxFrame/wxDialog style flags
  */
@@ -1104,22 +1091,6 @@ enum wxBorder
 #define wxLB_HSCROLL        wxHSCROLL
 // always show an entire number of rows
 #define wxLB_INT_HEIGHT     0x0800
-/*
- * wxTextCtrl style flags
- */
-// the flag bits 0x0001, 2, 4 and 8 are free but should be used only for the
-// things which don't make sense for a text control used by wxTextEntryDialog
-// because they would otherwise conflict with wxOK, wxCANCEL, wxCENTRE
-#define wxTE_READONLY       0x0010
-#define wxTE_MULTILINE      0x0020
-#define wxTE_PROCESS_TAB    0x0040
-// this style means to use RICHEDIT control and does something only under wxMSW
-// and Win32 and is silently ignored under all other platforms
-#define wxTE_RICH           0x0080
-#define wxTE_NO_VSCROLL     0x0100
-#define wxTE_AUTO_SCROLL    0x0200
-#define wxTE_PROCESS_ENTER  0x0400
-#define wxTE_PASSWORD       0x0800
 
 // use wxHSCROLL to not wrap text at all, wxTE_LINEWRAP to wrap it at any
 // position and wxTE_WORDWRAP to wrap at words boundary
@@ -1192,61 +1163,6 @@ enum wxBorder
 #define wxSB_HORIZONTAL      wxHORIZONTAL
 #define wxSB_VERTICAL        wxVERTICAL
 
-/*
- * wxButton flags (Win32 only)
- */
-#define wxBU_AUTODRAW        0x0004
-#define wxBU_NOAUTODRAW      0x0000
-#define wxBU_LEFT            0x0040
-#define wxBU_TOP             0x0080
-#define wxBU_RIGHT           0x0100
-#define wxBU_BOTTOM          0x0200
-
-/*
- * wxTreeCtrl flags
- */
-#define wxTR_HAS_BUTTONS     0x0004
-#define wxTR_EDIT_LABELS     0x0008
-#define wxTR_LINES_AT_ROOT   0x0010
-
-#define wxTR_SINGLE          0x0000
-#define wxTR_MULTIPLE        0x0020
-#define wxTR_EXTENDED        0x0040
-#define wxTR_HAS_VARIABLE_ROW_HEIGHT 0x0080
-#define wxTR_NO_LINES        0x0100
-#define wxTR_MAC_BUTTONS     0x0200
-#define wxTR_ROW_LINES       0x0400
-
-/*
- * wxListCtrl flags
- */
-#define wxLC_VRULES          0x0001
-#define wxLC_HRULES          0x0002
-#define wxLC_ICON            0x0004
-#define wxLC_SMALL_ICON      0x0008
-#define wxLC_LIST            0x0010
-#define wxLC_REPORT          0x0020
-#define wxLC_ALIGN_TOP       0x0040
-#define wxLC_ALIGN_LEFT      0x0080
-#define wxLC_AUTOARRANGE     0x0100
-#define wxLC_USER_TEXT       0x0200
-#define wxLC_EDIT_LABELS     0x0400
-#define wxLC_NO_HEADER       0x0800
-#define wxLC_NO_SORT_HEADER  0x1000
-#define wxLC_SINGLE_SEL      0x2000
-#define wxLC_SORT_ASCENDING  0x4000
-#define wxLC_SORT_DESCENDING 0x8000
-
-#define wxLC_MASK_TYPE       (wxLC_ICON | wxLC_SMALL_ICON | wxLC_LIST | wxLC_REPORT)
-#define wxLC_MASK_ALIGN      (wxLC_ALIGN_TOP | wxLC_ALIGN_LEFT)
-#define wxLC_MASK_SORT       (wxLC_SORT_ASCENDING | wxLC_SORT_DESCENDING)
-
-// Omitted because (a) too much detail (b) not enough style flags
-// #define wxLC_NO_SCROLL
-// #define wxLC_NO_LABEL_WRAP
-// #define wxLC_OWNERDRAW_FIXED
-// #define wxLC_SHOW_SEL_ALWAYS
-
 /*
  * wxSpinButton flags.
  * Note that a wxSpinCtrl is sometimes defined as
@@ -1271,14 +1187,6 @@ enum wxBorder
 #define wxSP_FULLSASH         0x0400
 #define wxSP_3D               (wxSP_3DBORDER | wxSP_3DSASH)
 
-/*
- * wxTabCtrl flags
- */
-#define wxTC_MULTILINE        0x0000
-#define wxTC_RIGHTJUSTIFY     0x0010
-#define wxTC_FIXEDWIDTH       0x0020
-#define wxTC_OWNERDRAW        0x0040
-
 /*
  * wxNotebook flags
  */
@@ -1289,6 +1197,14 @@ enum wxBorder
 #define wxNB_BOTTOM           0x0080
 #define wxNB_MULTILINE        0x0100
 
+/*
+ * wxTabCtrl flags
+ */
+#define wxTC_RIGHTJUSTIFY     0x0010
+#define wxTC_FIXEDWIDTH       0x0020
+#define wxTC_OWNERDRAW        0x0040
+#define wxTC_MULTILINE        wxNB_MULTILINE
+
 /*
  * wxStatusBar95 flags
  */
@@ -2010,7 +1926,7 @@ typedef struct tagLOGPALETTE
 } LOGPALETTE;
 #endif //__WXPM__
 
-#if defined(__GNUWIN32__) || defined(__WXWINE__)
+#if defined(__GNUWIN32__) || defined(__WXWINE__) || defined(__WXMICROWIN__)
     typedef int (*WXFARPROC)();
 #elif defined(__WIN32__)
     typedef int (__stdcall *WXFARPROC)();
@@ -2053,7 +1969,6 @@ typedef void*           WXGC;
 typedef void*           WXRegion;
 typedef void*           WXFont;
 typedef void*           WXImage;
-typedef void*           WXCursor;
 typedef void*           WXFontList;
 
 typedef unsigned long   Atom;  /* this might fail on a few architectures */
@@ -2122,7 +2037,7 @@ typedef struct _PangoFontDescription PangoFontDescription;
 #endif // GTK
 
 #ifdef __WXMGL__
-typedef void *WXWidget; // FIXME_MGL - type-safe
+typedef struct window_t *WXWidget;
 #endif // MGL
 
 // This is required because of clashing macros in windows.h, which may be