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/. */
9 #ifndef MOZILLA_INTERNAL_API
10 #error "This header is only usable from within libxul (MOZILLA_INTERNAL_API)."
23 // When modifying this list, also modify nsXPLookAndFeel::sColorPrefs
24 // in widget/xpwidgts/nsXPLookAndFeel.cpp.
27 // WARNING : NO NEGATIVE VALUE IN THIS ENUMERATION
28 // see patch in bug 57757 for more information
30 eColorID_WindowBackground
,
31 eColorID_WindowForeground
,
32 eColorID_WidgetBackground
,
33 eColorID_WidgetForeground
,
34 eColorID_WidgetSelectBackground
,
35 eColorID_WidgetSelectForeground
,
36 eColorID_Widget3DHighlight
,
37 eColorID_Widget3DShadow
,
38 eColorID_TextBackground
,
39 eColorID_TextForeground
,
40 eColorID_TextSelectBackground
,
41 eColorID_TextSelectForeground
,
42 eColorID_TextSelectForegroundCustom
,
43 eColorID_TextSelectBackgroundDisabled
,
44 eColorID_TextSelectBackgroundAttention
,
45 eColorID_TextHighlightBackground
,
46 eColorID_TextHighlightForeground
,
48 eColorID_IMERawInputBackground
,
49 eColorID_IMERawInputForeground
,
50 eColorID_IMERawInputUnderline
,
51 eColorID_IMESelectedRawTextBackground
,
52 eColorID_IMESelectedRawTextForeground
,
53 eColorID_IMESelectedRawTextUnderline
,
54 eColorID_IMEConvertedTextBackground
,
55 eColorID_IMEConvertedTextForeground
,
56 eColorID_IMEConvertedTextUnderline
,
57 eColorID_IMESelectedConvertedTextBackground
,
58 eColorID_IMESelectedConvertedTextForeground
,
59 eColorID_IMESelectedConvertedTextUnderline
,
61 eColorID_SpellCheckerUnderline
,
63 // New CSS 2 color definitions
64 eColorID_activeborder
,
65 eColorID_activecaption
,
66 eColorID_appworkspace
,
69 eColorID_buttonhighlight
,
70 eColorID_buttonshadow
,
75 eColorID_highlighttext
,
76 eColorID_inactiveborder
,
77 eColorID_inactivecaption
,
78 eColorID_inactivecaptiontext
,
79 eColorID_infobackground
,
84 eColorID_threeddarkshadow
,
86 eColorID_threedhighlight
,
87 eColorID_threedlightshadow
,
88 eColorID_threedshadow
,
93 eColorID__moz_buttondefault
,
94 // Colors which will hopefully become CSS3
96 eColorID__moz_fieldtext
,
98 eColorID__moz_dialogtext
,
99 // used to highlight valid regions to drop something onto
100 eColorID__moz_dragtargetzone
,
102 // used to cell text background, selected but not focus
103 eColorID__moz_cellhighlight
,
104 // used to cell text, selected but not focus
105 eColorID__moz_cellhighlighttext
,
106 // used to html select cell text background, selected but not focus
107 eColorID__moz_html_cellhighlight
,
108 // used to html select cell text, selected but not focus
109 eColorID__moz_html_cellhighlighttext
,
110 // used to button text background, when mouse is over
111 eColorID__moz_buttonhoverface
,
112 // used to button text, when mouse is over
113 eColorID__moz_buttonhovertext
,
114 // used to menu item background, when mouse is over
115 eColorID__moz_menuhover
,
116 // used to menu item text, when mouse is over
117 eColorID__moz_menuhovertext
,
118 // used to menu bar item text
119 eColorID__moz_menubartext
,
120 // used to menu bar item text, when mouse is over
121 eColorID__moz_menubarhovertext
,
122 // On platforms where these colors are the same as
123 // -moz-field, use -moz-fieldtext as foreground color
124 eColorID__moz_eventreerow
,
125 eColorID__moz_oddtreerow
,
127 // colors needed by the Mac OS X theme
129 // foreground color of :hover:active buttons
130 eColorID__moz_mac_buttonactivetext
,
131 // background color of chrome toolbars in active windows
132 eColorID__moz_mac_chrome_active
,
133 // background color of chrome toolbars in inactive windows
134 eColorID__moz_mac_chrome_inactive
,
135 // foreground color of default buttons
136 eColorID__moz_mac_defaultbuttontext
,
137 //ring around text fields and lists
138 eColorID__moz_mac_focusring
,
139 //colour used when mouse is over a menu item
140 eColorID__moz_mac_menuselect
,
141 //colour used to do shadows on menu items
142 eColorID__moz_mac_menushadow
,
143 // color used to display text for disabled menu items
144 eColorID__moz_mac_menutextdisable
,
145 //colour used to display text while mouse is over a menu item
146 eColorID__moz_mac_menutextselect
,
147 // text color of disabled text on toolbars
148 eColorID__moz_mac_disabledtoolbartext
,
149 //inactive light hightlight
150 eColorID__moz_mac_secondaryhighlight
,
154 // accent color for title bar
155 eColorID__moz_win_accentcolor
,
156 // color from drawing text over the accent color
157 eColorID__moz_win_accentcolortext
,
159 eColorID__moz_win_mediatext
,
160 // communications rebar text
161 eColorID__moz_win_communicationstext
,
163 // Hyperlink color extracted from the system, not affected by the
164 // browser.anchor_color user pref.
165 // There is no OS-specified safe background color for this text,
166 // but it is used regularly within Windows and the Gnome DE on Dialog and
168 eColorID__moz_nativehyperlinktext
,
171 eColorID__moz_comboboxtext
,
172 eColorID__moz_combobox
,
174 // keep this one last, please
178 // When modifying this list, also modify nsXPLookAndFeel::sIntPrefs
179 // in widget/xpwidgts/nsXPLookAndFeel.cpp.
181 // default, may be overriden by OS
182 eIntID_CaretBlinkTime
,
183 // pixel width of caret
185 // show the caret when text is selected?
186 eIntID_ShowCaretDuringSelection
,
187 // select textfields when focused via tab/accesskey?
188 eIntID_SelectTextfieldsOnKeyFocus
,
189 // delay before submenus open
191 // can popups overlap menu/task bar?
192 eIntID_MenusCanOverlapOSBar
,
193 // should overlay scrollbars be used?
194 eIntID_UseOverlayScrollbars
,
195 // allow H and V overlay scrollbars to overlap?
196 eIntID_AllowOverlayScrollbarsOverlap
,
197 // show/hide scrollbars based on activity
198 eIntID_ShowHideScrollbars
,
199 // skip navigating to disabled menu item?
200 eIntID_SkipNavigatingDisabledMenuItem
,
201 // begin a drag if the mouse is moved further than the threshold while the
203 eIntID_DragThresholdX
,
204 eIntID_DragThresholdY
,
205 // Accessibility theme being used?
206 eIntID_UseAccessibilityTheme
,
208 // position of scroll arrows in a scrollbar
209 eIntID_ScrollArrowStyle
,
210 // is scroll thumb proportional or fixed?
211 eIntID_ScrollSliderStyle
,
213 // each button can take one of four values:
214 eIntID_ScrollButtonLeftMouseButtonAction
,
215 // 0 - scrolls one line, 1 - scrolls one page
216 eIntID_ScrollButtonMiddleMouseButtonAction
,
217 // 2 - scrolls to end, 3 - button ignored
218 eIntID_ScrollButtonRightMouseButtonAction
,
220 // delay for opening spring loaded folders
221 eIntID_TreeOpenDelay
,
222 // delay for closing spring loaded folders
223 eIntID_TreeCloseDelay
,
224 // delay for triggering the tree scrolling
225 eIntID_TreeLazyScrollDelay
,
226 // delay for scrolling the tree
227 eIntID_TreeScrollDelay
,
228 // the maximum number of lines to be scrolled at ones
229 eIntID_TreeScrollLinesMax
,
230 // What type of tab-order to use
231 eIntID_TabFocusModel
,
232 // Should menu items blink when they're chosen?
233 eIntID_ChosenMenuItemsShouldBlink
,
236 * A Boolean value to determine whether the Windows accent color
237 * should be applied to the title bar.
239 * The value of this metric is not used on other platforms. These platforms
240 * should return NS_ERROR_NOT_IMPLEMENTED when queried for this metric.
242 eIntID_WindowsAccentColorApplies
,
245 * A Boolean value to determine whether the Windows accent color
246 * is considered dark and should get bright text/controls.
248 * The value of this metric is not used on other platforms. These platforms
249 * should return NS_ERROR_NOT_IMPLEMENTED when queried for this metric.
251 eIntID_WindowsAccentColorIsDark
,
254 * A Boolean value to determine whether the Windows default theme is
257 * The value of this metric is not used on other platforms. These platforms
258 * should return NS_ERROR_NOT_IMPLEMENTED when queried for this metric.
260 eIntID_WindowsDefaultTheme
,
263 * A Boolean value to determine whether the DWM compositor is being used
265 * This metric is not used on non-Windows platforms. These platforms
266 * should return NS_ERROR_NOT_IMPLEMENTED when queried for this metric.
268 eIntID_DWMCompositor
,
271 * A Boolean value to determine whether Windows is themed (Classic vs.
274 * This is Windows-specific and is not implemented on other platforms
275 * (will return the default of NS_ERROR_FAILURE).
277 eIntID_WindowsClassic
,
280 * A Boolean value to determine whether the current Windows desktop theme
281 * supports Aero Glass.
283 * This is Windows-specific and is not implemented on other platforms
284 * (will return the default of NS_ERROR_FAILURE).
289 * A Boolean value to determine whether the device is a touch enabled
290 * device. Currently this is only supported by the Windows 7 Touch API.
292 * Platforms that do not support this metric should return
293 * NS_ERROR_NOT_IMPLEMENTED when queried for this metric.
298 * A Boolean value to determine whether the Mac graphite theme is
301 * The value of this metric is not used on other platforms. These platforms
302 * should return NS_ERROR_NOT_IMPLEMENTED when queried for this metric.
304 eIntID_MacGraphiteTheme
,
307 * A Boolean value to determine whether the Mac OS X Lion-specific theming
310 * The value of this metric is not used on non-Mac platforms. These
311 * platforms should return NS_ERROR_NOT_IMPLEMENTED when queried for this
317 * A Boolean value to determine whether the Mac OS X Yosemite-specific theming
320 * The value of this metric is not used on non-Mac platforms. These
321 * platforms should return NS_ERROR_NOT_IMPLEMENTED when queried for this
324 eIntID_MacYosemiteTheme
,
327 * eIntID_AlertNotificationOrigin indicates from which corner of the
328 * screen alerts slide in, and from which direction (horizontal/vertical).
329 * 0, the default, represents bottom right, sliding vertically.
330 * Use any bitwise combination of the following constants:
331 * NS_ALERT_HORIZONTAL (1), NS_ALERT_LEFT (2), NS_ALERT_TOP (4).
341 eIntID_AlertNotificationOrigin
,
344 * If true, clicking on a scrollbar (not as in dragging the thumb) defaults
345 * to scrolling the view corresponding to the clicked point. Otherwise, we
346 * only do so if the scrollbar is clicked using the middle mouse button or
347 * if shift is pressed when the scrollbar is clicked.
349 eIntID_ScrollToClick
,
352 * IME and spell checker underline styles, the values should be
353 * NS_DECORATION_LINE_STYLE_*. They are defined below.
355 eIntID_IMERawInputUnderlineStyle
,
356 eIntID_IMESelectedRawTextUnderlineStyle
,
357 eIntID_IMEConvertedTextUnderlineStyle
,
358 eIntID_IMESelectedConvertedTextUnderline
,
359 eIntID_SpellCheckerUnderlineStyle
,
362 * If this metric != 0, show icons in menus.
364 eIntID_ImagesInMenus
,
366 * If this metric != 0, show icons in buttons.
368 eIntID_ImagesInButtons
,
370 * If this metric != 0, support window dragging on the menubar.
374 * Return the appropriate WindowsThemeIdentifier for the current theme.
376 eIntID_WindowsThemeIdentifier
,
378 * Return an appropriate os version identifier.
380 eIntID_OperatingSystemVersionIdentifier
,
382 * 0: scrollbar button repeats to scroll only when cursor is on the button.
383 * 1: scrollbar button repeats to scroll even if cursor is outside of it.
385 eIntID_ScrollbarButtonAutoRepeatBehavior
,
387 * Delay before showing a tooltip.
391 * A Boolean value to determine whether Mac OS X Lion style swipe animations
394 eIntID_SwipeAnimationEnabled
,
397 * A Boolean value to determine whether we have a color picker available
398 * for <input type="color"> to hook into.
400 * This lets us selectively enable the style for <input type="color">
401 * based on whether it's functional or not.
403 eIntID_ColorPickerAvailable
,
406 * A boolean value indicating whether or not the device has a hardware
407 * home button. Used on gaia to determine whether a home button
410 eIntID_PhysicalHomeButton
,
413 * Controls whether overlay scrollbars display when the user moves
414 * the mouse in a scrollable frame.
416 eIntID_ScrollbarDisplayOnMouseMove
,
419 * Overlay scrollbar animation constants.
421 eIntID_ScrollbarFadeBeginDelay
,
422 eIntID_ScrollbarFadeDuration
426 * Windows themes we currently detect.
429 eWindowsTheme_Generic
= 0, // unrecognized theme
430 eWindowsTheme_Classic
,
432 eWindowsTheme_AeroLite
436 * Operating system versions.
438 enum OperatingSystemVersion
{
439 eOperatingSystemVersion_WindowsXP
= 0,
440 eOperatingSystemVersion_WindowsVista
,
441 eOperatingSystemVersion_Windows7
,
442 eOperatingSystemVersion_Windows8
,
443 eOperatingSystemVersion_Windows10
,
444 eOperatingSystemVersion_Unknown
448 eScrollArrow_None
= 0,
449 eScrollArrow_StartBackward
= 0x1000,
450 eScrollArrow_StartForward
= 0x0100,
451 eScrollArrow_EndBackward
= 0x0010,
452 eScrollArrow_EndForward
= 0x0001
456 // single arrow at each end
457 eScrollArrowStyle_Single
=
458 eScrollArrow_StartBackward
| eScrollArrow_EndForward
,
459 // both arrows at bottom/right, none at top/left
460 eScrollArrowStyle_BothAtBottom
=
461 eScrollArrow_EndBackward
| eScrollArrow_EndForward
,
462 // both arrows at both ends
463 eScrollArrowStyle_BothAtEachEnd
=
464 eScrollArrow_EndBackward
| eScrollArrow_EndForward
|
465 eScrollArrow_StartBackward
| eScrollArrow_StartForward
,
466 // both arrows at top/left, none at bottom/right
467 eScrollArrowStyle_BothAtTop
=
468 eScrollArrow_StartBackward
| eScrollArrow_StartForward
472 eScrollThumbStyle_Normal
,
473 eScrollThumbStyle_Proportional
476 // When modifying this list, also modify nsXPLookAndFeel::sFloatPrefs
477 // in widget/xpwidgts/nsXPLookAndFeel.cpp.
479 eFloatID_IMEUnderlineRelativeSize
,
480 eFloatID_SpellCheckerUnderlineRelativeSize
,
482 // The width/height ratio of the cursor. If used, the CaretWidth int metric
483 // should be added to the calculated caret width.
484 eFloatID_CaretAspectRatio
487 // These constants must be kept in 1:1 correspondence with the
488 // NS_STYLE_FONT_* system font constants.
490 eFont_Caption
= 1, // css2
497 eFont_Window
, // css3
508 eFont_Tooltips
, // moz
513 * GetColor() return a native color value (might be overwritten by prefs) for
514 * aID. Some platforms don't return an error even if the index doesn't
515 * match any system colors. And also some platforms may initialize the
516 * return value even when it returns an error. Therefore, if you want to
517 * use a color for the default value, you should use the other GetColor()
518 * which returns nscolor directly.
521 * eColorID_TextSelectForeground might return NS_DONT_CHANGE_COLOR.
522 * eColorID_IME* might return NS_TRANSPARENT, NS_SAME_AS_FOREGROUND_COLOR or
523 * NS_40PERCENT_FOREGROUND_COLOR.
524 * These values have particular meaning. Then, they are not an actual
527 static nsresult
GetColor(ColorID aID
, nscolor
* aResult
);
530 * GetInt() and GetFloat() return a int or float value for aID. The result
531 * might be distance, time, some flags or a int value which has particular
532 * meaning. See each document at definition of each ID for the detail.
533 * The result is always 0 when they return error. Therefore, if you want to
534 * use a value for the default value, you should use the other method which
535 * returns int or float directly.
537 static nsresult
GetInt(IntID aID
, int32_t* aResult
);
538 static nsresult
GetFloat(FloatID aID
, float* aResult
);
540 static nscolor
GetColor(ColorID aID
, nscolor aDefault
= NS_RGB(0, 0, 0))
542 nscolor result
= NS_RGB(0, 0, 0);
543 if (NS_FAILED(GetColor(aID
, &result
))) {
549 static int32_t GetInt(IntID aID
, int32_t aDefault
= 0)
552 if (NS_FAILED(GetInt(aID
, &result
))) {
558 static float GetFloat(FloatID aID
, float aDefault
= 0.0f
)
561 if (NS_FAILED(GetFloat(aID
, &result
))) {
568 * Retrieve the name and style of a system-theme font. Returns true
569 * if the system theme specifies this font, false if a default should
570 * be used. In the latter case neither aName nor aStyle is modified.
572 * @param aID Which system-theme font is wanted.
573 * @param aName The name of the font to use.
574 * @param aStyle Styling to apply to the font.
575 * @param aDevPixPerCSSPixel Ratio of device pixels to CSS pixels
577 static bool GetFont(FontID aID
, nsString
& aName
, gfxFontStyle
& aStyle
,
578 float aDevPixPerCSSPixel
);
581 * GetPasswordCharacter() returns a unicode character which should be used
582 * for a masked character in password editor. E.g., '*'.
584 static char16_t
GetPasswordCharacter();
587 * If the latest character in password field shouldn't be hidden by the
588 * result of GetPasswordCharacter(), GetEchoPassword() returns TRUE.
591 static bool GetEchoPassword();
594 * The millisecond to mask password value.
595 * This value is only valid when GetEchoPassword() returns true.
597 static uint32_t GetPasswordMaskDelay();
600 * When system look and feel is changed, Refresh() must be called. Then,
601 * cached data would be released.
603 static void Refresh();
606 } // namespace mozilla
608 // On the Mac, GetColor(eColorID_TextSelectForeground, color) returns this
609 // constant to specify that the foreground color should not be changed
610 // (ie. a colored text keeps its colors when selected).
611 // Of course if other plaforms work like the Mac, they can use it too.
612 #define NS_DONT_CHANGE_COLOR NS_RGB(0x01, 0x01, 0x01)
614 // Similar with NS_DONT_CHANGE_COLOR, except NS_DONT_CHANGE_COLOR would returns
615 // complementary color if fg color is same as bg color.
616 // NS_CHANGE_COLOR_IF_SAME_AS_BG would returns eColorID_TextSelectForegroundCustom if
617 // fg and bg color are the same.
618 #define NS_CHANGE_COLOR_IF_SAME_AS_BG NS_RGB(0x02, 0x02, 0x02)
620 // ---------------------------------------------------------------------
621 // Special colors for eColorID_IME* and eColorID_SpellCheckerUnderline
622 // ---------------------------------------------------------------------
624 // For background color only.
625 #define NS_TRANSPARENT NS_RGBA(0x01, 0x00, 0x00, 0x00)
626 // For foreground color only.
627 #define NS_SAME_AS_FOREGROUND_COLOR NS_RGBA(0x02, 0x00, 0x00, 0x00)
628 #define NS_40PERCENT_FOREGROUND_COLOR NS_RGBA(0x03, 0x00, 0x00, 0x00)
630 #define NS_IS_SELECTION_SPECIAL_COLOR(c) ((c) == NS_TRANSPARENT || \
631 (c) == NS_SAME_AS_FOREGROUND_COLOR || \
632 (c) == NS_40PERCENT_FOREGROUND_COLOR)
634 // ------------------------------------------
635 // Bits for eIntID_AlertNotificationOrigin
636 // ------------------------------------------
638 #define NS_ALERT_HORIZONTAL 1
639 #define NS_ALERT_LEFT 2
640 #define NS_ALERT_TOP 4
642 #endif /* __LookAndFeel */