]> git.saurik.com Git - wxWidgets.git/blame - docs/latex/wx/platinfo.tex
added null pointer check and assert
[wxWidgets.git] / docs / latex / wx / platinfo.tex
CommitLineData
8bb6b2c0
VZ
1%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2%% Name: platinfo.tex
3%% Purpose: wxPlatformInfo
4%% Author: Francesco Montorsi
5%% Modified by:
6%% Created: 31-7-2006
7%% RCS-ID: $Id$
8%% Copyright: (c) wxWidgets Team
9%% License: wxWindows license
10%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11
12\section{\class{wxPlatformInfo}}\label{wxplatforminfo}
13
14This class holds informations about the operating system and the toolkit that the application
15is running under and some basic architecture info of the machine where it's running.
16
17\wxheading{Derived from}
18
19\helpref{wxObject}{wxobject}
20
21\wxheading{Include files}
22
aad035b2 23<wx/platinfo.h>
8bb6b2c0 24
a7af285d
VZ
25\wxheading{Library}
26
27\helpref{wxBase}{librarieslist}
28
8bb6b2c0
VZ
29\wxheading{See also}
30
31\helpref{wxGetOSVersion}{wxgetosversion}, \helpref{wxIsPlatformLittleEndian}{wxisplatformlittleendian},
32\helpref{wxIsPlatform64Bit}{wxisplatform64bit}, \helpref{wxAppTraits}{wxapptraits}
33
34\wxheading{Data structures}
35
36The following are the operating systems which are recognized by wxWidgets
37and whose version can be detected at run-time. The values of the constants
38are chosen so that they can be combined as flags; this allows to check
39for operating system {\it families} like e.g. wxOS\_MAC and wxOS\_UNIX.
40
41\begin{verbatim}
42enum wxOperatingSystemId
43{
44 wxOS_UNKNOWN = 0, // returned on error
45
46 wxOS_MAC_OS = 1 << 0, // Apple Mac OS 8/9/X with Mac paths
47 wxOS_MAC_OSX_DARWIN = 1 << 1, // Apple Mac OS X with Unix paths
48 wxOS_MAC = wxOS_MAC_OS|wxOS_MAC_OSX_DARWIN,
49
50 wxOS_WINDOWS_9X = 1 << 2, // Windows 9x family (95/98/ME)
51 wxOS_WINDOWS_NT = 1 << 3, // Windows NT family (NT/2000/XP)
52 wxOS_WINDOWS_MICRO = 1 << 4, // MicroWindows
53 wxOS_WINDOWS_CE = 1 << 5, // Windows CE (Window Mobile)
54 wxOS_WINDOWS = wxOS_WINDOWS_9X |
55 wxOS_WINDOWS_NT |
56 wxOS_WINDOWS_MICRO |
57 wxOS_WINDOWS_CE,
58
59 wxOS_UNIX_LINUX = 1 << 6, // Linux
60 wxOS_UNIX_FREEBSD = 1 << 7, // FreeBSD
61 wxOS_UNIX_OPENBSD = 1 << 8, // OpenBSD
62 wxOS_UNIX_NETBSD = 1 << 9, // NetBSD
63 wxOS_UNIX_SOLARIS = 1 << 10, // SunOS
64 wxOS_UNIX_AIX = 1 << 11, // AIX
65 wxOS_UNIX_HPUX = 1 << 12, // HP/UX
66 wxOS_UNIX = wxOS_UNIX_LINUX |
67 wxOS_UNIX_FREEBSD |
68 wxOS_UNIX_OPENBSD |
69 wxOS_UNIX_NETBSD |
70 wxOS_UNIX_SOLARIS |
71 wxOS_UNIX_AIX |
72 wxOS_UNIX_HPUX,
73
74 wxOS_DOS = 1 << 15, // Microsoft DOS
75 wxOS_OS2 = 1 << 16 // OS/2
76};
77\end{verbatim}
78
79The list of wxWidgets ports. Some of them can be used with more than
80a single (native) toolkit; e.g. wxWinCE port sources can be used with
81smartphones, pocket PCs and handheld devices SDKs.
82
83\begin{verbatim}
84enum wxPortId
85{
86 wxPORT_UNKNOWN = 0, // returned on error
87
88 wxPORT_BASE = 1 << 0, // wxBase, no native toolkit used
89
90 wxPORT_MSW = 1 << 1, // wxMSW, native toolkit is Windows API
91 wxPORT_MOTIF = 1 << 2, // wxMotif, using [Open]Motif or Lesstif
92 wxPORT_GTK = 1 << 3, // wxGTK, using GTK+ 1.x, 2.x, GPE or Maemo
93 wxPORT_MGL = 1 << 4, // wxMGL, using wxUniversal
94 wxPORT_X11 = 1 << 5, // wxX11, using wxUniversal
95 wxPORT_OS2 = 1 << 6, // wxOS2, using OS/2 Presentation Manager
96 wxPORT_MAC = 1 << 7, // wxMac, using Carbon or Classic Mac API
97 wxPORT_COCOA = 1 << 8, // wxCocoa, using Cocoa NextStep/Mac API
98 wxPORT_WINCE = 1 << 9, // wxWinCE, toolkit is WinCE SDK API
449090b5
VZ
99 wxPORT_PALMOS = 1 << 10, // wxPalmOS, toolkit is PalmOS API
100 wxPORT_DFB = 1 << 11 // wxDFB, using wxUniversal
8bb6b2c0
VZ
101};
102\end{verbatim}
103
104The architecture of the operating system (regardless of the build environment
105of wxWidgets library - see \helpref{wxIsPlatform64bit}{wxisplatform64bit} documentation
106for more info).
107
108\begin{verbatim}
109enum wxArchitecture
110{
111 wxARCH_INVALID = -1, // returned on error
112
113 wxARCH_32, // 32 bit
114 wxARCH_64,
115
116 wxARCH_MAX
117}
118\end{verbatim}
119
120The endian-ness of the machine.
121
122\begin{verbatim}
123enum wxEndianness
124{
125 wxENDIAN_INVALID = -1, // returned on error
126
127 wxENDIAN_BIG, // 4321
128 wxENDIAN_LITTLE, // 1234
129 wxENDIAN_PDP, // 3412
130
131 wxENDIAN_MAX
132}
133\end{verbatim}
134
135\latexignore{\rtfignore{\wxheading{Members}}}
136
137
138\membersection{wxPlatformInfo::wxPlatformInfo}\label{wxplatforminfowxplatforminfo}
139
140\func{}{wxPlatformInfo}{}
141
142Initializes the instance with the values corresponding to the currently running platform.
449090b5
VZ
143This is a fast operation because it only requires to copy the values internally cached for the
144currently running platform (see also \helpref{Get}{wxplatforminfoget}).
8bb6b2c0
VZ
145
146\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}}
147
148Initializes the object using given values.
149
150
151
a24db82d
VZ
152\membersection{wxPlatformInfo::CheckOSVersion}\label{wxplatforminfocheckosversion}
153
578c2e3a 154\constfunc{bool}{CheckOSVersion}{\param{int }{major}, \param{int }{minor}}
a24db82d
VZ
155
156Returns \true if the OS version is at least \texttt{major.minor}.
157
158\wxheading{See also}
159
160\helpref{GetOSMajorVersion}{wxplatforminfogetosmajorversion},
161\helpref{GetOSMinorVersion}{wxplatforminfogetosminorversion},
162\helpref{CheckToolkitVersion}{wxplatforminfochecktoolkitversion}
163
164
165\membersection{wxPlatformInfo::CheckToolkitVersion}\label{wxplatforminfochecktoolkitversion}
166
578c2e3a 167\constfunc{bool}{CheckToolkitVersion}{\param{int }{major}, \param{int }{minor}}
a24db82d
VZ
168
169Returns \true if the toolkit version is at least \texttt{major.minor}.
170
171\wxheading{See also}
172
173\helpref{GetToolkitMajorVersion}{wxplatforminfogettoolkitmajorversion},
174\helpref{GetToolkitMinorVersion}{wxplatforminfogettoolkitminorversion},
175\helpref{CheckOSVersion}{wxplatforminfocheckosversion}
176
177
8bb6b2c0 178
449090b5
VZ
179\membersection{wxPlatformInfo::Get}\label{wxplatforminfoget}
180
181\func{static const wxPlatformInfo\& }{Get}{\void}
182
183Returns the global wxPlatformInfo object, initialized with the values for the currently running platform.
184
185
8bb6b2c0
VZ
186\membersection{wxPlatformInfo::GetArch}\label{wxplatforminfogetarch}
187
188\func{static wxArchitecture}{GetArch}{\param{const wxString\& }{arch}}
189
190Converts the given string to a wxArchitecture enum value or to
d4417426 191wxARCH\_INVALID if the given string is not a valid architecture string
8bb6b2c0
VZ
192(i.e. does not contain nor {\tt 32} nor {\tt 64} strings).
193
194
195\membersection{wxPlatformInfo::GetArchName}\label{wxplatforminfogetarchname}
196
197\func{static wxString}{GetArchName}{\param{wxArchitecture }{arch}}
198
199Returns the name for the given wxArchitecture enumeration value.
200
201\constfunc{wxString}{GetArchName}{\void}
202
203Returns the name for the architecture of this wxPlatformInfo instance.
204
205
206\membersection{wxPlatformInfo::GetArchitecture}\label{wxplatforminfogetarchitecture}
207
208\constfunc{wxArchitecture}{GetArchitecture}{\void}
209
210Returns the architecture ID of this wxPlatformInfo instance.
211
212
213
214
215\membersection{wxPlatformInfo::GetEndianness}\label{wxplatforminfogetendianness}
216
217\func{static wxEndianness}{GetEndianness}{\param{const wxString\& }{end}}
218
219Converts the given string to a wxEndianness enum value or to
d4417426 220wxENDIAN\_INVALID if the given string is not a valid endianness string
8bb6b2c0
VZ
221(i.e. does not contain nor {\tt little} nor {\tt big} strings).
222
223\constfunc{wxEndianness}{GetEndianness}{\void}
224
225Returns the endianness ID of this wxPlatformInfo instance.
226
227\membersection{wxPlatformInfo::GetEndiannessName}\label{wxplatforminfogetendiannessname}
228
229\func{static wxString}{GetEndiannessName}{\param{wxEndianness }{end}}
230
231Returns name for the given wxEndianness enumeration value.
232
233\constfunc{wxString}{GetEndiannessName}{\void}
234
235Returns the name for the endianness of this wxPlatformInfo instance.
236
237
238
239
240
241\membersection{wxPlatformInfo::GetOSMajorVersion}\label{wxplatforminfogetosmajorversion}
242
243\constfunc{int}{GetOSMajorVersion}{\void}
244
449090b5
VZ
245Returns the run-time major version of the OS associated with this wxPlatformInfo instance.
246See \helpref{wxGetOsVersion}{wxgetosversion} for more info.
8bb6b2c0 247
a24db82d
VZ
248\wxheading{See also}
249
250\helpref{CheckOSVersion}{wxplatforminfocheckosversion}
251
252
8bb6b2c0
VZ
253\membersection{wxPlatformInfo::GetOSMinorVersion}\label{wxplatforminfogetosminorversion}
254
255\constfunc{int}{GetOSMinorVersion}{\void}
256
449090b5
VZ
257Returns the run-time minor version of the OS associated with this wxPlatformInfo instance.
258See \helpref{wxGetOsVersion}{wxgetosversion} for more info.
259
260\wxheading{See also}
8bb6b2c0 261
a24db82d 262\helpref{CheckOSVersion}{wxplatforminfocheckosversion}
8bb6b2c0
VZ
263
264
265
266\membersection{wxPlatformInfo::GetOperatingSystemFamilyName}\label{wxplatforminfogetoperatingsystemfamilyname}
267
268\func{static wxString}{GetOperatingSystemFamilyName}{\param{wxOperatingSystemId }{os}}
269
270Returns the operating system family name for the given wxOperatingSystemId enumeration value:
d4417426
VS
271{\tt Unix} for wxOS\_UNIX, {\tt Macintosh} for wxOS\_MAC, {\tt Windows} for wxOS\_WINDOWS,
272{\tt DOS} for wxOS\_DOS, {\tt OS/2} for wxOS\_OS2.
8bb6b2c0
VZ
273
274\constfunc{wxString}{GetOperatingSystemFamilyName}{\void}
275
276Returns the operating system family name of the OS associated with this wxPlatformInfo instance.
277
278
279
280\membersection{wxPlatformInfo::GetOperatingSystemId}\label{wxplatforminfogetoperatingsystemid}
281
282\func{static wxOperatingSystemId}{GetOperatingSystemId}{\param{const wxString\& }{name}}
283
284Converts the given string to a wxOperatingSystemId enum value or to
d4417426 285wxOS\_UNKNOWN if the given string is not a valid operating system name.
8bb6b2c0
VZ
286
287\constfunc{wxOperatingSystemId}{GetOperatingSystemId}{\void}
288
289Returns the operating system ID of this wxPlatformInfo instance.
290
291
292
293\membersection{wxPlatformInfo::GetOperatingSystemIdName}\label{wxplatforminfogetoperatingsystemidname}
294
295\func{static wxString}{GetOperatingSystemIdName}{\param{wxOperatingSystemId }{os}}
296
297Returns the name for the given operating system ID value. This can be a long name
298(e.g. {\tt Microsoft Windows NT}); use \helpref{GetOperatingSystemFamilyName}{wxplatforminfogetoperatingsystemfamilyname} to
299retrieve a short, generic name.
300
301
302\constfunc{wxString}{GetOperatingSystemIdName}{\void}
303
304Returns the operating system name of the OS associated with this wxPlatformInfo instance.
305
306
307
308
309
310\membersection{wxPlatformInfo::GetPortId}\label{wxplatforminfogetportid}
311
312\func{static wxPortId}{GetPortId}{\param{const wxString\& }{portname}}
313
d4417426 314Converts the given string to a wxWidgets port ID value or to wxPORT\_UNKNOWN if
8bb6b2c0
VZ
315the given string does not match any of the wxWidgets canonical name ports ("wxGTK", "wxMSW", etc)
316nor any of the short wxWidgets name ports ("gtk", "msw", etc).
317
318\constfunc{wxPortId}{GetPortId}{\void}
319
320Returns the wxWidgets port ID associated with this wxPlatformInfo instance.
321
322\membersection{wxPlatformInfo::GetPortIdName}\label{wxplatforminfogetportidname}
323
b98bd6af 324\func{static wxString}{GetPortIdName}{\param{wxPortId }{port}, \param{bool }{usingUniversal}}
8bb6b2c0 325
b98bd6af
VS
326Returns the name of the given wxWidgets port ID value. The \arg{usingUniversal}
327argument specifies whether the port is in its native or wxUniversal variant.
328
329The returned string always starts with the "wx" prefix and is a mixed-case
330string.
8bb6b2c0
VZ
331
332\constfunc{wxString}{GetPortIdName}{\void}
333
334Returns the name of the wxWidgets port ID associated with this wxPlatformInfo instance.
335
336
337
338
339\membersection{wxPlatformInfo::GetPortIdShortName}\label{wxplatforminfogetportidshortname}
340
b98bd6af
VS
341\func{static wxString}{GetPortIdShortName}{\param{wxPortId }{port}, \param{bool }{usingUniversal}}
342
343Returns the short name of the given wxWidgets port ID value. The
344\arg{usingUniversal} argument specifies whether the port is in its native or
345wxUniversal variant.
8bb6b2c0 346
b98bd6af
VS
347The returned string does not start with the "wx" prefix and is always lower
348case.
8bb6b2c0
VZ
349
350\constfunc{wxString}{GetPortIdShortName}{\void}
351
352Returns the short name of the wxWidgets port ID associated with this wxPlatformInfo instance.
353
354
355
356
357\membersection{wxPlatformInfo::GetToolkitMajorVersion}\label{wxplatforminfogettoolkitmajorversion}
358
359\constfunc{int}{GetToolkitMajorVersion}{\void}
360
449090b5
VZ
361Returns the run-time major version of the toolkit associated with this wxPlatformInfo instance.
362Note that if \helpref{GetPortId}{wxplatforminfogetportid} returns wxPORT\_BASE, then this value is zero (unless externally modified with \helpref{SetToolkitVersion}{wxplatforminfosettoolkitversion}); that is, no native toolkit is in use.
363
364See \helpref{wxAppTraits::GetToolkitVersion}{wxapptraitsgettoolkitversion} for more info.
365
8bb6b2c0 366
a24db82d
VZ
367\wxheading{See also}
368
369\helpref{CheckToolkitVersion}{wxplatforminfochecktoolkitversion}
370
371
8bb6b2c0
VZ
372\membersection{wxPlatformInfo::GetToolkitMinorVersion}\label{wxplatforminfogettoolkitminorversion}
373
374\constfunc{int}{GetToolkitMinorVersion}{\void}
375
449090b5
VZ
376Returns the run-time minor version of the toolkit associated with this wxPlatformInfo instance.
377Note that if \helpref{GetPortId}{wxplatforminfogetportid} returns wxPORT\_BASE, then this value is zero (unless externally modified with \helpref{SetToolkitVersion}{wxplatforminfosettoolkitversion}); that is, no native toolkit is in use.
8bb6b2c0 378
449090b5 379See \helpref{wxAppTraits::GetToolkitVersion}{wxapptraitsgettoolkitversion} for more info.
1ae30333 380
a24db82d
VZ
381\wxheading{See also}
382
383\helpref{CheckToolkitVersion}{wxplatforminfochecktoolkitversion}
384
8bb6b2c0
VZ
385
386
387
388\membersection{wxPlatformInfo::IsOk}\label{wxplatforminfoisok}
389
390\constfunc{bool}{IsOk}{\void}
391
392Returns \true if this instance is fully initialized with valid values.
393
394
395
396\membersection{wxPlatformInfo::IsUsingUniversalWidgets}\label{wxplatforminfoisusinguniversalwidgets}
397
b98bd6af 398\constfunc{bool}{IsUsingUniversalWidgets}{\void}
8bb6b2c0 399
b98bd6af 400Returns \true if this wxPlatformInfo describes wxUniversal build.
8bb6b2c0
VZ
401
402
403\membersection{wxPlatformInfo::SetArchitecture}\label{wxplatforminfosetarchitecture}
404
405\func{void}{SetArchitecture}{\param{wxArchitecture }{n}}
406
407Sets the architecture enum value associated with this wxPlatformInfo instance.
408
409
410
411\membersection{wxPlatformInfo::SetEndianness}\label{wxplatforminfosetendianness}
412
413\func{void}{SetEndianness}{\param{wxEndianness }{n}}
414
415Sets the endianness enum value associated with this wxPlatformInfo instance.
416
417
418\membersection{wxPlatformInfo::SetOSVersion}\label{wxplatforminfosetosversion}
419
420\func{void}{SetOSVersion}{\param{int }{major}, \param{int }{minor}}
421
422Sets the version of the operating system associated with this wxPlatformInfo instance.
423
424
425
426\membersection{wxPlatformInfo::SetOperatingSystemId}\label{wxplatforminfosetoperatingsystemid}
427
428\func{void}{SetOperatingSystemId}{\param{wxOperatingSystemId }{n}}
429
430Sets the operating system associated with this wxPlatformInfo instance.
431
432
433
434\membersection{wxPlatformInfo::SetPortId}\label{wxplatforminfosetportid}
435
436\func{void}{SetPortId}{\param{wxPortId }{n}}
437
438Sets the wxWidgets port ID associated with this wxPlatformInfo instance.
439
440
441
442\membersection{wxPlatformInfo::SetToolkitVersion}\label{wxplatforminfosettoolkitversion}
443
444\func{void}{SetToolkitVersion}{\param{int }{major}, \param{int }{minor}}
445
446Sets the version of the toolkit associated with this wxPlatformInfo instance.
447
448
449
450\membersection{wxPlatformInfo::operator!=}\label{wxplatforminfooperatorunknown}
451
452\constfunc{bool}{operator!=}{\param{const wxPlatformInfo\& }{t}}
453
454Inequality operator. Tests all class' internal variables.
455
456
457\membersection{wxPlatformInfo::operator==}\label{wxplatforminfooperatorequal}
458
459\constfunc{bool}{operator==}{\param{const wxPlatformInfo\& }{t}}
460
461Equality operator. Tests all class' internal variables.
462