From c75d190a0ac1671b1d2af75ba8928716d77bf823 Mon Sep 17 00:00:00 2001
From: Julian Smart <julian@anthemion.co.uk>
Date: Wed, 16 Mar 2005 10:18:13 +0000
Subject: [PATCH] Added wxWINDOWS_POCKETPC, wxWINDOWS_SMARTPHONE

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@32849 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
---
 docs/latex/wx/function.tex |  5 ++++-
 docs/latex/wx/wxmsw.tex    | 21 +++++++++++++++++++--
 include/wx/defs.h          |  4 +++-
 src/msw/app.cpp            |  2 +-
 src/msw/utils.cpp          |  9 ++++++---
 5 files changed, 33 insertions(+), 8 deletions(-)

diff --git a/docs/latex/wx/function.tex b/docs/latex/wx/function.tex
index dcca717867..1cc593dd6b 100644
--- a/docs/latex/wx/function.tex
+++ b/docs/latex/wx/function.tex
@@ -1388,10 +1388,13 @@ Both {\it major} and {\it minor} have to be looked at as hexadecimal numbers. So
 \twocolitem{Motif}{Return value is wxMOTIF\_X, {\it major} is X version, {\it minor} is X revision.}
 \twocolitem{OS/2}{Return value is wxOS2\_PM.}
 \twocolitem{Windows 3.1}{Return value is wxWINDOWS, {\it major} is 3, {\it minor} is 1.}
-\twocolitem{Windows NT/2000}{Return value is wxWINDOWS\_NT, version is returned in {\it major} and {\it minor}}
+\twocolitem{Windows NT/2000}{Return value is wxWINDOWS\_NT, version is returned in {\it major} and {\it minor}.}
 \twocolitem{Windows 98}{Return value is wxWIN95, {\it major} is 4, {\it minor} is 1 or greater.}
 \twocolitem{Windows 95}{Return value is wxWIN95, {\it major} is 4, {\it minor} is 0.}
 \twocolitem{Win32s (Windows 3.1)}{Return value is wxWIN32S, {\it major} is 3, {\it minor} is 1.}
+\twocolitem{Windows PocketPC}{Return value is wxWINDOWS\_POCKETPC, version is returned in {\it major} and {\it minor}.}
+\twocolitem{Windows Smartphone}{Return value is wxWINDOWS\_SMARTPHONE, version is returned in {\it major} and {\it minor}.}
+\twocolitem{Windows CE (non-specific)}{Return value is wxWINDOWS\_CE, version is returned in {\it major} and {\it minor}.}
 \twocolitem{Watcom C++ 386 supervisor mode (Windows 3.1)}{Return value is wxWIN386, {\it major} is 3, {\it minor} is 1.}
 \end{twocollist}
 
diff --git a/docs/latex/wx/wxmsw.tex b/docs/latex/wx/wxmsw.tex
index 027f1d5074..637a048123 100644
--- a/docs/latex/wx/wxmsw.tex
+++ b/docs/latex/wx/wxmsw.tex
@@ -34,7 +34,7 @@ the amount of spacing used by sizers, for which you can
 use a macro such as this:
 
 \begin{verbatim}
-#if defined(__WXWINCE__
+#if defined(__WXWINCE__)
     #define wxLARGESMALL(large,small) small
 #else
     #define wxLARGESMALL(large,small) large
@@ -52,8 +52,17 @@ You can test the return value of wxSystemSettings::GetScreenType()
 for a qualitative assessment of what kind of display is available,
 or use wxGetDisplaySize() if you need more information.
 
+You can also use wxGetOsVersion to test for a version of Windows CE at
+run-time (see the next section). However, because different builds
+are currently required to target different kinds of device, these
+values are hard-wired according to the build, and you cannot
+dynamically adapt the same executable for different major Windows CE
+platforms. This would require a different approach to the way
+wxWidgets adapts its behaviour (such as for menubars) to suit the
+style of device.
+
 See the "Life!" example (demos/life) for an example of
-an application that has been tailored for Windows CE use.
+an application that has been tailored for PocketPC and Smartphone use.
 
 \subsubsection{Testing for WinCE SDKs}
 
@@ -70,6 +79,14 @@ Use these preprocessor symbols to test for the different types of device or SDK:
 \twocolitem{\_\_WINCE\_NET\_\_}{Microsoft-powered Windows CE .NET devices (\_WIN32\_WCE is 400 or greater)}
 \end{twocollist}
 
+wxGetOsVersion will return these values:
+
+\begin{twocollist}\itemsep=0pt
+\twocolitem{wxWINDOWS\_POCKETPC}{The application is running under PocketPC.}
+\twocolitem{wxWINDOWS\_SMARTPHONE}{The application is running under Smartphone.}
+\twocolitem{wxWINDOWS\_CE}{The application is running under Windows CE (built with the Standard SDK).}
+\end{twocollist}
+
 \subsubsection{Window sizing in wxWinCE}
 
 When creating frames and dialogs, create them with wxDefaultPosition and
diff --git a/include/wx/defs.h b/include/wx/defs.h
index c06c812e44..7d360b82fd 100644
--- a/include/wx/defs.h
+++ b/include/wx/defs.h
@@ -604,7 +604,9 @@ enum
     wxWIN32S,                 /*  Windows 32S API */
     wxWIN95,                  /*  Windows 95 */
     wxWIN386,                 /*  Watcom 32-bit supervisor modus */
-    wxWINDOWS_CE,             /*  Windows CE */
+    wxWINDOWS_CE,             /*  Windows CE (generic) */
+    wxWINDOWS_POCKETPC,       /*  Windows CE PocketPC */
+    wxWINDOWS_SMARTPHONE,     /*  Windows CE Smartphone */
     wxMGL_UNIX,               /*  MGL with direct hardware access */
     wxMGL_X,                  /*  MGL on X */
     wxMGL_WIN32,              /*  MGL on Win32 */
diff --git a/src/msw/app.cpp b/src/msw/app.cpp
index b399d62aaa..64ea131143 100644
--- a/src/msw/app.cpp
+++ b/src/msw/app.cpp
@@ -279,7 +279,7 @@ bool wxApp::Initialize(int& argc, wxChar **argv)
     // program under Win9x w/o MSLU emulation layer - if so, abort right now
     // as it has no chance to work
 #if wxUSE_UNICODE && !wxUSE_UNICODE_MSLU
-    if ( wxGetOsVersion() != wxWINDOWS_NT && wxGetOsVersion() != wxWINDOWS_CE )
+    if ( wxGetOsVersion() != wxWINDOWS_NT && wxGetOsVersion() != wxWINDOWS_CE && wxGetOsVersion() != wxWINDOWS_SMARTPHONE && wxGetOsVersion() != wxWINDOWS_POCKETPC )
     {
         // note that we can use MessageBoxW() as it's implemented even under
         // Win9x - OTOH, we can't use wxGetTranslation() because the file APIs
diff --git a/src/msw/utils.cpp b/src/msw/utils.cpp
index cb4eba0172..09cf9f13fe 100644
--- a/src/msw/utils.cpp
+++ b/src/msw/utils.cpp
@@ -1210,6 +1210,11 @@ wxToolkitInfo& wxAppTraits::GetToolkitInfo()
             s_major = info.dwMajorVersion;
             s_minor = info.dwMinorVersion;
 
+#ifdef __SMARTPHONE__
+            s_ver = wxWINDOWS_SMARTPHONE;
+#elif defined(__POCKETPC__)
+            s_ver = wxWINDOWS_POCKETPC;
+#else
             switch ( info.dwPlatformId )
             {
                 case VER_PLATFORM_WIN32s:
@@ -1223,12 +1228,10 @@ wxToolkitInfo& wxAppTraits::GetToolkitInfo()
                 case VER_PLATFORM_WIN32_NT:
                     s_ver = wxWINDOWS_NT;
                     break;
-#ifdef __WXWINCE__
                 case VER_PLATFORM_WIN32_CE:
                     s_ver = wxWINDOWS_CE;
-                    break;
-#endif
             }
+#endif            
         }
     }
 
-- 
2.50.0

