sysopt.h 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197
  1. /////////////////////////////////////////////////////////////////////////////
  2. // Name: sysopt.h
  3. // Purpose: interface of wxSystemOptions
  4. // Author: wxWidgets team
  5. // Licence: wxWindows licence
  6. /////////////////////////////////////////////////////////////////////////////
  7. /**
  8. @class wxSystemOptions
  9. wxSystemOptions stores option/value pairs that wxWidgets itself or
  10. applications can use to alter behaviour at run-time. It can be
  11. used to optimize behaviour that doesn't deserve a distinct API,
  12. but is still important to be able to configure.
  13. System options can be set by the program itself using SetOption() method
  14. and they also can be set from the program environment by defining an
  15. environment variable @c wx_option to set the given option for all wxWidgets
  16. applications or @c wx_appname_option to set it just for the application
  17. with the given name (as returned by wxApp::GetAppName()). Notice that any
  18. characters not allowed in the environment variables names, such as periods
  19. and dashes, should be replaced with underscores. E.g. to define a system
  20. option "foo-bar" you need to define the environment variable "wx_foo_bar".
  21. The program may use system options for its own needs but they are mostly
  22. used to control the behaviour of wxWidgets library itself.
  23. These options are currently recognised by wxWidgets:
  24. @section sysopt_all All platforms
  25. @beginFlagTable
  26. @flag{exit-on-assert}
  27. If set to non-zero value, abort the program if an assertion fails. The
  28. default behaviour in case of assertion failure depends on the build mode
  29. and can be changed by overriding wxApp::OnAssertFailure() but setting
  30. this option allows to change it without modifying the program code and
  31. also applies to asserts which may happen before the wxApp object
  32. creation or after its destruction.
  33. @endFlagTable
  34. @section sysopt_win Windows
  35. @beginFlagTable
  36. @flag{no-maskblt}
  37. 1 to never use WIN32's MaskBlt function, 0 to allow it to be used where possible.
  38. Default: 0. In some circumstances the MaskBlt function can be slower than using
  39. the fallback code, especially if using DC caching. By default, MaskBlt will be
  40. used where it is implemented by the operating system and driver.
  41. @flag{msw.remap}
  42. If 1 (the default), wxToolBar bitmap colours will be remapped to the current
  43. theme's values. Set this to 0 to disable this functionality, for example if
  44. you're using more than 16 colours in your tool bitmaps.
  45. @flag{msw.window.no-clip-children}
  46. If 1, windows will not automatically get the WS_CLIPCHILDREN style.
  47. This restores the way windows are refreshed back to the method used in
  48. versions of wxWidgets earlier than 2.5.4, and for some complex window
  49. hierarchies it can reduce apparent refresh delays.
  50. You may still specify wxCLIP_CHILDREN for individual windows.
  51. @flag{msw.notebook.themed-background}
  52. If set to 0, globally disables themed backgrounds on notebook pages.
  53. Note that this won't disable the theme on the actual notebook background
  54. (noticeable only if there are no pages).
  55. @flag{msw.staticbox.optimized-paint}
  56. If set to 0, switches off optimized wxStaticBox painting.
  57. Setting this to 0 causes more flicker, but allows applications to paint
  58. graphics on the parent of a static box (the optimized refresh causes any
  59. such drawing to disappear).
  60. @flag{msw.display.directdraw}
  61. If set to 1, use DirectDraw-based implementation of wxDisplay.
  62. By default the standard Win32 functions are used.
  63. @flag{msw.font.no-proof-quality}
  64. If set to 1, use default fonts quality instead of proof quality when
  65. creating fonts. With proof quality the fonts have slightly better
  66. appearance but not all fonts are available in this quality,
  67. e.g. the Terminal font in small sizes is not and this option may be
  68. used if wider fonts selection is more important than higher quality.
  69. @flag{wince.dialog.real-ok-cancel}
  70. The PocketPC guidelines recommend for Ok/Cancel dialogs to use an OK button
  71. located inside the caption bar and implement Cancel functionality through
  72. Undo outside the dialog.
  73. wxDialog::CreateButtonSizer will follow the native behaviour on WinCE but
  74. it can be overridden with real wxButtons by setting the option below to 1.
  75. @endFlagTable
  76. @section sysopt_gtk GTK+
  77. @beginFlagTable
  78. @flag{gtk.tlw.can-set-transparent}
  79. wxTopLevelWindow::CanSetTransparent() method normally tries to detect
  80. automatically whether transparency for top level windows is currently
  81. supported, however this may sometimes fail and this option allows to
  82. override the automatic detection. Setting it to 1 makes the transparency
  83. be always available (setting it can still fail, of course) and setting it
  84. to 0 makes it always unavailable.
  85. @flag{gtk.desktop}
  86. This option can be set to override the default desktop environment
  87. determination. Supported values are GNOME and KDE.
  88. @flag{gtk.window.force-background-colour}
  89. If 1, the backgrounds of windows with the wxBG_STYLE_COLOUR background
  90. style are cleared forcibly instead of relying on the underlying GTK+
  91. window colour. This works around a display problem when running
  92. applications under KDE with the gtk-qt theme installed (0.6 and below).
  93. @endFlagTable
  94. @section sysopt_mac Mac
  95. @beginFlagTable
  96. @flag{mac.window-plain-transition}
  97. If 1, uses a plainer transition when showing a window.
  98. You can also use the symbol wxMAC_WINDOW_PLAIN_TRANSITION.
  99. @flag{window-default-variant}
  100. The default variant used by windows (cast to integer from the wxWindowVariant enum).
  101. Also known as wxWINDOW_DEFAULT_VARIANT.
  102. @flag{mac.listctrl.always_use_generic}
  103. Tells wxListCtrl to use the generic control even when it is capable of
  104. using the native control instead. Also known as wxMAC_ALWAYS_USE_GENERIC_LISTCTRL.
  105. @flag{mac.textcontrol-use-spell-checker}
  106. This option only has effect for Mac OS X 10.4 and higher.
  107. If 1 activates the spell checking in wxTextCtrl.
  108. @flag{osx.openfiledialog.always-show-types}
  109. Per default a wxFileDialog with wxFD_OPEN does not show a types-popup on OSX but allows
  110. the selection of files from any of the supported types. Setting this to 1 shows a wxChoice
  111. for selection (if there is more than one supported filetype).
  112. @endFlagTable
  113. @section sysopt_motif Motif
  114. @beginFlagTable
  115. @flag{motif.largebuttons}
  116. If 1, uses a bigger default size for wxButtons.
  117. @endFlagTable
  118. The compile-time option to include or exclude this functionality is wxUSE_SYSTEM_OPTIONS.
  119. @library{wxbase}
  120. @category{cfg}
  121. @see wxSystemSettings
  122. */
  123. class wxSystemOptions : public wxObject
  124. {
  125. public:
  126. /**
  127. Default constructor.
  128. You don't need to create an instance of wxSystemOptions since all
  129. of its functions are static.
  130. */
  131. wxSystemOptions();
  132. /**
  133. Gets an option. The function is case-insensitive to @a name.
  134. Returns empty string if the option hasn't been set.
  135. @see SetOption(), GetOptionInt(), HasOption()
  136. */
  137. static wxString GetOption(const wxString& name);
  138. /**
  139. Gets an option as an integer. The function is case-insensitive to @a name.
  140. If the option hasn't been set, this function returns 0.
  141. @see SetOption(), GetOption(), HasOption()
  142. */
  143. static int GetOptionInt(const wxString& name);
  144. /**
  145. Returns @true if the given option is present.
  146. The function is case-insensitive to @a name.
  147. @see SetOption(), GetOption(), GetOptionInt()
  148. */
  149. static bool HasOption(const wxString& name);
  150. /**
  151. Returns @true if the option with the given @a name had been set to 0 value.
  152. This is mostly useful for boolean options for which you can't use
  153. @c GetOptionInt(name) == 0 as this would also be @true if the option
  154. hadn't been set at all.
  155. */
  156. static bool IsFalse(const wxString& name);
  157. //@{
  158. /**
  159. Sets an option. The function is case-insensitive to @a name.
  160. */
  161. static void SetOption(const wxString& name, const wxString& value);
  162. static void SetOption(const wxString& name, int value);
  163. //@}
  164. };