]>
Commit | Line | Data |
---|---|---|
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 | ||
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. | |
16 | ||
17 | \wxheading{Derived from} | |
18 | ||
19 | \helpref{wxObject}{wxobject} | |
20 | ||
21 | \wxheading{Include files} | |
22 | ||
23 | <wx/platinfo.h> | |
24 | ||
25 | \wxheading{See also} | |
26 | ||
27 | \helpref{wxGetOSVersion}{wxgetosversion}, \helpref{wxIsPlatformLittleEndian}{wxisplatformlittleendian}, | |
28 | \helpref{wxIsPlatform64Bit}{wxisplatform64bit}, \helpref{wxAppTraits}{wxapptraits} | |
29 | ||
30 | \wxheading{Data structures} | |
31 | ||
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. | |
36 | ||
37 | \begin{verbatim} | |
38 | enum wxOperatingSystemId | |
39 | { | |
40 | wxOS_UNKNOWN = 0, // returned on error | |
41 | ||
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, | |
45 | ||
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 | | |
51 | wxOS_WINDOWS_NT | | |
52 | wxOS_WINDOWS_MICRO | | |
53 | wxOS_WINDOWS_CE, | |
54 | ||
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 | | |
63 | wxOS_UNIX_FREEBSD | | |
64 | wxOS_UNIX_OPENBSD | | |
65 | wxOS_UNIX_NETBSD | | |
66 | wxOS_UNIX_SOLARIS | | |
67 | wxOS_UNIX_AIX | | |
68 | wxOS_UNIX_HPUX, | |
69 | ||
70 | wxOS_DOS = 1 << 15, // Microsoft DOS | |
71 | wxOS_OS2 = 1 << 16 // OS/2 | |
72 | }; | |
73 | \end{verbatim} | |
74 | ||
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. | |
78 | ||
79 | \begin{verbatim} | |
80 | enum wxPortId | |
81 | { | |
82 | wxPORT_UNKNOWN = 0, // returned on error | |
83 | ||
84 | wxPORT_BASE = 1 << 0, // wxBase, no native toolkit used | |
85 | ||
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 | |
96 | wxPORT_DFB = 1 << 11 // wxDFB, using wxUniversal | |
97 | }; | |
98 | \end{verbatim} | |
99 | ||
100 | The architecture of the operating system (regardless of the build environment | |
101 | of wxWidgets library - see \helpref{wxIsPlatform64bit}{wxisplatform64bit} documentation | |
102 | for more info). | |
103 | ||
104 | \begin{verbatim} | |
105 | enum wxArchitecture | |
106 | { | |
107 | wxARCH_INVALID = -1, // returned on error | |
108 | ||
109 | wxARCH_32, // 32 bit | |
110 | wxARCH_64, | |
111 | ||
112 | wxARCH_MAX | |
113 | } | |
114 | \end{verbatim} | |
115 | ||
116 | The endian-ness of the machine. | |
117 | ||
118 | \begin{verbatim} | |
119 | enum wxEndianness | |
120 | { | |
121 | wxENDIAN_INVALID = -1, // returned on error | |
122 | ||
123 | wxENDIAN_BIG, // 4321 | |
124 | wxENDIAN_LITTLE, // 1234 | |
125 | wxENDIAN_PDP, // 3412 | |
126 | ||
127 | wxENDIAN_MAX | |
128 | } | |
129 | \end{verbatim} | |
130 | ||
131 | \latexignore{\rtfignore{\wxheading{Members}}} | |
132 | ||
133 | ||
134 | \membersection{wxPlatformInfo::wxPlatformInfo}\label{wxplatforminfowxplatforminfo} | |
135 | ||
136 | \func{}{wxPlatformInfo}{} | |
137 | ||
138 | Initializes the instance with the values corresponding to the currently running platform. | |
139 | This is a fast operation because it only requires to copy the values internally cached for the | |
140 | currently running platform (see also \helpref{Get}{wxplatforminfoget}). | |
141 | ||
142 | \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}} | |
143 | ||
144 | Initializes the object using given values. | |
145 | ||
146 | ||
147 | ||
148 | \membersection{wxPlatformInfo::CheckOSVersion}\label{wxplatforminfocheckosversion} | |
149 | ||
150 | \constfunc{bool}{CheckOSVersion}{\param{int }{major}, \param{int }{minor}} | |
151 | ||
152 | Returns \true if the OS version is at least \texttt{major.minor}. | |
153 | ||
154 | \wxheading{See also} | |
155 | ||
156 | \helpref{GetOSMajorVersion}{wxplatforminfogetosmajorversion}, | |
157 | \helpref{GetOSMinorVersion}{wxplatforminfogetosminorversion}, | |
158 | \helpref{CheckToolkitVersion}{wxplatforminfochecktoolkitversion} | |
159 | ||
160 | ||
161 | \membersection{wxPlatformInfo::CheckToolkitVersion}\label{wxplatforminfochecktoolkitversion} | |
162 | ||
163 | \constfunc{bool}{CheckToolkitVersion}{\param{int }{major}, \param{int }{minor}} | |
164 | ||
165 | Returns \true if the toolkit version is at least \texttt{major.minor}. | |
166 | ||
167 | \wxheading{See also} | |
168 | ||
169 | \helpref{GetToolkitMajorVersion}{wxplatforminfogettoolkitmajorversion}, | |
170 | \helpref{GetToolkitMinorVersion}{wxplatforminfogettoolkitminorversion}, | |
171 | \helpref{CheckOSVersion}{wxplatforminfocheckosversion} | |
172 | ||
173 | ||
174 | ||
175 | \membersection{wxPlatformInfo::Get}\label{wxplatforminfoget} | |
176 | ||
177 | \func{static const wxPlatformInfo\& }{Get}{\void} | |
178 | ||
179 | Returns the global wxPlatformInfo object, initialized with the values for the currently running platform. | |
180 | ||
181 | ||
182 | \membersection{wxPlatformInfo::GetArch}\label{wxplatforminfogetarch} | |
183 | ||
184 | \func{static wxArchitecture}{GetArch}{\param{const wxString\& }{arch}} | |
185 | ||
186 | Converts the given string to a wxArchitecture enum value or to | |
187 | wxARCH\_INVALID if the given string is not a valid architecture string | |
188 | (i.e. does not contain nor {\tt 32} nor {\tt 64} strings). | |
189 | ||
190 | ||
191 | \membersection{wxPlatformInfo::GetArchName}\label{wxplatforminfogetarchname} | |
192 | ||
193 | \func{static wxString}{GetArchName}{\param{wxArchitecture }{arch}} | |
194 | ||
195 | Returns the name for the given wxArchitecture enumeration value. | |
196 | ||
197 | \constfunc{wxString}{GetArchName}{\void} | |
198 | ||
199 | Returns the name for the architecture of this wxPlatformInfo instance. | |
200 | ||
201 | ||
202 | \membersection{wxPlatformInfo::GetArchitecture}\label{wxplatforminfogetarchitecture} | |
203 | ||
204 | \constfunc{wxArchitecture}{GetArchitecture}{\void} | |
205 | ||
206 | Returns the architecture ID of this wxPlatformInfo instance. | |
207 | ||
208 | ||
209 | ||
210 | ||
211 | \membersection{wxPlatformInfo::GetEndianness}\label{wxplatforminfogetendianness} | |
212 | ||
213 | \func{static wxEndianness}{GetEndianness}{\param{const wxString\& }{end}} | |
214 | ||
215 | Converts the given string to a wxEndianness enum value or to | |
216 | wxENDIAN\_INVALID if the given string is not a valid endianness string | |
217 | (i.e. does not contain nor {\tt little} nor {\tt big} strings). | |
218 | ||
219 | \constfunc{wxEndianness}{GetEndianness}{\void} | |
220 | ||
221 | Returns the endianness ID of this wxPlatformInfo instance. | |
222 | ||
223 | \membersection{wxPlatformInfo::GetEndiannessName}\label{wxplatforminfogetendiannessname} | |
224 | ||
225 | \func{static wxString}{GetEndiannessName}{\param{wxEndianness }{end}} | |
226 | ||
227 | Returns name for the given wxEndianness enumeration value. | |
228 | ||
229 | \constfunc{wxString}{GetEndiannessName}{\void} | |
230 | ||
231 | Returns the name for the endianness of this wxPlatformInfo instance. | |
232 | ||
233 | ||
234 | ||
235 | ||
236 | ||
237 | \membersection{wxPlatformInfo::GetOSMajorVersion}\label{wxplatforminfogetosmajorversion} | |
238 | ||
239 | \constfunc{int}{GetOSMajorVersion}{\void} | |
240 | ||
241 | Returns the run-time major version of the OS associated with this wxPlatformInfo instance. | |
242 | See \helpref{wxGetOsVersion}{wxgetosversion} for more info. | |
243 | ||
244 | \wxheading{See also} | |
245 | ||
246 | \helpref{CheckOSVersion}{wxplatforminfocheckosversion} | |
247 | ||
248 | ||
249 | \membersection{wxPlatformInfo::GetOSMinorVersion}\label{wxplatforminfogetosminorversion} | |
250 | ||
251 | \constfunc{int}{GetOSMinorVersion}{\void} | |
252 | ||
253 | Returns the run-time minor version of the OS associated with this wxPlatformInfo instance. | |
254 | See \helpref{wxGetOsVersion}{wxgetosversion} for more info. | |
255 | ||
256 | \wxheading{See also} | |
257 | ||
258 | \helpref{CheckOSVersion}{wxplatforminfocheckosversion} | |
259 | ||
260 | ||
261 | ||
262 | \membersection{wxPlatformInfo::GetOperatingSystemFamilyName}\label{wxplatforminfogetoperatingsystemfamilyname} | |
263 | ||
264 | \func{static wxString}{GetOperatingSystemFamilyName}{\param{wxOperatingSystemId }{os}} | |
265 | ||
266 | Returns the operating system family name for the given wxOperatingSystemId enumeration value: | |
267 | {\tt Unix} for wxOS\_UNIX, {\tt Macintosh} for wxOS\_MAC, {\tt Windows} for wxOS\_WINDOWS, | |
268 | {\tt DOS} for wxOS\_DOS, {\tt OS/2} for wxOS\_OS2. | |
269 | ||
270 | \constfunc{wxString}{GetOperatingSystemFamilyName}{\void} | |
271 | ||
272 | Returns the operating system family name of the OS associated with this wxPlatformInfo instance. | |
273 | ||
274 | ||
275 | ||
276 | \membersection{wxPlatformInfo::GetOperatingSystemId}\label{wxplatforminfogetoperatingsystemid} | |
277 | ||
278 | \func{static wxOperatingSystemId}{GetOperatingSystemId}{\param{const wxString\& }{name}} | |
279 | ||
280 | Converts the given string to a wxOperatingSystemId enum value or to | |
281 | wxOS\_UNKNOWN if the given string is not a valid operating system name. | |
282 | ||
283 | \constfunc{wxOperatingSystemId}{GetOperatingSystemId}{\void} | |
284 | ||
285 | Returns the operating system ID of this wxPlatformInfo instance. | |
286 | ||
287 | ||
288 | ||
289 | \membersection{wxPlatformInfo::GetOperatingSystemIdName}\label{wxplatforminfogetoperatingsystemidname} | |
290 | ||
291 | \func{static wxString}{GetOperatingSystemIdName}{\param{wxOperatingSystemId }{os}} | |
292 | ||
293 | Returns the name for the given operating system ID value. This can be a long name | |
294 | (e.g. {\tt Microsoft Windows NT}); use \helpref{GetOperatingSystemFamilyName}{wxplatforminfogetoperatingsystemfamilyname} to | |
295 | retrieve a short, generic name. | |
296 | ||
297 | ||
298 | \constfunc{wxString}{GetOperatingSystemIdName}{\void} | |
299 | ||
300 | Returns the operating system name of the OS associated with this wxPlatformInfo instance. | |
301 | ||
302 | ||
303 | ||
304 | ||
305 | ||
306 | \membersection{wxPlatformInfo::GetPortId}\label{wxplatforminfogetportid} | |
307 | ||
308 | \func{static wxPortId}{GetPortId}{\param{const wxString\& }{portname}} | |
309 | ||
310 | Converts the given string to a wxWidgets port ID value or to wxPORT\_UNKNOWN if | |
311 | the given string does not match any of the wxWidgets canonical name ports ("wxGTK", "wxMSW", etc) | |
312 | nor any of the short wxWidgets name ports ("gtk", "msw", etc). | |
313 | ||
314 | \constfunc{wxPortId}{GetPortId}{\void} | |
315 | ||
316 | Returns the wxWidgets port ID associated with this wxPlatformInfo instance. | |
317 | ||
318 | \membersection{wxPlatformInfo::GetPortIdName}\label{wxplatforminfogetportidname} | |
319 | ||
320 | \func{static wxString}{GetPortIdName}{\param{wxPortId }{port}, \param{bool }{usingUniversal}} | |
321 | ||
322 | Returns the name of the given wxWidgets port ID value. The \arg{usingUniversal} | |
323 | argument specifies whether the port is in its native or wxUniversal variant. | |
324 | ||
325 | The returned string always starts with the "wx" prefix and is a mixed-case | |
326 | string. | |
327 | ||
328 | \constfunc{wxString}{GetPortIdName}{\void} | |
329 | ||
330 | Returns the name of the wxWidgets port ID associated with this wxPlatformInfo instance. | |
331 | ||
332 | ||
333 | ||
334 | ||
335 | \membersection{wxPlatformInfo::GetPortIdShortName}\label{wxplatforminfogetportidshortname} | |
336 | ||
337 | \func{static wxString}{GetPortIdShortName}{\param{wxPortId }{port}, \param{bool }{usingUniversal}} | |
338 | ||
339 | Returns the short name of the given wxWidgets port ID value. The | |
340 | \arg{usingUniversal} argument specifies whether the port is in its native or | |
341 | wxUniversal variant. | |
342 | ||
343 | The returned string does not start with the "wx" prefix and is always lower | |
344 | case. | |
345 | ||
346 | \constfunc{wxString}{GetPortIdShortName}{\void} | |
347 | ||
348 | Returns the short name of the wxWidgets port ID associated with this wxPlatformInfo instance. | |
349 | ||
350 | ||
351 | ||
352 | ||
353 | \membersection{wxPlatformInfo::GetToolkitMajorVersion}\label{wxplatforminfogettoolkitmajorversion} | |
354 | ||
355 | \constfunc{int}{GetToolkitMajorVersion}{\void} | |
356 | ||
357 | Returns the run-time major version of the toolkit associated with this wxPlatformInfo instance. | |
358 | Note 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. | |
359 | ||
360 | See \helpref{wxAppTraits::GetToolkitVersion}{wxapptraitsgettoolkitversion} for more info. | |
361 | ||
362 | ||
363 | \wxheading{See also} | |
364 | ||
365 | \helpref{CheckToolkitVersion}{wxplatforminfochecktoolkitversion} | |
366 | ||
367 | ||
368 | \membersection{wxPlatformInfo::GetToolkitMinorVersion}\label{wxplatforminfogettoolkitminorversion} | |
369 | ||
370 | \constfunc{int}{GetToolkitMinorVersion}{\void} | |
371 | ||
372 | Returns the run-time minor version of the toolkit associated with this wxPlatformInfo instance. | |
373 | Note 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. | |
374 | ||
375 | See \helpref{wxAppTraits::GetToolkitVersion}{wxapptraitsgettoolkitversion} for more info. | |
376 | ||
377 | \wxheading{See also} | |
378 | ||
379 | \helpref{CheckToolkitVersion}{wxplatforminfochecktoolkitversion} | |
380 | ||
381 | ||
382 | ||
383 | ||
384 | \membersection{wxPlatformInfo::IsOk}\label{wxplatforminfoisok} | |
385 | ||
386 | \constfunc{bool}{IsOk}{\void} | |
387 | ||
388 | Returns \true if this instance is fully initialized with valid values. | |
389 | ||
390 | ||
391 | ||
392 | \membersection{wxPlatformInfo::IsUsingUniversalWidgets}\label{wxplatforminfoisusinguniversalwidgets} | |
393 | ||
394 | \constfunc{bool}{IsUsingUniversalWidgets}{\void} | |
395 | ||
396 | Returns \true if this wxPlatformInfo describes wxUniversal build. | |
397 | ||
398 | ||
399 | \membersection{wxPlatformInfo::SetArchitecture}\label{wxplatforminfosetarchitecture} | |
400 | ||
401 | \func{void}{SetArchitecture}{\param{wxArchitecture }{n}} | |
402 | ||
403 | Sets the architecture enum value associated with this wxPlatformInfo instance. | |
404 | ||
405 | ||
406 | ||
407 | \membersection{wxPlatformInfo::SetEndianness}\label{wxplatforminfosetendianness} | |
408 | ||
409 | \func{void}{SetEndianness}{\param{wxEndianness }{n}} | |
410 | ||
411 | Sets the endianness enum value associated with this wxPlatformInfo instance. | |
412 | ||
413 | ||
414 | \membersection{wxPlatformInfo::SetOSVersion}\label{wxplatforminfosetosversion} | |
415 | ||
416 | \func{void}{SetOSVersion}{\param{int }{major}, \param{int }{minor}} | |
417 | ||
418 | Sets the version of the operating system associated with this wxPlatformInfo instance. | |
419 | ||
420 | ||
421 | ||
422 | \membersection{wxPlatformInfo::SetOperatingSystemId}\label{wxplatforminfosetoperatingsystemid} | |
423 | ||
424 | \func{void}{SetOperatingSystemId}{\param{wxOperatingSystemId }{n}} | |
425 | ||
426 | Sets the operating system associated with this wxPlatformInfo instance. | |
427 | ||
428 | ||
429 | ||
430 | \membersection{wxPlatformInfo::SetPortId}\label{wxplatforminfosetportid} | |
431 | ||
432 | \func{void}{SetPortId}{\param{wxPortId }{n}} | |
433 | ||
434 | Sets the wxWidgets port ID associated with this wxPlatformInfo instance. | |
435 | ||
436 | ||
437 | ||
438 | \membersection{wxPlatformInfo::SetToolkitVersion}\label{wxplatforminfosettoolkitversion} | |
439 | ||
440 | \func{void}{SetToolkitVersion}{\param{int }{major}, \param{int }{minor}} | |
441 | ||
442 | Sets the version of the toolkit associated with this wxPlatformInfo instance. | |
443 | ||
444 | ||
445 | ||
446 | \membersection{wxPlatformInfo::operator!=}\label{wxplatforminfooperatorunknown} | |
447 | ||
448 | \constfunc{bool}{operator!=}{\param{const wxPlatformInfo\& }{t}} | |
449 | ||
450 | Inequality operator. Tests all class' internal variables. | |
451 | ||
452 | ||
453 | \membersection{wxPlatformInfo::operator==}\label{wxplatforminfooperatorequal} | |
454 | ||
455 | \constfunc{bool}{operator==}{\param{const wxPlatformInfo\& }{t}} | |
456 | ||
457 | Equality operator. Tests all class' internal variables. | |
458 |