2011-09-09 06:27:11 +04:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
2012-05-21 15:12:37 +04:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
1998-07-29 22:54:36 +04:00
|
|
|
|
2011-09-09 06:27:12 +04:00
|
|
|
#ifndef __LookAndFeel
|
|
|
|
#define __LookAndFeel
|
2011-09-09 06:27:11 +04:00
|
|
|
|
|
|
|
#ifndef MOZILLA_INTERNAL_API
|
|
|
|
# error "This header is only usable from within libxul (MOZILLA_INTERNAL_API)."
|
|
|
|
#endif
|
|
|
|
|
2011-09-09 06:27:13 +04:00
|
|
|
#include "nsDebug.h"
|
1998-07-29 22:54:36 +04:00
|
|
|
#include "nsColor.h"
|
2015-04-22 17:58:15 +03:00
|
|
|
#include "nsTArray.h"
|
1998-07-29 22:54:36 +04:00
|
|
|
|
2012-02-21 03:19:48 +04:00
|
|
|
struct gfxFontStyle;
|
1999-10-19 15:34:00 +04:00
|
|
|
|
2015-04-22 17:58:15 +03:00
|
|
|
struct LookAndFeelInt {
|
|
|
|
int32_t id;
|
2020-01-24 18:01:48 +03:00
|
|
|
int32_t value;
|
2015-04-22 17:58:15 +03:00
|
|
|
};
|
|
|
|
|
2011-09-09 06:27:11 +04:00
|
|
|
namespace mozilla {
|
|
|
|
|
2019-05-26 16:10:00 +03:00
|
|
|
enum class StyleSystemColor : uint8_t;
|
|
|
|
|
2011-09-09 06:27:11 +04:00
|
|
|
class LookAndFeel {
|
|
|
|
public:
|
2019-05-26 16:10:00 +03:00
|
|
|
using ColorID = StyleSystemColor;
|
2011-09-09 06:27:11 +04:00
|
|
|
|
|
|
|
// When modifying this list, also modify nsXPLookAndFeel::sIntPrefs
|
2012-01-04 07:09:29 +04:00
|
|
|
// in widget/xpwidgts/nsXPLookAndFeel.cpp.
|
2011-09-09 06:27:11 +04:00
|
|
|
enum IntID {
|
|
|
|
// default, may be overriden by OS
|
|
|
|
eIntID_CaretBlinkTime,
|
|
|
|
// pixel width of caret
|
|
|
|
eIntID_CaretWidth,
|
|
|
|
// show the caret when text is selected?
|
|
|
|
eIntID_ShowCaretDuringSelection,
|
|
|
|
// select textfields when focused via tab/accesskey?
|
|
|
|
eIntID_SelectTextfieldsOnKeyFocus,
|
|
|
|
// delay before submenus open
|
|
|
|
eIntID_SubmenuDelay,
|
|
|
|
// can popups overlap menu/task bar?
|
|
|
|
eIntID_MenusCanOverlapOSBar,
|
2013-05-02 18:58:00 +04:00
|
|
|
// should overlay scrollbars be used?
|
|
|
|
eIntID_UseOverlayScrollbars,
|
2013-05-24 01:14:00 +04:00
|
|
|
// allow H and V overlay scrollbars to overlap?
|
|
|
|
eIntID_AllowOverlayScrollbarsOverlap,
|
2012-08-03 14:35:14 +04:00
|
|
|
// show/hide scrollbars based on activity
|
|
|
|
eIntID_ShowHideScrollbars,
|
2011-09-09 06:27:11 +04:00
|
|
|
// skip navigating to disabled menu item?
|
|
|
|
eIntID_SkipNavigatingDisabledMenuItem,
|
|
|
|
// begin a drag if the mouse is moved further than the threshold while the
|
|
|
|
// button is down
|
|
|
|
eIntID_DragThresholdX,
|
|
|
|
eIntID_DragThresholdY,
|
|
|
|
// Accessibility theme being used?
|
|
|
|
eIntID_UseAccessibilityTheme,
|
|
|
|
|
|
|
|
// position of scroll arrows in a scrollbar
|
|
|
|
eIntID_ScrollArrowStyle,
|
|
|
|
// is scroll thumb proportional or fixed?
|
|
|
|
eIntID_ScrollSliderStyle,
|
|
|
|
|
|
|
|
// each button can take one of four values:
|
|
|
|
eIntID_ScrollButtonLeftMouseButtonAction,
|
|
|
|
// 0 - scrolls one line, 1 - scrolls one page
|
|
|
|
eIntID_ScrollButtonMiddleMouseButtonAction,
|
|
|
|
// 2 - scrolls to end, 3 - button ignored
|
|
|
|
eIntID_ScrollButtonRightMouseButtonAction,
|
|
|
|
|
|
|
|
// delay for opening spring loaded folders
|
|
|
|
eIntID_TreeOpenDelay,
|
|
|
|
// delay for closing spring loaded folders
|
|
|
|
eIntID_TreeCloseDelay,
|
|
|
|
// delay for triggering the tree scrolling
|
|
|
|
eIntID_TreeLazyScrollDelay,
|
|
|
|
// delay for scrolling the tree
|
|
|
|
eIntID_TreeScrollDelay,
|
|
|
|
// the maximum number of lines to be scrolled at ones
|
|
|
|
eIntID_TreeScrollLinesMax,
|
|
|
|
// What type of tab-order to use
|
|
|
|
eIntID_TabFocusModel,
|
|
|
|
// Should menu items blink when they're chosen?
|
|
|
|
eIntID_ChosenMenuItemsShouldBlink,
|
|
|
|
|
2017-06-08 16:49:21 +03:00
|
|
|
/*
|
|
|
|
* A Boolean value to determine whether the Windows accent color
|
|
|
|
* should be applied to the title bar.
|
|
|
|
*
|
|
|
|
* The value of this metric is not used on other platforms. These platforms
|
|
|
|
* should return NS_ERROR_NOT_IMPLEMENTED when queried for this metric.
|
|
|
|
*/
|
2017-07-19 17:38:49 +03:00
|
|
|
eIntID_WindowsAccentColorInTitlebar,
|
2017-06-08 16:49:21 +03:00
|
|
|
|
2011-09-09 06:27:11 +04:00
|
|
|
/*
|
|
|
|
* A Boolean value to determine whether the Windows default theme is
|
|
|
|
* being used.
|
|
|
|
*
|
|
|
|
* The value of this metric is not used on other platforms. These platforms
|
|
|
|
* should return NS_ERROR_NOT_IMPLEMENTED when queried for this metric.
|
|
|
|
*/
|
|
|
|
eIntID_WindowsDefaultTheme,
|
|
|
|
|
|
|
|
/*
|
|
|
|
* A Boolean value to determine whether the DWM compositor is being used
|
|
|
|
*
|
|
|
|
* This metric is not used on non-Windows platforms. These platforms
|
|
|
|
* should return NS_ERROR_NOT_IMPLEMENTED when queried for this metric.
|
|
|
|
*/
|
|
|
|
eIntID_DWMCompositor,
|
|
|
|
|
|
|
|
/*
|
|
|
|
* A Boolean value to determine whether Windows is themed (Classic vs.
|
|
|
|
* uxtheme)
|
|
|
|
*
|
|
|
|
* This is Windows-specific and is not implemented on other platforms
|
|
|
|
* (will return the default of NS_ERROR_FAILURE).
|
|
|
|
*/
|
|
|
|
eIntID_WindowsClassic,
|
|
|
|
|
2013-01-17 07:27:16 +04:00
|
|
|
/*
|
|
|
|
* A Boolean value to determine whether the current Windows desktop theme
|
|
|
|
* supports Aero Glass.
|
|
|
|
*
|
|
|
|
* This is Windows-specific and is not implemented on other platforms
|
|
|
|
* (will return the default of NS_ERROR_FAILURE).
|
|
|
|
*/
|
|
|
|
eIntID_WindowsGlass,
|
|
|
|
|
2011-09-09 06:27:11 +04:00
|
|
|
/*
|
|
|
|
* A Boolean value to determine whether the device is a touch enabled
|
|
|
|
* device. Currently this is only supported by the Windows 7 Touch API.
|
|
|
|
*
|
|
|
|
* Platforms that do not support this metric should return
|
|
|
|
* NS_ERROR_NOT_IMPLEMENTED when queried for this metric.
|
|
|
|
*/
|
|
|
|
eIntID_TouchEnabled,
|
|
|
|
|
|
|
|
/*
|
|
|
|
* A Boolean value to determine whether the Mac graphite theme is
|
|
|
|
* being used.
|
|
|
|
*
|
|
|
|
* The value of this metric is not used on other platforms. These platforms
|
|
|
|
* should return NS_ERROR_NOT_IMPLEMENTED when queried for this metric.
|
|
|
|
*/
|
|
|
|
eIntID_MacGraphiteTheme,
|
|
|
|
|
2014-06-06 02:02:46 +04:00
|
|
|
/*
|
|
|
|
* A Boolean value to determine whether the Mac OS X Yosemite-specific
|
|
|
|
* theming should be used.
|
|
|
|
*
|
|
|
|
* The value of this metric is not used on non-Mac platforms. These
|
|
|
|
* platforms should return NS_ERROR_NOT_IMPLEMENTED when queried for this
|
|
|
|
* metric.
|
|
|
|
*/
|
|
|
|
eIntID_MacYosemiteTheme,
|
|
|
|
|
2011-09-09 06:27:11 +04:00
|
|
|
/*
|
|
|
|
* eIntID_AlertNotificationOrigin indicates from which corner of the
|
|
|
|
* screen alerts slide in, and from which direction (horizontal/vertical).
|
|
|
|
* 0, the default, represents bottom right, sliding vertically.
|
|
|
|
* Use any bitwise combination of the following constants:
|
|
|
|
* NS_ALERT_HORIZONTAL (1), NS_ALERT_LEFT (2), NS_ALERT_TOP (4).
|
|
|
|
*
|
|
|
|
* 6 4
|
|
|
|
* +-----------+
|
|
|
|
* 7| |5
|
|
|
|
* | |
|
|
|
|
* 3| |1
|
|
|
|
* +-----------+
|
|
|
|
* 2 0
|
|
|
|
*/
|
|
|
|
eIntID_AlertNotificationOrigin,
|
|
|
|
|
|
|
|
/**
|
|
|
|
* If true, clicking on a scrollbar (not as in dragging the thumb) defaults
|
|
|
|
* to scrolling the view corresponding to the clicked point. Otherwise, we
|
|
|
|
* only do so if the scrollbar is clicked using the middle mouse button or
|
|
|
|
* if shift is pressed when the scrollbar is clicked.
|
|
|
|
*/
|
|
|
|
eIntID_ScrollToClick,
|
|
|
|
|
|
|
|
/**
|
|
|
|
* IME and spell checker underline styles, the values should be
|
|
|
|
* NS_DECORATION_LINE_STYLE_*. They are defined below.
|
|
|
|
*/
|
|
|
|
eIntID_IMERawInputUnderlineStyle,
|
|
|
|
eIntID_IMESelectedRawTextUnderlineStyle,
|
|
|
|
eIntID_IMEConvertedTextUnderlineStyle,
|
|
|
|
eIntID_IMESelectedConvertedTextUnderline,
|
|
|
|
eIntID_SpellCheckerUnderlineStyle,
|
|
|
|
|
|
|
|
/**
|
|
|
|
* If this metric != 0, support window dragging on the menubar.
|
|
|
|
*/
|
|
|
|
eIntID_MenuBarDrag,
|
|
|
|
/**
|
|
|
|
* Return the appropriate WindowsThemeIdentifier for the current theme.
|
|
|
|
*/
|
2011-11-18 03:41:35 +04:00
|
|
|
eIntID_WindowsThemeIdentifier,
|
2013-07-01 20:02:29 +04:00
|
|
|
/**
|
|
|
|
* Return an appropriate os version identifier.
|
|
|
|
*/
|
|
|
|
eIntID_OperatingSystemVersionIdentifier,
|
2011-11-18 03:41:35 +04:00
|
|
|
/**
|
|
|
|
* 0: scrollbar button repeats to scroll only when cursor is on the button.
|
|
|
|
* 1: scrollbar button repeats to scroll even if cursor is outside of it.
|
|
|
|
*/
|
2011-12-16 13:18:48 +04:00
|
|
|
eIntID_ScrollbarButtonAutoRepeatBehavior,
|
|
|
|
/**
|
2013-07-02 14:02:21 +04:00
|
|
|
* Delay before showing a tooltip.
|
2011-12-16 13:18:48 +04:00
|
|
|
*/
|
2013-04-09 23:44:01 +04:00
|
|
|
eIntID_TooltipDelay,
|
|
|
|
/*
|
|
|
|
* A Boolean value to determine whether Mac OS X Lion style swipe animations
|
|
|
|
* should be used.
|
|
|
|
*/
|
2013-06-06 06:42:02 +04:00
|
|
|
eIntID_SwipeAnimationEnabled,
|
|
|
|
|
2013-07-02 14:02:21 +04:00
|
|
|
/*
|
|
|
|
* Controls whether overlay scrollbars display when the user moves
|
|
|
|
* the mouse in a scrollable frame.
|
|
|
|
*/
|
|
|
|
eIntID_ScrollbarDisplayOnMouseMove,
|
2018-11-30 13:46:48 +03:00
|
|
|
|
2013-07-02 14:02:21 +04:00
|
|
|
/*
|
|
|
|
* Overlay scrollbar animation constants.
|
|
|
|
*/
|
|
|
|
eIntID_ScrollbarFadeBeginDelay,
|
2015-08-04 23:41:00 +03:00
|
|
|
eIntID_ScrollbarFadeDuration,
|
2018-11-30 13:46:48 +03:00
|
|
|
|
2015-08-04 23:41:00 +03:00
|
|
|
/**
|
|
|
|
* Distance in pixels to offset the context menu from the cursor
|
|
|
|
* on open.
|
|
|
|
*/
|
|
|
|
eIntID_ContextMenuOffsetVertical,
|
2017-10-17 22:12:21 +03:00
|
|
|
eIntID_ContextMenuOffsetHorizontal,
|
2018-11-30 13:46:48 +03:00
|
|
|
|
2017-10-17 22:12:21 +03:00
|
|
|
/*
|
|
|
|
* A boolean value indicating whether client-side decorations are
|
|
|
|
* supported by the user's GTK version.
|
|
|
|
*/
|
|
|
|
eIntID_GTKCSDAvailable,
|
2018-11-30 13:46:48 +03:00
|
|
|
|
2019-01-17 15:44:49 +03:00
|
|
|
/*
|
|
|
|
* A boolean value indicating whether GTK+ system titlebar should be
|
|
|
|
* disabled by default.
|
|
|
|
*/
|
|
|
|
eIntID_GTKCSDHideTitlebarByDefault,
|
|
|
|
|
2018-09-25 14:53:04 +03:00
|
|
|
/*
|
|
|
|
* A boolean value indicating whether client-side decorations should
|
|
|
|
* have transparent background.
|
|
|
|
*/
|
|
|
|
eIntID_GTKCSDTransparentBackground,
|
2018-11-30 13:46:48 +03:00
|
|
|
|
2017-10-17 22:12:21 +03:00
|
|
|
/*
|
|
|
|
* A boolean value indicating whether client-side decorations should
|
|
|
|
* contain a minimize button.
|
|
|
|
*/
|
|
|
|
eIntID_GTKCSDMinimizeButton,
|
2018-11-30 13:46:48 +03:00
|
|
|
|
2017-10-17 22:12:21 +03:00
|
|
|
/*
|
|
|
|
* A boolean value indicating whether client-side decorations should
|
|
|
|
* contain a maximize button.
|
|
|
|
*/
|
|
|
|
eIntID_GTKCSDMaximizeButton,
|
2018-11-30 13:46:48 +03:00
|
|
|
|
2017-10-17 22:12:21 +03:00
|
|
|
/*
|
|
|
|
* A boolean value indicating whether client-side decorations should
|
|
|
|
* contain a close button.
|
|
|
|
*/
|
2018-06-27 20:59:21 +03:00
|
|
|
eIntID_GTKCSDCloseButton,
|
2018-11-30 13:46:48 +03:00
|
|
|
|
2019-01-18 16:52:29 +03:00
|
|
|
/*
|
|
|
|
* A boolean value indicating whether titlebar buttons are located
|
|
|
|
* in left titlebar corner.
|
|
|
|
*/
|
|
|
|
eIntID_GTKCSDReversedPlacement,
|
|
|
|
|
2018-06-27 20:59:21 +03:00
|
|
|
/*
|
|
|
|
* A boolean value indicating whether or not the OS is using a dark theme,
|
|
|
|
* which we may want to switch to as well if not overridden by the user.
|
|
|
|
*/
|
2018-07-24 10:50:47 +03:00
|
|
|
eIntID_SystemUsesDarkTheme,
|
2018-11-30 13:46:48 +03:00
|
|
|
|
2018-07-24 10:50:47 +03:00
|
|
|
/**
|
|
|
|
* Corresponding to prefers-reduced-motion.
|
|
|
|
* https://drafts.csswg.org/mediaqueries-5/#prefers-reduced-motion
|
|
|
|
* 0: no-preference
|
|
|
|
* 1: reduce
|
|
|
|
*/
|
2018-11-30 13:46:48 +03:00
|
|
|
|
2018-07-24 10:50:47 +03:00
|
|
|
eIntID_PrefersReducedMotion,
|
2018-08-14 11:13:04 +03:00
|
|
|
/**
|
|
|
|
* Corresponding to PointerCapabilities in ServoTypes.h
|
|
|
|
* 0: None
|
|
|
|
* 1: Coarse
|
|
|
|
* 2: Fine
|
|
|
|
* 4: Hover
|
|
|
|
*/
|
|
|
|
eIntID_PrimaryPointerCapabilities,
|
|
|
|
/**
|
|
|
|
* Corresponding to union of PointerCapabilities values in ServoTypes.h
|
|
|
|
* E.g. if there is a mouse and a digitizer, the value will be
|
|
|
|
* 'Coarse | Fine | Hover'.
|
|
|
|
*/
|
|
|
|
eIntID_AllPointerCapabilities,
|
2013-07-02 04:28:44 +04:00
|
|
|
};
|
2011-09-09 06:27:11 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Windows themes we currently detect.
|
|
|
|
*/
|
|
|
|
enum WindowsTheme {
|
|
|
|
eWindowsTheme_Generic = 0, // unrecognized theme
|
|
|
|
eWindowsTheme_Classic,
|
|
|
|
eWindowsTheme_Aero,
|
|
|
|
eWindowsTheme_LunaBlue,
|
|
|
|
eWindowsTheme_LunaOlive,
|
|
|
|
eWindowsTheme_LunaSilver,
|
|
|
|
eWindowsTheme_Royale,
|
2013-06-14 02:41:26 +04:00
|
|
|
eWindowsTheme_Zune,
|
|
|
|
eWindowsTheme_AeroLite
|
2011-09-09 06:27:11 +04:00
|
|
|
};
|
|
|
|
|
2013-07-01 20:02:29 +04:00
|
|
|
/**
|
|
|
|
* Operating system versions.
|
|
|
|
*/
|
|
|
|
enum OperatingSystemVersion {
|
2017-01-29 10:42:46 +03:00
|
|
|
eOperatingSystemVersion_Windows7 = 2,
|
2013-07-01 20:02:29 +04:00
|
|
|
eOperatingSystemVersion_Windows8,
|
2015-05-21 13:16:00 +03:00
|
|
|
eOperatingSystemVersion_Windows10,
|
2013-07-01 20:02:29 +04:00
|
|
|
eOperatingSystemVersion_Unknown
|
|
|
|
};
|
|
|
|
|
2011-09-09 06:27:11 +04:00
|
|
|
enum {
|
|
|
|
eScrollArrow_None = 0,
|
|
|
|
eScrollArrow_StartBackward = 0x1000,
|
|
|
|
eScrollArrow_StartForward = 0x0100,
|
|
|
|
eScrollArrow_EndBackward = 0x0010,
|
|
|
|
eScrollArrow_EndForward = 0x0001
|
|
|
|
};
|
|
|
|
|
|
|
|
enum {
|
|
|
|
// single arrow at each end
|
|
|
|
eScrollArrowStyle_Single =
|
2015-05-21 13:16:00 +03:00
|
|
|
eScrollArrow_StartBackward | eScrollArrow_EndForward,
|
2011-09-09 06:27:11 +04:00
|
|
|
// both arrows at bottom/right, none at top/left
|
|
|
|
eScrollArrowStyle_BothAtBottom =
|
|
|
|
eScrollArrow_EndBackward | eScrollArrow_EndForward,
|
|
|
|
// both arrows at both ends
|
|
|
|
eScrollArrowStyle_BothAtEachEnd =
|
|
|
|
eScrollArrow_EndBackward | eScrollArrow_EndForward |
|
|
|
|
eScrollArrow_StartBackward | eScrollArrow_StartForward,
|
|
|
|
// both arrows at top/left, none at bottom/right
|
|
|
|
eScrollArrowStyle_BothAtTop =
|
|
|
|
eScrollArrow_StartBackward | eScrollArrow_StartForward
|
|
|
|
};
|
|
|
|
|
|
|
|
enum { eScrollThumbStyle_Normal, eScrollThumbStyle_Proportional };
|
|
|
|
|
|
|
|
// When modifying this list, also modify nsXPLookAndFeel::sFloatPrefs
|
2012-01-04 07:09:29 +04:00
|
|
|
// in widget/xpwidgts/nsXPLookAndFeel.cpp.
|
2011-09-09 06:27:11 +04:00
|
|
|
enum FloatID {
|
|
|
|
eFloatID_IMEUnderlineRelativeSize,
|
|
|
|
eFloatID_SpellCheckerUnderlineRelativeSize,
|
|
|
|
|
|
|
|
// The width/height ratio of the cursor. If used, the CaretWidth int metric
|
|
|
|
// should be added to the calculated caret width.
|
|
|
|
eFloatID_CaretAspectRatio
|
|
|
|
};
|
|
|
|
|
2012-02-21 03:19:48 +04:00
|
|
|
// These constants must be kept in 1:1 correspondence with the
|
|
|
|
// NS_STYLE_FONT_* system font constants.
|
|
|
|
enum FontID {
|
|
|
|
eFont_Caption = 1, // css2
|
2017-06-09 18:59:12 +03:00
|
|
|
FontID_MINIMUM = eFont_Caption,
|
2012-02-21 03:19:48 +04:00
|
|
|
eFont_Icon,
|
|
|
|
eFont_Menu,
|
|
|
|
eFont_MessageBox,
|
|
|
|
eFont_SmallCaption,
|
|
|
|
eFont_StatusBar,
|
|
|
|
|
|
|
|
eFont_Window, // css3
|
|
|
|
eFont_Document,
|
|
|
|
eFont_Workspace,
|
|
|
|
eFont_Desktop,
|
|
|
|
eFont_Info,
|
|
|
|
eFont_Dialog,
|
|
|
|
eFont_Button,
|
|
|
|
eFont_PullDownMenu,
|
|
|
|
eFont_List,
|
|
|
|
eFont_Field,
|
|
|
|
|
|
|
|
eFont_Tooltips, // moz
|
2017-06-09 18:59:12 +03:00
|
|
|
eFont_Widget,
|
|
|
|
FontID_MAXIMUM = eFont_Widget
|
2012-02-21 03:19:48 +04:00
|
|
|
};
|
|
|
|
|
2011-09-09 06:27:11 +04:00
|
|
|
/**
|
|
|
|
* GetColor() return a native color value (might be overwritten by prefs) for
|
|
|
|
* aID. Some platforms don't return an error even if the index doesn't
|
|
|
|
* match any system colors. And also some platforms may initialize the
|
|
|
|
* return value even when it returns an error. Therefore, if you want to
|
|
|
|
* use a color for the default value, you should use the other GetColor()
|
|
|
|
* which returns nscolor directly.
|
|
|
|
*
|
|
|
|
* NOTE:
|
2019-05-26 16:10:00 +03:00
|
|
|
* ColorID::TextSelectForeground might return NS_DONT_CHANGE_COLOR.
|
|
|
|
* ColorID::IME* might return NS_TRANSPARENT, NS_SAME_AS_FOREGROUND_COLOR or
|
2011-09-09 06:27:11 +04:00
|
|
|
* NS_40PERCENT_FOREGROUND_COLOR.
|
|
|
|
* These values have particular meaning. Then, they are not an actual
|
|
|
|
* color value.
|
|
|
|
*/
|
|
|
|
static nsresult GetColor(ColorID aID, nscolor* aResult);
|
|
|
|
|
2015-09-25 01:59:00 +03:00
|
|
|
/**
|
|
|
|
* This variant of GetColor() takes an extra Boolean parameter that allows
|
|
|
|
* the caller to ask that hard-coded color values be substituted for
|
|
|
|
* native colors (used when it is desireable to hide system colors to
|
|
|
|
* avoid system fingerprinting).
|
|
|
|
*/
|
|
|
|
static nsresult GetColor(ColorID aID, bool aUseStandinsForNativeColors,
|
|
|
|
nscolor* aResult);
|
|
|
|
|
2011-09-09 06:27:11 +04:00
|
|
|
/**
|
|
|
|
* GetInt() and GetFloat() return a int or float value for aID. The result
|
|
|
|
* might be distance, time, some flags or a int value which has particular
|
|
|
|
* meaning. See each document at definition of each ID for the detail.
|
|
|
|
* The result is always 0 when they return error. Therefore, if you want to
|
|
|
|
* use a value for the default value, you should use the other method which
|
|
|
|
* returns int or float directly.
|
|
|
|
*/
|
2012-08-22 19:56:38 +04:00
|
|
|
static nsresult GetInt(IntID aID, int32_t* aResult);
|
2011-09-09 06:27:11 +04:00
|
|
|
static nsresult GetFloat(FloatID aID, float* aResult);
|
|
|
|
|
|
|
|
static nscolor GetColor(ColorID aID, nscolor aDefault = NS_RGB(0, 0, 0)) {
|
2011-10-20 18:46:45 +04:00
|
|
|
nscolor result = NS_RGB(0, 0, 0);
|
2011-09-09 06:27:11 +04:00
|
|
|
if (NS_FAILED(GetColor(aID, &result))) {
|
|
|
|
return aDefault;
|
|
|
|
}
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
2017-06-12 08:57:17 +03:00
|
|
|
static nscolor GetColorUsingStandins(ColorID aID,
|
|
|
|
nscolor aDefault = NS_RGB(0, 0, 0)) {
|
|
|
|
nscolor result = NS_RGB(0, 0, 0);
|
|
|
|
if (NS_FAILED(GetColor(aID,
|
|
|
|
true, // aUseStandinsForNativeColors
|
|
|
|
&result))) {
|
|
|
|
return aDefault;
|
|
|
|
}
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
static int32_t GetInt(IntID aID, int32_t aDefault = 0) {
|
|
|
|
int32_t result;
|
2011-09-09 06:27:11 +04:00
|
|
|
if (NS_FAILED(GetInt(aID, &result))) {
|
|
|
|
return aDefault;
|
|
|
|
}
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
|
|
|
static float GetFloat(FloatID aID, float aDefault = 0.0f) {
|
|
|
|
float result;
|
|
|
|
if (NS_FAILED(GetFloat(aID, &result))) {
|
|
|
|
return aDefault;
|
|
|
|
}
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
2012-02-21 03:19:48 +04:00
|
|
|
/**
|
|
|
|
* Retrieve the name and style of a system-theme font. Returns true
|
|
|
|
* if the system theme specifies this font, false if a default should
|
|
|
|
* be used. In the latter case neither aName nor aStyle is modified.
|
|
|
|
*
|
2019-02-08 16:22:11 +03:00
|
|
|
* Size of the font should be in CSS pixels, not device pixels.
|
|
|
|
*
|
2012-02-21 03:19:48 +04:00
|
|
|
* @param aID Which system-theme font is wanted.
|
|
|
|
* @param aName The name of the font to use.
|
|
|
|
* @param aStyle Styling to apply to the font.
|
|
|
|
*/
|
2019-02-08 16:22:11 +03:00
|
|
|
static bool GetFont(FontID aID, nsString& aName, gfxFontStyle& aStyle);
|
2012-02-21 03:19:48 +04:00
|
|
|
|
2011-09-09 06:27:11 +04:00
|
|
|
/**
|
|
|
|
* GetPasswordCharacter() returns a unicode character which should be used
|
|
|
|
* for a masked character in password editor. E.g., '*'.
|
|
|
|
*/
|
2014-01-04 19:02:17 +04:00
|
|
|
static char16_t GetPasswordCharacter();
|
2011-09-09 06:27:11 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* If the latest character in password field shouldn't be hidden by the
|
|
|
|
* result of GetPasswordCharacter(), GetEchoPassword() returns TRUE.
|
|
|
|
* Otherwise, FALSE.
|
|
|
|
*/
|
2011-09-29 10:19:26 +04:00
|
|
|
static bool GetEchoPassword();
|
2011-09-09 06:27:11 +04:00
|
|
|
|
2012-07-13 06:26:20 +04:00
|
|
|
/**
|
|
|
|
* The millisecond to mask password value.
|
|
|
|
* This value is only valid when GetEchoPassword() returns true.
|
|
|
|
*/
|
2012-08-22 19:56:38 +04:00
|
|
|
static uint32_t GetPasswordMaskDelay();
|
2012-07-13 06:26:20 +04:00
|
|
|
|
2011-09-09 06:27:11 +04:00
|
|
|
/**
|
|
|
|
* When system look and feel is changed, Refresh() must be called. Then,
|
|
|
|
* cached data would be released.
|
|
|
|
*/
|
|
|
|
static void Refresh();
|
2015-04-22 17:58:15 +03:00
|
|
|
|
2017-08-03 23:16:31 +03:00
|
|
|
/**
|
|
|
|
* GTK's initialization code can't be run off main thread, call this
|
|
|
|
* if you plan on using LookAndFeel off main thread later.
|
|
|
|
*
|
|
|
|
* This initialized state may get reset due to theme changes, so it
|
|
|
|
* must be called prior to each potential off-main-thread LookAndFeel
|
|
|
|
* call, not just once.
|
|
|
|
*/
|
|
|
|
static void NativeInit();
|
|
|
|
|
2015-04-22 17:58:15 +03:00
|
|
|
/**
|
|
|
|
* If the implementation is caching values, these accessors allow the
|
|
|
|
* cache to be exported and imported.
|
|
|
|
*/
|
|
|
|
static nsTArray<LookAndFeelInt> GetIntCache();
|
|
|
|
static void SetIntCache(const nsTArray<LookAndFeelInt>& aLookAndFeelIntCache);
|
2018-09-15 04:00:07 +03:00
|
|
|
/**
|
|
|
|
* Set a flag indicating whether the cache should be cleared in RefreshImpl()
|
|
|
|
* or not.
|
|
|
|
*/
|
|
|
|
static void SetShouldRetainCacheForTest(bool aValue);
|
2020-01-14 08:50:53 +03:00
|
|
|
|
|
|
|
static void SetPrefersReducedMotionOverrideForTest(bool aValue);
|
|
|
|
|
|
|
|
static void ResetPrefersReducedMotionOverrideForTest();
|
2011-09-09 06:27:11 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace mozilla
|
2005-11-11 17:36:26 +03:00
|
|
|
|
2019-05-26 16:10:00 +03:00
|
|
|
// On the Mac, GetColor(ColorID::TextSelectForeground, color) returns this
|
2011-09-09 06:27:11 +04:00
|
|
|
// constant to specify that the foreground color should not be changed
|
|
|
|
// (ie. a colored text keeps its colors when selected).
|
|
|
|
// Of course if other plaforms work like the Mac, they can use it too.
|
2000-04-04 13:07:41 +04:00
|
|
|
#define NS_DONT_CHANGE_COLOR NS_RGB(0x01, 0x01, 0x01)
|
|
|
|
|
2014-07-28 04:13:00 +04:00
|
|
|
// Similar with NS_DONT_CHANGE_COLOR, except NS_DONT_CHANGE_COLOR would returns
|
|
|
|
// complementary color if fg color is same as bg color.
|
|
|
|
// NS_CHANGE_COLOR_IF_SAME_AS_BG would returns
|
2019-05-26 16:10:00 +03:00
|
|
|
// ColorID::TextSelectForegroundCustom if fg and bg color are the same.
|
2014-07-28 04:13:00 +04:00
|
|
|
#define NS_CHANGE_COLOR_IF_SAME_AS_BG NS_RGB(0x02, 0x02, 0x02)
|
|
|
|
|
2011-09-09 06:27:11 +04:00
|
|
|
// ---------------------------------------------------------------------
|
2019-05-26 16:10:00 +03:00
|
|
|
// Special colors for ColorID::IME* and ColorID::SpellCheckerUnderline
|
2011-09-09 06:27:11 +04:00
|
|
|
// ---------------------------------------------------------------------
|
2005-09-17 15:34:27 +04:00
|
|
|
|
|
|
|
// For background color only.
|
|
|
|
#define NS_TRANSPARENT NS_RGBA(0x01, 0x00, 0x00, 0x00)
|
|
|
|
// For foreground color only.
|
|
|
|
#define NS_SAME_AS_FOREGROUND_COLOR NS_RGBA(0x02, 0x00, 0x00, 0x00)
|
|
|
|
#define NS_40PERCENT_FOREGROUND_COLOR NS_RGBA(0x03, 0x00, 0x00, 0x00)
|
|
|
|
|
2009-04-03 11:26:28 +04:00
|
|
|
#define NS_IS_SELECTION_SPECIAL_COLOR(c) \
|
|
|
|
((c) == NS_TRANSPARENT || (c) == NS_SAME_AS_FOREGROUND_COLOR || \
|
|
|
|
(c) == NS_40PERCENT_FOREGROUND_COLOR)
|
2000-04-04 13:07:41 +04:00
|
|
|
|
2006-07-19 23:47:19 +04:00
|
|
|
// ------------------------------------------
|
2011-09-09 06:27:11 +04:00
|
|
|
// Bits for eIntID_AlertNotificationOrigin
|
2006-07-19 23:47:19 +04:00
|
|
|
// ------------------------------------------
|
|
|
|
|
|
|
|
#define NS_ALERT_HORIZONTAL 1
|
|
|
|
#define NS_ALERT_LEFT 2
|
|
|
|
#define NS_ALERT_TOP 4
|
|
|
|
|
2011-09-09 06:27:12 +04:00
|
|
|
#endif /* __LookAndFeel */
|