LookAndFeel.h 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666
  1. /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
  2. /* This Source Code Form is subject to the terms of the Mozilla Public
  3. * License, v. 2.0. If a copy of the MPL was not distributed with this
  4. * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
  5. #ifndef __LookAndFeel
  6. #define __LookAndFeel
  7. #ifndef MOZILLA_INTERNAL_API
  8. #error "This header is only usable from within libxul (MOZILLA_INTERNAL_API)."
  9. #endif
  10. #include "nsDebug.h"
  11. #include "nsColor.h"
  12. #include "nsTArray.h"
  13. struct gfxFontStyle;
  14. struct LookAndFeelInt
  15. {
  16. int32_t id;
  17. int32_t value;
  18. };
  19. namespace mozilla {
  20. class LookAndFeel
  21. {
  22. public:
  23. // When modifying this list, also modify nsXPLookAndFeel::sColorPrefs
  24. // in widget/xpwidgts/nsXPLookAndFeel.cpp.
  25. enum ColorID : uint8_t {
  26. // WARNING : NO NEGATIVE VALUE IN THIS ENUMERATION
  27. // see patch in bug 57757 for more information
  28. eColorID_WindowBackground,
  29. eColorID_WindowForeground,
  30. eColorID_WidgetBackground,
  31. eColorID_WidgetForeground,
  32. eColorID_WidgetSelectBackground,
  33. eColorID_WidgetSelectForeground,
  34. eColorID_Widget3DHighlight,
  35. eColorID_Widget3DShadow,
  36. eColorID_TextBackground,
  37. eColorID_TextForeground,
  38. eColorID_TextSelectBackground,
  39. eColorID_TextSelectForeground,
  40. eColorID_TextSelectForegroundCustom,
  41. eColorID_TextSelectBackgroundDisabled,
  42. eColorID_TextSelectBackgroundAttention,
  43. eColorID_TextHighlightBackground,
  44. eColorID_TextHighlightForeground,
  45. eColorID_IMERawInputBackground,
  46. eColorID_IMERawInputForeground,
  47. eColorID_IMERawInputUnderline,
  48. eColorID_IMESelectedRawTextBackground,
  49. eColorID_IMESelectedRawTextForeground,
  50. eColorID_IMESelectedRawTextUnderline,
  51. eColorID_IMEConvertedTextBackground,
  52. eColorID_IMEConvertedTextForeground,
  53. eColorID_IMEConvertedTextUnderline,
  54. eColorID_IMESelectedConvertedTextBackground,
  55. eColorID_IMESelectedConvertedTextForeground,
  56. eColorID_IMESelectedConvertedTextUnderline,
  57. eColorID_SpellCheckerUnderline,
  58. // New CSS 2 color definitions
  59. eColorID_activeborder,
  60. eColorID_activecaption,
  61. eColorID_appworkspace,
  62. eColorID_background,
  63. eColorID_buttonface,
  64. eColorID_buttonhighlight,
  65. eColorID_buttonshadow,
  66. eColorID_buttontext,
  67. eColorID_captiontext,
  68. eColorID_graytext,
  69. eColorID_highlight,
  70. eColorID_highlighttext,
  71. eColorID_inactiveborder,
  72. eColorID_inactivecaption,
  73. eColorID_inactivecaptiontext,
  74. eColorID_infobackground,
  75. eColorID_infotext,
  76. eColorID_menu,
  77. eColorID_menutext,
  78. eColorID_scrollbar,
  79. eColorID_threeddarkshadow,
  80. eColorID_threedface,
  81. eColorID_threedhighlight,
  82. eColorID_threedlightshadow,
  83. eColorID_threedshadow,
  84. eColorID_window,
  85. eColorID_windowframe,
  86. eColorID_windowtext,
  87. eColorID__moz_buttondefault,
  88. // Colors which will hopefully become CSS3
  89. eColorID__moz_field,
  90. eColorID__moz_fieldtext,
  91. eColorID__moz_dialog,
  92. eColorID__moz_dialogtext,
  93. // used to highlight valid regions to drop something onto
  94. eColorID__moz_dragtargetzone,
  95. // used to cell text background, selected but not focus
  96. eColorID__moz_cellhighlight,
  97. // used to cell text, selected but not focus
  98. eColorID__moz_cellhighlighttext,
  99. // used to html select cell text background, selected but not focus
  100. eColorID__moz_html_cellhighlight,
  101. // used to html select cell text, selected but not focus
  102. eColorID__moz_html_cellhighlighttext,
  103. // used to button text background, when mouse is over
  104. eColorID__moz_buttonhoverface,
  105. // used to button text, when mouse is over
  106. eColorID__moz_buttonhovertext,
  107. // used to menu item background, when mouse is over
  108. eColorID__moz_menuhover,
  109. // used to menu item text, when mouse is over
  110. eColorID__moz_menuhovertext,
  111. // used to menu bar item text
  112. eColorID__moz_menubartext,
  113. // used to menu bar item text, when mouse is over
  114. eColorID__moz_menubarhovertext,
  115. // On platforms where these colors are the same as
  116. // -moz-field, use -moz-fieldtext as foreground color
  117. eColorID__moz_eventreerow,
  118. eColorID__moz_oddtreerow,
  119. // colors needed by the Mac OS X theme
  120. // foreground color of :hover:active buttons
  121. eColorID__moz_mac_buttonactivetext,
  122. // background color of chrome toolbars in active windows
  123. eColorID__moz_mac_chrome_active,
  124. // background color of chrome toolbars in inactive windows
  125. eColorID__moz_mac_chrome_inactive,
  126. // foreground color of default buttons
  127. eColorID__moz_mac_defaultbuttontext,
  128. //ring around text fields and lists
  129. eColorID__moz_mac_focusring,
  130. //colour used when mouse is over a menu item
  131. eColorID__moz_mac_menuselect,
  132. //colour used to do shadows on menu items
  133. eColorID__moz_mac_menushadow,
  134. // color used to display text for disabled menu items
  135. eColorID__moz_mac_menutextdisable,
  136. //colour used to display text while mouse is over a menu item
  137. eColorID__moz_mac_menutextselect,
  138. // text color of disabled text on toolbars
  139. eColorID__moz_mac_disabledtoolbartext,
  140. //inactive light hightlight
  141. eColorID__moz_mac_secondaryhighlight,
  142. // vista rebars
  143. // accent color for title bar
  144. eColorID__moz_win_accentcolor,
  145. // color from drawing text over the accent color
  146. eColorID__moz_win_accentcolortext,
  147. // media rebar text
  148. eColorID__moz_win_mediatext,
  149. // communications rebar text
  150. eColorID__moz_win_communicationstext,
  151. // Hyperlink color extracted from the system, not affected by the
  152. // browser.anchor_color user pref.
  153. // There is no OS-specified safe background color for this text,
  154. // but it is used regularly within Windows and the Gnome DE on Dialog and
  155. // Window colors.
  156. eColorID__moz_nativehyperlinktext,
  157. // Combo box widgets
  158. eColorID__moz_comboboxtext,
  159. eColorID__moz_combobox,
  160. // GtkInfoBar
  161. eColorID__moz_gtk_info_bar_text,
  162. // keep this one last, please
  163. eColorID_LAST_COLOR
  164. };
  165. // When modifying this list, also modify nsXPLookAndFeel::sIntPrefs
  166. // in widget/xpwidgts/nsXPLookAndFeel.cpp.
  167. enum IntID {
  168. // default, may be overriden by OS
  169. eIntID_CaretBlinkTime,
  170. // pixel width of caret
  171. eIntID_CaretWidth,
  172. // show the caret when text is selected?
  173. eIntID_ShowCaretDuringSelection,
  174. // select textfields when focused via tab/accesskey?
  175. eIntID_SelectTextfieldsOnKeyFocus,
  176. // delay before submenus open
  177. eIntID_SubmenuDelay,
  178. // can popups overlap menu/task bar?
  179. eIntID_MenusCanOverlapOSBar,
  180. // should overlay scrollbars be used?
  181. eIntID_UseOverlayScrollbars,
  182. // allow H and V overlay scrollbars to overlap?
  183. eIntID_AllowOverlayScrollbarsOverlap,
  184. // show/hide scrollbars based on activity
  185. eIntID_ShowHideScrollbars,
  186. // skip navigating to disabled menu item?
  187. eIntID_SkipNavigatingDisabledMenuItem,
  188. // begin a drag if the mouse is moved further than the threshold while the
  189. // button is down
  190. eIntID_DragThresholdX,
  191. eIntID_DragThresholdY,
  192. // Accessibility theme being used?
  193. eIntID_UseAccessibilityTheme,
  194. // position of scroll arrows in a scrollbar
  195. eIntID_ScrollArrowStyle,
  196. // is scroll thumb proportional or fixed?
  197. eIntID_ScrollSliderStyle,
  198. // each button can take one of four values:
  199. eIntID_ScrollButtonLeftMouseButtonAction,
  200. // 0 - scrolls one line, 1 - scrolls one page
  201. eIntID_ScrollButtonMiddleMouseButtonAction,
  202. // 2 - scrolls to end, 3 - button ignored
  203. eIntID_ScrollButtonRightMouseButtonAction,
  204. // delay for opening spring loaded folders
  205. eIntID_TreeOpenDelay,
  206. // delay for closing spring loaded folders
  207. eIntID_TreeCloseDelay,
  208. // delay for triggering the tree scrolling
  209. eIntID_TreeLazyScrollDelay,
  210. // delay for scrolling the tree
  211. eIntID_TreeScrollDelay,
  212. // the maximum number of lines to be scrolled at ones
  213. eIntID_TreeScrollLinesMax,
  214. // What type of tab-order to use
  215. eIntID_TabFocusModel,
  216. // Should menu items blink when they're chosen?
  217. eIntID_ChosenMenuItemsShouldBlink,
  218. /*
  219. * A Boolean value to determine whether the Windows accent color
  220. * should be applied to the title bar.
  221. *
  222. * The value of this metric is not used on other platforms. These platforms
  223. * should return NS_ERROR_NOT_IMPLEMENTED when queried for this metric.
  224. */
  225. eIntID_WindowsAccentColorApplies,
  226. /*
  227. * A Boolean value to determine whether the Windows accent color
  228. * is considered dark and should get bright text/controls.
  229. *
  230. * The value of this metric is not used on other platforms. These platforms
  231. * should return NS_ERROR_NOT_IMPLEMENTED when queried for this metric.
  232. */
  233. eIntID_WindowsAccentColorIsDark,
  234. /*
  235. * A Boolean value to determine whether the Windows default theme is
  236. * being used.
  237. *
  238. * The value of this metric is not used on other platforms. These platforms
  239. * should return NS_ERROR_NOT_IMPLEMENTED when queried for this metric.
  240. */
  241. eIntID_WindowsDefaultTheme,
  242. /*
  243. * A Boolean value to determine whether the DWM compositor is being used
  244. *
  245. * This metric is not used on non-Windows platforms. These platforms
  246. * should return NS_ERROR_NOT_IMPLEMENTED when queried for this metric.
  247. */
  248. eIntID_DWMCompositor,
  249. /*
  250. * A Boolean value to determine whether Windows is themed (Classic vs.
  251. * uxtheme)
  252. *
  253. * This is Windows-specific and is not implemented on other platforms
  254. * (will return the default of NS_ERROR_FAILURE).
  255. */
  256. eIntID_WindowsClassic,
  257. /*
  258. * A Boolean value to determine whether the current Windows desktop theme
  259. * supports Aero Glass.
  260. *
  261. * This is Windows-specific and is not implemented on other platforms
  262. * (will return the default of NS_ERROR_FAILURE).
  263. */
  264. eIntID_WindowsGlass,
  265. /*
  266. * A Boolean value to determine whether the device is a touch enabled
  267. * device. Currently this is only supported by the Windows 7 Touch API.
  268. *
  269. * Platforms that do not support this metric should return
  270. * NS_ERROR_NOT_IMPLEMENTED when queried for this metric.
  271. */
  272. eIntID_TouchEnabled,
  273. /*
  274. * A Boolean value to determine whether the Mac graphite theme is
  275. * being used.
  276. *
  277. * The value of this metric is not used on other platforms. These platforms
  278. * should return NS_ERROR_NOT_IMPLEMENTED when queried for this metric.
  279. */
  280. eIntID_MacGraphiteTheme,
  281. /*
  282. * A Boolean value to determine whether the Mac OS X Lion-specific theming
  283. * should be used.
  284. *
  285. * The value of this metric is not used on non-Mac platforms. These
  286. * platforms should return NS_ERROR_NOT_IMPLEMENTED when queried for this
  287. * metric.
  288. */
  289. eIntID_MacLionTheme,
  290. /*
  291. * A Boolean value to determine whether the Mac OS X Yosemite-specific theming
  292. * should be used.
  293. *
  294. * The value of this metric is not used on non-Mac platforms. These
  295. * platforms should return NS_ERROR_NOT_IMPLEMENTED when queried for this
  296. * metric.
  297. */
  298. eIntID_MacYosemiteTheme,
  299. /*
  300. * eIntID_AlertNotificationOrigin indicates from which corner of the
  301. * screen alerts slide in, and from which direction (horizontal/vertical).
  302. * 0, the default, represents bottom right, sliding vertically.
  303. * Use any bitwise combination of the following constants:
  304. * NS_ALERT_HORIZONTAL (1), NS_ALERT_LEFT (2), NS_ALERT_TOP (4).
  305. *
  306. * 6 4
  307. * +-----------+
  308. * 7| |5
  309. * | |
  310. * 3| |1
  311. * +-----------+
  312. * 2 0
  313. */
  314. eIntID_AlertNotificationOrigin,
  315. /**
  316. * If true, clicking on a scrollbar (not as in dragging the thumb) defaults
  317. * to scrolling the view corresponding to the clicked point. Otherwise, we
  318. * only do so if the scrollbar is clicked using the middle mouse button or
  319. * if shift is pressed when the scrollbar is clicked.
  320. */
  321. eIntID_ScrollToClick,
  322. /**
  323. * IME and spell checker underline styles, the values should be
  324. * NS_DECORATION_LINE_STYLE_*. They are defined below.
  325. */
  326. eIntID_IMERawInputUnderlineStyle,
  327. eIntID_IMESelectedRawTextUnderlineStyle,
  328. eIntID_IMEConvertedTextUnderlineStyle,
  329. eIntID_IMESelectedConvertedTextUnderline,
  330. eIntID_SpellCheckerUnderlineStyle,
  331. /**
  332. * If this metric != 0, support window dragging on the menubar.
  333. */
  334. eIntID_MenuBarDrag,
  335. /**
  336. * Return the appropriate WindowsThemeIdentifier for the current theme.
  337. */
  338. eIntID_WindowsThemeIdentifier,
  339. /**
  340. * Return an appropriate os version identifier.
  341. */
  342. eIntID_OperatingSystemVersionIdentifier,
  343. /**
  344. * 0: scrollbar button repeats to scroll only when cursor is on the button.
  345. * 1: scrollbar button repeats to scroll even if cursor is outside of it.
  346. */
  347. eIntID_ScrollbarButtonAutoRepeatBehavior,
  348. /**
  349. * Delay before showing a tooltip.
  350. */
  351. eIntID_TooltipDelay,
  352. /*
  353. * A Boolean value to determine whether Mac OS X Lion style swipe animations
  354. * should be used.
  355. */
  356. eIntID_SwipeAnimationEnabled,
  357. /*
  358. * A Boolean value to determine whether we have a color picker available
  359. * for <input type="color"> to hook into.
  360. *
  361. * This lets us selectively enable the style for <input type="color">
  362. * based on whether it's functional or not.
  363. */
  364. eIntID_ColorPickerAvailable,
  365. /*
  366. * A boolean value indicating whether or not the device has a hardware
  367. * home button. Used on gaia to determine whether a home button
  368. * is shown.
  369. */
  370. eIntID_PhysicalHomeButton,
  371. /*
  372. * Controls whether overlay scrollbars display when the user moves
  373. * the mouse in a scrollable frame.
  374. */
  375. eIntID_ScrollbarDisplayOnMouseMove,
  376. /*
  377. * Overlay scrollbar animation constants.
  378. */
  379. eIntID_ScrollbarFadeBeginDelay,
  380. eIntID_ScrollbarFadeDuration,
  381. /**
  382. * Distance in pixels to offset the context menu from the cursor
  383. * on open.
  384. */
  385. eIntID_ContextMenuOffsetVertical,
  386. eIntID_ContextMenuOffsetHorizontal
  387. };
  388. /**
  389. * Windows themes we currently detect.
  390. */
  391. enum WindowsTheme {
  392. eWindowsTheme_Generic = 0, // unrecognized theme
  393. eWindowsTheme_Classic,
  394. eWindowsTheme_Aero,
  395. eWindowsTheme_AeroLite
  396. };
  397. /**
  398. * Operating system versions.
  399. */
  400. enum OperatingSystemVersion {
  401. eOperatingSystemVersion_Windows7 = 2,
  402. eOperatingSystemVersion_Windows8,
  403. eOperatingSystemVersion_Windows10,
  404. eOperatingSystemVersion_Unknown
  405. };
  406. enum {
  407. eScrollArrow_None = 0,
  408. eScrollArrow_StartBackward = 0x1000,
  409. eScrollArrow_StartForward = 0x0100,
  410. eScrollArrow_EndBackward = 0x0010,
  411. eScrollArrow_EndForward = 0x0001
  412. };
  413. enum {
  414. // single arrow at each end
  415. eScrollArrowStyle_Single =
  416. eScrollArrow_StartBackward | eScrollArrow_EndForward,
  417. // both arrows at bottom/right, none at top/left
  418. eScrollArrowStyle_BothAtBottom =
  419. eScrollArrow_EndBackward | eScrollArrow_EndForward,
  420. // both arrows at both ends
  421. eScrollArrowStyle_BothAtEachEnd =
  422. eScrollArrow_EndBackward | eScrollArrow_EndForward |
  423. eScrollArrow_StartBackward | eScrollArrow_StartForward,
  424. // both arrows at top/left, none at bottom/right
  425. eScrollArrowStyle_BothAtTop =
  426. eScrollArrow_StartBackward | eScrollArrow_StartForward
  427. };
  428. enum {
  429. eScrollThumbStyle_Normal,
  430. eScrollThumbStyle_Proportional
  431. };
  432. // When modifying this list, also modify nsXPLookAndFeel::sFloatPrefs
  433. // in widget/xpwidgts/nsXPLookAndFeel.cpp.
  434. enum FloatID {
  435. eFloatID_IMEUnderlineRelativeSize,
  436. eFloatID_SpellCheckerUnderlineRelativeSize,
  437. // The width/height ratio of the cursor. If used, the CaretWidth int metric
  438. // should be added to the calculated caret width.
  439. eFloatID_CaretAspectRatio
  440. };
  441. // These constants must be kept in 1:1 correspondence with the
  442. // NS_STYLE_FONT_* system font constants.
  443. enum FontID {
  444. eFont_Caption = 1, // css2
  445. eFont_Icon,
  446. eFont_Menu,
  447. eFont_MessageBox,
  448. eFont_SmallCaption,
  449. eFont_StatusBar,
  450. eFont_Window, // css3
  451. eFont_Document,
  452. eFont_Workspace,
  453. eFont_Desktop,
  454. eFont_Info,
  455. eFont_Dialog,
  456. eFont_Button,
  457. eFont_PullDownMenu,
  458. eFont_List,
  459. eFont_Field,
  460. eFont_Tooltips, // moz
  461. eFont_Widget
  462. };
  463. /**
  464. * GetColor() return a native color value (might be overwritten by prefs) for
  465. * aID. Some platforms don't return an error even if the index doesn't
  466. * match any system colors. And also some platforms may initialize the
  467. * return value even when it returns an error. Therefore, if you want to
  468. * use a color for the default value, you should use the other GetColor()
  469. * which returns nscolor directly.
  470. *
  471. * NOTE:
  472. * eColorID_TextSelectForeground might return NS_DONT_CHANGE_COLOR.
  473. * eColorID_IME* might return NS_TRANSPARENT, NS_SAME_AS_FOREGROUND_COLOR or
  474. * NS_40PERCENT_FOREGROUND_COLOR.
  475. * These values have particular meaning. Then, they are not an actual
  476. * color value.
  477. */
  478. static nsresult GetColor(ColorID aID, nscolor* aResult);
  479. /**
  480. * This variant of GetColor() takes an extra Boolean parameter that allows
  481. * the caller to ask that hard-coded color values be substituted for
  482. * native colors (used when it is desireable to hide system colors to
  483. * avoid system fingerprinting).
  484. */
  485. static nsresult GetColor(ColorID aID, bool aUseStandinsForNativeColors,
  486. nscolor* aResult);
  487. /**
  488. * GetInt() and GetFloat() return a int or float value for aID. The result
  489. * might be distance, time, some flags or a int value which has particular
  490. * meaning. See each document at definition of each ID for the detail.
  491. * The result is always 0 when they return error. Therefore, if you want to
  492. * use a value for the default value, you should use the other method which
  493. * returns int or float directly.
  494. */
  495. static nsresult GetInt(IntID aID, int32_t* aResult);
  496. static nsresult GetFloat(FloatID aID, float* aResult);
  497. static nscolor GetColor(ColorID aID, nscolor aDefault = NS_RGB(0, 0, 0))
  498. {
  499. nscolor result = NS_RGB(0, 0, 0);
  500. if (NS_FAILED(GetColor(aID, &result))) {
  501. return aDefault;
  502. }
  503. return result;
  504. }
  505. static int32_t GetInt(IntID aID, int32_t aDefault = 0)
  506. {
  507. int32_t result;
  508. if (NS_FAILED(GetInt(aID, &result))) {
  509. return aDefault;
  510. }
  511. return result;
  512. }
  513. static float GetFloat(FloatID aID, float aDefault = 0.0f)
  514. {
  515. float result;
  516. if (NS_FAILED(GetFloat(aID, &result))) {
  517. return aDefault;
  518. }
  519. return result;
  520. }
  521. /**
  522. * Retrieve the name and style of a system-theme font. Returns true
  523. * if the system theme specifies this font, false if a default should
  524. * be used. In the latter case neither aName nor aStyle is modified.
  525. *
  526. * @param aID Which system-theme font is wanted.
  527. * @param aName The name of the font to use.
  528. * @param aStyle Styling to apply to the font.
  529. * @param aDevPixPerCSSPixel Ratio of device pixels to CSS pixels
  530. */
  531. static bool GetFont(FontID aID, nsString& aName, gfxFontStyle& aStyle,
  532. float aDevPixPerCSSPixel);
  533. /**
  534. * GetPasswordCharacter() returns a unicode character which should be used
  535. * for a masked character in password editor. E.g., '*'.
  536. */
  537. static char16_t GetPasswordCharacter();
  538. /**
  539. * If the latest character in password field shouldn't be hidden by the
  540. * result of GetPasswordCharacter(), GetEchoPassword() returns TRUE.
  541. * Otherwise, FALSE.
  542. */
  543. static bool GetEchoPassword();
  544. /**
  545. * The millisecond to mask password value.
  546. * This value is only valid when GetEchoPassword() returns true.
  547. */
  548. static uint32_t GetPasswordMaskDelay();
  549. /**
  550. * When system look and feel is changed, Refresh() must be called. Then,
  551. * cached data would be released.
  552. */
  553. static void Refresh();
  554. /**
  555. * If the implementation is caching values, these accessors allow the
  556. * cache to be exported and imported.
  557. */
  558. static nsTArray<LookAndFeelInt> GetIntCache();
  559. static void SetIntCache(const nsTArray<LookAndFeelInt>& aLookAndFeelIntCache);
  560. };
  561. } // namespace mozilla
  562. // On the Mac, GetColor(eColorID_TextSelectForeground, color) returns this
  563. // constant to specify that the foreground color should not be changed
  564. // (ie. a colored text keeps its colors when selected).
  565. // Of course if other plaforms work like the Mac, they can use it too.
  566. #define NS_DONT_CHANGE_COLOR NS_RGB(0x01, 0x01, 0x01)
  567. // Similar with NS_DONT_CHANGE_COLOR, except NS_DONT_CHANGE_COLOR would returns
  568. // complementary color if fg color is same as bg color.
  569. // NS_CHANGE_COLOR_IF_SAME_AS_BG would returns eColorID_TextSelectForegroundCustom if
  570. // fg and bg color are the same.
  571. #define NS_CHANGE_COLOR_IF_SAME_AS_BG NS_RGB(0x02, 0x02, 0x02)
  572. // ---------------------------------------------------------------------
  573. // Special colors for eColorID_IME* and eColorID_SpellCheckerUnderline
  574. // ---------------------------------------------------------------------
  575. // For background color only.
  576. #define NS_TRANSPARENT NS_RGBA(0x01, 0x00, 0x00, 0x00)
  577. // For foreground color only.
  578. #define NS_SAME_AS_FOREGROUND_COLOR NS_RGBA(0x02, 0x00, 0x00, 0x00)
  579. #define NS_40PERCENT_FOREGROUND_COLOR NS_RGBA(0x03, 0x00, 0x00, 0x00)
  580. #define NS_IS_SELECTION_SPECIAL_COLOR(c) ((c) == NS_TRANSPARENT || \
  581. (c) == NS_SAME_AS_FOREGROUND_COLOR || \
  582. (c) == NS_40PERCENT_FOREGROUND_COLOR)
  583. // ------------------------------------------
  584. // Bits for eIntID_AlertNotificationOrigin
  585. // ------------------------------------------
  586. #define NS_ALERT_HORIZONTAL 1
  587. #define NS_ALERT_LEFT 2
  588. #define NS_ALERT_TOP 4
  589. #endif /* __LookAndFeel */