]> git.saurik.com Git - wxWidgets.git/blame - interface/wx/platinfo.h
adding default interpolation enum
[wxWidgets.git] / interface / wx / platinfo.h
CommitLineData
23324ae1
FM
1/////////////////////////////////////////////////////////////////////////////
2// Name: platinfo.h
e54c96f1 3// Purpose: interface of wxPlatformInfo
23324ae1
FM
4// Author: wxWidgets team
5// RCS-ID: $Id$
526954c5 6// Licence: wxWindows licence
23324ae1
FM
7/////////////////////////////////////////////////////////////////////////////
8
74bf4e64 9
4d7b68d1 10/**
74bf4e64
FM
11 The following are the operating systems which are recognized by wxWidgets and
12 whose version can be detected at run-time.
4d7b68d1 13
74bf4e64 14 The values of the constants are chosen so that they can be combined as flags;
9bbb78b9
FM
15 this allows to check for operating system families like e.g. @c wxOS_MAC and @c wxOS_UNIX.
16
17 Note that you can obtain more detailed informations about the current OS
18 version in use by checking the major and minor version numbers returned
19 by ::wxGetOsVersion() or by wxPlatformInfo::GetOSMajorVersion(),
20 wxPlatformInfo::GetOSMinorVersion().
4d7b68d1
FM
21*/
22enum wxOperatingSystemId
23{
24 wxOS_UNKNOWN = 0, //!< returned on error
25
26 wxOS_MAC_OS = 1 << 0, //!< Apple Mac OS 8/9/X with Mac paths
27 wxOS_MAC_OSX_DARWIN = 1 << 1, //!< Apple Mac OS X with Unix paths
9bbb78b9
FM
28
29 //! A combination of all @c wxOS_MAC_* values previously listed.
4d7b68d1
FM
30 wxOS_MAC = wxOS_MAC_OS|wxOS_MAC_OSX_DARWIN,
31
32 wxOS_WINDOWS_9X = 1 << 2, //!< Windows 9x family (95/98/ME)
9bbb78b9 33 wxOS_WINDOWS_NT = 1 << 3, //!< Windows NT family (NT/2000/XP/Vista/7)
4d7b68d1
FM
34 wxOS_WINDOWS_MICRO = 1 << 4, //!< MicroWindows
35 wxOS_WINDOWS_CE = 1 << 5, //!< Windows CE (Window Mobile)
9bbb78b9
FM
36
37 //! A combination of all @c wxOS_WINDOWS_* values previously listed.
4d7b68d1
FM
38 wxOS_WINDOWS = wxOS_WINDOWS_9X |
39 wxOS_WINDOWS_NT |
40 wxOS_WINDOWS_MICRO |
41 wxOS_WINDOWS_CE,
42
43 wxOS_UNIX_LINUX = 1 << 6, //!< Linux
44 wxOS_UNIX_FREEBSD = 1 << 7, //!< FreeBSD
45 wxOS_UNIX_OPENBSD = 1 << 8, //!< OpenBSD
46 wxOS_UNIX_NETBSD = 1 << 9, //!< NetBSD
47 wxOS_UNIX_SOLARIS = 1 << 10, //!< SunOS
48 wxOS_UNIX_AIX = 1 << 11, //!< AIX
49 wxOS_UNIX_HPUX = 1 << 12, //!< HP/UX
9bbb78b9
FM
50
51 //! A combination of all @c wxOS_UNIX_* values previously listed.
4d7b68d1
FM
52 wxOS_UNIX = wxOS_UNIX_LINUX |
53 wxOS_UNIX_FREEBSD |
54 wxOS_UNIX_OPENBSD |
55 wxOS_UNIX_NETBSD |
56 wxOS_UNIX_SOLARIS |
57 wxOS_UNIX_AIX |
58 wxOS_UNIX_HPUX,
59
60 wxOS_DOS = 1 << 15, //!< Microsoft DOS
61 wxOS_OS2 = 1 << 16 //!< OS/2
62};
74bf4e64 63
4d7b68d1 64/**
74bf4e64 65 The list of wxWidgets ports.
4d7b68d1 66
74bf4e64
FM
67 Some of them can be used with more than a single (native) toolkit;
68 e.g. wxWinCE port sources can be used with smartphones, pocket PCs
69 and handheld devices SDKs.
4d7b68d1
FM
70*/
71enum wxPortId
72{
73 wxPORT_UNKNOWN = 0, //!< returned on error
74bf4e64 74
4d7b68d1 75 wxPORT_BASE = 1 << 0, //!< wxBase, no native toolkit used
74bf4e64 76
4d7b68d1
FM
77 wxPORT_MSW = 1 << 1, //!< wxMSW, native toolkit is Windows API
78 wxPORT_MOTIF = 1 << 2, //!< wxMotif, using [Open]Motif or Lesstif
79 wxPORT_GTK = 1 << 3, //!< wxGTK, using GTK+ 1.x, 2.x, GPE or Maemo
80 wxPORT_MGL = 1 << 4, //!< wxMGL, using wxUniversal
81 wxPORT_X11 = 1 << 5, //!< wxX11, using wxUniversal
82 wxPORT_OS2 = 1 << 6, //!< wxOS2, using OS/2 Presentation Manager
83 wxPORT_MAC = 1 << 7, //!< wxMac, using Carbon or Classic Mac API
84 wxPORT_COCOA = 1 << 8, //!< wxCocoa, using Cocoa NextStep/Mac API
85 wxPORT_WINCE = 1 << 9, //!< wxWinCE, toolkit is WinCE SDK API
86 wxPORT_PALMOS = 1 << 10, //!< wxPalmOS, toolkit is PalmOS API
87 wxPORT_DFB = 1 << 11 //!< wxDFB, using wxUniversal
88};
74bf4e64 89
74bf4e64 90
4d7b68d1 91/**
74bf4e64 92 The architecture of the operating system
b2025b31 93 (regardless of the build environment of wxWidgets library - see ::wxIsPlatform64Bit()
b1b95a65 94 documentation for more info).
4d7b68d1
FM
95*/
96enum wxArchitecture
97{
98 wxARCH_INVALID = -1, //!< returned on error
74bf4e64 99
4d7b68d1 100 wxARCH_32, //!< 32 bit
3b36f093 101 wxARCH_64, //!< 64 bit
74bf4e64 102
4d7b68d1 103 wxARCH_MAX
3a7fb603 104};
74bf4e64 105
74bf4e64 106
4d7b68d1 107/**
74bf4e64 108 The endian-ness of the machine.
4d7b68d1
FM
109*/
110enum wxEndianness
111{
112 wxENDIAN_INVALID = -1, //!< returned on error
74bf4e64 113
4d7b68d1
FM
114 wxENDIAN_BIG, //!< 4321
115 wxENDIAN_LITTLE, //!< 1234
116 wxENDIAN_PDP, //!< 3412
74bf4e64 117
4d7b68d1 118 wxENDIAN_MAX
3a7fb603 119};
74bf4e64 120
23790a2a
FM
121/**
122 A structure containing informations about a Linux distribution as returned
123 by the @c lsb_release utility.
124
125 See wxGetLinuxDistributionInfo() or wxPlatformInfo::GetLinuxDistributionInfo()
126 for more info.
127*/
128struct wxLinuxDistributionInfo
129{
130 wxString Id; //!< The id of the distribution; e.g. "Ubuntu"
131 wxString Release; //!< The version of the distribution; e.g. "9.04"
132 wxString CodeName; //!< The code name of the distribution; e.g. "jaunty"
133 wxString Description; //!< The description of the distribution; e.g. "Ubuntu 9.04"
134
135 bool operator==(const wxLinuxDistributionInfo& ldi) const;
136 bool operator!=(const wxLinuxDistributionInfo& ldi) const;
137};
138
74bf4e64 139
4d7b68d1
FM
140/**
141 @class wxPlatformInfo
74bf4e64 142
3b36f093
FM
143 This class holds informations about the operating system, the toolkit and the
144 basic architecture of the machine where the application is currently running.
145
146 This class does not only have @e getters for the informations above, it also has
147 @e setters. This allows you to e.g. save the current platform informations in a
148 data file (maybe in string form) so that when you later load it, you can easily
23790a2a
FM
149 retrieve (see the static getters for string->enum conversion functions) and store
150 inside a wxPlatformInfo instance (using its setters) the signature of the system
151 which generated it.
152
153 In general however you only need to use the static Get() function and then
154 access the various informations for the current platform:
155 @code
156 wxLogMessage("This application is running under %s.",
157 wxPlatformInfo::Get().GetOperatingSystemIdName());
158 @endcode
74bf4e64 159
4d7b68d1 160 @library{wxbase}
3c99e2fd 161 @category{cfg}
74bf4e64 162
4d7b68d1 163 @see ::wxGetOsVersion(), wxIsPlatformLittleEndian(), wxIsPlatform64Bit(),
3b36f093 164 wxAppTraits, @ref group_funcmacro_networkuseros
23324ae1 165*/
a3b14191 166class wxPlatformInfo
23324ae1
FM
167{
168public:
74bf4e64 169
23324ae1 170 /**
74bf4e64
FM
171 Initializes the instance with the values corresponding to the currently
172 running platform.
173
174 This is a fast operation because it only requires to copy the values
175 internally cached for the currently running platform.
176
177 @see Get()
23324ae1
FM
178 */
179 wxPlatformInfo();
74bf4e64
FM
180
181 /**
182 Initializes the object using given values.
183 */
7c913512
FM
184 wxPlatformInfo(wxPortId pid = wxPORT_UNKNOWN,
185 int tkMajor = -1,
186 int tkMinor = -1,
187 wxOperatingSystemId id = wxOS_UNKNOWN,
188 int osMajor = -1,
189 int osMinor = -1,
190 wxArchitecture arch = wxARCH_INVALID,
191 wxEndianness endian = wxENDIAN_INVALID);
74bf4e64 192
23324ae1
FM
193
194 /**
195 Returns @true if the OS version is at least @c major.minor.
3c4f71cc 196
4cc4bfaf
FM
197 @see GetOSMajorVersion(), GetOSMinorVersion(),
198 CheckToolkitVersion()
23324ae1 199 */
328f5751 200 bool CheckOSVersion(int major, int minor) const;
23324ae1
FM
201
202 /**
203 Returns @true if the toolkit version is at least @c major.minor.
3c4f71cc 204
4cc4bfaf
FM
205 @see GetToolkitMajorVersion(),
206 GetToolkitMinorVersion(), CheckOSVersion()
23324ae1 207 */
328f5751 208 bool CheckToolkitVersion(int major, int minor) const;
3b36f093 209
23324ae1
FM
210
211 /**
3b36f093 212 Returns @true if this instance is fully initialized with valid values.
23324ae1 213 */
3b36f093 214 bool IsOk() const;
23324ae1
FM
215
216 /**
3b36f093 217 Returns @true if this wxPlatformInfo describes wxUniversal build.
23324ae1 218 */
3b36f093 219 bool IsUsingUniversalWidgets() const;
23324ae1 220
23324ae1 221 /**
3b36f093 222 Inequality operator. Tests all class' internal variables.
23324ae1 223 */
3b36f093 224 bool operator!=(const wxPlatformInfo& t) const;
74bf4e64
FM
225
226 /**
3b36f093 227 Equality operator. Tests all class' internal variables.
74bf4e64 228 */
3b36f093
FM
229 bool operator==(const wxPlatformInfo& t) const;
230
231 /**
232 Returns the global wxPlatformInfo object, initialized with the values
233 for the currently running platform.
234 */
235 static const wxPlatformInfo& Get();
236
237 /**
238 @name Static enum getters
239
240 These getters allow for easy string-to-enumeration-value conversion.
241 */
242 //@{
23324ae1
FM
243
244 /**
3b36f093
FM
245 Converts the given string to a wxArchitecture enum value or to
246 @c wxARCH_INVALID if the given string is not a valid architecture string
247 (i.e. does not contain nor @c 32 nor @c 64 strings).
23324ae1 248 */
3b36f093 249 static wxArchitecture GetArch(const wxString& arch);
23324ae1 250
23324ae1 251 /**
74bf4e64
FM
252 Converts the given string to a wxEndianness enum value or to
253 @c wxENDIAN_INVALID if the given string is not a valid endianness
254 string (i.e. does not contain nor little nor big strings).
23324ae1 255 */
57bf907d 256 static wxEndianness GetEndianness(const wxString& end);
74bf4e64
FM
257
258 /**
3b36f093
FM
259 Converts the given string to a wxOperatingSystemId enum value or to @c
260 wxOS_UNKNOWN if the given string is not a valid operating system name.
74bf4e64 261 */
3b36f093 262 static wxOperatingSystemId GetOperatingSystemId(const wxString& name);
23324ae1 263
23324ae1 264 /**
3b36f093
FM
265 Converts the given string to a wxWidgets port ID value or to @c wxPORT_UNKNOWN
266 if the given string does not match any of the wxWidgets canonical name ports
267 ("wxGTK", "wxMSW", etc) nor any of the short wxWidgets name ports ("gtk", "msw", etc).
23324ae1 268 */
3b36f093
FM
269 static wxPortId GetPortId(const wxString& portname);
270
271 //@}
272
273
74bf4e64 274 /**
3b36f093
FM
275 @name Static string-form getters
276
277 These getters allow for easy enumeration-value-to-string conversion.
74bf4e64 278 */
3b36f093 279 //@{
23324ae1
FM
280
281 /**
3b36f093 282 Returns the name for the given wxArchitecture enumeration value.
23324ae1 283 */
3b36f093 284 static wxString GetArchName(wxArchitecture arch);
23324ae1
FM
285
286 /**
3b36f093 287 Returns name for the given wxEndianness enumeration value.
23324ae1 288 */
3b36f093
FM
289 static wxString GetEndiannessName(wxEndianness end);
290
74bf4e64
FM
291 /**
292 Returns the operating system family name for the given wxOperatingSystemId
293 enumeration value: @c Unix for @c wxOS_UNIX, @c Macintosh for @c wxOS_MAC,
294 @c Windows for @c wxOS_WINDOWS, @c DOS for @c wxOS_DOS, @c OS/2 for @c wxOS_OS2.
295 */
57bf907d 296 static wxString GetOperatingSystemFamilyName(wxOperatingSystemId os);
74bf4e64 297
23324ae1 298 /**
3b36f093 299 Returns the name for the given operating system ID value.
23324ae1 300
3b36f093
FM
301 This can be a long name (e.g. <tt>Microsoft Windows NT</tt>);
302 use GetOperatingSystemFamilyName() to retrieve a short, generic name.
23324ae1 303 */
3b36f093 304 static wxString GetOperatingSystemIdName(wxOperatingSystemId os);
74bf4e64
FM
305
306 /**
3b36f093
FM
307 Returns the name of the given wxWidgets port ID value.
308 The @a usingUniversal argument specifies whether the port is in its native
309 or wxUniversal variant.
310
311 The returned string always starts with the "wx" prefix and is a mixed-case string.
74bf4e64 312 */
3b36f093 313 static wxString GetPortIdName(wxPortId port, bool usingUniversal);
23324ae1 314
74bf4e64 315 /**
3b36f093
FM
316 Returns the short name of the given wxWidgets port ID value.
317 The @a usingUniversal argument specifies whether the port is in its native
318 or wxUniversal variant.
74bf4e64 319
3b36f093 320 The returned string does not start with the "wx" prefix and is always lower case.
74bf4e64 321 */
3b36f093
FM
322 static wxString GetPortIdShortName(wxPortId port,
323 bool usingUniversal);
74bf4e64 324
23790a2a
FM
325 /**
326 Returns the operating system directory.
327
328 See wxGetOSDirectory() for more info.
329 */
330 static wxString GetOperatingSystemDirectory();
331
3b36f093
FM
332 //@}
333
334
23324ae1 335 /**
3b36f093 336 @name Getters
23324ae1 337 */
3b36f093 338 //@{
74bf4e64 339
23324ae1 340 /**
3b36f093 341 Returns the architecture ID of this wxPlatformInfo instance.
23324ae1 342 */
3b36f093 343 wxArchitecture GetArchitecture() const;
74bf4e64
FM
344
345 /**
3b36f093 346 Returns the endianness ID of this wxPlatformInfo instance.
74bf4e64 347 */
3b36f093 348 wxEndianness GetEndianness() const;
23324ae1 349
74bf4e64 350 /**
3b36f093
FM
351 Returns the run-time major version of the OS associated with this
352 wxPlatformInfo instance.
74bf4e64 353
3b36f093 354 @see ::wxGetOsVersion(), CheckOSVersion()
74bf4e64 355 */
3b36f093 356 int GetOSMajorVersion() const;
74bf4e64 357
23324ae1 358 /**
3b36f093
FM
359 Returns the run-time minor version of the OS associated with this
360 wxPlatformInfo instance.
361
362 @see ::wxGetOsVersion(), CheckOSVersion()
23324ae1 363 */
3b36f093 364 int GetOSMinorVersion() const;
23324ae1 365
23324ae1 366 /**
3b36f093 367 Returns the operating system ID of this wxPlatformInfo instance.
9bbb78b9
FM
368
369 See wxGetOsVersion() for more info.
23324ae1 370 */
3b36f093 371 wxOperatingSystemId GetOperatingSystemId() const;
23790a2a
FM
372
373 /**
374 Returns the description of the operating system of this wxPlatformInfo instance.
375
376 See wxGetOSDescription() for more info.
377 */
378 wxString GetOperatingSystemDescription() const;
74bf4e64
FM
379
380 /**
3b36f093 381 Returns the wxWidgets port ID associated with this wxPlatformInfo instance.
74bf4e64 382 */
3b36f093 383 wxPortId GetPortId() const;
23790a2a
FM
384
385 /**
386 Returns the Linux distribution info associated with this wxPlatformInfo instance.
387
388 See wxGetLinuxDistributionInfo() for more info.
389 */
390 wxLinuxDistributionInfo GetLinuxDistributionInfo() const;
391
392 /**
393 Returns the desktop environment associated with this wxPlatformInfo instance.
394
395 See wxAppTraits::GetDesktopEnvironment() for more info.
396 */
397 wxString GetDesktopEnvironment() const;
23324ae1
FM
398
399 /**
400 Returns the run-time major version of the toolkit associated with this
401 wxPlatformInfo instance.
74bf4e64
FM
402
403 Note that if GetPortId() returns @c wxPORT_BASE, then this value is zero
404 (unless externally modified with SetToolkitVersion()); that is, no native
405 toolkit is in use.
406 See wxAppTraits::GetToolkitVersion() for more info.
3c4f71cc 407
4cc4bfaf 408 @see CheckToolkitVersion()
23324ae1 409 */
328f5751 410 int GetToolkitMajorVersion() const;
23324ae1
FM
411
412 /**
413 Returns the run-time minor version of the toolkit associated with this
414 wxPlatformInfo instance.
74bf4e64
FM
415
416 Note that if GetPortId() returns @c wxPORT_BASE, then this value is zero
417 (unless externally modified with SetToolkitVersion()); that is, no native
418 toolkit is in use.
419 See wxAppTraits::GetToolkitVersion() for more info.
3c4f71cc 420
4cc4bfaf 421 @see CheckToolkitVersion()
23324ae1 422 */
328f5751 423 int GetToolkitMinorVersion() const;
3b36f093
FM
424
425 //@}
426
23324ae1
FM
427
428 /**
3b36f093 429 @name String-form getters
23324ae1 430 */
3b36f093 431 //@{
23324ae1
FM
432
433 /**
3b36f093 434 Returns the name for the architecture of this wxPlatformInfo instance.
23324ae1 435 */
3b36f093
FM
436 wxString GetArchName() const;
437
438 /**
439 Returns the name for the endianness of this wxPlatformInfo instance.
440 */
441 wxString GetEndiannessName() const;
23324ae1 442
3b36f093
FM
443 /**
444 Returns the operating system family name of the OS associated with this
445 wxPlatformInfo instance.
446 */
447 wxString GetOperatingSystemFamilyName() const;
448
449 /**
450 Returns the operating system name of the OS associated with this wxPlatformInfo
451 instance.
452 */
453 wxString GetOperatingSystemIdName() const;
454
455 /**
456 Returns the name of the wxWidgets port ID associated with this wxPlatformInfo
457 instance.
458 */
459 wxString GetPortIdName() const;
460
461 /**
462 Returns the short name of the wxWidgets port ID associated with this
463 wxPlatformInfo instance.
464 */
465 wxString GetPortIdShortName() const;
466
467 //@}
468
469
470
471 /**
472 @name Setters
473 */
474 //@{
475
23324ae1
FM
476 /**
477 Sets the architecture enum value associated with this wxPlatformInfo instance.
478 */
479 void SetArchitecture(wxArchitecture n);
480
481 /**
482 Sets the endianness enum value associated with this wxPlatformInfo instance.
483 */
484 void SetEndianness(wxEndianness n);
485
486 /**
487 Sets the version of the operating system associated with this wxPlatformInfo
488 instance.
489 */
490 void SetOSVersion(int major, int minor);
491
492 /**
493 Sets the operating system associated with this wxPlatformInfo instance.
494 */
495 void SetOperatingSystemId(wxOperatingSystemId n);
496
497 /**
498 Sets the wxWidgets port ID associated with this wxPlatformInfo instance.
499 */
500 void SetPortId(wxPortId n);
501
502 /**
503 Sets the version of the toolkit associated with this wxPlatformInfo instance.
504 */
505 void SetToolkitVersion(int major, int minor);
23790a2a
FM
506
507 /**
508 Sets the operating system description associated with this wxPlatformInfo instance.
509 */
510 void SetOperatingSystemDescription(const wxString& desc);
511
512 /**
513 Sets the desktop environment associated with this wxPlatformInfo instance.
514 */
515 void SetDesktopEnvironment(const wxString& de);
3b36f093 516
23790a2a
FM
517 /**
518 Sets the linux distribution info associated with this wxPlatformInfo instance.
519 */
520 void SetLinuxDistributionInfo(const wxLinuxDistributionInfo& di);
3b36f093 521
23790a2a 522 //@}
23324ae1 523};
e54c96f1 524