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