From a38c9b4337656f5bd669908c3fff972a05aa8df2 Mon Sep 17 00:00:00 2001
From: =?utf8?q?V=C3=A1clav=20Slav=C3=ADk?= <vslavik@fastmail.fm>
Date: Tue, 29 Jan 2008 12:22:13 +0000
Subject: [PATCH] added wxCHECK_VISUALC_VERSION macro

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@51444 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
---
 docs/latex/wx/cppconst.tex |  5 +++--
 docs/latex/wx/function.tex | 10 ++++++++++
 include/wx/platform.h      | 11 +++++++++++
 3 files changed, 24 insertions(+), 2 deletions(-)

diff --git a/docs/latex/wx/cppconst.tex b/docs/latex/wx/cppconst.tex
index 4276c62456..2c8d81af2a 100644
--- a/docs/latex/wx/cppconst.tex
+++ b/docs/latex/wx/cppconst.tex
@@ -147,8 +147,9 @@ to the compiler version: $500$ is $5.0$.}
 \twocolitem{\_\_SUNCC\_\_}{Sun CC, see also \helpref{wxCHECK\_SUNCC\_VERSION}{wxchecksunccversion}}
 \twocolitem{\_\_SYMANTECC\_\_}{Symantec C++}
 \twocolitem{\_\_VISAGECPP\_\_}{IBM Visual Age (OS/2)}
-\twocolitem{\_\_VISUALC\_\_}{Microsoft Visual C++. The value of this macro
-corresponds to the compiler version: $1020$ for $4.2$ (the first supported
+\twocolitem{\_\_VISUALC\_\_}{Microsoft Visual C++, see also
+\helpref{wxCHECK\_VISUALC\_VERSION}{wxcheckvisualcversion}. The value of this
+macro corresponds to the compiler version: $1020$ for $4.2$ (the first supported
 version), $1100$ for $5.0$, $1200$ for $6.0$ and so on. For convenience, the
 symbols \_\_VISUALCn\_\_ are also defined for each major compiler version from
 5 to 9, i.e. you can use tests such \texttt{#ifdef \_\_VISUALC7\_\_} to test
diff --git a/docs/latex/wx/function.tex b/docs/latex/wx/function.tex
index 668118a551..412fa7e839 100644
--- a/docs/latex/wx/function.tex
+++ b/docs/latex/wx/function.tex
@@ -52,6 +52,7 @@ the corresponding topic.
 \helpref{wxCHECK\_SUNCC\_VERSION}{wxchecksunccversion}\\
 \helpref{wxCHECK\_VERSION}{wxcheckversion}\\
 \helpref{wxCHECK\_VERSION\_FULL}{wxcheckversionfull}\\
+\helpref{wxCHECK\_VISUALC\_VERSION}{wxcheckvisualcversion}\\
 \helpref{wxCHECK\_W32API\_VERSION}{wxcheckw32apiversion}\\
 \helpref{wxClientDisplayRect}{wxclientdisplayrect}\\
 \helpref{wxClipboardOpen}{functionwxclipboardopen}\\
@@ -365,6 +366,15 @@ Same as \helpref{wxCHECK\_VERSION}{wxcheckversion} but also checks that
 \texttt{wxSUBRELEASE\_NUMBER} is at least \arg{subrel}.
 
 
+\membersection{wxCHECK\_VISUALC\_VERSION}\label{wxcheckvisualcversion}
+
+\func{bool}{wxCHECK\_VISUALC\_VERSION}{\param{}{major}}
+
+Returns $1$ if the compiler being used to compile the code is Visual C++
+compiler version \arg{major} or greater. Otherwise, and also if
+the compiler is not Visual C++ at all, returns $0$.
+
+
 \membersection{wxCHECK\_W32API\_VERSION}\label{wxcheckw32apiversion}
 
 \func{bool}{wxCHECK\_W32API\_VERSION}{\param{}{major, minor, release}}
diff --git a/include/wx/platform.h b/include/wx/platform.h
index 10f61e6cca..35497c53ed 100644
--- a/include/wx/platform.h
+++ b/include/wx/platform.h
@@ -559,6 +559,17 @@
 #define wxNEEDS_CHARPP
 #endif
 
+/*
+   This macro can be used to test the Visual C++ version.
+*/
+#ifndef __VISUALC__
+#   define wxVISUALC_VERSION(major) 0
+#   define wxCHECK_VISUALC_VERSION(major) 0
+#else
+#   define wxVISUALC_VERSION(major) ( (6 + major) * 100 )
+#   define wxCHECK_VISUALC_VERSION(major) ( __VISUALC__ >= wxVISUALC_VERSION(major) )
+#endif
+
 /*
    This macro can be used to check that the version of mingw32 compiler is
    at least maj.min
-- 
2.50.0

