wxPlatformInfo (patch 1532064)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@40599 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -323,6 +323,7 @@ IMPORTANT: please read docs/tech/tn0016.txt before modifying this file!
|
|||||||
src/common/module.cpp
|
src/common/module.cpp
|
||||||
src/common/mstream.cpp
|
src/common/mstream.cpp
|
||||||
src/common/object.cpp
|
src/common/object.cpp
|
||||||
|
src/common/platinfo.cpp
|
||||||
src/common/powercmn.cpp
|
src/common/powercmn.cpp
|
||||||
src/common/process.cpp
|
src/common/process.cpp
|
||||||
src/common/regex.cpp
|
src/common/regex.cpp
|
||||||
@@ -421,6 +422,7 @@ IMPORTANT: please read docs/tech/tn0016.txt before modifying this file!
|
|||||||
wx/mstream.h
|
wx/mstream.h
|
||||||
wx/object.h
|
wx/object.h
|
||||||
wx/platform.h
|
wx/platform.h
|
||||||
|
wx/platinfo.h
|
||||||
wx/power.h
|
wx/power.h
|
||||||
wx/process.h
|
wx/process.h
|
||||||
wx/ptr_scpd.h
|
wx/ptr_scpd.h
|
||||||
|
@@ -51,6 +51,7 @@ Major changes in 2.7 release
|
|||||||
All:
|
All:
|
||||||
|
|
||||||
- Added wxDir::FindFirst() (Francesco Montorsi)
|
- Added wxDir::FindFirst() (Francesco Montorsi)
|
||||||
|
- Added wxPlatformInfo class (Francesco Montorsi)
|
||||||
|
|
||||||
All (GUI):
|
All (GUI):
|
||||||
|
|
||||||
|
@@ -36,12 +36,27 @@ None
|
|||||||
\latexignore{\rtfignore{\wxheading{Members}}}
|
\latexignore{\rtfignore{\wxheading{Members}}}
|
||||||
|
|
||||||
|
|
||||||
\membersection{wxAppTraits::GetToolkitInfo}\label{wxapptraitsgettoolkitinfo}
|
\membersection{wxAppTraits::GetPlatformInfo}\label{wxapptraitsgetplatforminfo}
|
||||||
|
|
||||||
\func{virtual wxToolkitInfo \&}{GetToolkitInfo}{\void}
|
\func{virtual wxPlatformInfo \&}{GetPlatformInfo}{\void}
|
||||||
|
|
||||||
|
Returns information about which platform is the program running on.
|
||||||
|
See \helpref{wxPlatformInfo}{wxplatforminfo} for more details.
|
||||||
|
|
||||||
|
|
||||||
|
\membersection{wxAppTraits::GetToolkitVersion}\label{wxapptraitsgettoolkitversion}
|
||||||
|
|
||||||
|
\func{virtual wxPortId}{GetToolkitVersion}{\param{int *}{major = NULL}, \param{int *}{minor = NULL}}
|
||||||
|
|
||||||
|
Returns the wxWidgets port ID used by the running program and eventually
|
||||||
|
fills the given pointers with the values of the major and minor digits
|
||||||
|
of the native toolkit currently used.
|
||||||
|
|
||||||
|
E.g. if your program is using wxGTK port this function will return wxPORT_GTK and
|
||||||
|
put in given pointers the versions of the GTK library in use.
|
||||||
|
|
||||||
|
See \helpref{wxPlatformInfo}{wxplatforminfo} for more details.
|
||||||
|
|
||||||
Returns information about which toolkit is running. See \helpref{wxToolkitInfo}{wxtoolkitinfo}
|
|
||||||
for more details.
|
|
||||||
|
|
||||||
|
|
||||||
\membersection{wxAppTraits::HasStderr}\label{wxapptraitshasstderr}
|
\membersection{wxAppTraits::HasStderr}\label{wxapptraitshasstderr}
|
||||||
|
@@ -264,6 +264,7 @@
|
|||||||
\input pathlist.tex
|
\input pathlist.tex
|
||||||
\input pen.tex
|
\input pen.tex
|
||||||
\input pickerbase.tex
|
\input pickerbase.tex
|
||||||
|
\input platinfo.tex
|
||||||
\input point.tex
|
\input point.tex
|
||||||
\input postscpt.tex
|
\input postscpt.tex
|
||||||
\input powerevt.tex
|
\input powerevt.tex
|
||||||
|
@@ -173,6 +173,8 @@ the corresponding topic.
|
|||||||
\helpref{wxIsEmpty}{wxisempty}\\
|
\helpref{wxIsEmpty}{wxisempty}\\
|
||||||
\helpref{wxIsMainThread}{wxismainthread}\\
|
\helpref{wxIsMainThread}{wxismainthread}\\
|
||||||
\helpref{wxIsNaN}{wxisnan}\\
|
\helpref{wxIsNaN}{wxisnan}\\
|
||||||
|
\helpref{wxIsPlatformLittleEndian}{wxisplatformlittleendian}\\
|
||||||
|
\helpref{wxIsPlatform64Bit}{wxisplatform64bit}\\
|
||||||
\helpref{wxIsWild}{wxiswild}\\
|
\helpref{wxIsWild}{wxiswild}\\
|
||||||
\helpref{wxKill}{wxkill}\\
|
\helpref{wxKill}{wxkill}\\
|
||||||
\helpref{wxLaunchDefaultBrowser}{wxlaunchdefaultbrowser}\\
|
\helpref{wxLaunchDefaultBrowser}{wxlaunchdefaultbrowser}\\
|
||||||
@@ -1404,32 +1406,49 @@ user-readable form. For example, this function may return strings like
|
|||||||
|
|
||||||
\membersection{::wxGetOsVersion}\label{wxgetosversion}
|
\membersection{::wxGetOsVersion}\label{wxgetosversion}
|
||||||
|
|
||||||
\func{int}{wxGetOsVersion}{\param{int *}{major = NULL}, \param{int *}{minor = NULL}}
|
\func{wxOperatingSystemId}{wxGetOsVersion}{\param{int *}{major = NULL}, \param{int *}{minor = NULL}}
|
||||||
|
|
||||||
Gets operating system version information.
|
Gets the version and the operating system ID for currently running OS.
|
||||||
|
See \helpref{wxPlatformInfo}{wxplatforminfo} for more details about wxOperatingSystemId.
|
||||||
\begin{twocollist}\itemsep=0pt
|
|
||||||
\twocolitemruled{Platform}{Return types}
|
|
||||||
\twocolitem{Mac OS}{Return value is wxMAC when compiled with CodeWarrior under Mac OS 8.x/9.x and Mac OS X, wxMAC\_DARWIN when compiled with the Apple Developer Tools under Mac OS X.
|
|
||||||
|
|
||||||
Both {\it major} and {\it minor} have to be looked at as hexadecimal numbers. So System 10.2.4 returns 0x10, resp 16 for {\it major} and 0x24, resp 36 for {\it minor}. }
|
|
||||||
\twocolitem{GTK}{Return value is wxGTK, For GTK 1.0, {\it major} is 1, {\it minor} is 0. }
|
|
||||||
\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 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}
|
|
||||||
|
|
||||||
\wxheading{See also}
|
\wxheading{See also}
|
||||||
|
|
||||||
\helpref{::wxGetOsDescription}{wxgetosdescription}
|
\helpref{::wxGetOsDescription}{wxgetosdescription},
|
||||||
|
\helpref{wxPlatformInfo}{wxplatforminfo}
|
||||||
|
|
||||||
|
\wxheading{Include files}
|
||||||
|
|
||||||
|
<wx/utils.h>
|
||||||
|
|
||||||
|
|
||||||
|
\membersection{::wxIsPlatformLittleEndian}\label{wxisplatformlittleendian}
|
||||||
|
|
||||||
|
\func{bool}{wxIsPlatformLittleEndian}{\void}
|
||||||
|
|
||||||
|
Returns \true if the current platform is little endian (instead of big endian).
|
||||||
|
The check is performed at run-time.
|
||||||
|
|
||||||
|
\wxheading{See also}
|
||||||
|
|
||||||
|
\helpref{Byte order macros}{byteordermacros}
|
||||||
|
|
||||||
|
\wxheading{Include files}
|
||||||
|
|
||||||
|
<wx/utils.h>
|
||||||
|
|
||||||
|
|
||||||
|
\membersection{::wxIsPlatform64Bit}\label{wxisplatform64bit}
|
||||||
|
|
||||||
|
\func{bool}{wxIsPlatform64Bit}{\void}
|
||||||
|
|
||||||
|
Returns \true if the operating system the program is running under is 64 bit.
|
||||||
|
The check is performed at run-time and may differ from the value available at
|
||||||
|
compile-time (at compile-time you can just check if {\tt sizeof(void*)==8})
|
||||||
|
since the program could be running in emulation mode or in a mixed 32/64 bit system
|
||||||
|
(bi-architecture operating system).
|
||||||
|
|
||||||
|
Very important: this function is not 100\% reliable on some systems given the fact
|
||||||
|
that there isn't always a standard way to do a reliable check on the OS architecture.
|
||||||
|
|
||||||
\wxheading{Include files}
|
\wxheading{Include files}
|
||||||
|
|
||||||
|
392
docs/latex/wx/platinfo.tex
Normal file
392
docs/latex/wx/platinfo.tex
Normal file
@@ -0,0 +1,392 @@
|
|||||||
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
|
%% Name: platinfo.tex
|
||||||
|
%% Purpose: wxPlatformInfo
|
||||||
|
%% Author: Francesco Montorsi
|
||||||
|
%% Modified by:
|
||||||
|
%% Created: 31-7-2006
|
||||||
|
%% RCS-ID: $Id$
|
||||||
|
%% Copyright: (c) wxWidgets Team
|
||||||
|
%% License: wxWindows license
|
||||||
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
|
|
||||||
|
\section{\class{wxPlatformInfo}}\label{wxplatforminfo}
|
||||||
|
|
||||||
|
This class holds informations about the operating system and the toolkit that the application
|
||||||
|
is running under and some basic architecture info of the machine where it's running.
|
||||||
|
|
||||||
|
\wxheading{Derived from}
|
||||||
|
|
||||||
|
\helpref{wxObject}{wxobject}
|
||||||
|
|
||||||
|
\wxheading{Include files}
|
||||||
|
|
||||||
|
<include/wx/platinfo.h>
|
||||||
|
|
||||||
|
\wxheading{See also}
|
||||||
|
|
||||||
|
\helpref{wxGetOSVersion}{wxgetosversion}, \helpref{wxIsPlatformLittleEndian}{wxisplatformlittleendian},
|
||||||
|
\helpref{wxIsPlatform64Bit}{wxisplatform64bit}, \helpref{wxAppTraits}{wxapptraits}
|
||||||
|
|
||||||
|
\wxheading{Data structures}
|
||||||
|
|
||||||
|
The following are the operating systems which are recognized by wxWidgets
|
||||||
|
and whose version can be detected at run-time. The values of the constants
|
||||||
|
are chosen so that they can be combined as flags; this allows to check
|
||||||
|
for operating system {\it families} like e.g. wxOS\_MAC and wxOS\_UNIX.
|
||||||
|
|
||||||
|
\begin{verbatim}
|
||||||
|
enum wxOperatingSystemId
|
||||||
|
{
|
||||||
|
wxOS_UNKNOWN = 0, // returned on error
|
||||||
|
|
||||||
|
wxOS_MAC_OS = 1 << 0, // Apple Mac OS 8/9/X with Mac paths
|
||||||
|
wxOS_MAC_OSX_DARWIN = 1 << 1, // Apple Mac OS X with Unix paths
|
||||||
|
wxOS_MAC = wxOS_MAC_OS|wxOS_MAC_OSX_DARWIN,
|
||||||
|
|
||||||
|
wxOS_WINDOWS_9X = 1 << 2, // Windows 9x family (95/98/ME)
|
||||||
|
wxOS_WINDOWS_NT = 1 << 3, // Windows NT family (NT/2000/XP)
|
||||||
|
wxOS_WINDOWS_MICRO = 1 << 4, // MicroWindows
|
||||||
|
wxOS_WINDOWS_CE = 1 << 5, // Windows CE (Window Mobile)
|
||||||
|
wxOS_WINDOWS = wxOS_WINDOWS_9X |
|
||||||
|
wxOS_WINDOWS_NT |
|
||||||
|
wxOS_WINDOWS_MICRO |
|
||||||
|
wxOS_WINDOWS_CE,
|
||||||
|
|
||||||
|
wxOS_UNIX_LINUX = 1 << 6, // Linux
|
||||||
|
wxOS_UNIX_FREEBSD = 1 << 7, // FreeBSD
|
||||||
|
wxOS_UNIX_OPENBSD = 1 << 8, // OpenBSD
|
||||||
|
wxOS_UNIX_NETBSD = 1 << 9, // NetBSD
|
||||||
|
wxOS_UNIX_SOLARIS = 1 << 10, // SunOS
|
||||||
|
wxOS_UNIX_AIX = 1 << 11, // AIX
|
||||||
|
wxOS_UNIX_HPUX = 1 << 12, // HP/UX
|
||||||
|
wxOS_UNIX = wxOS_UNIX_LINUX |
|
||||||
|
wxOS_UNIX_FREEBSD |
|
||||||
|
wxOS_UNIX_OPENBSD |
|
||||||
|
wxOS_UNIX_NETBSD |
|
||||||
|
wxOS_UNIX_SOLARIS |
|
||||||
|
wxOS_UNIX_AIX |
|
||||||
|
wxOS_UNIX_HPUX,
|
||||||
|
|
||||||
|
wxOS_DOS = 1 << 15, // Microsoft DOS
|
||||||
|
wxOS_OS2 = 1 << 16 // OS/2
|
||||||
|
};
|
||||||
|
\end{verbatim}
|
||||||
|
|
||||||
|
The list of wxWidgets ports. Some of them can be used with more than
|
||||||
|
a single (native) toolkit; e.g. wxWinCE port sources can be used with
|
||||||
|
smartphones, pocket PCs and handheld devices SDKs.
|
||||||
|
|
||||||
|
\begin{verbatim}
|
||||||
|
enum wxPortId
|
||||||
|
{
|
||||||
|
wxPORT_UNKNOWN = 0, // returned on error
|
||||||
|
|
||||||
|
wxPORT_BASE = 1 << 0, // wxBase, no native toolkit used
|
||||||
|
|
||||||
|
wxPORT_MSW = 1 << 1, // wxMSW, native toolkit is Windows API
|
||||||
|
wxPORT_MOTIF = 1 << 2, // wxMotif, using [Open]Motif or Lesstif
|
||||||
|
wxPORT_GTK = 1 << 3, // wxGTK, using GTK+ 1.x, 2.x, GPE or Maemo
|
||||||
|
wxPORT_MGL = 1 << 4, // wxMGL, using wxUniversal
|
||||||
|
wxPORT_X11 = 1 << 5, // wxX11, using wxUniversal
|
||||||
|
wxPORT_OS2 = 1 << 6, // wxOS2, using OS/2 Presentation Manager
|
||||||
|
wxPORT_MAC = 1 << 7, // wxMac, using Carbon or Classic Mac API
|
||||||
|
wxPORT_COCOA = 1 << 8, // wxCocoa, using Cocoa NextStep/Mac API
|
||||||
|
wxPORT_WINCE = 1 << 9, // wxWinCE, toolkit is WinCE SDK API
|
||||||
|
wxPORT_PALMOS = 1 << 10 // wxPalmOS, toolkit is PalmOS API
|
||||||
|
};
|
||||||
|
\end{verbatim}
|
||||||
|
|
||||||
|
The architecture of the operating system (regardless of the build environment
|
||||||
|
of wxWidgets library - see \helpref{wxIsPlatform64bit}{wxisplatform64bit} documentation
|
||||||
|
for more info).
|
||||||
|
|
||||||
|
\begin{verbatim}
|
||||||
|
enum wxArchitecture
|
||||||
|
{
|
||||||
|
wxARCH_INVALID = -1, // returned on error
|
||||||
|
|
||||||
|
wxARCH_32, // 32 bit
|
||||||
|
wxARCH_64,
|
||||||
|
|
||||||
|
wxARCH_MAX
|
||||||
|
}
|
||||||
|
\end{verbatim}
|
||||||
|
|
||||||
|
The endian-ness of the machine.
|
||||||
|
|
||||||
|
\begin{verbatim}
|
||||||
|
enum wxEndianness
|
||||||
|
{
|
||||||
|
wxENDIAN_INVALID = -1, // returned on error
|
||||||
|
|
||||||
|
wxENDIAN_BIG, // 4321
|
||||||
|
wxENDIAN_LITTLE, // 1234
|
||||||
|
wxENDIAN_PDP, // 3412
|
||||||
|
|
||||||
|
wxENDIAN_MAX
|
||||||
|
}
|
||||||
|
\end{verbatim}
|
||||||
|
|
||||||
|
\latexignore{\rtfignore{\wxheading{Members}}}
|
||||||
|
|
||||||
|
|
||||||
|
\membersection{wxPlatformInfo::wxPlatformInfo}\label{wxplatforminfowxplatforminfo}
|
||||||
|
|
||||||
|
\func{}{wxPlatformInfo}{}
|
||||||
|
|
||||||
|
Initializes the instance with the values corresponding to the currently running platform.
|
||||||
|
|
||||||
|
\func{}{wxPlatformInfo}{\param{wxPortId }{pid = wxPORT\_UNKNOWN}, \param{int }{tkMajor = -1}, \param{int }{tkMinor = -1}, \param{wxOperatingSystemId }{id = wxOS\_UNKNOWN}, \param{int }{osMajor = -1}, \param{int }{osMinor = -1}, \param{wxArchitecture }{arch = wxARCH\_INVALID}, \param{wxEndianness }{endian = wxENDIAN\_INVALID}}
|
||||||
|
|
||||||
|
Initializes the object using given values.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
\membersection{wxPlatformInfo::GetArch}\label{wxplatforminfogetarch}
|
||||||
|
|
||||||
|
\func{static wxArchitecture}{GetArch}{\param{const wxString\& }{arch}}
|
||||||
|
|
||||||
|
Converts the given string to a wxArchitecture enum value or to
|
||||||
|
wxARCH_INVALID if the given string is not a valid architecture string
|
||||||
|
(i.e. does not contain nor {\tt 32} nor {\tt 64} strings).
|
||||||
|
|
||||||
|
|
||||||
|
\membersection{wxPlatformInfo::GetArchName}\label{wxplatforminfogetarchname}
|
||||||
|
|
||||||
|
\func{static wxString}{GetArchName}{\param{wxArchitecture }{arch}}
|
||||||
|
|
||||||
|
Returns the name for the given wxArchitecture enumeration value.
|
||||||
|
|
||||||
|
\constfunc{wxString}{GetArchName}{\void}
|
||||||
|
|
||||||
|
Returns the name for the architecture of this wxPlatformInfo instance.
|
||||||
|
|
||||||
|
|
||||||
|
\membersection{wxPlatformInfo::GetArchitecture}\label{wxplatforminfogetarchitecture}
|
||||||
|
|
||||||
|
\constfunc{wxArchitecture}{GetArchitecture}{\void}
|
||||||
|
|
||||||
|
Returns the architecture ID of this wxPlatformInfo instance.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
\membersection{wxPlatformInfo::GetEndianness}\label{wxplatforminfogetendianness}
|
||||||
|
|
||||||
|
\func{static wxEndianness}{GetEndianness}{\param{const wxString\& }{end}}
|
||||||
|
|
||||||
|
Converts the given string to a wxEndianness enum value or to
|
||||||
|
wxENDIAN_INVALID if the given string is not a valid endianness string
|
||||||
|
(i.e. does not contain nor {\tt little} nor {\tt big} strings).
|
||||||
|
|
||||||
|
\constfunc{wxEndianness}{GetEndianness}{\void}
|
||||||
|
|
||||||
|
Returns the endianness ID of this wxPlatformInfo instance.
|
||||||
|
|
||||||
|
\membersection{wxPlatformInfo::GetEndiannessName}\label{wxplatforminfogetendiannessname}
|
||||||
|
|
||||||
|
\func{static wxString}{GetEndiannessName}{\param{wxEndianness }{end}}
|
||||||
|
|
||||||
|
Returns name for the given wxEndianness enumeration value.
|
||||||
|
|
||||||
|
\constfunc{wxString}{GetEndiannessName}{\void}
|
||||||
|
|
||||||
|
Returns the name for the endianness of this wxPlatformInfo instance.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
\membersection{wxPlatformInfo::GetOSMajorVersion}\label{wxplatforminfogetosmajorversion}
|
||||||
|
|
||||||
|
\constfunc{int}{GetOSMajorVersion}{\void}
|
||||||
|
|
||||||
|
Returns the major version of the OS associated with this wxPlatformInfo instance.
|
||||||
|
|
||||||
|
\membersection{wxPlatformInfo::GetOSMinorVersion}\label{wxplatforminfogetosminorversion}
|
||||||
|
|
||||||
|
\constfunc{int}{GetOSMinorVersion}{\void}
|
||||||
|
|
||||||
|
Returns the minor version of the OS associated with this wxPlatformInfo instance.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
\membersection{wxPlatformInfo::GetOperatingSystemFamilyName}\label{wxplatforminfogetoperatingsystemfamilyname}
|
||||||
|
|
||||||
|
\func{static wxString}{GetOperatingSystemFamilyName}{\param{wxOperatingSystemId }{os}}
|
||||||
|
|
||||||
|
Returns the operating system family name for the given wxOperatingSystemId enumeration value:
|
||||||
|
{\tt Unix} for wxOS_UNIX, {\tt Macintosh} for wxOS_MAC, {\tt Windows} for wxOS_WINDOWS,
|
||||||
|
{\tt DOS} for wxOS_DOS, {\tt OS/2} for wxOS_OS2.
|
||||||
|
|
||||||
|
\constfunc{wxString}{GetOperatingSystemFamilyName}{\void}
|
||||||
|
|
||||||
|
Returns the operating system family name of the OS associated with this wxPlatformInfo instance.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
\membersection{wxPlatformInfo::GetOperatingSystemId}\label{wxplatforminfogetoperatingsystemid}
|
||||||
|
|
||||||
|
\func{static wxOperatingSystemId}{GetOperatingSystemId}{\param{const wxString\& }{name}}
|
||||||
|
|
||||||
|
Converts the given string to a wxOperatingSystemId enum value or to
|
||||||
|
wxOS_UNKNOWN if the given string is not a valid operating system name.
|
||||||
|
|
||||||
|
\constfunc{wxOperatingSystemId}{GetOperatingSystemId}{\void}
|
||||||
|
|
||||||
|
Returns the operating system ID of this wxPlatformInfo instance.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
\membersection{wxPlatformInfo::GetOperatingSystemIdName}\label{wxplatforminfogetoperatingsystemidname}
|
||||||
|
|
||||||
|
\func{static wxString}{GetOperatingSystemIdName}{\param{wxOperatingSystemId }{os}}
|
||||||
|
|
||||||
|
Returns the name for the given operating system ID value. This can be a long name
|
||||||
|
(e.g. {\tt Microsoft Windows NT}); use \helpref{GetOperatingSystemFamilyName}{wxplatforminfogetoperatingsystemfamilyname} to
|
||||||
|
retrieve a short, generic name.
|
||||||
|
|
||||||
|
|
||||||
|
\constfunc{wxString}{GetOperatingSystemIdName}{\void}
|
||||||
|
|
||||||
|
Returns the operating system name of the OS associated with this wxPlatformInfo instance.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
\membersection{wxPlatformInfo::GetPortId}\label{wxplatforminfogetportid}
|
||||||
|
|
||||||
|
\func{static wxPortId}{GetPortId}{\param{const wxString\& }{portname}}
|
||||||
|
|
||||||
|
Converts the given string to a wxWidgets port ID value or to wxPORT_UNKNOWN if
|
||||||
|
the given string does not match any of the wxWidgets canonical name ports ("wxGTK", "wxMSW", etc)
|
||||||
|
nor any of the short wxWidgets name ports ("gtk", "msw", etc).
|
||||||
|
|
||||||
|
\constfunc{wxPortId}{GetPortId}{\void}
|
||||||
|
|
||||||
|
Returns the wxWidgets port ID associated with this wxPlatformInfo instance.
|
||||||
|
|
||||||
|
\membersection{wxPlatformInfo::GetPortIdName}\label{wxplatforminfogetportidname}
|
||||||
|
|
||||||
|
\func{static wxString}{GetPortIdName}{\param{wxPortId }{port}}
|
||||||
|
|
||||||
|
Returns the name of the given wxWidgets port ID value. The returned string always starts with
|
||||||
|
the "wx" prefix and is a mixed-case string.
|
||||||
|
|
||||||
|
\constfunc{wxString}{GetPortIdName}{\void}
|
||||||
|
|
||||||
|
Returns the name of the wxWidgets port ID associated with this wxPlatformInfo instance.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
\membersection{wxPlatformInfo::GetPortIdShortName}\label{wxplatforminfogetportidshortname}
|
||||||
|
|
||||||
|
\func{static wxString}{GetPortIdShortName}{\param{wxPortId }{port}}
|
||||||
|
|
||||||
|
Returns the short name of the given wxWidgets port ID value. The returned string does not start with
|
||||||
|
the "wx" prefix and is always lower case.
|
||||||
|
|
||||||
|
\constfunc{wxString}{GetPortIdShortName}{\void}
|
||||||
|
|
||||||
|
Returns the short name of the wxWidgets port ID associated with this wxPlatformInfo instance.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
\membersection{wxPlatformInfo::GetToolkitMajorVersion}\label{wxplatforminfogettoolkitmajorversion}
|
||||||
|
|
||||||
|
\constfunc{int}{GetToolkitMajorVersion}{\void}
|
||||||
|
|
||||||
|
Returns the major version of the toolkit associated with this wxPlatformInfo instance.
|
||||||
|
Note that if {GetPortId}{wxplatforminfogetportid} returns wxPORT_BASE, then this value is zero (unless externally modified with SetToolkitVersion); that is, no native toolkit is in use.
|
||||||
|
|
||||||
|
\membersection{wxPlatformInfo::GetToolkitMinorVersion}\label{wxplatforminfogettoolkitminorversion}
|
||||||
|
|
||||||
|
\constfunc{int}{GetToolkitMinorVersion}{\void}
|
||||||
|
|
||||||
|
Returns the minor version of the toolkit associated with this wxPlatformInfo instance.
|
||||||
|
Note that if {GetPortId}{wxplatforminfogetportid} returns wxPORT_BASE, then this value is zero (unless externally modified with SetToolkitVersion); that is, no native toolkit is in use.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
\membersection{wxPlatformInfo::IsOk}\label{wxplatforminfoisok}
|
||||||
|
|
||||||
|
\constfunc{bool}{IsOk}{\void}
|
||||||
|
|
||||||
|
Returns \true if this instance is fully initialized with valid values.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
\membersection{wxPlatformInfo::IsUsingUniversalWidgets}\label{wxplatforminfoisusinguniversalwidgets}
|
||||||
|
|
||||||
|
\func{bool}{IsUsingUniversalWidgets}{\void}
|
||||||
|
|
||||||
|
Returns \true if __WXUNIVERSAL__ symbol is defined. Note that this function always
|
||||||
|
returns a constant value defined at compile-time and exists just for completeness.
|
||||||
|
|
||||||
|
|
||||||
|
\membersection{wxPlatformInfo::SetArchitecture}\label{wxplatforminfosetarchitecture}
|
||||||
|
|
||||||
|
\func{void}{SetArchitecture}{\param{wxArchitecture }{n}}
|
||||||
|
|
||||||
|
Sets the architecture enum value associated with this wxPlatformInfo instance.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
\membersection{wxPlatformInfo::SetEndianness}\label{wxplatforminfosetendianness}
|
||||||
|
|
||||||
|
\func{void}{SetEndianness}{\param{wxEndianness }{n}}
|
||||||
|
|
||||||
|
Sets the endianness enum value associated with this wxPlatformInfo instance.
|
||||||
|
|
||||||
|
|
||||||
|
\membersection{wxPlatformInfo::SetOSVersion}\label{wxplatforminfosetosversion}
|
||||||
|
|
||||||
|
\func{void}{SetOSVersion}{\param{int }{major}, \param{int }{minor}}
|
||||||
|
|
||||||
|
Sets the version of the operating system associated with this wxPlatformInfo instance.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
\membersection{wxPlatformInfo::SetOperatingSystemId}\label{wxplatforminfosetoperatingsystemid}
|
||||||
|
|
||||||
|
\func{void}{SetOperatingSystemId}{\param{wxOperatingSystemId }{n}}
|
||||||
|
|
||||||
|
Sets the operating system associated with this wxPlatformInfo instance.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
\membersection{wxPlatformInfo::SetPortId}\label{wxplatforminfosetportid}
|
||||||
|
|
||||||
|
\func{void}{SetPortId}{\param{wxPortId }{n}}
|
||||||
|
|
||||||
|
Sets the wxWidgets port ID associated with this wxPlatformInfo instance.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
\membersection{wxPlatformInfo::SetToolkitVersion}\label{wxplatforminfosettoolkitversion}
|
||||||
|
|
||||||
|
\func{void}{SetToolkitVersion}{\param{int }{major}, \param{int }{minor}}
|
||||||
|
|
||||||
|
Sets the version of the toolkit associated with this wxPlatformInfo instance.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
\membersection{wxPlatformInfo::operator!=}\label{wxplatforminfooperatorunknown}
|
||||||
|
|
||||||
|
\constfunc{bool}{operator!=}{\param{const wxPlatformInfo\& }{t}}
|
||||||
|
|
||||||
|
Inequality operator. Tests all class' internal variables.
|
||||||
|
|
||||||
|
|
||||||
|
\membersection{wxPlatformInfo::operator==}\label{wxplatforminfooperatorequal}
|
||||||
|
|
||||||
|
\constfunc{bool}{operator==}{\param{const wxPlatformInfo\& }{t}}
|
||||||
|
|
||||||
|
Equality operator. Tests all class' internal variables.
|
||||||
|
|
@@ -13,6 +13,7 @@
|
|||||||
#define _WX_APPTRAIT_H_
|
#define _WX_APPTRAIT_H_
|
||||||
|
|
||||||
#include "wx/string.h"
|
#include "wx/string.h"
|
||||||
|
#include "wx/platinfo.h"
|
||||||
|
|
||||||
class WXDLLIMPEXP_BASE wxObject;
|
class WXDLLIMPEXP_BASE wxObject;
|
||||||
class WXDLLEXPORT wxAppTraits;
|
class WXDLLEXPORT wxAppTraits;
|
||||||
@@ -26,24 +27,6 @@ class WXDLLIMPEXP_BASE wxString;
|
|||||||
|
|
||||||
class GSocketGUIFunctionsTable;
|
class GSocketGUIFunctionsTable;
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
|
||||||
// toolkit information
|
|
||||||
// ----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
// Information about the toolkit that the app is running under (e.g. wxMSW):
|
|
||||||
struct WXDLLIMPEXP_BASE wxToolkitInfo
|
|
||||||
{
|
|
||||||
// Short name of the toolkit (e.g. "msw" or "mswuniv"); empty for console:
|
|
||||||
wxString shortName;
|
|
||||||
// Descriptive name of the toolkit, human readable (e.g. "wxMSW" or
|
|
||||||
// "wxMSW/Universal"); "wxBase" for console apps:
|
|
||||||
wxString name;
|
|
||||||
// Version of the underlying toolkit or of the OS for console apps:
|
|
||||||
int versionMajor, versionMinor;
|
|
||||||
// OS mnenomics, e.g. wxGTK or wxMSW:
|
|
||||||
int os;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// wxAppTraits: this class defines various configurable aspects of wxApp
|
// wxAppTraits: this class defines various configurable aspects of wxApp
|
||||||
@@ -127,15 +110,10 @@ public:
|
|||||||
virtual GSocketGUIFunctionsTable* GetSocketGUIFunctionsTable() = 0;
|
virtual GSocketGUIFunctionsTable* GetSocketGUIFunctionsTable() = 0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// return information about the (native) toolkit currently used;
|
||||||
// return information about what toolkit is running; we need for two things
|
// returns wxPORT_BASE for console applications and one of the remaining
|
||||||
// that are both contained in wxBase:
|
// wxPORT_* values for GUI applications.
|
||||||
// - wxGetOsVersion() behaves differently in GUI and non-GUI builds under
|
virtual wxPortId GetToolkitVersion(int *majVer, int *minVer) const = 0;
|
||||||
// Unix: in the former case it returns the information about the toolkit
|
|
||||||
// and in the latter -- about the OS, so we need to virtualize it
|
|
||||||
// - wxDynamicLibrary::CanonicalizePluginName() must embed toolkit
|
|
||||||
// signature in DLL name
|
|
||||||
virtual wxToolkitInfo& GetToolkitInfo() = 0;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
@@ -192,6 +170,17 @@ public:
|
|||||||
|
|
||||||
virtual void ScheduleForDestroy(wxObject *object);
|
virtual void ScheduleForDestroy(wxObject *object);
|
||||||
virtual void RemoveFromPendingDelete(wxObject *object);
|
virtual void RemoveFromPendingDelete(wxObject *object);
|
||||||
|
|
||||||
|
// the GetToolkitVersion for console application is always the same
|
||||||
|
wxPortId GetToolkitVersion(int *verMaj, int *verMin) const
|
||||||
|
{
|
||||||
|
// no toolkits (wxBase is for console applications without GUI support)
|
||||||
|
// NB: zero means "no toolkit", -1 means "not initialized yet"
|
||||||
|
// so we must use zero here!
|
||||||
|
if (verMaj) *verMaj = 0;
|
||||||
|
if (verMin) *verMin = 0;
|
||||||
|
return wxPORT_BASE;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
@@ -242,16 +231,13 @@ public:
|
|||||||
#elif defined(__WXPM__)
|
#elif defined(__WXPM__)
|
||||||
#include "wx/os2/apptrait.h"
|
#include "wx/os2/apptrait.h"
|
||||||
#else
|
#else
|
||||||
// at least, we need an implementation of GetToolkitInfo !
|
|
||||||
#if wxUSE_GUI
|
#if wxUSE_GUI
|
||||||
class wxGUIAppTraits : public wxGUIAppTraitsBase
|
class wxGUIAppTraits : public wxGUIAppTraitsBase
|
||||||
{
|
{
|
||||||
virtual wxToolkitInfo& GetToolkitInfo();
|
|
||||||
};
|
};
|
||||||
#endif // wxUSE_GUI
|
#endif // wxUSE_GUI
|
||||||
class wxConsoleAppTraits: public wxConsoleAppTraitsBase
|
class wxConsoleAppTraits: public wxConsoleAppTraitsBase
|
||||||
{
|
{
|
||||||
virtual wxToolkitInfo& GetToolkitInfo();
|
|
||||||
};
|
};
|
||||||
#endif // platform
|
#endif // platform
|
||||||
|
|
||||||
|
@@ -664,68 +664,6 @@ typedef int wxWindowID;
|
|||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* ---------------------------------------------------------------------------- */
|
|
||||||
/* OS mnemonics -- Identify the running OS (useful for Windows) */
|
|
||||||
/* ---------------------------------------------------------------------------- */
|
|
||||||
|
|
||||||
/* Not all platforms are currently available or supported */
|
|
||||||
enum
|
|
||||||
{
|
|
||||||
wxUNKNOWN_PLATFORM,
|
|
||||||
wxCURSES, /* Text-only CURSES */
|
|
||||||
wxXVIEW_X, /* Sun's XView OpenLOOK toolkit */
|
|
||||||
wxMOTIF_X, /* OSF Motif 1.x.x */
|
|
||||||
wxCOSE_X, /* OSF Common Desktop Environment */
|
|
||||||
wxNEXTSTEP, /* NeXTStep */
|
|
||||||
wxMAC, /* Apple Mac OS 8/9/X with Mac paths */
|
|
||||||
wxMAC_DARWIN, /* Apple Mac OS X with Unix paths */
|
|
||||||
wxBEOS, /* BeOS */
|
|
||||||
wxGTK, /* GTK on X */
|
|
||||||
wxGTK_WIN32, /* GTK on Win32 */
|
|
||||||
wxGTK_OS2, /* GTK on OS/2 */
|
|
||||||
wxGTK_BEOS, /* GTK on BeOS */
|
|
||||||
wxGEOS, /* GEOS */
|
|
||||||
wxOS2_PM, /* OS/2 Workplace */
|
|
||||||
wxWINDOWS, /* Windows or WfW */
|
|
||||||
wxMICROWINDOWS, /* MicroWindows */
|
|
||||||
wxPENWINDOWS, /* Windows for Pen Computing */
|
|
||||||
wxWINDOWS_NT, /* Windows NT */
|
|
||||||
wxWIN32S, /* Windows 32S API */
|
|
||||||
wxWIN95, /* Windows 95 */
|
|
||||||
wxWIN386, /* Watcom 32-bit supervisor modus */
|
|
||||||
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 */
|
|
||||||
wxMGL_OS2, /* MGL on OS/2 */
|
|
||||||
wxMGL_DOS, /* MGL on MS-DOS */
|
|
||||||
wxWINDOWS_OS2, /* Native OS/2 PM */
|
|
||||||
wxUNIX, /* wxBase under Unix */
|
|
||||||
wxX11, /* Plain X11 and Universal widgets */
|
|
||||||
wxPALMOS, /* PalmOS */
|
|
||||||
wxDOS /* wxBase under MS-DOS */
|
|
||||||
};
|
|
||||||
|
|
||||||
/* Friendlier platform names */
|
|
||||||
enum
|
|
||||||
{
|
|
||||||
wxMotif = wxMOTIF_X,
|
|
||||||
wxMac = wxMAC,
|
|
||||||
wxMSW = wxWINDOWS,
|
|
||||||
wxWinCE = wxWINDOWS_CE,
|
|
||||||
wxWinPocketPC = wxWINDOWS_POCKETPC,
|
|
||||||
wxWinSmartPhone = wxWINDOWS_SMARTPHONE,
|
|
||||||
wxWin95= wxWIN95,
|
|
||||||
wxUnix = wxUNIX, /* wxBase under Unix */
|
|
||||||
wxPalmOS = wxPALMOS, /* PalmOS */
|
|
||||||
wxOS2 = wxOS2_PM,
|
|
||||||
|
|
||||||
wxMGL = 100,
|
|
||||||
wxCocoa
|
|
||||||
};
|
|
||||||
|
|
||||||
/* ---------------------------------------------------------------------------- */
|
/* ---------------------------------------------------------------------------- */
|
||||||
/* standard wxWidgets types */
|
/* standard wxWidgets types */
|
||||||
/* ---------------------------------------------------------------------------- */
|
/* ---------------------------------------------------------------------------- */
|
||||||
|
@@ -40,14 +40,6 @@ public:
|
|||||||
// process a message while waiting for a(nother) thread, should return
|
// process a message while waiting for a(nother) thread, should return
|
||||||
// false if and only if we have to exit the application
|
// false if and only if we have to exit the application
|
||||||
virtual bool DoMessageFromThreadWait() = 0;
|
virtual bool DoMessageFromThreadWait() = 0;
|
||||||
|
|
||||||
// other miscellaneous helpers
|
|
||||||
// ---------------------------
|
|
||||||
|
|
||||||
// under MSW this function returns same version for both console and GUI
|
|
||||||
// applications so we can implement it directly in the base class and only
|
|
||||||
// override it wxGUIAppTraits to fill in toolkit information
|
|
||||||
virtual wxToolkitInfo& GetToolkitInfo();
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // _WX_MSW_APPTBASE_H_
|
#endif // _WX_MSW_APPTBASE_H_
|
||||||
|
@@ -36,7 +36,7 @@ public:
|
|||||||
virtual void AfterChildWaitLoop(void *data);
|
virtual void AfterChildWaitLoop(void *data);
|
||||||
|
|
||||||
virtual bool DoMessageFromThreadWait();
|
virtual bool DoMessageFromThreadWait();
|
||||||
virtual wxToolkitInfo& GetToolkitInfo();
|
virtual wxPortId GetToolkitVersion(int *majVer, int *minVer) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // wxUSE_GUI
|
#endif // wxUSE_GUI
|
||||||
|
@@ -19,7 +19,6 @@
|
|||||||
class WXDLLIMPEXP_BASE wxConsoleAppTraits : public wxConsoleAppTraitsBase
|
class WXDLLIMPEXP_BASE wxConsoleAppTraits : public wxConsoleAppTraitsBase
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
virtual wxToolkitInfo& GetToolkitInfo();
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#if wxUSE_GUI
|
#if wxUSE_GUI
|
||||||
@@ -27,7 +26,7 @@ public:
|
|||||||
class WXDLLIMPEXP_CORE wxGUIAppTraits : public wxGUIAppTraitsBase
|
class WXDLLIMPEXP_CORE wxGUIAppTraits : public wxGUIAppTraitsBase
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
virtual wxToolkitInfo& GetToolkitInfo();
|
virtual wxPortId GetToolkitVersion(int *majVer, int *minVer) const;
|
||||||
|
|
||||||
// wxThread helpers
|
// wxThread helpers
|
||||||
// ----------------
|
// ----------------
|
||||||
|
@@ -40,14 +40,6 @@ public:
|
|||||||
// process a message while waiting for a(nother) thread, should return
|
// process a message while waiting for a(nother) thread, should return
|
||||||
// false if and only if we have to exit the application
|
// false if and only if we have to exit the application
|
||||||
virtual bool DoMessageFromThreadWait() = 0;
|
virtual bool DoMessageFromThreadWait() = 0;
|
||||||
|
|
||||||
// other miscellaneous helpers
|
|
||||||
// ---------------------------
|
|
||||||
|
|
||||||
// under MSW this function returns same version for both console and GUI
|
|
||||||
// applications so we can implement it directly in the base class and only
|
|
||||||
// override it wxGUIAppTraits to fill in toolkit information
|
|
||||||
virtual wxToolkitInfo& GetToolkitInfo();
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // _WX_PALMOS_APPTBASE_H_
|
#endif // _WX_PALMOS_APPTBASE_H_
|
||||||
|
@@ -36,7 +36,7 @@ public:
|
|||||||
virtual void AfterChildWaitLoop(void *data);
|
virtual void AfterChildWaitLoop(void *data);
|
||||||
|
|
||||||
virtual bool DoMessageFromThreadWait();
|
virtual bool DoMessageFromThreadWait();
|
||||||
virtual wxToolkitInfo& GetToolkitInfo();
|
virtual wxPortId GetToolkitVersion(int *majVer, int *minVer) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // wxUSE_GUI
|
#endif // wxUSE_GUI
|
||||||
|
282
include/wx/platinfo.h
Normal file
282
include/wx/platinfo.h
Normal file
@@ -0,0 +1,282 @@
|
|||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Name: wx/platinfo.h
|
||||||
|
// Purpose: declaration of the wxPlatformInfo class
|
||||||
|
// Author: Francesco Montorsi
|
||||||
|
// Modified by:
|
||||||
|
// Created: 07.07.2006 (based on wxToolkitInfo)
|
||||||
|
// RCS-ID: $Id$
|
||||||
|
// Copyright: (c) 2006 Francesco Montorsi
|
||||||
|
// License: wxWindows license
|
||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#ifndef _WX_PLATINFO_H_
|
||||||
|
#define _WX_PLATINFO_H_
|
||||||
|
|
||||||
|
#include "wx/defs.h"
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
// wxPlatformInfo
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// VERY IMPORTANT: when changing these enum values, also change the relative
|
||||||
|
// string tables in src/common/platinfo.cpp
|
||||||
|
|
||||||
|
|
||||||
|
// families & sub-families of operating systems
|
||||||
|
enum wxOperatingSystemId
|
||||||
|
{
|
||||||
|
wxOS_UNKNOWN = 0, // returned on error
|
||||||
|
|
||||||
|
wxOS_MAC_OS = 1 << 0, // Apple Mac OS 8/9/X with Mac paths
|
||||||
|
wxOS_MAC_OSX_DARWIN = 1 << 1, // Apple Mac OS X with Unix paths
|
||||||
|
wxOS_MAC = wxOS_MAC_OS|wxOS_MAC_OSX_DARWIN,
|
||||||
|
|
||||||
|
wxOS_WINDOWS_9X = 1 << 2, // Windows 9x family (95/98/ME)
|
||||||
|
wxOS_WINDOWS_NT = 1 << 3, // Windows NT family (NT/2000/XP)
|
||||||
|
wxOS_WINDOWS_MICRO = 1 << 4, // MicroWindows
|
||||||
|
wxOS_WINDOWS_CE = 1 << 5, // Windows CE (Window Mobile)
|
||||||
|
wxOS_WINDOWS = wxOS_WINDOWS_9X |
|
||||||
|
wxOS_WINDOWS_NT |
|
||||||
|
wxOS_WINDOWS_MICRO |
|
||||||
|
wxOS_WINDOWS_CE,
|
||||||
|
|
||||||
|
wxOS_UNIX_LINUX = 1 << 6, // Linux
|
||||||
|
wxOS_UNIX_FREEBSD = 1 << 7, // FreeBSD
|
||||||
|
wxOS_UNIX_OPENBSD = 1 << 8, // OpenBSD
|
||||||
|
wxOS_UNIX_NETBSD = 1 << 9, // NetBSD
|
||||||
|
wxOS_UNIX_SOLARIS = 1 << 10, // SunOS
|
||||||
|
wxOS_UNIX_AIX = 1 << 11, // AIX
|
||||||
|
wxOS_UNIX_HPUX = 1 << 12, // HP/UX
|
||||||
|
wxOS_UNIX = wxOS_UNIX_LINUX |
|
||||||
|
wxOS_UNIX_FREEBSD |
|
||||||
|
wxOS_UNIX_OPENBSD |
|
||||||
|
wxOS_UNIX_NETBSD |
|
||||||
|
wxOS_UNIX_SOLARIS |
|
||||||
|
wxOS_UNIX_AIX |
|
||||||
|
wxOS_UNIX_HPUX,
|
||||||
|
|
||||||
|
// 1<<13 and 1<<14 available for other Unix flavours
|
||||||
|
|
||||||
|
wxOS_DOS = 1 << 15, // Microsoft DOS
|
||||||
|
wxOS_OS2 = 1 << 16 // OS/2
|
||||||
|
};
|
||||||
|
|
||||||
|
// list of wxWidgets ports - some of them can be used with more than
|
||||||
|
// a single toolkit.
|
||||||
|
enum wxPortId
|
||||||
|
{
|
||||||
|
wxPORT_UNKNOWN = 0, // returned on error
|
||||||
|
|
||||||
|
wxPORT_BASE = 1 << 0, // wxBase, no native toolkit used
|
||||||
|
|
||||||
|
wxPORT_MSW = 1 << 1, // wxMSW, native toolkit is Windows API
|
||||||
|
wxPORT_MOTIF = 1 << 2, // wxMotif, using [Open]Motif or Lesstif
|
||||||
|
wxPORT_GTK = 1 << 3, // wxGTK, using GTK+ 1.x, 2.x, GPE or Maemo
|
||||||
|
wxPORT_MGL = 1 << 4, // wxMGL, using wxUniversal
|
||||||
|
wxPORT_X11 = 1 << 5, // wxX11, using wxUniversal
|
||||||
|
wxPORT_OS2 = 1 << 6, // wxOS2, using OS/2 Presentation Manager
|
||||||
|
wxPORT_MAC = 1 << 7, // wxMac, using Carbon or Classic Mac API
|
||||||
|
wxPORT_COCOA = 1 << 8, // wxCocoa, using Cocoa NextStep/Mac API
|
||||||
|
wxPORT_WINCE = 1 << 9, // wxWinCE, toolkit is WinCE SDK API
|
||||||
|
wxPORT_PALMOS = 1 << 10 // wxPalmOS, toolkit is PalmOS API
|
||||||
|
};
|
||||||
|
|
||||||
|
// architecture of the operating system
|
||||||
|
// (regardless of the build environment of wxWidgets library - see
|
||||||
|
// wxIsPlatform64bit documentation for more info)
|
||||||
|
enum wxArchitecture
|
||||||
|
{
|
||||||
|
wxARCH_INVALID = -1, // returned on error
|
||||||
|
|
||||||
|
wxARCH_32, // 32 bit
|
||||||
|
wxARCH_64,
|
||||||
|
|
||||||
|
wxARCH_MAX
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// endian-ness of the machine
|
||||||
|
enum wxEndianness
|
||||||
|
{
|
||||||
|
wxENDIAN_INVALID = -1, // returned on error
|
||||||
|
|
||||||
|
wxENDIAN_BIG, // 4321
|
||||||
|
wxENDIAN_LITTLE, // 1234
|
||||||
|
wxENDIAN_PDP, // 3412
|
||||||
|
|
||||||
|
wxENDIAN_MAX
|
||||||
|
};
|
||||||
|
|
||||||
|
// Information about the toolkit that the app is running under and some basic
|
||||||
|
// platform and architecture info
|
||||||
|
class WXDLLIMPEXP_BASE wxPlatformInfo
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
wxPlatformInfo();
|
||||||
|
wxPlatformInfo(wxPortId pid,
|
||||||
|
int tkMajor = -1, int tkMinor = -1,
|
||||||
|
wxOperatingSystemId id = wxOS_UNKNOWN,
|
||||||
|
int osMajor = -1, int osMinor = -1,
|
||||||
|
wxArchitecture arch = wxARCH_INVALID,
|
||||||
|
wxEndianness endian = wxENDIAN_INVALID);
|
||||||
|
|
||||||
|
// default copy ctor, assignment operator and dtor are ok
|
||||||
|
|
||||||
|
bool operator==(const wxPlatformInfo &t) const;
|
||||||
|
|
||||||
|
bool operator!=(const wxPlatformInfo &t) const
|
||||||
|
{ return !(*this == t); }
|
||||||
|
|
||||||
|
|
||||||
|
// string -> enum conversions
|
||||||
|
// ---------------------------------
|
||||||
|
|
||||||
|
static wxOperatingSystemId GetOperatingSystemId(const wxString &name);
|
||||||
|
static wxPortId GetPortId(const wxString &portname);
|
||||||
|
|
||||||
|
static wxArchitecture GetArch(const wxString &arch);
|
||||||
|
static wxEndianness GetEndianness(const wxString &end);
|
||||||
|
|
||||||
|
// enum -> string conversions
|
||||||
|
// ---------------------------------
|
||||||
|
|
||||||
|
static wxString GetOperatingSystemFamilyName(wxOperatingSystemId os);
|
||||||
|
static wxString GetOperatingSystemIdName(wxOperatingSystemId os);
|
||||||
|
static wxString GetPortIdName(wxPortId port);
|
||||||
|
static wxString GetPortIdShortName(wxPortId port);
|
||||||
|
|
||||||
|
static wxString GetArchName(wxArchitecture arch);
|
||||||
|
static wxString GetEndiannessName(wxEndianness end);
|
||||||
|
|
||||||
|
// getters
|
||||||
|
// -----------------
|
||||||
|
|
||||||
|
int GetOSMajorVersion() const
|
||||||
|
{ return m_osVersionMajor; }
|
||||||
|
int GetOSMinorVersion() const
|
||||||
|
{ return m_osVersionMinor; }
|
||||||
|
|
||||||
|
int GetToolkitMajorVersion() const
|
||||||
|
{ return m_tkVersionMajor; }
|
||||||
|
int GetToolkitMinorVersion() const
|
||||||
|
{ return m_tkVersionMinor; }
|
||||||
|
|
||||||
|
wxOperatingSystemId GetOperatingSystemId() const
|
||||||
|
{ return m_os; }
|
||||||
|
wxPortId GetPortId() const
|
||||||
|
{ return m_port; }
|
||||||
|
wxArchitecture GetArchitecture() const
|
||||||
|
{ return m_arch; }
|
||||||
|
wxEndianness GetEndianness() const
|
||||||
|
{ return m_endian; }
|
||||||
|
|
||||||
|
|
||||||
|
// string getters
|
||||||
|
// -----------------
|
||||||
|
|
||||||
|
wxString GetOperatingSystemFamilyName() const
|
||||||
|
{ return GetOperatingSystemFamilyName(m_os); }
|
||||||
|
wxString GetOperatingSystemIdName() const
|
||||||
|
{ return GetOperatingSystemIdName(m_os); }
|
||||||
|
wxString GetPortIdName() const
|
||||||
|
{ return GetPortIdName(m_port); }
|
||||||
|
wxString GetPortIdShortName() const
|
||||||
|
{ return GetPortIdShortName(m_port); }
|
||||||
|
wxString GetArchName() const
|
||||||
|
{ return GetArchName(m_arch); }
|
||||||
|
wxString GetEndiannessName() const
|
||||||
|
{ return GetEndiannessName(m_endian); }
|
||||||
|
|
||||||
|
// setters
|
||||||
|
// -----------------
|
||||||
|
|
||||||
|
void SetOSVersion(int major, int minor)
|
||||||
|
{ m_osVersionMajor=major; m_osVersionMinor=minor; }
|
||||||
|
void SetToolkitVersion(int major, int minor)
|
||||||
|
{ m_tkVersionMajor=major; m_tkVersionMinor=minor; }
|
||||||
|
|
||||||
|
void SetOperatingSystemId(wxOperatingSystemId n)
|
||||||
|
{ m_os=n; }
|
||||||
|
void SetPortId(wxPortId n)
|
||||||
|
{ m_port=n; }
|
||||||
|
void SetArchitecture(wxArchitecture n)
|
||||||
|
{ m_arch=n; }
|
||||||
|
void SetEndianness(wxEndianness n)
|
||||||
|
{ m_endian=n; }
|
||||||
|
|
||||||
|
// miscellaneous
|
||||||
|
// -----------------
|
||||||
|
|
||||||
|
bool IsOk() const
|
||||||
|
{
|
||||||
|
return m_osVersionMajor != -1 && m_osVersionMinor != -1 &&
|
||||||
|
m_os != wxOS_UNKNOWN &&
|
||||||
|
m_tkVersionMajor != -1 && m_tkVersionMinor != -1 &&
|
||||||
|
m_port != wxPORT_UNKNOWN &&
|
||||||
|
m_arch != wxARCH_INVALID && m_endian != wxENDIAN_INVALID;
|
||||||
|
}
|
||||||
|
|
||||||
|
static bool IsUsingUniversalWidgets()
|
||||||
|
{
|
||||||
|
#ifdef __WXUNIVERSAL__
|
||||||
|
return true;
|
||||||
|
#else
|
||||||
|
return false;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
protected:
|
||||||
|
// OS stuff
|
||||||
|
// -----------------
|
||||||
|
|
||||||
|
// Version of the OS; valid if m_os != wxOS_UNKNOWN
|
||||||
|
// (-1 means not initialized yet).
|
||||||
|
int m_osVersionMajor, m_osVersionMinor;
|
||||||
|
|
||||||
|
// Operating system ID.
|
||||||
|
wxOperatingSystemId m_os;
|
||||||
|
|
||||||
|
|
||||||
|
// toolkit
|
||||||
|
// -----------------
|
||||||
|
|
||||||
|
// Version of the underlying toolkit
|
||||||
|
// (-1 means not initialized yet; zero means no toolkit).
|
||||||
|
int m_tkVersionMajor, m_tkVersionMinor;
|
||||||
|
|
||||||
|
// name of the wxWidgets port
|
||||||
|
wxPortId m_port;
|
||||||
|
|
||||||
|
|
||||||
|
// others
|
||||||
|
// -----------------
|
||||||
|
|
||||||
|
// architecture of the OS
|
||||||
|
wxArchitecture m_arch;
|
||||||
|
|
||||||
|
// endianness of the machine
|
||||||
|
wxEndianness m_endian;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
#if WXWIN_COMPATIBILITY_2_6
|
||||||
|
#define wxUNKNOWN_PLATFORM wxOS_UNKNOWN
|
||||||
|
#define wxUnix wxOS_UNIX
|
||||||
|
#define wxWin95 wxOS_WINDOWS_9X
|
||||||
|
#define wxWIN95 wxOS_WINDOWS_9X
|
||||||
|
#define wxWINDOWS_NT wxOS_WINDOWS_NT
|
||||||
|
#define wxMSW wxOS_WINDOWS
|
||||||
|
#define wxWinCE wxOS_WINDOWS_CE
|
||||||
|
#define wxWIN32S wxOS_WINDOWS_9X
|
||||||
|
|
||||||
|
#define wxPalmOS wxPORT_PALMOS
|
||||||
|
#define wxOS2 wxPORT_OS2
|
||||||
|
#define wxMGL wxPORT_MGL
|
||||||
|
#define wxCocoa wxPORT_MAC
|
||||||
|
#define wxMac wxPORT_MAC
|
||||||
|
#define wxMotif wxPORT_MOTIF
|
||||||
|
#define wxGTK wxPORT_GTK
|
||||||
|
#endif // WXWIN_COMPATIBILITY_2_6
|
||||||
|
|
||||||
|
#endif // _WX_PLATINFO_H_
|
@@ -23,8 +23,6 @@ public:
|
|||||||
virtual bool IsWriteFDOfEndProcessPipe(wxExecuteData& execData, int fd);
|
virtual bool IsWriteFDOfEndProcessPipe(wxExecuteData& execData, int fd);
|
||||||
virtual void DetachWriteFDOfEndProcessPipe(wxExecuteData& execData);
|
virtual void DetachWriteFDOfEndProcessPipe(wxExecuteData& execData);
|
||||||
virtual int WaitForChild(wxExecuteData& execData);
|
virtual int WaitForChild(wxExecuteData& execData);
|
||||||
|
|
||||||
virtual wxToolkitInfo& GetToolkitInfo();
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#if wxUSE_GUI
|
#if wxUSE_GUI
|
||||||
@@ -40,7 +38,7 @@ public:
|
|||||||
#if defined(__WXMAC__) || defined(__WXCOCOA__)
|
#if defined(__WXMAC__) || defined(__WXCOCOA__)
|
||||||
virtual wxStandardPathsBase& GetStandardPaths();
|
virtual wxStandardPathsBase& GetStandardPaths();
|
||||||
#endif
|
#endif
|
||||||
virtual wxToolkitInfo& GetToolkitInfo();
|
virtual wxPortId GetToolkitVersion(int *majVer, int *minVer) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // wxUSE_GUI
|
#endif // wxUSE_GUI
|
||||||
|
@@ -30,6 +30,9 @@ class WXDLLIMPEXP_BASE wxArrayInt;
|
|||||||
// wxLongLong
|
// wxLongLong
|
||||||
#include "wx/longlong.h"
|
#include "wx/longlong.h"
|
||||||
|
|
||||||
|
// need for wxOperatingSystemId
|
||||||
|
#include "wx/platinfo.h"
|
||||||
|
|
||||||
#ifdef __WATCOMC__
|
#ifdef __WATCOMC__
|
||||||
#include <direct.h>
|
#include <direct.h>
|
||||||
#elif defined(__X__)
|
#elif defined(__X__)
|
||||||
@@ -93,9 +96,15 @@ WXDLLIMPEXP_BASE void wxBell();
|
|||||||
WXDLLIMPEXP_BASE wxString wxGetOsDescription();
|
WXDLLIMPEXP_BASE wxString wxGetOsDescription();
|
||||||
|
|
||||||
// Get OS version
|
// Get OS version
|
||||||
WXDLLIMPEXP_BASE int wxGetOsVersion(int *majorVsn = (int *) NULL,
|
WXDLLIMPEXP_BASE wxOperatingSystemId wxGetOsVersion(int *majorVsn = (int *) NULL,
|
||||||
int *minorVsn = (int *) NULL);
|
int *minorVsn = (int *) NULL);
|
||||||
|
|
||||||
|
// Get platform endianness
|
||||||
|
WXDLLIMPEXP_BASE bool wxIsPlatformLittleEndian();
|
||||||
|
|
||||||
|
// Get platform architecture
|
||||||
|
WXDLLIMPEXP_BASE bool wxIsPlatform64Bit();
|
||||||
|
|
||||||
// Return a string with the current date/time
|
// Return a string with the current date/time
|
||||||
WXDLLIMPEXP_BASE wxString wxNow();
|
WXDLLIMPEXP_BASE wxString wxNow();
|
||||||
|
|
||||||
|
@@ -25,6 +25,8 @@
|
|||||||
#include "wx/file.h"
|
#include "wx/file.h"
|
||||||
#include "wx/app.h"
|
#include "wx/app.h"
|
||||||
#include "wx/log.h"
|
#include "wx/log.h"
|
||||||
|
#include "wx/apptrait.h"
|
||||||
|
#include "wx/platinfo.h"
|
||||||
|
|
||||||
// without this pragma, the stupid compiler precompiles #defines below so that
|
// without this pragma, the stupid compiler precompiles #defines below so that
|
||||||
// changing them doesn't "take place" later!
|
// changing them doesn't "take place" later!
|
||||||
@@ -86,7 +88,7 @@
|
|||||||
#define TEST_WCHAR
|
#define TEST_WCHAR
|
||||||
#define TEST_ZIP
|
#define TEST_ZIP
|
||||||
#else // #if TEST_ALL
|
#else // #if TEST_ALL
|
||||||
#define TEST_MODULE
|
#define TEST_INFO_FUNCTIONS
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// some tests are interactive, define this to run them
|
// some tests are interactive, define this to run them
|
||||||
@@ -1510,6 +1512,23 @@ static void TestOsInfo()
|
|||||||
wxPuts(wxEmptyString);
|
wxPuts(wxEmptyString);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void TestPlatformInfo()
|
||||||
|
{
|
||||||
|
wxPuts(_T("*** Testing wxPlatformInfo functions ***\n"));
|
||||||
|
|
||||||
|
// get this platform
|
||||||
|
wxPlatformInfo plat;
|
||||||
|
|
||||||
|
wxPrintf(_T("Operating system family name is: %s\n"), plat.GetOperatingSystemFamilyName().c_str());
|
||||||
|
wxPrintf(_T("Operating system name is: %s\n"), plat.GetOperatingSystemIdName().c_str());
|
||||||
|
wxPrintf(_T("Port ID name is: %s\n"), plat.GetPortIdName().c_str());
|
||||||
|
wxPrintf(_T("Port ID short name is: %s\n"), plat.GetPortIdShortName().c_str());
|
||||||
|
wxPrintf(_T("Architecture is: %s\n"), plat.GetArchName().c_str());
|
||||||
|
wxPrintf(_T("Endianness is: %s\n"), plat.GetEndiannessName().c_str());
|
||||||
|
|
||||||
|
wxPuts(wxEmptyString);
|
||||||
|
}
|
||||||
|
|
||||||
static void TestUserInfo()
|
static void TestUserInfo()
|
||||||
{
|
{
|
||||||
wxPuts(_T("*** Testing user info functions ***\n"));
|
wxPuts(_T("*** Testing user info functions ***\n"));
|
||||||
@@ -4332,14 +4351,13 @@ int main(int argc, char **argv)
|
|||||||
#endif // TEST_MIME
|
#endif // TEST_MIME
|
||||||
|
|
||||||
#ifdef TEST_INFO_FUNCTIONS
|
#ifdef TEST_INFO_FUNCTIONS
|
||||||
#if TEST_ALL
|
|
||||||
TestOsInfo();
|
TestOsInfo();
|
||||||
|
TestPlatformInfo();
|
||||||
TestUserInfo();
|
TestUserInfo();
|
||||||
|
|
||||||
#if TEST_INTERACTIVE
|
#if TEST_INTERACTIVE
|
||||||
TestDiskInfo();
|
TestDiskInfo();
|
||||||
#endif
|
#endif
|
||||||
#endif
|
|
||||||
#endif // TEST_INFO_FUNCTIONS
|
#endif // TEST_INFO_FUNCTIONS
|
||||||
|
|
||||||
#ifdef TEST_PATHLIST
|
#ifdef TEST_PATHLIST
|
||||||
|
@@ -40,7 +40,7 @@
|
|||||||
|
|
||||||
#include "wx/filefn.h"
|
#include "wx/filefn.h"
|
||||||
#include "wx/filename.h" // for SplitPath()
|
#include "wx/filename.h" // for SplitPath()
|
||||||
#include "wx/apptrait.h"
|
#include "wx/platinfo.h"
|
||||||
|
|
||||||
#include "wx/arrimpl.cpp"
|
#include "wx/arrimpl.cpp"
|
||||||
|
|
||||||
@@ -247,11 +247,7 @@ wxString wxDynamicLibrary::CanonicalizePluginName(const wxString& name,
|
|||||||
wxString suffix;
|
wxString suffix;
|
||||||
if ( cat == wxDL_PLUGIN_GUI )
|
if ( cat == wxDL_PLUGIN_GUI )
|
||||||
{
|
{
|
||||||
wxAppTraits *traits = wxAppConsole::GetInstance() ?
|
suffix = wxPlatformInfo().GetPortIdShortName();
|
||||||
wxAppConsole::GetInstance()->GetTraits() : NULL;
|
|
||||||
wxCHECK_MSG( traits, wxEmptyString,
|
|
||||||
_("can't query for GUI plugins name in console applications") );
|
|
||||||
suffix = traits->GetToolkitInfo().shortName;
|
|
||||||
}
|
}
|
||||||
#if wxUSE_UNICODE
|
#if wxUSE_UNICODE
|
||||||
suffix << _T('u');
|
suffix << _T('u');
|
||||||
|
@@ -1583,11 +1583,13 @@ bool wxLocale::Init(const wxChar *szName,
|
|||||||
|
|
||||||
// there may be a catalog with toolkit specific overrides, it is not
|
// there may be a catalog with toolkit specific overrides, it is not
|
||||||
// an error if this does not exist
|
// an error if this does not exist
|
||||||
if ( bOk && wxTheApp )
|
if ( bOk )
|
||||||
{
|
{
|
||||||
wxAppTraits *traits = wxTheApp->GetTraits();
|
wxString port(wxPlatformInfo().GetPortIdName());
|
||||||
if (traits)
|
if ( !port.empty() )
|
||||||
AddCatalog(traits->GetToolkitInfo().name.BeforeFirst(wxT('/')).MakeLower());
|
{
|
||||||
|
AddCatalog(port.BeforeFirst(wxT('/')).MakeLower());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
297
src/common/platinfo.cpp
Normal file
297
src/common/platinfo.cpp
Normal file
@@ -0,0 +1,297 @@
|
|||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Name: src/common/platinfo.cpp
|
||||||
|
// Purpose: implements wxPlatformInfo class
|
||||||
|
// Author: Francesco Montorsi
|
||||||
|
// Modified by:
|
||||||
|
// Created: 07.07.2006 (based on wxToolkitInfo)
|
||||||
|
// RCS-ID: $Id$
|
||||||
|
// Copyright: (c) 2006 Francesco Montorsi
|
||||||
|
// License: wxWindows license
|
||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
// ============================================================================
|
||||||
|
// declarations
|
||||||
|
// ============================================================================
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
// headers
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// for compilers that support precompilation, includes "wx.h".
|
||||||
|
#include "wx/wxprec.h"
|
||||||
|
|
||||||
|
#ifdef __BORLANDC__
|
||||||
|
#pragma hdrstop
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef WX_PRECOMP
|
||||||
|
#include "wx/utils.h"
|
||||||
|
#endif //WX_PRECOMP
|
||||||
|
|
||||||
|
#include "wx/platinfo.h"
|
||||||
|
#include "wx/apptrait.h"
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
// constants
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
static wxString wxOperatingSystemIdNames[] =
|
||||||
|
{
|
||||||
|
_T("Apple Mac OS"),
|
||||||
|
_T("Apple Mac OS X"),
|
||||||
|
|
||||||
|
_T("Microsoft Windows 9X"),
|
||||||
|
_T("Microsoft Windows NT"),
|
||||||
|
_T("Microsoft Windows Micro"),
|
||||||
|
_T("Microsoft Windows CE"),
|
||||||
|
|
||||||
|
_T("Linux"),
|
||||||
|
_T("FreeBSD"),
|
||||||
|
_T("OpenBSD"),
|
||||||
|
_T("NetBSD"),
|
||||||
|
|
||||||
|
_T("SunOS"),
|
||||||
|
_T("AIX"),
|
||||||
|
_T("HPUX"),
|
||||||
|
|
||||||
|
_T("DOS"),
|
||||||
|
_T("OS/2")
|
||||||
|
};
|
||||||
|
|
||||||
|
static wxString wxPortIdNames[] =
|
||||||
|
{
|
||||||
|
_T("wxBase"),
|
||||||
|
_T("wxMSW"),
|
||||||
|
_T("wxMotif"),
|
||||||
|
_T("wxGTK"),
|
||||||
|
_T("wxMGL"),
|
||||||
|
_T("wxX11"),
|
||||||
|
_T("wxOS2"),
|
||||||
|
_T("wxMac"),
|
||||||
|
_T("wxCocoa"),
|
||||||
|
_T("wxWinCE"),
|
||||||
|
_T("wxPalmOS")
|
||||||
|
};
|
||||||
|
|
||||||
|
static wxString wxArchitectureNames[] =
|
||||||
|
{
|
||||||
|
_T("32 bit"),
|
||||||
|
_T("64 bit")
|
||||||
|
};
|
||||||
|
|
||||||
|
static wxString wxEndiannessNames[] =
|
||||||
|
{
|
||||||
|
_T("Big endian"),
|
||||||
|
_T("Little endian"),
|
||||||
|
_T("PDP endian")
|
||||||
|
};
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
// local functions
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// returns log in base 2 of the value, this maps the enum values to the
|
||||||
|
// corresponding indices
|
||||||
|
static int wxGetIndexFromEnumValue(int value)
|
||||||
|
{
|
||||||
|
wxCHECK_MSG( value, -1, _T("invalid enum value") );
|
||||||
|
|
||||||
|
int n = 0;
|
||||||
|
while ( !(value & 1) )
|
||||||
|
{
|
||||||
|
value >>= 1;
|
||||||
|
n++;
|
||||||
|
}
|
||||||
|
|
||||||
|
wxASSERT_MSG( value == 1, _T("more than one bit set in enum value") );
|
||||||
|
|
||||||
|
return n;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
// wxPlatformInfo
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
wxPlatformInfo::wxPlatformInfo()
|
||||||
|
{
|
||||||
|
// autodetect all informations
|
||||||
|
const wxAppTraits * const traits = wxTheApp ? wxTheApp->GetTraits() : NULL;
|
||||||
|
if ( !traits )
|
||||||
|
{
|
||||||
|
wxFAIL_MSG( _T("failed to initialize wxPlatformInfo") );
|
||||||
|
|
||||||
|
m_port = wxPORT_UNKNOWN;
|
||||||
|
m_tkVersionMajor =
|
||||||
|
m_tkVersionMinor = 0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_port = traits->GetToolkitVersion(&m_tkVersionMajor, &m_tkVersionMinor);
|
||||||
|
}
|
||||||
|
|
||||||
|
m_os = wxGetOsVersion(&m_osVersionMajor, &m_osVersionMinor);
|
||||||
|
m_endian = wxIsPlatformLittleEndian() ? wxENDIAN_LITTLE : wxENDIAN_BIG;
|
||||||
|
m_arch = wxIsPlatform64Bit() ? wxARCH_64 : wxARCH_32;
|
||||||
|
}
|
||||||
|
|
||||||
|
wxPlatformInfo::wxPlatformInfo(wxPortId pid, int tkMajor, int tkMinor,
|
||||||
|
wxOperatingSystemId id, int osMajor, int osMinor,
|
||||||
|
wxArchitecture arch,
|
||||||
|
wxEndianness endian)
|
||||||
|
{
|
||||||
|
m_tkVersionMajor = tkMajor;
|
||||||
|
m_tkVersionMinor = tkMinor;
|
||||||
|
m_port = pid;
|
||||||
|
|
||||||
|
m_os = id;
|
||||||
|
m_osVersionMajor = osMajor;
|
||||||
|
m_osVersionMinor = osMinor;
|
||||||
|
|
||||||
|
m_endian = endian;
|
||||||
|
m_arch = arch;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool wxPlatformInfo::operator==(const wxPlatformInfo &t) const
|
||||||
|
{
|
||||||
|
return m_tkVersionMajor == t.m_tkVersionMajor &&
|
||||||
|
m_tkVersionMinor == t.m_tkVersionMinor &&
|
||||||
|
m_osVersionMajor == t.m_osVersionMajor &&
|
||||||
|
m_osVersionMinor == t.m_osVersionMinor &&
|
||||||
|
m_os == t.m_os &&
|
||||||
|
m_port == t.m_port &&
|
||||||
|
m_arch == t.m_arch &&
|
||||||
|
m_endian == t.m_endian;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
// wxPlatformInfo - enum -> string conversions
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
wxString wxPlatformInfo::GetOperatingSystemFamilyName(wxOperatingSystemId os)
|
||||||
|
{
|
||||||
|
if ( os & wxOS_MAC )
|
||||||
|
return _T("Macintosh");
|
||||||
|
else if ( os & wxOS_WINDOWS )
|
||||||
|
return _T("Windows");
|
||||||
|
else if ( os & wxOS_UNIX )
|
||||||
|
return _T("Unix");
|
||||||
|
else if ( os == wxOS_DOS )
|
||||||
|
return _T("DOS");
|
||||||
|
else if ( os == wxOS_OS2 )
|
||||||
|
return _T("OS/2");
|
||||||
|
|
||||||
|
return _T("Unknown");
|
||||||
|
}
|
||||||
|
|
||||||
|
wxString wxPlatformInfo::GetOperatingSystemIdName(wxOperatingSystemId os)
|
||||||
|
{
|
||||||
|
const int idx = wxGetIndexFromEnumValue(os);
|
||||||
|
|
||||||
|
wxCHECK_MSG( idx < WXSIZEOF(wxOperatingSystemIdNames), wxEmptyString,
|
||||||
|
_T("invalid OS id") );
|
||||||
|
|
||||||
|
return wxOperatingSystemIdNames[idx];
|
||||||
|
}
|
||||||
|
|
||||||
|
wxString wxPlatformInfo::GetPortIdName(wxPortId port)
|
||||||
|
{
|
||||||
|
const int idx = wxGetIndexFromEnumValue(port);
|
||||||
|
|
||||||
|
wxCHECK_MSG( idx < WXSIZEOF(wxPortIdNames), wxEmptyString,
|
||||||
|
_T("invalid port id") );
|
||||||
|
|
||||||
|
wxString ret = wxPortIdNames[idx];
|
||||||
|
|
||||||
|
if ( IsUsingUniversalWidgets() )
|
||||||
|
ret += wxT("/wxUniversal");
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
wxString wxPlatformInfo::GetPortIdShortName(wxPortId port)
|
||||||
|
{
|
||||||
|
const int idx = wxGetIndexFromEnumValue(port);
|
||||||
|
|
||||||
|
wxCHECK_MSG( idx < WXSIZEOF(wxPortIdNames), wxEmptyString,
|
||||||
|
_T("invalid port id") );
|
||||||
|
|
||||||
|
wxString ret = wxPortIdNames[idx];
|
||||||
|
ret = ret.Mid(2).Lower(); // remove 'wx' prefix
|
||||||
|
|
||||||
|
if ( IsUsingUniversalWidgets() )
|
||||||
|
ret += wxT("univ");
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
wxString wxPlatformInfo::GetArchName(wxArchitecture arch)
|
||||||
|
{
|
||||||
|
wxCOMPILE_TIME_ASSERT( WXSIZEOF(wxArchitectureNames) == wxARCH_MAX,
|
||||||
|
wxArchitectureNamesMismatch );
|
||||||
|
|
||||||
|
return wxArchitectureNames[arch];
|
||||||
|
}
|
||||||
|
|
||||||
|
wxString wxPlatformInfo::GetEndiannessName(wxEndianness end)
|
||||||
|
{
|
||||||
|
wxCOMPILE_TIME_ASSERT( WXSIZEOF(wxEndiannessNames) == wxENDIAN_MAX,
|
||||||
|
wxEndiannessNamesMismatch );
|
||||||
|
|
||||||
|
return wxEndiannessNames[end];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
// wxPlatformInfo - string -> enum conversions
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
wxOperatingSystemId wxPlatformInfo::GetOperatingSystemId(const wxString &str)
|
||||||
|
{
|
||||||
|
for ( size_t i = 0; i < WXSIZEOF(wxOperatingSystemIdNames); i++ )
|
||||||
|
{
|
||||||
|
if ( wxOperatingSystemIdNames[i].CmpNoCase(str) == 0 )
|
||||||
|
return (wxOperatingSystemId)(1 << i);
|
||||||
|
}
|
||||||
|
|
||||||
|
return wxOS_UNKNOWN;
|
||||||
|
}
|
||||||
|
|
||||||
|
wxPortId wxPlatformInfo::GetPortId(const wxString &str)
|
||||||
|
{
|
||||||
|
// recognize both short and long port names
|
||||||
|
for ( size_t i = 0; i < WXSIZEOF(wxPortIdNames); i++ )
|
||||||
|
{
|
||||||
|
wxPortId current = (wxPortId)(1 << i);
|
||||||
|
|
||||||
|
if ( wxPortIdNames[i].CmpNoCase(str) == 0 )
|
||||||
|
return current;
|
||||||
|
if ( GetPortIdShortName(current).CmpNoCase(str) == 0 )
|
||||||
|
return current;
|
||||||
|
}
|
||||||
|
|
||||||
|
return wxPORT_UNKNOWN;
|
||||||
|
}
|
||||||
|
|
||||||
|
wxArchitecture wxPlatformInfo::GetArch(const wxString &arch)
|
||||||
|
{
|
||||||
|
if ( arch.Contains(wxT("32")) )
|
||||||
|
return wxARCH_32;
|
||||||
|
|
||||||
|
if ( arch.Contains(wxT("64")) )
|
||||||
|
return wxARCH_64;
|
||||||
|
|
||||||
|
return wxARCH_INVALID;
|
||||||
|
}
|
||||||
|
|
||||||
|
wxEndianness wxPlatformInfo::GetEndianness(const wxString& end)
|
||||||
|
{
|
||||||
|
wxString endl(end.Lower());
|
||||||
|
if ( end.StartsWith(wxT("little")) )
|
||||||
|
return wxENDIAN_LITTLE;
|
||||||
|
|
||||||
|
if ( end.StartsWith(wxT("big")) )
|
||||||
|
return wxENDIAN_BIG;
|
||||||
|
|
||||||
|
return wxENDIAN_INVALID;
|
||||||
|
}
|
||||||
|
|
@@ -287,22 +287,20 @@ wxString wxGetDataDir()
|
|||||||
return dir;
|
return dir;
|
||||||
}
|
}
|
||||||
|
|
||||||
int wxGetOsVersion(int *verMaj, int *verMin)
|
bool wxIsPlatformLittleEndian()
|
||||||
{
|
{
|
||||||
// we want this function to work even if there is no wxApp
|
// Are we little or big endian? This method is from Harbison & Steele.
|
||||||
wxConsoleAppTraits traitsConsole;
|
union
|
||||||
wxAppTraits *traits = wxTheApp ? wxTheApp->GetTraits() : NULL;
|
{
|
||||||
if ( ! traits )
|
long l;
|
||||||
traits = &traitsConsole;
|
char c[sizeof(long)];
|
||||||
|
} u;
|
||||||
|
u.l = 1;
|
||||||
|
|
||||||
wxToolkitInfo& info = traits->GetToolkitInfo();
|
return u.c[0] == 1;
|
||||||
if ( verMaj )
|
|
||||||
*verMaj = info.versionMajor;
|
|
||||||
if ( verMin )
|
|
||||||
*verMin = info.versionMinor;
|
|
||||||
return info.os;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Class to make it easier to specify platform-dependent values
|
* Class to make it easier to specify platform-dependent values
|
||||||
*/
|
*/
|
||||||
|
@@ -83,6 +83,8 @@
|
|||||||
extern const unsigned int gtk_micro_version;
|
extern const unsigned int gtk_micro_version;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include "wx/platinfo.h"
|
||||||
|
|
||||||
// Windows List
|
// Windows List
|
||||||
WXDLLIMPEXP_DATA_CORE(wxWindowList) wxTopLevelWindows;
|
WXDLLIMPEXP_DATA_CORE(wxWindowList) wxTopLevelWindows;
|
||||||
|
|
||||||
@@ -2164,54 +2166,19 @@ void wxWindowBase::OnMiddleClick( wxMouseEvent& event )
|
|||||||
#endif // __WXDEBUG__
|
#endif // __WXDEBUG__
|
||||||
|
|
||||||
#if wxUSE_MSGDLG
|
#if wxUSE_MSGDLG
|
||||||
// don't translate these strings
|
// don't translate these strings, they're for diagnostics purposes only
|
||||||
wxString port;
|
wxString msg;
|
||||||
|
msg.Printf(_T("wxWidgets Library (%s port)\n")
|
||||||
#ifdef __WXUNIVERSAL__
|
_T("Version %d.%d.%d%s%s, compiled at %s %s%s\n")
|
||||||
port = _T("Univ/");
|
_T("Copyright (c) 1995-2006 wxWidgets team"),
|
||||||
#endif // __WXUNIVERSAL__
|
wxPlatformInfo().GetPortIdName().c_str(),
|
||||||
|
|
||||||
switch ( wxGetOsVersion() )
|
|
||||||
{
|
|
||||||
case wxMOTIF_X: port += _T("Motif"); break;
|
|
||||||
case wxMAC:
|
|
||||||
case wxMAC_DARWIN: port += _T("Mac"); break;
|
|
||||||
case wxBEOS: port += _T("BeOS"); break;
|
|
||||||
case wxGTK:
|
|
||||||
case wxGTK_WIN32:
|
|
||||||
case wxGTK_OS2:
|
|
||||||
case wxGTK_BEOS: port += _T("GTK"); break;
|
|
||||||
case wxWINDOWS:
|
|
||||||
case wxPENWINDOWS:
|
|
||||||
case wxWINDOWS_NT:
|
|
||||||
case wxWIN32S:
|
|
||||||
case wxWIN95:
|
|
||||||
case wxWIN386: port += _T("MS Windows"); break;
|
|
||||||
case wxMGL_UNIX:
|
|
||||||
case wxMGL_X:
|
|
||||||
case wxMGL_WIN32:
|
|
||||||
case wxMGL_OS2: port += _T("MGL"); break;
|
|
||||||
case wxWINDOWS_OS2:
|
|
||||||
case wxOS2_PM: port += _T("OS/2"); break;
|
|
||||||
case wxPALMOS: port += _T("Palm OS"); break;
|
|
||||||
case wxWINDOWS_CE: port += _T("Windows CE (generic)"); break;
|
|
||||||
case wxWINDOWS_POCKETPC: port += _T("Windows CE PocketPC"); break;
|
|
||||||
case wxWINDOWS_SMARTPHONE: port += _T("Windows CE Smartphone"); break;
|
|
||||||
default: port += _T("unknown"); break;
|
|
||||||
}
|
|
||||||
|
|
||||||
wxMessageBox(wxString::Format(
|
|
||||||
_T(
|
|
||||||
" wxWidgets Library (%s port)\nVersion %d.%d.%d%s%s, compiled at %s %s%s\n Copyright (c) 1995-2006 wxWidgets team"
|
|
||||||
),
|
|
||||||
port.c_str(),
|
|
||||||
wxMAJOR_VERSION,
|
wxMAJOR_VERSION,
|
||||||
wxMINOR_VERSION,
|
wxMINOR_VERSION,
|
||||||
wxRELEASE_NUMBER,
|
wxRELEASE_NUMBER,
|
||||||
#if wxUSE_UNICODE
|
#if wxUSE_UNICODE
|
||||||
L" (Unicode)",
|
L" (Unicode)",
|
||||||
#else
|
#else
|
||||||
"",
|
wxEmptyString,
|
||||||
#endif
|
#endif
|
||||||
#ifdef __WXDEBUG__
|
#ifdef __WXDEBUG__
|
||||||
_T(" Debug build"),
|
_T(" Debug build"),
|
||||||
@@ -2223,10 +2190,11 @@ void wxWindowBase::OnMiddleClick( wxMouseEvent& event )
|
|||||||
#ifdef __WXGTK__
|
#ifdef __WXGTK__
|
||||||
wxString::Format(_T("\nagainst GTK+ %d.%d.%d. Runtime GTK+ version: %d.%d.%d"), GTK_MAJOR_VERSION, GTK_MINOR_VERSION, GTK_MICRO_VERSION, gtk_major_version, gtk_minor_version, gtk_micro_version).c_str()
|
wxString::Format(_T("\nagainst GTK+ %d.%d.%d. Runtime GTK+ version: %d.%d.%d"), GTK_MAJOR_VERSION, GTK_MINOR_VERSION, GTK_MICRO_VERSION, gtk_major_version, gtk_minor_version, gtk_micro_version).c_str()
|
||||||
#else
|
#else
|
||||||
""
|
wxEmptyString
|
||||||
#endif
|
#endif
|
||||||
),
|
);
|
||||||
_T("wxWidgets information"),
|
|
||||||
|
wxMessageBox(msg, _T("wxWidgets information"),
|
||||||
wxICON_INFORMATION | wxOK,
|
wxICON_INFORMATION | wxOK,
|
||||||
(wxWindow *)this);
|
(wxWindow *)this);
|
||||||
}
|
}
|
||||||
|
@@ -163,21 +163,6 @@ int wxDisplayDepth()
|
|||||||
return gdk_drawable_get_visual( wxGetRootWindow()->window )->depth;
|
return gdk_drawable_get_visual( wxGetRootWindow()->window )->depth;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxToolkitInfo& wxGUIAppTraits::GetToolkitInfo()
|
|
||||||
{
|
|
||||||
static wxToolkitInfo info;
|
|
||||||
info.shortName = _T("gtk2");
|
|
||||||
info.name = _T("wxGTK");
|
|
||||||
#ifdef __WXUNIVERSAL__
|
|
||||||
info.shortName << _T("univ");
|
|
||||||
info.name << _T("/wxUniversal");
|
|
||||||
#endif
|
|
||||||
info.versionMajor = gtk_major_version;
|
|
||||||
info.versionMinor = gtk_minor_version;
|
|
||||||
info.os = wxGTK;
|
|
||||||
return info;
|
|
||||||
}
|
|
||||||
|
|
||||||
wxWindow* wxFindWindowAtPoint(const wxPoint& pt)
|
wxWindow* wxFindWindowAtPoint(const wxPoint& pt)
|
||||||
{
|
{
|
||||||
return wxGenericFindWindowAtPoint(pt);
|
return wxGenericFindWindowAtPoint(pt);
|
||||||
@@ -259,3 +244,19 @@ int wxAddProcessCallback(wxEndProcessData *proc_data, int fd)
|
|||||||
|
|
||||||
return tag;
|
return tag;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
// wxPlatformInfo-related
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
wxPortId wxGUIAppTraits::GetToolkitVersion(int *verMaj, int *verMin) const
|
||||||
|
{
|
||||||
|
if ( verMaj )
|
||||||
|
*verMaj = gtk_major_version;
|
||||||
|
if ( verMin )
|
||||||
|
*verMin = gtk_minor_version;
|
||||||
|
|
||||||
|
return wxPORT_GTK;
|
||||||
|
}
|
||||||
|
@@ -129,21 +129,6 @@ int wxDisplayDepth()
|
|||||||
return gdk_window_get_visual( wxGetRootWindow()->window )->depth;
|
return gdk_window_get_visual( wxGetRootWindow()->window )->depth;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxToolkitInfo& wxGUIAppTraits::GetToolkitInfo()
|
|
||||||
{
|
|
||||||
static wxToolkitInfo info;
|
|
||||||
info.shortName = _T("gtk");
|
|
||||||
info.name = _T("wxGTK");
|
|
||||||
#ifdef __WXUNIVERSAL__
|
|
||||||
info.shortName << _T("univ");
|
|
||||||
info.name << _T("/wxUniversal");
|
|
||||||
#endif
|
|
||||||
info.versionMajor = gtk_major_version;
|
|
||||||
info.versionMinor = gtk_minor_version;
|
|
||||||
info.os = wxGTK;
|
|
||||||
return info;
|
|
||||||
}
|
|
||||||
|
|
||||||
wxWindow* wxFindWindowAtPoint(const wxPoint& pt)
|
wxWindow* wxFindWindowAtPoint(const wxPoint& pt)
|
||||||
{
|
{
|
||||||
return wxGenericFindWindowAtPoint(pt);
|
return wxGenericFindWindowAtPoint(pt);
|
||||||
@@ -197,3 +182,17 @@ int wxAddProcessCallback(wxEndProcessData *proc_data, int fd)
|
|||||||
|
|
||||||
return tag;
|
return tag;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
// wxPlatformInfo-related
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
wxPortId wxGUIAppTraits::GetToolkitVersion(int *verMaj, int *verMin) const
|
||||||
|
{
|
||||||
|
if ( verMaj )
|
||||||
|
*verMaj = gtk_major_version;
|
||||||
|
if ( verMin )
|
||||||
|
*verMin = gtk_minor_version;
|
||||||
|
|
||||||
|
return wxPORT_GTK;
|
||||||
|
}
|
||||||
|
@@ -72,7 +72,7 @@
|
|||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
// our OS version is the same in non GUI and GUI cases
|
// our OS version is the same in non GUI and GUI cases
|
||||||
static int DoGetOSVersion(int *majorVsn, int *minorVsn)
|
wxOperatingSystemId wxGetOsVersion(int *verMaj, int *verMin)
|
||||||
{
|
{
|
||||||
long theSystem;
|
long theSystem;
|
||||||
|
|
||||||
@@ -85,14 +85,15 @@ static int DoGetOSVersion(int *majorVsn, int *minorVsn)
|
|||||||
if (majorVsn != NULL)
|
if (majorVsn != NULL)
|
||||||
*majorVsn = (theSystem >> 8);
|
*majorVsn = (theSystem >> 8);
|
||||||
|
|
||||||
#ifdef __DARWIN__
|
#if defined( __DARWIN__ )
|
||||||
return wxMAC_DARWIN;
|
return wxOS_MAC_OSX_DARWIN;
|
||||||
#else
|
#else
|
||||||
return wxMAC;
|
return wxOS_MAC_OS;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#if wxUSE_BASE
|
#if wxUSE_BASE
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
@@ -370,34 +371,17 @@ void wxBell()
|
|||||||
SysBeep(30);
|
SysBeep(30);
|
||||||
}
|
}
|
||||||
|
|
||||||
wxToolkitInfo& wxConsoleAppTraits::GetToolkitInfo()
|
|
||||||
{
|
|
||||||
static wxToolkitInfo info;
|
|
||||||
|
|
||||||
info.os = DoGetOSVersion(&info.versionMajor, &info.versionMinor);
|
|
||||||
info.name = _T("wxBase");
|
|
||||||
|
|
||||||
return info;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif // wxUSE_BASE
|
#endif // wxUSE_BASE
|
||||||
|
|
||||||
#if wxUSE_GUI
|
#if wxUSE_GUI
|
||||||
|
|
||||||
wxToolkitInfo& wxGUIAppTraits::GetToolkitInfo()
|
wxPortId wxGUIAppTraits::GetToolkitVersion(int *verMaj, int *verMin) const
|
||||||
{
|
{
|
||||||
static wxToolkitInfo info;
|
// We suppose that toolkit version is the same as OS version under Mac
|
||||||
|
wxGetOsVersion(verMaj, verMin);
|
||||||
|
|
||||||
info.os = DoGetOSVersion(&info.versionMajor, &info.versionMinor);
|
return wxPORT_MAC;
|
||||||
info.shortName = _T("mac");
|
|
||||||
info.name = _T("wxMac");
|
|
||||||
|
|
||||||
#ifdef __WXUNIVERSAL__
|
|
||||||
info.shortName << _T("univ");
|
|
||||||
info.name << _T("/wxUniversal");
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return info;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Reading and writing resources (eg WIN.INI, .Xdefaults)
|
// Reading and writing resources (eg WIN.INI, .Xdefaults)
|
||||||
|
@@ -61,23 +61,23 @@
|
|||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
// our OS version is the same in non GUI and GUI cases
|
// our OS version is the same in non GUI and GUI cases
|
||||||
static int DoGetOSVersion(int *majorVsn, int *minorVsn)
|
wxOperatingSystemId wxGetOsVersion(int *verMaj, int *verMin)
|
||||||
{
|
{
|
||||||
long theSystem;
|
long theSystem;
|
||||||
|
|
||||||
// are there x-platform conventions ?
|
// are there x-platform conventions ?
|
||||||
|
|
||||||
Gestalt(gestaltSystemVersion, &theSystem);
|
Gestalt(gestaltSystemVersion, &theSystem);
|
||||||
if (minorVsn != NULL) {
|
if (minorVsn != NULL)
|
||||||
*minorVsn = (theSystem & 0xFF);
|
*minorVsn = (theSystem & 0xFF);
|
||||||
}
|
|
||||||
if (majorVsn != NULL) {
|
if (majorVsn != NULL)
|
||||||
*majorVsn = (theSystem >> 8);
|
*majorVsn = (theSystem >> 8);
|
||||||
}
|
|
||||||
#ifdef __DARWIN__
|
#if defined( __DARWIN__ )
|
||||||
return wxMAC_DARWIN;
|
return wxOS_MAC_OSX_DARWIN;
|
||||||
#else
|
#else
|
||||||
return wxMAC;
|
return wxOS_MAC_OS;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -224,29 +224,16 @@ void wxBell()
|
|||||||
SysBeep(30);
|
SysBeep(30);
|
||||||
}
|
}
|
||||||
|
|
||||||
wxToolkitInfo& wxConsoleAppTraits::GetToolkitInfo()
|
|
||||||
{
|
|
||||||
static wxToolkitInfo info;
|
|
||||||
info.os = DoGetOSVersion(&info.versionMajor, &info.versionMinor);
|
|
||||||
info.name = _T("wxBase");
|
|
||||||
return info;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif // wxUSE_BASE
|
#endif // wxUSE_BASE
|
||||||
|
|
||||||
#if wxUSE_GUI
|
#if wxUSE_GUI
|
||||||
|
|
||||||
wxToolkitInfo& wxGUIAppTraits::GetToolkitInfo()
|
wxPortId wxGUIAppTraits::GetToolkitVersion(int *verMaj, int *verMin) const
|
||||||
{
|
{
|
||||||
static wxToolkitInfo info;
|
// We suppose that toolkit version is the same as OS version under Mac
|
||||||
info.os = DoGetOSVersion(&info.versionMajor, &info.versionMinor);
|
wxGetOsVersion(verMaj, verMin);
|
||||||
info.shortName = _T("mac");
|
|
||||||
info.name = _T("wxMac");
|
return wxPORT_MAC;
|
||||||
#ifdef __WXUNIVERSAL__
|
|
||||||
info.shortName << _T("univ");
|
|
||||||
info.name << _T("/wxUniversal");
|
|
||||||
#endif
|
|
||||||
return info;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Reading and writing resources (eg WIN.INI, .Xdefaults)
|
// Reading and writing resources (eg WIN.INI, .Xdefaults)
|
||||||
|
@@ -103,55 +103,15 @@ int wxDisplayDepth()
|
|||||||
return g_displayDC->getBitsPerPixel();
|
return g_displayDC->getBitsPerPixel();
|
||||||
}
|
}
|
||||||
|
|
||||||
#if wxUSE_GUI
|
wxPortId wxGUIAppTraits::GetToolkitVersion(int *verMaj, int *verMin) const
|
||||||
|
|
||||||
wxToolkitInfo& wxGUIAppTraits::GetToolkitInfo()
|
|
||||||
{
|
{
|
||||||
static wxToolkitInfo info;
|
if ( verMaj )
|
||||||
info.shortName = _T("mgluniv");
|
*verMaj = MGL_RELEASE_MAJOR;
|
||||||
info.name = _T("wxMGL");
|
if ( verMin )
|
||||||
info.versionMajor = MGL_RELEASE_MAJOR;
|
*verMin = MGL_RELEASE_MINOR;
|
||||||
info.versionMinor = MGL_RELEASE_MINOR;
|
|
||||||
info.os = wxGTK;
|
|
||||||
#if defined(__UNIX__)
|
|
||||||
info.os = wxMGL_UNIX;
|
|
||||||
#elif defined(__OS2__)
|
|
||||||
info.os = wxMGL_OS2;
|
|
||||||
#elif defined(__WIN32__)
|
|
||||||
info.os = wxMGL_WIN32;
|
|
||||||
#elif defined(__DOS__)
|
|
||||||
info.os = wxMGL_DOS;
|
|
||||||
#else
|
|
||||||
#error Platform not supported by wxMGL!
|
|
||||||
#endif
|
|
||||||
return info;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
return wxPORT_MGL;
|
||||||
|
|
||||||
#if 0
|
|
||||||
wxToolkitInfo& wxConsoleAppTraits::GetToolkitInfo()
|
|
||||||
{
|
|
||||||
static wxToolkitInfo info;
|
|
||||||
info.shortName = _T("mglbase");
|
|
||||||
info.versionMajor = MGL_RELEASE_MAJOR;
|
|
||||||
info.versionMinor = MGL_RELEASE_MINOR;
|
|
||||||
info.name = _T("wxBase");
|
|
||||||
info.os = wxGTK;
|
|
||||||
#if defined(__UNIX__)
|
|
||||||
info.os = wxMGL_UNIX;
|
|
||||||
#elif defined(__OS2__)
|
|
||||||
info.os = wxMGL_OS2;
|
|
||||||
#elif defined(__WIN32__)
|
|
||||||
info.os = wxMGL_WIN32;
|
|
||||||
#elif defined(__DOS__)
|
|
||||||
info.os = wxMGL_DOS;
|
|
||||||
#else
|
|
||||||
#error Platform not supported by wxMGL!
|
|
||||||
#endif
|
|
||||||
return info;
|
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
void wxGetMousePosition(int* x, int* y)
|
void wxGetMousePosition(int* x, int* y)
|
||||||
{
|
{
|
||||||
|
@@ -143,30 +143,18 @@ void wxBell()
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
wxToolkitInfo& wxGUIAppTraits::GetToolkitInfo()
|
wxPortId wxGUIAppTraits::GetToolkitVersion(int *verMaj, int *verMin) const
|
||||||
{
|
{
|
||||||
static wxToolkitInfo info;
|
// XmVERSION and XmREVISION are defined in Xm/Xm.h
|
||||||
|
if ( verMaj )
|
||||||
|
*verMaj = XmVERSION;
|
||||||
|
if ( verMin )
|
||||||
|
*verMin = XmREVISION;
|
||||||
|
|
||||||
info.shortName = _T("motif");
|
return wxPORT_MOTIF;
|
||||||
info.name = _T("wxMotif");
|
|
||||||
#ifdef __WXUNIVERSAL__
|
|
||||||
info.shortName << _T("univ");
|
|
||||||
info.name << _T("/wxUniversal");
|
|
||||||
#endif
|
|
||||||
// FIXME TODO
|
|
||||||
// This code is WRONG!! Does NOT return the
|
|
||||||
// Motif version of the libs but the X protocol
|
|
||||||
// version!
|
|
||||||
Display *display = wxGlobalDisplay();
|
|
||||||
if (display)
|
|
||||||
{
|
|
||||||
info.versionMajor = ProtocolVersion (display);
|
|
||||||
info.versionMinor = ProtocolRevision (display);
|
|
||||||
}
|
|
||||||
info.os = wxMOTIF_X;
|
|
||||||
return info;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// Reading and writing resources (eg WIN.INI, .Xdefaults)
|
// Reading and writing resources (eg WIN.INI, .Xdefaults)
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
@@ -467,22 +467,9 @@ long wxExecute(wxChar **argv, int flags, wxProcess *process)
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
|
||||||
// Traits for console apps
|
|
||||||
//----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
wxToolkitInfo& wxConsoleAppTraits::GetToolkitInfo()
|
|
||||||
{
|
|
||||||
static wxToolkitInfo info;
|
|
||||||
info.versionMajor = _osmajor;
|
|
||||||
info.versionMinor = _osminor;
|
|
||||||
info.name = _T("wxBase");
|
|
||||||
info.os = wxDOS;
|
|
||||||
return info;
|
|
||||||
}
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
// OS Description
|
// OS-related
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
|
|
||||||
wxString wxGetOsDescription()
|
wxString wxGetOsDescription()
|
||||||
@@ -490,3 +477,14 @@ wxString wxGetOsDescription()
|
|||||||
wxString osname(_T("DOS"));
|
wxString osname(_T("DOS"));
|
||||||
return osname;
|
return osname;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
wxOperatingSystemId wxGetOsVersion(int *verMaj, int *verMin)
|
||||||
|
{
|
||||||
|
if ( verMaj )
|
||||||
|
*verMaj = _osmajor;
|
||||||
|
if ( verMin )
|
||||||
|
*verMin = _osminor;
|
||||||
|
|
||||||
|
return wxOS_DOS;
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -226,20 +226,27 @@ bool wxGUIAppTraits::DoMessageFromThreadWait()
|
|||||||
return evtLoop->Dispatch();
|
return evtLoop->Dispatch();
|
||||||
}
|
}
|
||||||
|
|
||||||
wxToolkitInfo& wxGUIAppTraits::GetToolkitInfo()
|
wxPortId wxGUIAppTraits::GetToolkitVersion(int *majVer, int *minVer) const
|
||||||
{
|
{
|
||||||
static wxToolkitInfo info;
|
OSVERSIONINFO info;
|
||||||
wxToolkitInfo& baseInfo = wxAppTraits::GetToolkitInfo();
|
wxZeroMemory(info);
|
||||||
info.versionMajor = baseInfo.versionMajor;
|
|
||||||
info.versionMinor = baseInfo.versionMinor;
|
// on Windows, the toolkit version is the same of the OS version
|
||||||
info.os = baseInfo.os;
|
// as Windows integrates the OS kernel with the GUI toolkit.
|
||||||
info.shortName = _T("msw");
|
info.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
|
||||||
info.name = _T("wxMSW");
|
if ( ::GetVersionEx(&info) )
|
||||||
#ifdef __WXUNIVERSAL__
|
{
|
||||||
info.shortName << _T("univ");
|
if ( majVer )
|
||||||
info.name << _T("/wxUniversal");
|
*majVer = info.dwMajorVersion;
|
||||||
|
if ( minVer )
|
||||||
|
*minVer = info.dwMinorVersion;
|
||||||
|
}
|
||||||
|
|
||||||
|
#if defined(__WXHANDHELD__) || defined(__WXWINCE__)
|
||||||
|
return wxPORT_WINCE;
|
||||||
|
#else
|
||||||
|
return wxPORT_MSW;
|
||||||
#endif
|
#endif
|
||||||
return info;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
@@ -1162,61 +1162,49 @@ wxString wxGetOsDescription()
|
|||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxToolkitInfo& wxAppTraits::GetToolkitInfo()
|
// taken from http://blogs.msdn.com/oldnewthing/archive/2005/02/01/364563.aspx
|
||||||
|
bool wxIsPlatform64Bit()
|
||||||
{
|
{
|
||||||
// cache the version info, it's not going to change
|
#if defined(_WIN64)
|
||||||
//
|
return true; // 64-bit programs run only on Win64
|
||||||
// NB: this is MT-safe, we may use these static vars from different threads
|
#elif defined(_WIN32)
|
||||||
// but as they always have the same value it doesn't matter
|
// 32-bit programs run on both 32-bit and 64-bit Windows
|
||||||
static int s_ver = -1,
|
// so must sniff
|
||||||
s_major = -1,
|
BOOL f64 = FALSE;
|
||||||
s_minor = -1;
|
return IsWow64Process(GetCurrentProcess(), &f64) && f64;
|
||||||
|
#else
|
||||||
|
return false; // Win64 does not support Win16
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
if ( s_ver == -1 )
|
wxOperatingSystemId wxGetOsVersion(int *verMaj, int *verMin)
|
||||||
{
|
{
|
||||||
OSVERSIONINFO info;
|
OSVERSIONINFO info;
|
||||||
wxZeroMemory(info);
|
wxZeroMemory(info);
|
||||||
|
|
||||||
s_ver = wxWINDOWS;
|
|
||||||
info.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
|
info.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
|
||||||
if ( ::GetVersionEx(&info) )
|
if ( ::GetVersionEx(&info) )
|
||||||
{
|
{
|
||||||
s_major = info.dwMajorVersion;
|
if (verMaj) *verMaj = info.dwMajorVersion;
|
||||||
s_minor = info.dwMinorVersion;
|
if (verMin) *verMin = info.dwMinorVersion;
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef __SMARTPHONE__
|
#if defined(__WXHANDHELD__) || defined( __WXWINCE__ )
|
||||||
s_ver = wxWINDOWS_SMARTPHONE;
|
return wxOS_WINDOWS_WINCE;
|
||||||
#elif defined(__POCKETPC__)
|
#elif defined( __WXMICROWIN__ )
|
||||||
s_ver = wxWINDOWS_POCKETPC;
|
return wxOS_WINDOWS_MICRO;
|
||||||
#else
|
#else
|
||||||
switch ( info.dwPlatformId )
|
switch ( info.dwPlatformId )
|
||||||
{
|
{
|
||||||
case VER_PLATFORM_WIN32s:
|
case VER_PLATFORM_WIN32_NT:
|
||||||
s_ver = wxWIN32S;
|
return wxOS_WINDOWS_NT;
|
||||||
break;
|
|
||||||
|
|
||||||
case VER_PLATFORM_WIN32_WINDOWS:
|
case VER_PLATFORM_WIN32_WINDOWS:
|
||||||
s_ver = wxWIN95;
|
return wxOS_WINDOWS_9X;
|
||||||
break;
|
|
||||||
|
|
||||||
case VER_PLATFORM_WIN32_NT:
|
|
||||||
s_ver = wxWINDOWS_NT;
|
|
||||||
break;
|
|
||||||
#ifdef __WXWINCE__
|
|
||||||
case VER_PLATFORM_WIN32_CE:
|
|
||||||
s_ver = wxWINDOWS_CE;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static wxToolkitInfo info;
|
return wxOS_UNKNOWN;
|
||||||
info.versionMajor = s_major;
|
#endif
|
||||||
info.versionMinor = s_minor;
|
|
||||||
info.os = s_ver;
|
|
||||||
info.name = _T("wxBase");
|
|
||||||
return info;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
wxWinVersion wxGetWinVersion()
|
wxWinVersion wxGetWinVersion()
|
||||||
|
@@ -326,27 +326,30 @@ void wxAppTraits::TerminateGui(unsigned long WXUNUSED(ulHab))
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
wxToolkitInfo & wxConsoleAppTraits::GetToolkitInfo()
|
wxOperatingSystemId wxGetOsVersion(int *verMaj, int *verMin)
|
||||||
{
|
{
|
||||||
static wxToolkitInfo vInfo;
|
static wxToolkitInfo vInfo;
|
||||||
ULONG ulSysInfo[QSV_MAX] = {0};
|
ULONG ulSysInfo[QSV_MAX] = {0};
|
||||||
APIRET ulrc;
|
APIRET ulrc;
|
||||||
|
|
||||||
vInfo.name = _T("wxBase");
|
|
||||||
ulrc = ::DosQuerySysInfo( 1L
|
ulrc = ::DosQuerySysInfo( 1L
|
||||||
,QSV_MAX
|
,QSV_MAX
|
||||||
,(PVOID)ulSysInfo
|
,(PVOID)ulSysInfo
|
||||||
,sizeof(ULONG) * QSV_MAX
|
,sizeof(ULONG) * QSV_MAX
|
||||||
);
|
);
|
||||||
|
|
||||||
if (ulrc == 0L)
|
if (ulrc == 0L)
|
||||||
{
|
{
|
||||||
vInfo.versionMajor = ulSysInfo[QSV_VERSION_MAJOR] / 10;
|
if ( verMaj )
|
||||||
vInfo.versionMinor = ulSysInfo[QSV_VERSION_MINOR];
|
*verMaj = ulSysInfo[QSV_VERSION_MAJOR] / 10;
|
||||||
|
if ( verMin )
|
||||||
|
*verMin = ulSysInfo[QSV_VERSION_MINOR];
|
||||||
}
|
}
|
||||||
vInfo.os = wxOS2_PM;
|
|
||||||
return vInfo;
|
return wxOS_OS2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
const wxChar* wxGetHomeDir(
|
const wxChar* wxGetHomeDir(
|
||||||
wxString* pStr
|
wxString* pStr
|
||||||
|
@@ -437,31 +437,12 @@ void wxGUIAppTraits::TerminateGui(unsigned long ulHab)
|
|||||||
::WinTerminate(ulHab);
|
::WinTerminate(ulHab);
|
||||||
}
|
}
|
||||||
|
|
||||||
wxToolkitInfo & wxGUIAppTraits::GetToolkitInfo()
|
wxPortId wxGUIAppTraits::GetToolkitVersion(int *verMaj, int *verMin) const
|
||||||
{
|
{
|
||||||
static wxToolkitInfo vInfo;
|
// TODO: how to get version of PM ?
|
||||||
ULONG ulSysInfo[QSV_MAX] = {0};
|
return wxPORT_OS2;
|
||||||
APIRET ulrc;
|
}
|
||||||
|
|
||||||
vInfo.shortName = _T("PM");
|
|
||||||
vInfo.name = _T("wxOS2");
|
|
||||||
#ifdef __WXUNIVERSAL__
|
|
||||||
vInfo.shortName << _T("univ");
|
|
||||||
vInfo.name << _T("/wxUniversal");
|
|
||||||
#endif
|
|
||||||
ulrc = ::DosQuerySysInfo( 1L
|
|
||||||
,QSV_MAX
|
|
||||||
,(PVOID)ulSysInfo
|
|
||||||
,sizeof(ULONG) * QSV_MAX
|
|
||||||
);
|
|
||||||
if (ulrc == 0L)
|
|
||||||
{
|
|
||||||
vInfo.versionMajor = ulSysInfo[QSV_VERSION_MAJOR] / 10;
|
|
||||||
vInfo.versionMinor = ulSysInfo[QSV_VERSION_MINOR];
|
|
||||||
}
|
|
||||||
vInfo.os = wxOS2_PM;
|
|
||||||
return vInfo;
|
|
||||||
}
|
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
// window information functions
|
// window information functions
|
||||||
|
@@ -113,20 +113,10 @@ bool wxGUIAppTraits::DoMessageFromThreadWait()
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxToolkitInfo& wxGUIAppTraits::GetToolkitInfo()
|
wxPortId wxGUIAppTraits::GetToolkitVersion(int *majVer, int *minVer) const
|
||||||
{
|
{
|
||||||
static wxToolkitInfo info;
|
// TODO: how to get PalmOS GUI system version ?
|
||||||
wxToolkitInfo& baseInfo = wxAppTraits::GetToolkitInfo();
|
return wxPORT_PALMOS;
|
||||||
info.versionMajor = baseInfo.versionMajor;
|
|
||||||
info.versionMinor = baseInfo.versionMinor;
|
|
||||||
info.os = baseInfo.os;
|
|
||||||
info.shortName = _T("palmos");
|
|
||||||
info.name = _T("wxPalmOS");
|
|
||||||
#ifdef __WXUNIVERSAL__
|
|
||||||
info.shortName << _T("univ");
|
|
||||||
info.name << _T("/wxUniversal");
|
|
||||||
#endif
|
|
||||||
return info;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
@@ -215,12 +215,11 @@ wxString wxGetOsDescription()
|
|||||||
return strOS;
|
return strOS;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxToolkitInfo& wxAppTraits::GetToolkitInfo()
|
wxOperatingSystemId wxGetOsVersion(int *verMaj, int *verMin)
|
||||||
{
|
{
|
||||||
static wxToolkitInfo info;
|
// TODO
|
||||||
info.os = wxPALMOS;
|
|
||||||
info.name = _T("wxBase");
|
return wxOS_UNKNOWN;
|
||||||
return info;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
@@ -81,45 +81,3 @@ wxConsoleAppTraits::WaitForChild(wxExecuteData& execData)
|
|||||||
return exitcode;
|
return exitcode;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
|
||||||
// misc other stuff
|
|
||||||
// ----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
// this is in mac/utils.cpp under Mac
|
|
||||||
#if !defined(__WXMAC__)
|
|
||||||
|
|
||||||
wxToolkitInfo& wxConsoleAppTraits::GetToolkitInfo()
|
|
||||||
{
|
|
||||||
static wxToolkitInfo info;
|
|
||||||
int major, minor;
|
|
||||||
|
|
||||||
FILE *f = popen("uname -r", "r");
|
|
||||||
if (f)
|
|
||||||
{
|
|
||||||
char buf[32];
|
|
||||||
size_t c = fread(buf, 1, sizeof(buf) - 1, f);
|
|
||||||
pclose(f);
|
|
||||||
buf[c] = '\0';
|
|
||||||
if ( sscanf(buf, "%d.%d", &major, &minor) != 2 )
|
|
||||||
{
|
|
||||||
// unrecognized uname string format
|
|
||||||
major =
|
|
||||||
minor = -1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// failed to run uname
|
|
||||||
major =
|
|
||||||
minor = -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
info.versionMajor = major;
|
|
||||||
info.versionMinor = minor;
|
|
||||||
info.name = _T("wxBase");
|
|
||||||
info.os = wxUNIX;
|
|
||||||
|
|
||||||
return info;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif // __WXMAC__
|
|
||||||
|
@@ -746,6 +746,35 @@ char *wxGetUserHome( const wxString &user )
|
|||||||
// network and user id routines
|
// network and user id routines
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// private utility function which returns output of the given command, removing
|
||||||
|
// the trailing newline
|
||||||
|
static wxString wxGetCommandOutput(const wxString &cmd)
|
||||||
|
{
|
||||||
|
FILE *f = popen(cmd.ToAscii(), "r");
|
||||||
|
if ( !f )
|
||||||
|
{
|
||||||
|
wxLogSysError(_T("Executing \"%s\" failed"), cmd.c_str());
|
||||||
|
return wxEmptyString;
|
||||||
|
}
|
||||||
|
|
||||||
|
wxString s;
|
||||||
|
char buf[256];
|
||||||
|
while ( !feof(f) )
|
||||||
|
{
|
||||||
|
if ( !fgets(buf, sizeof(buf), f) )
|
||||||
|
break;
|
||||||
|
|
||||||
|
s += wxString::FromAscii(buf);
|
||||||
|
}
|
||||||
|
|
||||||
|
pclose(f);
|
||||||
|
|
||||||
|
if ( !s.empty() && s.Last() == _T('\n') )
|
||||||
|
s.RemoveLast();
|
||||||
|
|
||||||
|
return s;
|
||||||
|
}
|
||||||
|
|
||||||
// retrieve either the hostname or FQDN depending on platform (caller must
|
// retrieve either the hostname or FQDN depending on platform (caller must
|
||||||
// check whether it's one or the other, this is why this function is for
|
// check whether it's one or the other, this is why this function is for
|
||||||
// private use only)
|
// private use only)
|
||||||
@@ -862,25 +891,54 @@ bool wxGetUserName(wxChar *buf, int sz)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
wxOperatingSystemId wxGetOsVersion(int *verMaj, int *verMin)
|
||||||
|
{
|
||||||
|
// get OS version
|
||||||
|
int major, minor;
|
||||||
|
wxString release = wxGetCommandOutput(wxT("uname -r"));
|
||||||
|
if ( !release.empty() && wxSscanf(release, "%d.%d", &major, &minor) != 2 )
|
||||||
|
{
|
||||||
|
// unrecognized uname string format
|
||||||
|
major =
|
||||||
|
minor = -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( verMaj )
|
||||||
|
*verMaj = major;
|
||||||
|
if ( verMin )
|
||||||
|
*verMin = minor;
|
||||||
|
|
||||||
|
// try to understand which OS are we running
|
||||||
|
wxString kernel = wxGetCommandOutput(wxT("uname -s"));
|
||||||
|
if ( kernel.empty() )
|
||||||
|
kernel = wxGetCommandOutput(wxT("uname -o"));
|
||||||
|
|
||||||
|
if ( kernel.empty() )
|
||||||
|
return wxOS_UNKNOWN;
|
||||||
|
|
||||||
|
return wxPlatformInfo::GetOperatingSystemId(kernel);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool wxIsPlatform64Bit()
|
||||||
|
{
|
||||||
|
wxString machine = wxGetCommandOutput(wxT("uname -m"));
|
||||||
|
|
||||||
|
// NOTE: these tests are not 100% reliable!
|
||||||
|
return machine.Contains(wxT("AMD64")) ||
|
||||||
|
machine.Contains(wxT("IA64")) ||
|
||||||
|
machine.Contains(wxT("x64")) ||
|
||||||
|
machine.Contains(wxT("X64")) ||
|
||||||
|
machine.Contains(wxT("alpha")) ||
|
||||||
|
machine.Contains(wxT("hppa64")) ||
|
||||||
|
machine.Contains(wxT("ppc64"));
|
||||||
|
}
|
||||||
|
|
||||||
// this function is in mac/utils.cpp for wxMac
|
// this function is in mac/utils.cpp for wxMac
|
||||||
#ifndef __WXMAC__
|
#ifndef __WXMAC__
|
||||||
|
|
||||||
wxString wxGetOsDescription()
|
wxString wxGetOsDescription()
|
||||||
{
|
{
|
||||||
FILE *f = popen("uname -s -r -m", "r");
|
return wxGetCommandOutput(wxT("uname -s -r -m"));
|
||||||
if (f)
|
|
||||||
{
|
|
||||||
char buf[256];
|
|
||||||
size_t c = fread(buf, 1, sizeof(buf) - 1, f);
|
|
||||||
pclose(f);
|
|
||||||
// Trim newline from output.
|
|
||||||
if (c && buf[c - 1] == '\n')
|
|
||||||
--c;
|
|
||||||
buf[c] = '\0';
|
|
||||||
return wxString::FromAscii( buf );
|
|
||||||
}
|
|
||||||
wxFAIL_MSG( _T("uname failed") );
|
|
||||||
return wxEmptyString;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // !__WXMAC__
|
#endif // !__WXMAC__
|
||||||
|
@@ -153,17 +153,22 @@ void wxBell()
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
wxToolkitInfo& wxGUIAppTraits::GetToolkitInfo()
|
wxPortId wxGUIAppTraits::GetToolkitVersion(int *verMaj, int *verMin) const
|
||||||
{
|
{
|
||||||
static wxToolkitInfo info;
|
// get X protocol version
|
||||||
info.shortName = _T("x11univ");
|
Display *display = wxGlobalDisplay();
|
||||||
info.name = _T("wxX11");
|
if (display)
|
||||||
info.versionMajor = 0;
|
{
|
||||||
info.versionMinor = 0;
|
if ( verMaj )
|
||||||
info.os = wxX11;
|
*verMaj = ProtocolVersion (display);
|
||||||
return info;
|
if ( verMin )
|
||||||
|
*verMin = ProtocolRevision (display);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return wxPORT_X11;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// display info
|
// display info
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
Reference in New Issue
Block a user