settings.h 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300
  1. /////////////////////////////////////////////////////////////////////////////
  2. // Name: settings.h
  3. // Purpose: interface of wxSystemSettings
  4. // Author: wxWidgets team
  5. // Licence: wxWindows licence
  6. /////////////////////////////////////////////////////////////////////////////
  7. /**
  8. Possible values for wxSystemSettings::GetFont() parameter.
  9. These values map 1:1 the native values supported by the Windows' @c GetStockObject
  10. function. Note that other ports (other than wxMSW) will try to provide meaningful
  11. fonts but they usually map the same font to various @c wxSYS_*_FONT values.
  12. */
  13. enum wxSystemFont
  14. {
  15. /// Original equipment manufacturer dependent fixed-pitch font.
  16. wxSYS_OEM_FIXED_FONT = 10,
  17. /// Windows fixed-pitch (monospaced) font.
  18. wxSYS_ANSI_FIXED_FONT,
  19. /// Windows variable-pitch (proportional) font.
  20. wxSYS_ANSI_VAR_FONT,
  21. /// System font. By default, the system uses the system font to draw menus,
  22. /// dialog box controls, and text.
  23. wxSYS_SYSTEM_FONT,
  24. /// Device-dependent font (Windows NT and later only).
  25. wxSYS_DEVICE_DEFAULT_FONT,
  26. /**
  27. Default font for user interface objects such as menus and dialog boxes.
  28. Note that with modern GUIs nothing guarantees that the same font is used
  29. for all GUI elements, so some controls might use a different font by default.
  30. */
  31. wxSYS_DEFAULT_GUI_FONT
  32. };
  33. /**
  34. Possible values for wxSystemSettings::GetColour() parameter.
  35. These values map 1:1 the native values supported by the Windows' @c GetSysColor
  36. function. Note that other ports (other than wxMSW) will try to provide meaningful
  37. colours but they usually map the same colour to various @c wxSYS_COLOUR_* values.
  38. */
  39. enum wxSystemColour
  40. {
  41. wxSYS_COLOUR_SCROLLBAR, //!< The scrollbar grey area.
  42. wxSYS_COLOUR_DESKTOP, //!< The desktop colour.
  43. wxSYS_COLOUR_ACTIVECAPTION, //!< Active window caption colour.
  44. wxSYS_COLOUR_INACTIVECAPTION, //!< Inactive window caption colour.
  45. wxSYS_COLOUR_MENU, //!< Menu background colour.
  46. wxSYS_COLOUR_WINDOW, //!< Window background colour.
  47. wxSYS_COLOUR_WINDOWFRAME, //!< Window frame colour.
  48. wxSYS_COLOUR_MENUTEXT, //!< Colour of the text used in the menus.
  49. wxSYS_COLOUR_WINDOWTEXT, //!< Colour of the text used in generic windows.
  50. wxSYS_COLOUR_CAPTIONTEXT, //!< Colour of the text used in captions, size boxes and scrollbar arrow boxes.
  51. wxSYS_COLOUR_ACTIVEBORDER, //!< Active window border colour.
  52. wxSYS_COLOUR_INACTIVEBORDER, //!< Inactive window border colour.
  53. wxSYS_COLOUR_APPWORKSPACE, //!< Background colour for MDI applications.
  54. wxSYS_COLOUR_HIGHLIGHT, //!< Colour of item(s) selected in a control.
  55. wxSYS_COLOUR_HIGHLIGHTTEXT, //!< Colour of the text of item(s) selected in a control.
  56. wxSYS_COLOUR_BTNFACE, //!< Face shading colour on push buttons.
  57. wxSYS_COLOUR_BTNSHADOW, //!< Edge shading colour on push buttons.
  58. wxSYS_COLOUR_GRAYTEXT, //!< Colour of greyed (disabled) text.
  59. wxSYS_COLOUR_BTNTEXT, //!< Colour of the text on push buttons.
  60. wxSYS_COLOUR_INACTIVECAPTIONTEXT, //!< Colour of the text in active captions.
  61. wxSYS_COLOUR_BTNHIGHLIGHT, //!< Highlight colour for buttons.
  62. wxSYS_COLOUR_3DDKSHADOW, //!< Dark shadow colour for three-dimensional display elements.
  63. wxSYS_COLOUR_3DLIGHT, //!< Light colour for three-dimensional display elements.
  64. wxSYS_COLOUR_INFOTEXT, //!< Text colour for tooltip controls.
  65. wxSYS_COLOUR_INFOBK, //!< Background colour for tooltip controls.
  66. wxSYS_COLOUR_LISTBOX, //!< Background colour for list-like controls.
  67. wxSYS_COLOUR_HOTLIGHT, //!< Colour for a hyperlink or hot-tracked item.
  68. /**
  69. Right side colour in the color gradient of an active window's title bar.
  70. @c wxSYS_COLOUR_ACTIVECAPTION specifies the left side color.
  71. */
  72. wxSYS_COLOUR_GRADIENTACTIVECAPTION,
  73. /**
  74. Right side colour in the color gradient of an inactive window's title bar.
  75. @c wxSYS_COLOUR_INACTIVECAPTION specifies the left side color.
  76. */
  77. wxSYS_COLOUR_GRADIENTINACTIVECAPTION,
  78. /**
  79. The colour used to highlight menu items when the menu appears as a flat menu.
  80. The highlighted menu item is outlined with @c wxSYS_COLOUR_HIGHLIGHT.
  81. */
  82. wxSYS_COLOUR_MENUHILIGHT,
  83. /**
  84. The background colour for the menu bar when menus appear as flat menus.
  85. However, @c wxSYS_COLOUR_MENU continues to specify the background color of the menu popup.
  86. */
  87. wxSYS_COLOUR_MENUBAR,
  88. /**
  89. Text colour for list-like controls.
  90. @since 2.9.0
  91. */
  92. wxSYS_COLOUR_LISTBOXTEXT,
  93. /**
  94. Text colour for the unfocused selection of list-like controls.
  95. @since 2.9.1
  96. */
  97. wxSYS_COLOUR_LISTBOXHIGHLIGHTTEXT,
  98. wxSYS_COLOUR_MAX
  99. // synonyms:
  100. wxSYS_COLOUR_BACKGROUND = wxSYS_COLOUR_DESKTOP,
  101. //!< Synonym for @c wxSYS_COLOUR_DESKTOP.
  102. wxSYS_COLOUR_3DFACE = wxSYS_COLOUR_BTNFACE,
  103. //!< Synonym for @c wxSYS_COLOUR_BTNFACE.
  104. wxSYS_COLOUR_3DSHADOW = wxSYS_COLOUR_BTNSHADOW,
  105. //!< Synonym for @c wxSYS_COLOUR_BTNSHADOW.
  106. wxSYS_COLOUR_BTNHILIGHT = wxSYS_COLOUR_BTNHIGHLIGHT,
  107. //!< Synonym for @c wxSYS_COLOUR_BTNHIGHLIGHT.
  108. wxSYS_COLOUR_3DHIGHLIGHT = wxSYS_COLOUR_BTNHIGHLIGHT,
  109. //!< Synonym for @c wxSYS_COLOUR_BTNHIGHLIGHT.
  110. wxSYS_COLOUR_3DHILIGHT = wxSYS_COLOUR_BTNHIGHLIGHT,
  111. //!< Synonym for @c wxSYS_COLOUR_BTNHIGHLIGHT.
  112. /**
  113. Synonym for @c wxSYS_COLOUR_BTNFACE.
  114. On wxMSW this colour should be used as the background colour of
  115. wxFrames which are used as containers of controls; this is in fact the
  116. same colour used for the borders of controls like e.g. wxNotebook or
  117. for the background of e.g. wxPanel.
  118. @since 2.9.0
  119. */
  120. wxSYS_COLOUR_FRAMEBK = wxSYS_COLOUR_BTNFACE
  121. };
  122. /**
  123. Possible values for wxSystemSettings::GetMetric() index parameter.
  124. */
  125. enum wxSystemMetric
  126. {
  127. wxSYS_MOUSE_BUTTONS, //!< Number of buttons on mouse, or zero if no mouse was installed.
  128. wxSYS_BORDER_X, //!< Width of single border.
  129. wxSYS_BORDER_Y, //!< Height of single border.
  130. wxSYS_CURSOR_X, //!< Width of cursor.
  131. wxSYS_CURSOR_Y, //!< Height of cursor.
  132. wxSYS_DCLICK_X, //!< Width in pixels of rectangle within which two successive mouse clicks must fall to generate a double-click.
  133. wxSYS_DCLICK_Y, //!< Height in pixels of rectangle within which two successive mouse clicks must fall to generate a double-click.
  134. wxSYS_DRAG_X, //!< Width in pixels of a rectangle centered on a drag point to allow for limited movement of the mouse pointer before a drag operation begins.
  135. wxSYS_DRAG_Y, //!< Height in pixels of a rectangle centered on a drag point to allow for limited movement of the mouse pointer before a drag operation begins.
  136. wxSYS_EDGE_X, //!< Width of a 3D border, in pixels.
  137. wxSYS_EDGE_Y, //!< Height of a 3D border, in pixels.
  138. wxSYS_HSCROLL_ARROW_X, //!< Width of arrow bitmap on horizontal scrollbar.
  139. wxSYS_HSCROLL_ARROW_Y, //!< Height of arrow bitmap on horizontal scrollbar.
  140. wxSYS_HTHUMB_X, //!< Width of horizontal scrollbar thumb.
  141. wxSYS_ICON_X, //!< The default width of an icon.
  142. wxSYS_ICON_Y, //!< The default height of an icon.
  143. wxSYS_ICONSPACING_X, //!< Width of a grid cell for items in large icon view, in pixels. Each item fits into a rectangle of this size when arranged.
  144. wxSYS_ICONSPACING_Y, //!< Height of a grid cell for items in large icon view, in pixels. Each item fits into a rectangle of this size when arranged.
  145. wxSYS_WINDOWMIN_X, //!< Minimum width of a window.
  146. wxSYS_WINDOWMIN_Y, //!< Minimum height of a window.
  147. wxSYS_SCREEN_X, //!< Width of the screen in pixels.
  148. wxSYS_SCREEN_Y, //!< Height of the screen in pixels.
  149. wxSYS_FRAMESIZE_X, //!< Width of the window frame for a wxTHICK_FRAME window.
  150. wxSYS_FRAMESIZE_Y, //!< Height of the window frame for a wxTHICK_FRAME window.
  151. wxSYS_SMALLICON_X, //!< Recommended width of a small icon (in window captions, and small icon view).
  152. wxSYS_SMALLICON_Y, //!< Recommended height of a small icon (in window captions, and small icon view).
  153. wxSYS_HSCROLL_Y, //!< Height of horizontal scrollbar in pixels.
  154. wxSYS_VSCROLL_X, //!< Width of vertical scrollbar in pixels.
  155. wxSYS_VSCROLL_ARROW_X, //!< Width of arrow bitmap on a vertical scrollbar.
  156. wxSYS_VSCROLL_ARROW_Y, //!< Height of arrow bitmap on a vertical scrollbar.
  157. wxSYS_VTHUMB_Y, //!< Height of vertical scrollbar thumb.
  158. wxSYS_CAPTION_Y, //!< Height of normal caption area.
  159. wxSYS_MENU_Y, //!< Height of single-line menu bar.
  160. wxSYS_NETWORK_PRESENT, //!< 1 if there is a network present, 0 otherwise.
  161. wxSYS_PENWINDOWS_PRESENT, //!< 1 if PenWindows is installed, 0 otherwise.
  162. wxSYS_SHOW_SOUNDS, //!< Non-zero if the user requires an application to present information
  163. //!< visually in situations where it would otherwise present the information
  164. //!< only in audible form; zero otherwise.
  165. wxSYS_SWAP_BUTTONS, //!< Non-zero if the meanings of the left and right mouse buttons are swapped; zero otherwise.
  166. wxSYS_DCLICK_MSEC //!< Maximal time, in milliseconds, which may pass between subsequent clicks for a double click to be generated.
  167. };
  168. /**
  169. Possible values for wxSystemSettings::HasFeature() parameter.
  170. */
  171. enum wxSystemFeature
  172. {
  173. wxSYS_CAN_DRAW_FRAME_DECORATIONS = 1,
  174. wxSYS_CAN_ICONIZE_FRAME,
  175. wxSYS_TABLET_PRESENT
  176. };
  177. /**
  178. Values for different screen designs. See wxSystemSettings::GetScreenType().
  179. */
  180. enum wxSystemScreenType
  181. {
  182. wxSYS_SCREEN_NONE = 0, //!< Undefined screen type.
  183. wxSYS_SCREEN_TINY, //!< Tiny screen, less than 320x240
  184. wxSYS_SCREEN_PDA, //!< PDA screen, 320x240 or more but less than 640x480
  185. wxSYS_SCREEN_SMALL, //!< Small screen, 640x480 or more but less than 800x600
  186. wxSYS_SCREEN_DESKTOP //!< Desktop screen, 800x600 or more
  187. };
  188. /**
  189. @class wxSystemSettings
  190. wxSystemSettings allows the application to ask for details about the system.
  191. This can include settings such as standard colours, fonts, and user interface
  192. element sizes.
  193. @library{wxcore}
  194. @category{cfg}
  195. @see wxFont, wxColour, wxSystemOptions
  196. */
  197. class wxSystemSettings : public wxObject
  198. {
  199. public:
  200. /**
  201. Default constructor.
  202. You don't need to create an instance of wxSystemSettings
  203. since all of its functions are static.
  204. */
  205. wxSystemSettings();
  206. /**
  207. Returns a system colour.
  208. @param index
  209. Can be one of the ::wxSystemColour enum values.
  210. @return
  211. The returned colour is always valid.
  212. */
  213. static wxColour GetColour(wxSystemColour index);
  214. /**
  215. Returns a system font.
  216. @param index
  217. Can be one of the ::wxSystemFont enum values.
  218. @return
  219. The returned font is always valid.
  220. */
  221. static wxFont GetFont(wxSystemFont index);
  222. /**
  223. Returns the value of a system metric, or -1 if the metric is not supported on
  224. the current system.
  225. The value of @a win determines if the metric returned is a global value or
  226. a wxWindow based value, in which case it might determine the widget, the
  227. display the window is on, or something similar. The window given should be as
  228. close to the metric as possible (e.g. a wxTopLevelWindow in case of the
  229. wxSYS_CAPTION_Y metric).
  230. @a index can be one of the ::wxSystemMetric enum values.
  231. @a win is a pointer to the window for which the metric is requested.
  232. Specifying the @a win parameter is encouraged, because some metrics on some
  233. ports are not supported without one,or they might be capable of reporting
  234. better values if given one. If a window does not make sense for a metric,
  235. one should still be given, as for example it might determine which displays
  236. cursor width is requested with wxSYS_CURSOR_X.
  237. */
  238. static int GetMetric(wxSystemMetric index, wxWindow* win = NULL);
  239. /**
  240. Returns the screen type.
  241. The return value is one of the ::wxSystemScreenType enum values.
  242. */
  243. static wxSystemScreenType GetScreenType();
  244. /**
  245. Returns @true if the port has certain feature.
  246. See the ::wxSystemFeature enum values.
  247. */
  248. static bool HasFeature(wxSystemFeature index);
  249. };