From: Václav Slavík <vslavik@fastmail.fm>
Date: Tue, 15 Jul 2003 18:52:32 +0000 (+0000)
Subject: added <windows.h> wrapper
X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/9ed0d735d588f42485461ea526596436c4c6ad4b

added <windows.h> wrapper


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@22004 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
---

diff --git a/configure b/configure
index d842c6b989..f488006aa4 100755
--- a/configure
+++ b/configure
@@ -6494,22 +6494,15 @@ fi
 ## FIXME: This is a blatant hack
 if test "x$wxUSE_COCOA" != "x" -a "$wxUSE_COCOA" != "0" ; then
   wxUSE_PRINTING_ARCHITECTURE=no
-  wxUSE_HELP=no
   wxUSE_CLIPBOARD=no
   wxUSE_DRAG_AND_DROP=no
   wxUSE_DATAOBJ=no
   # Generic notebook requires tab dialog
   DEFAULT_wxUSE_TABDIALOG=yes
   DEFAULT_wxUSE_TOOLBAR_NATIVE=no
-  DEFAULT_wxUSE_GAUGE=no
   DEFAULT_wxUSE_SCROLLBAR=no
-  DEFAULT_wxUSE_COMBOBOX=no
-  DEFAULT_wxUSE_CALCTRL=no
-  DEFAULT_wxUSE_SPINBTN=no
-  DEFAULT_wxUSE_SPINCTRL=no
   DEFAULT_wxUSE_TOOLTIPS=no
   DEFAULT_wxUSE_DRAGIMAGE=no
-  DEFAULT_wxUSE_PROGRESSDLG=no
 fi
 
 
@@ -19300,69 +19293,6 @@ fi
 
 
 
-        echo "$as_me:$LINENO: checking if w32api has good enough MSIE support" >&5
-echo $ECHO_N "checking if w32api has good enough MSIE support... $ECHO_C" >&6
-if test "${wx_cv_w32api_win32_ie+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-
-      cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <w32api.h>
-int
-main ()
-{
-
-                       #define wxCHECK_W32API_VERSION( major, minor ) \
-                       ( defined( __W32API_MAJOR_VERSION ) && defined( __W32API_MINOR_VERSION ) \
-                       && ( ( __W32API_MAJOR_VERSION > (major) ) \
-                       || ( __W32API_MAJOR_VERSION == (major) && __W32API_MINOR_VERSION >= (minor))))
-
-                       #if !wxCHECK_W32API_VERSION(1,1)
-                       #error You need w32api 1.1 or newer
-                       #endif
-
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-         { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-
-                        wx_cv_w32api_win32_ie=yes
-
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-
-                        wx_cv_w32api_win32_ie=no
-
-fi
-rm -f conftest.$ac_objext conftest.$ac_ext
-
-fi
-echo "$as_me:$LINENO: result: $wx_cv_w32api_win32_ie" >&5
-echo "${ECHO_T}$wx_cv_w32api_win32_ie" >&6
-    if test "$wx_cv_w32api_win32_ie" = "yes" ; then
-        CPPFLAGS="$CPPFLAGS -D_WIN32_IE=0x400"
-    fi
-
             LIBS="$LIBS -lwinspool -lwinmm -lshell32 -lcomctl32 -lcomdlg32 -lctl3d32 -ladvapi32 -lwsock32 -lgdi32"
 
     if test "$wxUSE_ACCESSIBILITY" = "yes" ; then
diff --git a/configure.in b/configure.in
index 2522347fd9..59ca6bd8d7 100644
--- a/configure.in
+++ b/configure.in
@@ -2059,29 +2059,6 @@ if test "$USE_WIN32" = 1 ; then
         AC_MSG_ERROR(please set CFLAGS to contain the location of windows.h)
     ])
 
-    dnl check if can use _WIN32_IE macro
-    AC_CACHE_CHECK([if w32api has good enough MSIE support], wx_cv_w32api_win32_ie,
-    [
-      AC_TRY_COMPILE([#include <w32api.h>],
-                     [
-                       #define wxCHECK_W32API_VERSION( major, minor ) \
-                       ( defined( __W32API_MAJOR_VERSION ) && defined( __W32API_MINOR_VERSION ) \
-                       && ( ( __W32API_MAJOR_VERSION > (major) ) \
-                       || ( __W32API_MAJOR_VERSION == (major) && __W32API_MINOR_VERSION >= (minor))))
-
-                       #if !wxCHECK_W32API_VERSION(1,1)
-                       #error You need w32api 1.1 or newer
-                       #endif
-                     ], [
-                        wx_cv_w32api_win32_ie=yes
-                     ], [
-                        wx_cv_w32api_win32_ie=no
-                     ])
-    ])
-    if test "$wx_cv_w32api_win32_ie" = "yes" ; then
-        CPPFLAGS="$CPPFLAGS -D_WIN32_IE=0x400"
-    fi
-
     dnl --- FIXME: This is still a somewhat random list of libs,
     dnl ---        some of them should probably be included conditionally.
     LIBS="$LIBS -lwinspool -lwinmm -lshell32 -lcomctl32 -lcomdlg32 -lctl3d32 -ladvapi32 -lwsock32 -lgdi32"
diff --git a/include/wx/msw/private.h b/include/wx/msw/private.h
index 3e5465eec3..28838451e1 100644
--- a/include/wx/msw/private.h
+++ b/include/wx/msw/private.h
@@ -14,11 +14,7 @@
 #ifndef _WX_PRIVATE_H_
 #define _WX_PRIVATE_H_
 
-#ifndef STRICT
-    #define STRICT 1
-#endif
-
-#include <windows.h>
+#include "wx/msw/wrapwin.h"
 
 
 #if defined (__WXWINCE__)
@@ -32,9 +28,6 @@
     #include "wx/msw/microwin.h"
 #endif
 
-// undefine conflicting symbols which were defined in windows.h
-#include "wx/msw/winundef.h"
-
 // Include fixes for MSLU:
 #include "wx/msw/mslu.h"
 
diff --git a/include/wx/msw/wrapwin.h b/include/wx/msw/wrapwin.h
new file mode 100644
index 0000000000..84141ec67b
--- /dev/null
+++ b/include/wx/msw/wrapwin.h
@@ -0,0 +1,37 @@
+/////////////////////////////////////////////////////////////////////////////
+// Name:        wrapwin.h
+// Purpose:     Wrapper around <windows.h>, to be included instead of it
+// Created:     2003/07/22
+// RCS-ID:      $Id$
+// Licence:     wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_WRAPWIN_H_
+#define _WX_WRAPWIN_H_
+
+#include "wx/platform.h"
+
+#ifndef STRICT
+    #define STRICT 1
+#endif
+
+// define _WIN32_IE to a high value because we always check for the version
+// of installed DLLs at runtime anyway:
+#ifndef _WIN32_IE
+    // for compilers that use w32api headers: w32api must be >= 1.1:
+    #if defined( __GNUWIN32__ ) || defined( __MINGW32__ ) || \
+        defined( __CYGWIN__ ) || \
+        (defined(__WATCOMC__) && __WATCOMC__ >= 1200) || \
+        defined(__DIGITALMARS__)
+        #if wxCHECK_W32API_VERSION(1,1)
+            #define _WIN32_IE 0x400
+        #endif
+    #else
+        #define _WIN32_IE 0x400
+    #endif
+#endif
+
+#include <windows.h>
+#include "wx/msw/winundef.h"
+
+#endif
diff --git a/include/wx/wxprec.h b/include/wx/wxprec.h
index 76f16b4108..fc6bba536c 100644
--- a/include/wx/wxprec.h
+++ b/include/wx/wxprec.h
@@ -38,8 +38,7 @@
         #define STRICT 1
     #endif
 
-    #include <windows.h>
-    #include "wx/msw/winundef.h"
+    #include "wx/msw/wrapwin.h"
 #endif
 
 // include the most common wx headers
diff --git a/src/common/file.cpp b/src/common/file.cpp
index 637d450da5..da27b425d1 100644
--- a/src/common/file.cpp
+++ b/src/common/file.cpp
@@ -60,7 +60,7 @@
     #include  <unistd.h>
     #include  <sys/stat.h>
     #ifdef __GNUWIN32__
-        #include <windows.h>
+        #include "wx/msw/wrapwin.h"
     #endif
 #elif defined(__DOS__)
     #if defined(__WATCOMC__)
diff --git a/src/common/filefn.cpp b/src/common/filefn.cpp
index 41e11eb45c..6978a4a25c 100644
--- a/src/common/filefn.cpp
+++ b/src/common/filefn.cpp
@@ -128,7 +128,7 @@
 #endif
 
 #ifdef __WINDOWS__
-    #include <windows.h>
+    #include "wx/msw/wrapwin.h"
     #include "wx/msw/mslu.h"
 
     // for _getcwd
diff --git a/src/common/filename.cpp b/src/common/filename.cpp
index 181b06705e..674265b462 100644
--- a/src/common/filename.cpp
+++ b/src/common/filename.cpp
@@ -86,8 +86,7 @@
 
 // For GetShort/LongPathName
 #ifdef __WIN32__
-#include <windows.h>
-#include "wx/msw/winundef.h"
+#include "wx/msw/wrapwin.h"
 #endif
 
 #ifdef __WXWINCE__
diff --git a/src/common/gdicmn.cpp b/src/common/gdicmn.cpp
index 2c01bccc06..20450b557e 100644
--- a/src/common/gdicmn.cpp
+++ b/src/common/gdicmn.cpp
@@ -43,7 +43,7 @@
 #include <string.h>
 
 #ifdef __WXMSW__
-#include <windows.h>
+#include "wx/msw/wrapwin.h"
 #endif
 
 #ifdef __WXMOTIF__
diff --git a/src/common/imagbmp.cpp b/src/common/imagbmp.cpp
index 1ba36f910c..ffe3162333 100644
--- a/src/common/imagbmp.cpp
+++ b/src/common/imagbmp.cpp
@@ -43,7 +43,7 @@
 #endif
 
 #ifdef __WXMSW__
-#include <windows.h>
+#include "wx/msw/wrapwin.h"
 #endif
 
 //-----------------------------------------------------------------------------
diff --git a/src/common/imagjpeg.cpp b/src/common/imagjpeg.cpp
index 98008589d1..b0a4e997e4 100644
--- a/src/common/imagjpeg.cpp
+++ b/src/common/imagjpeg.cpp
@@ -35,7 +35,7 @@
 //     defining HAVE_BOOLEAN.
 #if defined(__WXMSW__) && (defined(__MWERKS__) || defined(__DIGITALMARS__) || (defined(__WATCOMC__) && __WATCOMC__ < 1200))
     #define HAVE_BOOLEAN
-    #include <windows.h>
+    #include "wx/msw/wrapwin.h"
 #endif
 
 extern "C"
diff --git a/src/common/memory.cpp b/src/common/memory.cpp
index 5ec13fc7db..ce4051ad84 100644
--- a/src/common/memory.cpp
+++ b/src/common/memory.cpp
@@ -54,7 +54,7 @@
 #include <string.h>
 
 #ifdef __WXMSW__
-#include <windows.h>
+#include "wx/msw/wrapwin.h"
 
 #ifdef GetClassInfo
 #undef GetClassInfo
diff --git a/src/common/paper.cpp b/src/common/paper.cpp
index b60ad489b5..e207a9a4b1 100644
--- a/src/common/paper.cpp
+++ b/src/common/paper.cpp
@@ -39,7 +39,7 @@
 #include <string.h>
 
 #ifdef __WXMSW__
-#include <windows.h>
+#include "wx/msw/wrapwin.h"
 #include <commdlg.h>
 
 #ifndef __WIN32__
diff --git a/src/common/quantize.cpp b/src/common/quantize.cpp
index 3b2f3dc9a1..17231b4b71 100644
--- a/src/common/quantize.cpp
+++ b/src/common/quantize.cpp
@@ -49,7 +49,6 @@
 #include "wx/quantize.h"
 
 #ifdef __WXMSW__
-#include <windows.h>
 #include "wx/msw/private.h"
 #endif
 
diff --git a/src/common/stopwatch.cpp b/src/common/stopwatch.cpp
index f114953332..f6f5638032 100644
--- a/src/common/stopwatch.cpp
+++ b/src/common/stopwatch.cpp
@@ -41,7 +41,7 @@
 // ----------------------------------------------------------------------------
 
 #if defined(__WIN32__)
-    #include <windows.h>
+    #include "wx/msw/wrapwin.h"
 #endif
 
 #if defined(__WIN32__) && !defined(HAVE_FTIME) && !defined(__MWERKS__) && !defined(__WXWINCE__)
diff --git a/src/msw/checklst.cpp b/src/msw/checklst.cpp
index 4274114bf9..df2f156ce3 100644
--- a/src/msw/checklst.cpp
+++ b/src/msw/checklst.cpp
@@ -47,7 +47,7 @@
 #include "wx/ownerdrw.h"
 #include "wx/checklst.h"
 
-#include <windows.h>
+#include "wx/msw/wrapwin.h"
 #include <windowsx.h>
 
 #include "wx/msw/private.h"
diff --git a/src/msw/clipbrd.cpp b/src/msw/clipbrd.cpp
index fd07c1ffa6..3bd80dd069 100644
--- a/src/msw/clipbrd.cpp
+++ b/src/msw/clipbrd.cpp
@@ -52,7 +52,6 @@
 #include "wx/clipbrd.h"
 
 #include <string.h>
-#include <windows.h>
 
 #include "wx/msw/private.h"
 
diff --git a/src/msw/colordlg.cpp b/src/msw/colordlg.cpp
index 84ad0389ec..3e9571bc9e 100644
--- a/src/msw/colordlg.cpp
+++ b/src/msw/colordlg.cpp
@@ -44,8 +44,6 @@
 
 #if wxUSE_COLOURDLG
 
-#include <windows.h>
-
 #include "wx/msw/private.h"
 #include "wx/colordlg.h"
 #include "wx/cmndata.h"
diff --git a/src/msw/colour.cpp b/src/msw/colour.cpp
index 90074735d9..b41790d4df 100644
--- a/src/msw/colour.cpp
+++ b/src/msw/colour.cpp
@@ -24,7 +24,6 @@
 #include "wx/msw/private.h"
 
 #include <string.h>
-#include <windows.h>
 
 IMPLEMENT_DYNAMIC_CLASS(wxColour, wxObject)
 
diff --git a/src/msw/crashrpt.cpp b/src/msw/crashrpt.cpp
index 3b5da991bb..f49d2c0d48 100644
--- a/src/msw/crashrpt.cpp
+++ b/src/msw/crashrpt.cpp
@@ -40,7 +40,7 @@
 
 #include "wx/msw/crashrpt.h"
 
-#include <windows.h>
+#include "wx/msw/wrapwin.h"
 #include <imagehlp.h>
 #include "wx/msw/private.h"
 
diff --git a/src/msw/dde.cpp b/src/msw/dde.cpp
index cb98067949..ce6914ee5c 100644
--- a/src/msw/dde.cpp
+++ b/src/msw/dde.cpp
@@ -43,7 +43,6 @@
 #include "wx/msw/private.h"
 
 #include <string.h>
-#include <windows.h>
 #include <ddeml.h>
 
 #ifdef __GNUWIN32_OLD__
diff --git a/src/msw/iniconf.cpp b/src/msw/iniconf.cpp
index e03824cc3f..722fda8557 100644
--- a/src/msw/iniconf.cpp
+++ b/src/msw/iniconf.cpp
@@ -41,7 +41,7 @@
 // _WINDOWS_ is defined when windows.h is included,
 // __WXMSW__ is defined for MS Windows compilation
 #if       defined(__WXMSW__) && !defined(_WINDOWS_)
-  #include  <windows.h>
+  #include  "wx/msw/wrapwin.h"
 #endif  //windows.h
 
 // ----------------------------------------------------------------------------
diff --git a/src/msw/ole/access.cpp b/src/msw/ole/access.cpp
index 05d2d1c7ad..62e8024db4 100644
--- a/src/msw/ole/access.cpp
+++ b/src/msw/ole/access.cpp
@@ -38,7 +38,7 @@
 #include "wx/log.h"
 #include "wx/access.h"
 
-#include <windows.h>
+#include "wx/msw/wrapwin.h"
 
 // for some compilers, the entire ole2.h must be included, not only oleauto.h
 #if wxUSE_NORLANDER_HEADERS || defined(__WATCOMC__)
@@ -49,7 +49,6 @@
 #include <oleacc.h>
 #include <winable.h>
 
-#include "wx/msw/winundef.h"
 #include "wx/msw/ole/oleutils.h"
 
 #ifndef CHILDID_SELF
diff --git a/src/msw/ole/droptgt.cpp b/src/msw/ole/droptgt.cpp
index 37818b5760..759dc6ba81 100644
--- a/src/msw/ole/droptgt.cpp
+++ b/src/msw/ole/droptgt.cpp
@@ -43,7 +43,7 @@
 #ifdef __WIN32__
     #if !defined(__GNUWIN32__) || wxUSE_NORLANDER_HEADERS
         #if wxCHECK_W32API_VERSION( 1, 0 )
-            #include <windows.h>
+            #include "wx/msw/wrapwin.h"
         #endif
         #include <shlobj.h>            // for DROPFILES structure
     #endif
diff --git a/src/msw/ole/uuid.cpp b/src/msw/ole/uuid.cpp
index 65f125f6ab..cdcbe66714 100644
--- a/src/msw/ole/uuid.cpp
+++ b/src/msw/ole/uuid.cpp
@@ -30,7 +30,7 @@
 
 // standard headers
 #if wxCHECK_W32API_VERSION( 1, 0 )
-    #include <windows.h>
+    #include "wx/msw/wrapwin.h"
 #endif
 #include  <rpc.h>                       // UUID related functions
 
diff --git a/src/msw/registry.cpp b/src/msw/registry.cpp
index 188b50632b..9462ef29f0 100644
--- a/src/msw/registry.cpp
+++ b/src/msw/registry.cpp
@@ -36,7 +36,7 @@
 #define   WIN32_LEAN_AND_MEAN
 */
 
-#include  <windows.h>
+#include  "wx/msw/wrapwin.h"
 
 #ifdef __WXWINCE__
 #include "wx/msw/private.h"
diff --git a/src/msw/uxtheme.cpp b/src/msw/uxtheme.cpp
index 861ffd8858..ae90474c7b 100644
--- a/src/msw/uxtheme.cpp
+++ b/src/msw/uxtheme.cpp
@@ -28,9 +28,8 @@
 
 #if wxUSE_UXTHEME
 
-#include <windows.h>
+#include "wx/msw/wrapwin.h"
 
-#include "wx/msw/winundef.h"
 #include "wx/msw/uxtheme.h"
 #include "wx/msw/private.h"
 #include "wx/app.h"         // for GetComCtl32Version
diff --git a/src/msw/wave.cpp b/src/msw/wave.cpp
index 083a7abc84..610ef77cef 100644
--- a/src/msw/wave.cpp
+++ b/src/msw/wave.cpp
@@ -30,7 +30,6 @@
 #include "wx/msw/wave.h"
 #include "wx/msw/private.h"
 
-#include <windows.h>
 #include <windowsx.h>
 
 #if defined(__GNUWIN32_OLD__) && !defined(__CYGWIN10__)
diff --git a/src/msw/wince/net.cpp b/src/msw/wince/net.cpp
index 7891b54e4f..ea6b9545d6 100644
--- a/src/msw/wince/net.cpp
+++ b/src/msw/wince/net.cpp
@@ -12,7 +12,7 @@
 
 */
 
-#include <windows.h>
+#include "wx/msw/wrapwin.h"
 #include <tchar.h>
 #include <winsock.h>
 #include <string.h>
diff --git a/src/msw/wince/time.cpp b/src/msw/wince/time.cpp
index 99814647fa..9f1c570d10 100644
--- a/src/msw/wince/time.cpp
+++ b/src/msw/wince/time.cpp
@@ -29,8 +29,7 @@
 #endif
 
 #ifndef WX_PRECOMP
-    #include <windows.h>
-    #include "wx/msw/winundef.h"
+    #include "wx/msw/wrapwin.h"
 #endif
 
 #include "wx/msw/wince/time.h"
diff --git a/src/msw/window.cpp b/src/msw/window.cpp
index 01bca8a3f5..d57a865456 100644
--- a/src/msw/window.cpp
+++ b/src/msw/window.cpp
@@ -29,8 +29,7 @@
 #endif
 
 #ifndef WX_PRECOMP
-    #include <windows.h>
-    #include "wx/msw/winundef.h"
+    #include "wx/msw/wrapwin.h"
     #include "wx/window.h"
     #include "wx/accel.h"
     #include "wx/setup.h"