1 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3 %% Purpose: wxPlatformInfo
4 %% Author: Francesco Montorsi
8 %% Copyright: (c) wxWidgets Team
9 %% License: wxWindows license
10 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12 \section{\class{wxPlatformInfo
}}\label{wxplatforminfo
}
14 This class holds informations about the operating system and the toolkit that the application
15 is running under and some basic architecture info of the machine where it's running.
17 \wxheading{Derived from
}
19 \helpref{wxObject
}{wxobject
}
21 \wxheading{Include files
}
23 <include/wx/platinfo.h>
27 \helpref{wxGetOSVersion
}{wxgetosversion
},
\helpref{wxIsPlatformLittleEndian
}{wxisplatformlittleendian
},
28 \helpref{wxIsPlatform64Bit
}{wxisplatform64bit
},
\helpref{wxAppTraits
}{wxapptraits
}
30 \wxheading{Data structures
}
32 The following are the operating systems which are recognized by wxWidgets
33 and whose version can be detected at run-time. The values of the constants
34 are chosen so that they can be combined as flags; this allows to check
35 for operating system
{\it families
} like e.g. wxOS
\_MAC and wxOS
\_UNIX.
38 enum wxOperatingSystemId
40 wxOS_UNKNOWN =
0, // returned on error
42 wxOS_MAC_OS =
1 <<
0, // Apple Mac OS
8/
9/X with Mac paths
43 wxOS_MAC_OSX_DARWIN =
1 <<
1, // Apple Mac OS X with Unix paths
44 wxOS_MAC = wxOS_MAC_OS|wxOS_MAC_OSX_DARWIN,
46 wxOS_WINDOWS_9X =
1 <<
2, // Windows
9x family (
95/
98/ME)
47 wxOS_WINDOWS_NT =
1 <<
3, // Windows NT family (NT/
2000/XP)
48 wxOS_WINDOWS_MICRO =
1 <<
4, // MicroWindows
49 wxOS_WINDOWS_CE =
1 <<
5, // Windows CE (Window Mobile)
50 wxOS_WINDOWS = wxOS_WINDOWS_9X |
55 wxOS_UNIX_LINUX =
1 <<
6, // Linux
56 wxOS_UNIX_FREEBSD =
1 <<
7, // FreeBSD
57 wxOS_UNIX_OPENBSD =
1 <<
8, // OpenBSD
58 wxOS_UNIX_NETBSD =
1 <<
9, // NetBSD
59 wxOS_UNIX_SOLARIS =
1 <<
10, // SunOS
60 wxOS_UNIX_AIX =
1 <<
11, // AIX
61 wxOS_UNIX_HPUX =
1 <<
12, // HP/UX
62 wxOS_UNIX = wxOS_UNIX_LINUX |
70 wxOS_DOS =
1 <<
15, // Microsoft DOS
71 wxOS_OS2 =
1 <<
16 // OS/
2
75 The list of wxWidgets ports. Some of them can be used with more than
76 a single (native) toolkit; e.g. wxWinCE port sources can be used with
77 smartphones, pocket PCs and handheld devices SDKs.
82 wxPORT_UNKNOWN =
0, // returned on error
84 wxPORT_BASE =
1 <<
0, // wxBase, no native toolkit used
86 wxPORT_MSW =
1 <<
1, // wxMSW, native toolkit is Windows API
87 wxPORT_MOTIF =
1 <<
2, // wxMotif, using
[Open
]Motif or Lesstif
88 wxPORT_GTK =
1 <<
3, // wxGTK, using GTK+
1.x,
2.x, GPE or Maemo
89 wxPORT_MGL =
1 <<
4, // wxMGL, using wxUniversal
90 wxPORT_X11 =
1 <<
5, // wxX11, using wxUniversal
91 wxPORT_OS2 =
1 <<
6, // wxOS2, using OS/
2 Presentation Manager
92 wxPORT_MAC =
1 <<
7, // wxMac, using Carbon or Classic Mac API
93 wxPORT_COCOA =
1 <<
8, // wxCocoa, using Cocoa NextStep/Mac API
94 wxPORT_WINCE =
1 <<
9, // wxWinCE, toolkit is WinCE SDK API
95 wxPORT_PALMOS =
1 <<
10 // wxPalmOS, toolkit is PalmOS API
99 The architecture of the operating system (regardless of the build environment
100 of wxWidgets library - see
\helpref{wxIsPlatform64bit
}{wxisplatform64bit
} documentation
106 wxARCH_INVALID = -
1, // returned on error
115 The endian-ness of the machine.
120 wxENDIAN_INVALID = -
1, // returned on error
122 wxENDIAN_BIG, //
4321
123 wxENDIAN_LITTLE, //
1234
124 wxENDIAN_PDP, //
3412
130 \latexignore{\rtfignore{\wxheading{Members
}}}
133 \membersection{wxPlatformInfo::wxPlatformInfo
}\label{wxplatforminfowxplatforminfo
}
135 \func{}{wxPlatformInfo
}{}
137 Initializes the instance with the values corresponding to the currently running platform.
139 \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}}
141 Initializes the object using given values.
145 \membersection{wxPlatformInfo::CheckOSVersion
}\label{wxplatforminfocheckosversion
}
147 \constfunc{bool
}{CheckOSVersion
}{\param{int
}{major
},
\param{int
}{minor
}}
149 Returns
\true if the OS version is at least
\texttt{major.minor
}.
153 \helpref{GetOSMajorVersion
}{wxplatforminfogetosmajorversion
},
154 \helpref{GetOSMinorVersion
}{wxplatforminfogetosminorversion
},
155 \helpref{CheckToolkitVersion
}{wxplatforminfochecktoolkitversion
}
158 \membersection{wxPlatformInfo::CheckToolkitVersion
}\label{wxplatforminfochecktoolkitversion
}
160 \constfunc{bool
}{CheckToolkitVersion
}{\param{int
}{major
},
\param{int
}{minor
}}
162 Returns
\true if the toolkit version is at least
\texttt{major.minor
}.
166 \helpref{GetToolkitMajorVersion
}{wxplatforminfogettoolkitmajorversion
},
167 \helpref{GetToolkitMinorVersion
}{wxplatforminfogettoolkitminorversion
},
168 \helpref{CheckOSVersion
}{wxplatforminfocheckosversion
}
172 \membersection{wxPlatformInfo::GetArch
}\label{wxplatforminfogetarch
}
174 \func{static wxArchitecture
}{GetArch
}{\param{const wxString\&
}{arch
}}
176 Converts the given string to a wxArchitecture enum value or to
177 wxARCH
\_INVALID if the given string is not a valid architecture string
178 (i.e. does not contain nor
{\tt 32} nor
{\tt 64} strings).
181 \membersection{wxPlatformInfo::GetArchName
}\label{wxplatforminfogetarchname
}
183 \func{static wxString
}{GetArchName
}{\param{wxArchitecture
}{arch
}}
185 Returns the name for the given wxArchitecture enumeration value.
187 \constfunc{wxString
}{GetArchName
}{\void}
189 Returns the name for the architecture of this wxPlatformInfo instance.
192 \membersection{wxPlatformInfo::GetArchitecture
}\label{wxplatforminfogetarchitecture
}
194 \constfunc{wxArchitecture
}{GetArchitecture
}{\void}
196 Returns the architecture ID of this wxPlatformInfo instance.
201 \membersection{wxPlatformInfo::GetEndianness
}\label{wxplatforminfogetendianness
}
203 \func{static wxEndianness
}{GetEndianness
}{\param{const wxString\&
}{end
}}
205 Converts the given string to a wxEndianness enum value or to
206 wxENDIAN
\_INVALID if the given string is not a valid endianness string
207 (i.e. does not contain nor
{\tt little
} nor
{\tt big
} strings).
209 \constfunc{wxEndianness
}{GetEndianness
}{\void}
211 Returns the endianness ID of this wxPlatformInfo instance.
213 \membersection{wxPlatformInfo::GetEndiannessName
}\label{wxplatforminfogetendiannessname
}
215 \func{static wxString
}{GetEndiannessName
}{\param{wxEndianness
}{end
}}
217 Returns name for the given wxEndianness enumeration value.
219 \constfunc{wxString
}{GetEndiannessName
}{\void}
221 Returns the name for the endianness of this wxPlatformInfo instance.
227 \membersection{wxPlatformInfo::GetOSMajorVersion
}\label{wxplatforminfogetosmajorversion
}
229 \constfunc{int
}{GetOSMajorVersion
}{\void}
231 Returns the major version of the OS associated with this wxPlatformInfo instance.
235 \helpref{CheckOSVersion
}{wxplatforminfocheckosversion
}
238 \membersection{wxPlatformInfo::GetOSMinorVersion
}\label{wxplatforminfogetosminorversion
}
240 \constfunc{int
}{GetOSMinorVersion
}{\void}
242 Returns the minor version of the OS associated with this wxPlatformInfo instance.
244 \helpref{CheckOSVersion
}{wxplatforminfocheckosversion
}
248 \membersection{wxPlatformInfo::GetOperatingSystemFamilyName
}\label{wxplatforminfogetoperatingsystemfamilyname
}
250 \func{static wxString
}{GetOperatingSystemFamilyName
}{\param{wxOperatingSystemId
}{os
}}
252 Returns the operating system family name for the given wxOperatingSystemId enumeration value:
253 {\tt Unix
} for wxOS
\_UNIX,
{\tt Macintosh
} for wxOS
\_MAC,
{\tt Windows
} for wxOS
\_WINDOWS,
254 {\tt DOS
} for wxOS
\_DOS,
{\tt OS/
2} for wxOS
\_OS2.
256 \constfunc{wxString
}{GetOperatingSystemFamilyName
}{\void}
258 Returns the operating system family name of the OS associated with this wxPlatformInfo instance.
262 \membersection{wxPlatformInfo::GetOperatingSystemId
}\label{wxplatforminfogetoperatingsystemid
}
264 \func{static wxOperatingSystemId
}{GetOperatingSystemId
}{\param{const wxString\&
}{name
}}
266 Converts the given string to a wxOperatingSystemId enum value or to
267 wxOS
\_UNKNOWN if the given string is not a valid operating system name.
269 \constfunc{wxOperatingSystemId
}{GetOperatingSystemId
}{\void}
271 Returns the operating system ID of this wxPlatformInfo instance.
275 \membersection{wxPlatformInfo::GetOperatingSystemIdName
}\label{wxplatforminfogetoperatingsystemidname
}
277 \func{static wxString
}{GetOperatingSystemIdName
}{\param{wxOperatingSystemId
}{os
}}
279 Returns the name for the given operating system ID value. This can be a long name
280 (e.g.
{\tt Microsoft Windows NT
}); use
\helpref{GetOperatingSystemFamilyName
}{wxplatforminfogetoperatingsystemfamilyname
} to
281 retrieve a short, generic name.
284 \constfunc{wxString
}{GetOperatingSystemIdName
}{\void}
286 Returns the operating system name of the OS associated with this wxPlatformInfo instance.
292 \membersection{wxPlatformInfo::GetPortId
}\label{wxplatforminfogetportid
}
294 \func{static wxPortId
}{GetPortId
}{\param{const wxString\&
}{portname
}}
296 Converts the given string to a wxWidgets port ID value or to wxPORT
\_UNKNOWN if
297 the given string does not match any of the wxWidgets canonical name ports ("wxGTK", "wxMSW", etc)
298 nor any of the short wxWidgets name ports ("gtk", "msw", etc).
300 \constfunc{wxPortId
}{GetPortId
}{\void}
302 Returns the wxWidgets port ID associated with this wxPlatformInfo instance.
304 \membersection{wxPlatformInfo::GetPortIdName
}\label{wxplatforminfogetportidname
}
306 \func{static wxString
}{GetPortIdName
}{\param{wxPortId
}{port
},
\param{bool
}{usingUniversal
}}
308 Returns the name of the given wxWidgets port ID value. The
\arg{usingUniversal
}
309 argument specifies whether the port is in its native or wxUniversal variant.
311 The returned string always starts with the "wx" prefix and is a mixed-case
314 \constfunc{wxString
}{GetPortIdName
}{\void}
316 Returns the name of the wxWidgets port ID associated with this wxPlatformInfo instance.
321 \membersection{wxPlatformInfo::GetPortIdShortName
}\label{wxplatforminfogetportidshortname
}
323 \func{static wxString
}{GetPortIdShortName
}{\param{wxPortId
}{port
},
\param{bool
}{usingUniversal
}}
325 Returns the short name of the given wxWidgets port ID value. The
326 \arg{usingUniversal
} argument specifies whether the port is in its native or
329 The returned string does not start with the "wx" prefix and is always lower
332 \constfunc{wxString
}{GetPortIdShortName
}{\void}
334 Returns the short name of the wxWidgets port ID associated with this wxPlatformInfo instance.
339 \membersection{wxPlatformInfo::GetToolkitMajorVersion
}\label{wxplatforminfogettoolkitmajorversion
}
341 \constfunc{int
}{GetToolkitMajorVersion
}{\void}
343 Returns the major version of the toolkit associated with this wxPlatformInfo instance.
344 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.
348 \helpref{CheckToolkitVersion
}{wxplatforminfochecktoolkitversion
}
351 \membersection{wxPlatformInfo::GetToolkitMinorVersion
}\label{wxplatforminfogettoolkitminorversion
}
353 \constfunc{int
}{GetToolkitMinorVersion
}{\void}
355 Returns the minor version of the toolkit associated with this wxPlatformInfo instance.
356 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.
360 \helpref{CheckToolkitVersion
}{wxplatforminfochecktoolkitversion
}
365 \membersection{wxPlatformInfo::IsOk
}\label{wxplatforminfoisok
}
367 \constfunc{bool
}{IsOk
}{\void}
369 Returns
\true if this instance is fully initialized with valid values.
373 \membersection{wxPlatformInfo::IsUsingUniversalWidgets
}\label{wxplatforminfoisusinguniversalwidgets
}
375 \constfunc{bool
}{IsUsingUniversalWidgets
}{\void}
377 Returns
\true if this wxPlatformInfo describes wxUniversal build.
380 \membersection{wxPlatformInfo::SetArchitecture
}\label{wxplatforminfosetarchitecture
}
382 \func{void
}{SetArchitecture
}{\param{wxArchitecture
}{n
}}
384 Sets the architecture enum value associated with this wxPlatformInfo instance.
388 \membersection{wxPlatformInfo::SetEndianness
}\label{wxplatforminfosetendianness
}
390 \func{void
}{SetEndianness
}{\param{wxEndianness
}{n
}}
392 Sets the endianness enum value associated with this wxPlatformInfo instance.
395 \membersection{wxPlatformInfo::SetOSVersion
}\label{wxplatforminfosetosversion
}
397 \func{void
}{SetOSVersion
}{\param{int
}{major
},
\param{int
}{minor
}}
399 Sets the version of the operating system associated with this wxPlatformInfo instance.
403 \membersection{wxPlatformInfo::SetOperatingSystemId
}\label{wxplatforminfosetoperatingsystemid
}
405 \func{void
}{SetOperatingSystemId
}{\param{wxOperatingSystemId
}{n
}}
407 Sets the operating system associated with this wxPlatformInfo instance.
411 \membersection{wxPlatformInfo::SetPortId
}\label{wxplatforminfosetportid
}
413 \func{void
}{SetPortId
}{\param{wxPortId
}{n
}}
415 Sets the wxWidgets port ID associated with this wxPlatformInfo instance.
419 \membersection{wxPlatformInfo::SetToolkitVersion
}\label{wxplatforminfosettoolkitversion
}
421 \func{void
}{SetToolkitVersion
}{\param{int
}{major
},
\param{int
}{minor
}}
423 Sets the version of the toolkit associated with this wxPlatformInfo instance.
427 \membersection{wxPlatformInfo::operator!=
}\label{wxplatforminfooperatorunknown
}
429 \constfunc{bool
}{operator!=
}{\param{const wxPlatformInfo\&
}{t
}}
431 Inequality operator. Tests all class' internal variables.
434 \membersection{wxPlatformInfo::operator==
}\label{wxplatforminfooperatorequal
}
436 \constfunc{bool
}{operator==
}{\param{const wxPlatformInfo\&
}{t
}}
438 Equality operator. Tests all class' internal variables.