2001-09-28 20:14:13 +00:00
|
|
|
/* -*- mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* ***** BEGIN LICENSE BLOCK *****
|
2004-04-18 22:01:16 +00:00
|
|
|
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
2000-03-30 22:32:18 +00:00
|
|
|
*
|
2004-04-18 22:01:16 +00:00
|
|
|
* The contents of this file are subject to the Mozilla Public License Version
|
|
|
|
* 1.1 (the "License"); you may not use this file except in compliance with
|
|
|
|
* the License. You may obtain a copy of the License at
|
|
|
|
* http://www.mozilla.org/MPL/
|
2000-03-30 22:32:18 +00:00
|
|
|
*
|
2001-09-28 20:14:13 +00:00
|
|
|
* Software distributed under the License is distributed on an "AS IS" basis,
|
|
|
|
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
|
|
|
* for the specific language governing rights and limitations under the
|
|
|
|
* License.
|
2000-03-30 22:32:18 +00:00
|
|
|
*
|
2000-04-12 00:59:40 +00:00
|
|
|
* The Original Code is mozilla.org code.
|
2000-03-30 22:32:18 +00:00
|
|
|
*
|
2004-04-18 22:01:16 +00:00
|
|
|
* The Initial Developer of the Original Code is
|
2001-09-28 20:14:13 +00:00
|
|
|
* Netscape Communications Corporation.
|
|
|
|
* Portions created by the Initial Developer are Copyright (C) 1998
|
|
|
|
* the Initial Developer. All Rights Reserved.
|
2000-03-30 22:32:18 +00:00
|
|
|
*
|
2001-09-28 20:14:13 +00:00
|
|
|
* Contributor(s):
|
|
|
|
*
|
|
|
|
* Alternatively, the contents of this file may be used under the terms of
|
2004-04-18 22:01:16 +00:00
|
|
|
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
2001-09-28 20:14:13 +00:00
|
|
|
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
|
|
|
* in which case the provisions of the GPL or the LGPL are applicable instead
|
|
|
|
* of those above. If you wish to allow use of your version of this file only
|
|
|
|
* under the terms of either the GPL or the LGPL, and not to allow others to
|
2004-04-18 22:01:16 +00:00
|
|
|
* use your version of this file under the terms of the MPL, indicate your
|
2001-09-28 20:14:13 +00:00
|
|
|
* decision by deleting the provisions above and replace them with the notice
|
|
|
|
* and other provisions required by the GPL or the LGPL. If you do not delete
|
|
|
|
* the provisions above, a recipient may use your version of this file under
|
2004-04-18 22:01:16 +00:00
|
|
|
* the terms of any one of the MPL, the GPL or the LGPL.
|
2001-09-28 20:14:13 +00:00
|
|
|
*
|
|
|
|
* ***** END LICENSE BLOCK ***** */
|
2000-03-30 22:32:18 +00:00
|
|
|
|
2001-11-06 08:23:51 +00:00
|
|
|
#include "nscore.h"
|
|
|
|
|
2000-03-30 22:32:18 +00:00
|
|
|
#include "nsXPLookAndFeel.h"
|
|
|
|
#include "nsIServiceManager.h"
|
2005-09-12 12:36:11 +00:00
|
|
|
#include "nsIPrefBranch2.h"
|
|
|
|
#include "nsIPrefBranch.h"
|
|
|
|
#include "nsIPrefService.h"
|
|
|
|
#include "nsIObserver.h"
|
2002-05-15 18:55:21 +00:00
|
|
|
#include "nsCRT.h"
|
2004-10-25 19:34:45 +00:00
|
|
|
#include "nsFont.h"
|
2001-11-06 02:41:04 +00:00
|
|
|
|
2007-08-30 16:21:16 +00:00
|
|
|
#include "gfxPlatform.h"
|
2009-04-07 16:02:11 +00:00
|
|
|
#include "qcms.h"
|
2007-08-30 16:21:16 +00:00
|
|
|
|
2002-01-24 01:18:36 +00:00
|
|
|
#ifdef DEBUG
|
2001-11-06 02:41:04 +00:00
|
|
|
#include "nsSize.h"
|
|
|
|
#endif
|
2009-02-10 19:25:00 +00:00
|
|
|
|
2005-09-12 12:36:11 +00:00
|
|
|
NS_IMPL_ISUPPORTS2(nsXPLookAndFeel, nsILookAndFeel, nsIObserver)
|
2000-03-30 22:32:18 +00:00
|
|
|
|
|
|
|
nsLookAndFeelIntPref nsXPLookAndFeel::sIntPrefs[] =
|
|
|
|
{
|
2000-04-12 00:59:40 +00:00
|
|
|
{ "ui.windowTitleHeight", eMetric_WindowTitleHeight, PR_FALSE, nsLookAndFeelTypeInt, 0 },
|
|
|
|
{ "ui.windowBorderWidth", eMetric_WindowBorderWidth, PR_FALSE, nsLookAndFeelTypeInt, 0 },
|
|
|
|
{ "ui.windowBorderHeight", eMetric_WindowBorderHeight, PR_FALSE, nsLookAndFeelTypeInt, 0 },
|
|
|
|
{ "ui.widget3DBorder", eMetric_Widget3DBorder, PR_FALSE, nsLookAndFeelTypeInt, 0 },
|
|
|
|
{ "ui.textFieldBorder", eMetric_TextFieldBorder, PR_FALSE, nsLookAndFeelTypeInt, 0 },
|
|
|
|
{ "ui.textFieldHeight", eMetric_TextFieldHeight, PR_FALSE, nsLookAndFeelTypeInt, 0 },
|
2000-03-30 22:32:18 +00:00
|
|
|
{ "ui.buttonHorizontalInsidePaddingNavQuirks",
|
2000-04-12 00:59:40 +00:00
|
|
|
eMetric_ButtonHorizontalInsidePaddingNavQuirks, PR_FALSE, nsLookAndFeelTypeInt, 0 },
|
2000-03-30 22:32:18 +00:00
|
|
|
{ "ui.buttonHorizontalInsidePaddingOffsetNavQuirks",
|
2000-04-12 00:59:40 +00:00
|
|
|
eMetric_ButtonHorizontalInsidePaddingOffsetNavQuirks, PR_FALSE, nsLookAndFeelTypeInt, 0 },
|
|
|
|
{ "ui.checkboxSize", eMetric_CheckboxSize, PR_FALSE, nsLookAndFeelTypeInt, 0 },
|
|
|
|
{ "ui.radioboxSize", eMetric_RadioboxSize, PR_FALSE, nsLookAndFeelTypeInt, 0 },
|
2000-03-30 22:32:18 +00:00
|
|
|
{ "ui.textHorizontalInsideMinimumPadding",
|
2000-04-12 00:59:40 +00:00
|
|
|
eMetric_TextHorizontalInsideMinimumPadding, PR_FALSE, nsLookAndFeelTypeInt, 0 },
|
2000-03-30 22:32:18 +00:00
|
|
|
{ "ui.textVerticalInsidePadding", eMetric_TextVerticalInsidePadding,
|
2000-04-12 00:59:40 +00:00
|
|
|
PR_FALSE, nsLookAndFeelTypeInt, 0 },
|
2000-03-30 22:32:18 +00:00
|
|
|
{ "ui.textShouldUseVerticalInsidePadding",
|
2000-04-12 00:59:40 +00:00
|
|
|
eMetric_TextShouldUseVerticalInsidePadding, PR_FALSE, nsLookAndFeelTypeInt, 0 },
|
2000-03-30 22:32:18 +00:00
|
|
|
{ "ui.textShouldUseHorizontalInsideMinimumPadding",
|
2000-04-12 00:59:40 +00:00
|
|
|
eMetric_TextShouldUseHorizontalInsideMinimumPadding, PR_FALSE, nsLookAndFeelTypeInt, 0 },
|
2000-03-30 22:32:18 +00:00
|
|
|
{ "ui.listShouldUseHorizontalInsideMinimumPadding",
|
2000-04-12 00:59:40 +00:00
|
|
|
eMetric_ListShouldUseHorizontalInsideMinimumPadding, PR_FALSE, nsLookAndFeelTypeInt, 0 },
|
2000-03-30 22:32:18 +00:00
|
|
|
{ "ui.listHorizontalInsideMinimumPadding",
|
2000-04-12 00:59:40 +00:00
|
|
|
eMetric_ListHorizontalInsideMinimumPadding, PR_FALSE, nsLookAndFeelTypeInt, 0 },
|
2000-03-30 22:32:18 +00:00
|
|
|
{ "ui.listShouldUseVerticalInsidePadding",
|
2000-04-12 00:59:40 +00:00
|
|
|
eMetric_ListShouldUseVerticalInsidePadding, PR_FALSE, nsLookAndFeelTypeInt, 0 },
|
2000-03-30 22:32:18 +00:00
|
|
|
{ "ui.listVerticalInsidePadding", eMetric_ListVerticalInsidePadding,
|
2000-04-12 00:59:40 +00:00
|
|
|
PR_FALSE, nsLookAndFeelTypeInt, 0 },
|
|
|
|
{ "ui.caretBlinkTime", eMetric_CaretBlinkTime, PR_FALSE, nsLookAndFeelTypeInt, 0 },
|
2004-10-13 01:12:14 +00:00
|
|
|
{ "ui.caretWidth", eMetric_CaretWidth, PR_FALSE, nsLookAndFeelTypeInt, 0 },
|
2003-06-25 01:14:25 +00:00
|
|
|
{ "ui.caretVisibleWithSelection", eMetric_ShowCaretDuringSelection, PR_FALSE, nsLookAndFeelTypeInt, 0 },
|
2000-04-12 00:59:40 +00:00
|
|
|
{ "ui.submenuDelay", eMetric_SubmenuDelay, PR_FALSE, nsLookAndFeelTypeInt, 0 },
|
2000-11-16 22:25:45 +00:00
|
|
|
{ "ui.dragFullWindow", eMetric_DragFullWindow, PR_FALSE, nsLookAndFeelTypeInt, 0 },
|
2003-05-02 18:20:38 +00:00
|
|
|
{ "ui.dragThresholdX", eMetric_DragThresholdX, PR_FALSE, nsLookAndFeelTypeInt, 0 },
|
|
|
|
{ "ui.dragThresholdY", eMetric_DragThresholdY, PR_FALSE, nsLookAndFeelTypeInt, 0 },
|
2004-06-08 19:34:55 +00:00
|
|
|
{ "ui.useAccessibilityTheme", eMetric_UseAccessibilityTheme, PR_FALSE, nsLookAndFeelTypeInt, 0 },
|
2005-08-10 01:45:31 +00:00
|
|
|
{ "ui.isScreenReaderActive", eMetric_IsScreenReaderActive, PR_FALSE, nsLookAndFeelTypeInt, 0 },
|
2000-03-30 22:32:18 +00:00
|
|
|
{ "ui.menusCanOverlapOSBar", eMetric_MenusCanOverlapOSBar,
|
2000-04-12 00:59:40 +00:00
|
|
|
PR_FALSE, nsLookAndFeelTypeInt, 0 },
|
2006-03-17 03:55:10 +00:00
|
|
|
{ "ui.skipNavigatingDisabledMenuItem", eMetric_SkipNavigatingDisabledMenuItem, PR_FALSE, nsLookAndFeelTypeInt, 0 },
|
2003-03-16 23:26:31 +00:00
|
|
|
{ "ui.treeOpenDelay",
|
|
|
|
eMetric_TreeOpenDelay, PR_FALSE, nsLookAndFeelTypeInt, 0 },
|
|
|
|
{ "ui.treeCloseDelay",
|
|
|
|
eMetric_TreeCloseDelay, PR_FALSE, nsLookAndFeelTypeInt, 0 },
|
|
|
|
{ "ui.treeLazyScrollDelay",
|
|
|
|
eMetric_TreeLazyScrollDelay, PR_FALSE, nsLookAndFeelTypeInt, 0 },
|
|
|
|
{ "ui.treeScrollDelay",
|
|
|
|
eMetric_TreeScrollDelay, PR_FALSE, nsLookAndFeelTypeInt, 0 },
|
|
|
|
{ "ui.treeScrollLinesMax",
|
|
|
|
eMetric_TreeScrollLinesMax, PR_FALSE, nsLookAndFeelTypeInt, 0 },
|
2005-01-06 23:41:52 +00:00
|
|
|
{ "accessibility.tabfocus",
|
|
|
|
eMetric_TabFocusModel, PR_FALSE, nsLookAndFeelTypeInt, 0 },
|
2006-07-19 19:47:19 +00:00
|
|
|
{ "ui.alertNotificationOrigin",
|
|
|
|
eMetric_AlertNotificationOrigin, PR_FALSE, nsLookAndFeelTypeInt, 0 },
|
2007-04-12 00:36:40 +00:00
|
|
|
{ "ui.scrollToClick",
|
|
|
|
eMetric_ScrollToClick, PR_FALSE, nsLookAndFeelTypeInt, 0 },
|
2007-08-16 20:35:18 +00:00
|
|
|
{ "ui.IMERawInputUnderlineStyle",
|
|
|
|
eMetric_IMERawInputUnderlineStyle, PR_FALSE, nsLookAndFeelTypeInt, 0 },
|
|
|
|
{ "ui.IMESelectedRawTextUnderlineStyle",
|
|
|
|
eMetric_IMESelectedRawTextUnderlineStyle, PR_FALSE, nsLookAndFeelTypeInt, 0 },
|
|
|
|
{ "ui.IMEConvertedTextUnderlineStyle",
|
|
|
|
eMetric_IMEConvertedTextUnderlineStyle, PR_FALSE, nsLookAndFeelTypeInt, 0 },
|
|
|
|
{ "ui.IMESelectedConvertedTextUnderlineStyle",
|
|
|
|
eMetric_IMESelectedConvertedTextUnderline, PR_FALSE, nsLookAndFeelTypeInt, 0 },
|
2009-04-03 07:26:28 +00:00
|
|
|
{ "ui.SpellCheckerUnderlineStyle",
|
|
|
|
eMetric_SpellCheckerUnderlineStyle, PR_FALSE, nsLookAndFeelTypeInt, 0 },
|
2000-03-30 22:32:18 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
nsLookAndFeelFloatPref nsXPLookAndFeel::sFloatPrefs[] =
|
|
|
|
{
|
|
|
|
{ "ui.textFieldVerticalInsidePadding",
|
2000-04-12 00:59:40 +00:00
|
|
|
eMetricFloat_TextFieldVerticalInsidePadding, PR_FALSE, nsLookAndFeelTypeFloat, 0 },
|
2000-03-30 22:32:18 +00:00
|
|
|
{ "ui.textFieldHorizontalInsidePadding",
|
2000-04-12 00:59:40 +00:00
|
|
|
eMetricFloat_TextFieldHorizontalInsidePadding, PR_FALSE, nsLookAndFeelTypeFloat, 0 },
|
2000-03-30 22:32:18 +00:00
|
|
|
{ "ui.textAreaVerticalInsidePadding", eMetricFloat_TextAreaVerticalInsidePadding,
|
2000-04-12 00:59:40 +00:00
|
|
|
PR_FALSE, nsLookAndFeelTypeFloat, 0 },
|
2000-03-30 22:32:18 +00:00
|
|
|
{ "ui.textAreaHorizontalInsidePadding",
|
2000-04-12 00:59:40 +00:00
|
|
|
eMetricFloat_TextAreaHorizontalInsidePadding, PR_FALSE, nsLookAndFeelTypeFloat, 0 },
|
2000-03-30 22:32:18 +00:00
|
|
|
{ "ui.listVerticalInsidePadding",
|
2000-04-12 00:59:40 +00:00
|
|
|
eMetricFloat_ListVerticalInsidePadding, PR_FALSE, nsLookAndFeelTypeFloat, 0 },
|
2000-03-30 22:32:18 +00:00
|
|
|
{ "ui.listHorizontalInsidePadding",
|
2000-04-12 00:59:40 +00:00
|
|
|
eMetricFloat_ListHorizontalInsidePadding, PR_FALSE, nsLookAndFeelTypeFloat, 0 },
|
2000-03-30 22:32:18 +00:00
|
|
|
{ "ui.buttonVerticalInsidePadding", eMetricFloat_ButtonVerticalInsidePadding,
|
2000-04-12 00:59:40 +00:00
|
|
|
PR_FALSE, nsLookAndFeelTypeFloat, 0 },
|
2000-03-30 22:32:18 +00:00
|
|
|
{ "ui.buttonHorizontalInsidePadding", eMetricFloat_ButtonHorizontalInsidePadding,
|
2000-04-12 00:59:40 +00:00
|
|
|
PR_FALSE, nsLookAndFeelTypeFloat, 0 },
|
2005-09-17 11:34:27 +00:00
|
|
|
{ "ui.IMEUnderlineRelativeSize", eMetricFloat_IMEUnderlineRelativeSize,
|
|
|
|
PR_FALSE, nsLookAndFeelTypeFloat, 0 },
|
2009-04-03 07:26:28 +00:00
|
|
|
{ "ui.SpellCheckerUnderlineRelativeSize",
|
|
|
|
eMetricFloat_SpellCheckerUnderlineRelativeSize, PR_FALSE,
|
|
|
|
nsLookAndFeelTypeFloat, 0 },
|
2008-06-23 08:50:52 +00:00
|
|
|
{ "ui.caretAspectRatio", eMetricFloat_CaretAspectRatio, PR_FALSE,
|
|
|
|
nsLookAndFeelTypeFloat, 0 },
|
2000-04-11 22:34:55 +00:00
|
|
|
};
|
|
|
|
|
2001-11-06 02:41:04 +00:00
|
|
|
|
|
|
|
// This array MUST be kept in the same order as the color list in nsILookAndFeel.h.
|
2004-03-02 03:44:26 +00:00
|
|
|
/* XXX If you add any strings longer than
|
2008-01-24 09:31:44 +00:00
|
|
|
* "ui.IMESelectedConvertedTextBackground"
|
2004-03-02 03:44:26 +00:00
|
|
|
* to the following array then you MUST update the
|
|
|
|
* sizes of the sColorPrefs array in nsXPLookAndFeel.h
|
|
|
|
*/
|
2005-09-17 11:34:27 +00:00
|
|
|
const char nsXPLookAndFeel::sColorPrefs[][38] =
|
2000-04-11 22:34:55 +00:00
|
|
|
{
|
2001-11-06 02:41:04 +00:00
|
|
|
"ui.windowBackground",
|
|
|
|
"ui.windowForeground",
|
|
|
|
"ui.widgetBackground",
|
|
|
|
"ui.widgetForeground",
|
|
|
|
"ui.widgetSelectBackground",
|
|
|
|
"ui.widgetSelectForeground",
|
|
|
|
"ui.widget3DHighlight",
|
|
|
|
"ui.widget3DShadow",
|
|
|
|
"ui.textBackground",
|
|
|
|
"ui.textForeground",
|
|
|
|
"ui.textSelectBackground",
|
|
|
|
"ui.textSelectForeground",
|
2002-09-06 07:30:45 +00:00
|
|
|
"ui.textSelectBackgroundDisabled",
|
|
|
|
"ui.textSelectBackgroundAttention",
|
2008-07-30 20:48:56 +00:00
|
|
|
"ui.textHighlightBackground",
|
2008-09-02 06:28:44 +00:00
|
|
|
"ui.textHighlightForeground",
|
2005-09-17 11:34:27 +00:00
|
|
|
"ui.IMERawInputBackground",
|
|
|
|
"ui.IMERawInputForeground",
|
|
|
|
"ui.IMERawInputUnderline",
|
|
|
|
"ui.IMESelectedRawTextBackground",
|
|
|
|
"ui.IMESelectedRawTextForeground",
|
|
|
|
"ui.IMESelectedRawTextUnderline",
|
|
|
|
"ui.IMEConvertedTextBackground",
|
|
|
|
"ui.IMEConvertedTextForeground",
|
|
|
|
"ui.IMEConvertedTextUnderline",
|
|
|
|
"ui.IMESelectedConvertedTextBackground",
|
|
|
|
"ui.IMESelectedConvertedTextForeground",
|
|
|
|
"ui.IMESelectedConvertedTextUnderline",
|
2009-04-03 07:26:28 +00:00
|
|
|
"ui.SpellCheckerUnderline",
|
2001-11-06 02:41:04 +00:00
|
|
|
"ui.activeborder",
|
|
|
|
"ui.activecaption",
|
|
|
|
"ui.appworkspace",
|
|
|
|
"ui.background",
|
|
|
|
"ui.buttonface",
|
|
|
|
"ui.buttonhighlight",
|
|
|
|
"ui.buttonshadow",
|
|
|
|
"ui.buttontext",
|
|
|
|
"ui.captiontext",
|
|
|
|
"ui.graytext",
|
|
|
|
"ui.highlight",
|
|
|
|
"ui.highlighttext",
|
|
|
|
"ui.inactiveborder",
|
|
|
|
"ui.inactivecaption",
|
|
|
|
"ui.inactivecaptiontext",
|
|
|
|
"ui.infobackground",
|
|
|
|
"ui.infotext",
|
|
|
|
"ui.menu",
|
|
|
|
"ui.menutext",
|
|
|
|
"ui.scrollbar",
|
|
|
|
"ui.threeddarkshadow",
|
|
|
|
"ui.threedface",
|
|
|
|
"ui.threedhighlight",
|
|
|
|
"ui.threedlightshadow",
|
|
|
|
"ui.threedshadow",
|
|
|
|
"ui.window",
|
|
|
|
"ui.windowframe",
|
|
|
|
"ui.windowtext",
|
2003-06-18 21:16:29 +00:00
|
|
|
"ui.-moz-buttondefault",
|
2001-11-06 02:41:04 +00:00
|
|
|
"ui.-moz-field",
|
|
|
|
"ui.-moz-fieldtext",
|
|
|
|
"ui.-moz-dialog",
|
|
|
|
"ui.-moz-dialogtext",
|
|
|
|
"ui.-moz-dragtargetzone",
|
2008-04-24 08:08:33 +00:00
|
|
|
"ui.-moz-cellhighlight",
|
|
|
|
"ui.-moz_cellhighlighttext",
|
2008-01-24 09:31:44 +00:00
|
|
|
"ui.-moz-html-cellhighlight",
|
|
|
|
"ui.-moz-html-cellhighlighttext",
|
2008-04-24 08:08:33 +00:00
|
|
|
"ui.-moz-buttonhoverface",
|
|
|
|
"ui.-moz_buttonhovertext",
|
|
|
|
"ui.-moz_menuhover",
|
|
|
|
"ui.-moz_menuhovertext",
|
|
|
|
"ui.-moz_menubarhovertext",
|
|
|
|
"ui.-moz_eventreerow",
|
|
|
|
"ui.-moz_oddtreerow",
|
2009-03-31 20:02:55 +00:00
|
|
|
"ui.-moz_mac_chrome_active",
|
|
|
|
"ui.-moz_mac_chrome_inactive",
|
2001-11-06 02:41:04 +00:00
|
|
|
"ui.-moz-mac-focusring",
|
|
|
|
"ui.-moz-mac-menuselect",
|
|
|
|
"ui.-moz-mac-menushadow",
|
2006-07-14 19:54:08 +00:00
|
|
|
"ui.-moz-mac-menutextdisable",
|
2001-11-06 02:41:04 +00:00
|
|
|
"ui.-moz-mac-menutextselect",
|
2009-03-31 20:02:55 +00:00
|
|
|
"ui.-moz_mac_disabledtoolbartext",
|
2001-11-06 02:41:04 +00:00
|
|
|
"ui.-moz-mac-accentlightesthighlight",
|
|
|
|
"ui.-moz-mac-accentregularhighlight",
|
|
|
|
"ui.-moz-mac-accentface",
|
|
|
|
"ui.-moz-mac-accentlightshadow",
|
|
|
|
"ui.-moz-mac-accentregularshadow",
|
|
|
|
"ui.-moz-mac-accentdarkshadow",
|
2008-04-24 08:08:33 +00:00
|
|
|
"ui.-moz-mac-accentdarkestshadow",
|
|
|
|
"ui.-moz-mac-alternateprimaryhighlight",
|
2008-04-29 19:27:23 +00:00
|
|
|
"ui.-moz-mac-secondaryhighlight",
|
|
|
|
"ui.-moz-win-mediatext",
|
2008-07-11 18:34:53 +00:00
|
|
|
"ui.-moz-win-communicationstext",
|
2009-01-16 08:18:49 +00:00
|
|
|
"ui.-moz-nativehyperlinktext",
|
|
|
|
"ui.-moz-comboboxtext",
|
|
|
|
"ui.-moz-combobox"
|
2000-03-30 22:32:18 +00:00
|
|
|
};
|
|
|
|
|
2001-11-06 02:41:04 +00:00
|
|
|
PRInt32 nsXPLookAndFeel::sCachedColors[nsILookAndFeel::eColor_LAST_COLOR] = {0};
|
|
|
|
PRInt32 nsXPLookAndFeel::sCachedColorBits[COLOR_CACHE_SIZE] = {0};
|
|
|
|
|
2000-03-30 22:32:18 +00:00
|
|
|
PRBool nsXPLookAndFeel::sInitialized = PR_FALSE;
|
2009-02-10 19:25:00 +00:00
|
|
|
PRBool nsXPLookAndFeel::sUseNativeColors = PR_TRUE;
|
2000-03-30 22:32:18 +00:00
|
|
|
|
|
|
|
nsXPLookAndFeel::nsXPLookAndFeel() : nsILookAndFeel()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2005-09-12 12:36:11 +00:00
|
|
|
void
|
|
|
|
nsXPLookAndFeel::IntPrefChanged (nsLookAndFeelIntPref *data)
|
2000-03-30 22:32:18 +00:00
|
|
|
{
|
2005-09-12 12:36:11 +00:00
|
|
|
if (data)
|
2000-03-30 22:32:18 +00:00
|
|
|
{
|
2005-09-12 12:36:11 +00:00
|
|
|
nsCOMPtr<nsIPrefBranch> prefService(do_GetService(NS_PREFSERVICE_CONTRACTID));
|
|
|
|
if (prefService)
|
2000-03-30 22:32:18 +00:00
|
|
|
{
|
|
|
|
PRInt32 intpref;
|
2005-09-12 12:36:11 +00:00
|
|
|
nsresult rv = prefService->GetIntPref(data->name, &intpref);
|
2000-03-30 22:32:18 +00:00
|
|
|
if (NS_SUCCEEDED(rv))
|
|
|
|
{
|
2005-09-12 12:36:11 +00:00
|
|
|
data->intVar = intpref;
|
|
|
|
data->isSet = PR_TRUE;
|
2000-03-30 22:32:18 +00:00
|
|
|
#ifdef DEBUG_akkana
|
2005-09-12 12:36:11 +00:00
|
|
|
printf("====== Changed int pref %s to %d\n", data->name, data->intVar);
|
2000-03-30 22:32:18 +00:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-09-12 12:36:11 +00:00
|
|
|
void
|
|
|
|
nsXPLookAndFeel::FloatPrefChanged (nsLookAndFeelFloatPref *data)
|
2000-03-30 22:32:18 +00:00
|
|
|
{
|
2005-09-12 12:36:11 +00:00
|
|
|
if (data)
|
2000-03-30 22:32:18 +00:00
|
|
|
{
|
2005-09-12 12:36:11 +00:00
|
|
|
nsCOMPtr<nsIPrefBranch> prefService(do_GetService(NS_PREFSERVICE_CONTRACTID));
|
|
|
|
if (prefService)
|
2000-03-30 22:32:18 +00:00
|
|
|
{
|
|
|
|
PRInt32 intpref;
|
2005-09-12 12:36:11 +00:00
|
|
|
nsresult rv = prefService->GetIntPref(data->name, &intpref);
|
2000-03-30 22:32:18 +00:00
|
|
|
if (NS_SUCCEEDED(rv))
|
|
|
|
{
|
2005-09-12 12:36:11 +00:00
|
|
|
data->floatVar = (float)intpref / 100.;
|
|
|
|
data->isSet = PR_TRUE;
|
2000-03-30 22:32:18 +00:00
|
|
|
#ifdef DEBUG_akkana
|
2005-09-12 12:36:11 +00:00
|
|
|
printf("====== Changed float pref %s to %f\n", data->name, data->floatVar);
|
2000-03-30 22:32:18 +00:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-09-12 12:36:11 +00:00
|
|
|
void
|
|
|
|
nsXPLookAndFeel::ColorPrefChanged (unsigned int index, const char *prefName)
|
2000-04-11 22:34:55 +00:00
|
|
|
{
|
2005-09-12 12:36:11 +00:00
|
|
|
nsCOMPtr<nsIPrefBranch> prefService(do_GetService(NS_PREFSERVICE_CONTRACTID));
|
|
|
|
if (prefService) {
|
2001-11-06 02:41:04 +00:00
|
|
|
nsXPIDLCString colorStr;
|
2005-09-12 12:36:11 +00:00
|
|
|
nsresult rv = prefService->GetCharPref(prefName, getter_Copies(colorStr));
|
|
|
|
if (NS_SUCCEEDED(rv) && !colorStr.IsEmpty()) {
|
2001-11-06 02:41:04 +00:00
|
|
|
nscolor thecolor;
|
2002-08-13 10:07:16 +00:00
|
|
|
if (colorStr[0] == '#') {
|
2006-02-03 14:18:39 +00:00
|
|
|
if (NS_SUCCEEDED(NS_HexToRGB(NS_ConvertASCIItoUTF16(Substring(colorStr, 1, colorStr.Length() - 1)),
|
2002-08-13 10:07:16 +00:00
|
|
|
&thecolor))) {
|
2005-09-12 12:36:11 +00:00
|
|
|
PRInt32 id = NS_PTR_TO_INT32(index);
|
2002-08-13 10:07:16 +00:00
|
|
|
CACHE_COLOR(id, thecolor);
|
|
|
|
}
|
|
|
|
}
|
2006-02-03 14:18:39 +00:00
|
|
|
else if (NS_SUCCEEDED(NS_ColorNameToRGB(NS_ConvertASCIItoUTF16(colorStr),
|
2001-11-06 02:41:04 +00:00
|
|
|
&thecolor))) {
|
2005-09-12 12:36:11 +00:00
|
|
|
PRInt32 id = NS_PTR_TO_INT32(index);
|
2001-11-06 02:41:04 +00:00
|
|
|
CACHE_COLOR(id, thecolor);
|
2000-04-11 22:34:55 +00:00
|
|
|
#ifdef DEBUG_akkana
|
2001-11-06 02:41:04 +00:00
|
|
|
printf("====== Changed color pref %s to 0x%lx\n",
|
2005-09-12 12:36:11 +00:00
|
|
|
prefName, thecolor);
|
2000-04-11 22:34:55 +00:00
|
|
|
#endif
|
|
|
|
}
|
2008-09-05 09:57:52 +00:00
|
|
|
} else if (colorStr.IsEmpty()) {
|
|
|
|
// Reset to the default color, by clearing the cache
|
|
|
|
// to force lookup when the color is next used
|
|
|
|
PRInt32 id = NS_PTR_TO_INT32(index);
|
|
|
|
CLEAR_COLOR_CACHE(id);
|
2000-04-11 22:34:55 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-09-12 12:36:11 +00:00
|
|
|
void
|
|
|
|
nsXPLookAndFeel::InitFromPref(nsLookAndFeelIntPref* aPref, nsIPrefBranch* aPrefBranch)
|
2000-03-30 22:32:18 +00:00
|
|
|
{
|
|
|
|
PRInt32 intpref;
|
2005-09-12 12:36:11 +00:00
|
|
|
nsresult rv = aPrefBranch->GetIntPref(aPref->name, &intpref);
|
2000-03-30 22:32:18 +00:00
|
|
|
if (NS_SUCCEEDED(rv))
|
|
|
|
{
|
|
|
|
aPref->isSet = PR_TRUE;
|
|
|
|
aPref->intVar = intpref;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-09-12 12:36:11 +00:00
|
|
|
void
|
|
|
|
nsXPLookAndFeel::InitFromPref(nsLookAndFeelFloatPref* aPref, nsIPrefBranch* aPrefBranch)
|
2000-03-30 22:32:18 +00:00
|
|
|
{
|
|
|
|
PRInt32 intpref;
|
2005-09-12 12:36:11 +00:00
|
|
|
nsresult rv = aPrefBranch->GetIntPref(aPref->name, &intpref);
|
2000-03-30 22:32:18 +00:00
|
|
|
if (NS_SUCCEEDED(rv))
|
|
|
|
{
|
|
|
|
aPref->isSet = PR_TRUE;
|
|
|
|
aPref->floatVar = (float)intpref / 100.;
|
|
|
|
}
|
2000-04-11 22:34:55 +00:00
|
|
|
}
|
|
|
|
|
2005-09-12 12:36:11 +00:00
|
|
|
void
|
|
|
|
nsXPLookAndFeel::InitColorFromPref(PRInt32 i, nsIPrefBranch* aPrefBranch)
|
2000-04-11 22:34:55 +00:00
|
|
|
{
|
2005-09-12 12:36:11 +00:00
|
|
|
nsXPIDLCString colorStr;
|
|
|
|
nsresult rv = aPrefBranch->GetCharPref(sColorPrefs[i], getter_Copies(colorStr));
|
|
|
|
if (NS_SUCCEEDED(rv) && !colorStr.IsEmpty())
|
2000-04-11 22:34:55 +00:00
|
|
|
{
|
2000-04-17 08:21:30 +00:00
|
|
|
nsAutoString colorNSStr; colorNSStr.AssignWithConversion(colorStr);
|
2000-04-11 22:34:55 +00:00
|
|
|
nscolor thecolor;
|
2002-08-13 10:07:16 +00:00
|
|
|
if (colorNSStr[0] == '#') {
|
|
|
|
nsAutoString hexString;
|
|
|
|
colorNSStr.Right(hexString, colorNSStr.Length() - 1);
|
|
|
|
if (NS_SUCCEEDED(NS_HexToRGB(hexString, &thecolor))) {
|
|
|
|
CACHE_COLOR(i, thecolor);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (NS_SUCCEEDED(NS_ColorNameToRGB(colorNSStr, &thecolor)))
|
2000-04-11 22:34:55 +00:00
|
|
|
{
|
2001-11-06 02:41:04 +00:00
|
|
|
CACHE_COLOR(i, thecolor);
|
2005-09-12 12:36:11 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
nsXPLookAndFeel::Observe(nsISupports* aSubject,
|
|
|
|
const char* aTopic,
|
|
|
|
const PRUnichar* aData)
|
|
|
|
{
|
|
|
|
|
|
|
|
// looping in the same order as in ::Init
|
|
|
|
|
|
|
|
unsigned int i;
|
|
|
|
for (i = 0; i < NS_ARRAY_LENGTH(sIntPrefs); ++i) {
|
|
|
|
if (nsDependentString(aData).EqualsASCII(sIntPrefs[i].name)) {
|
|
|
|
IntPrefChanged(&sIntPrefs[i]);
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
for (i = 0; i < NS_ARRAY_LENGTH(sFloatPrefs); ++i) {
|
|
|
|
if (nsDependentString(aData).EqualsASCII(sFloatPrefs[i].name)) {
|
|
|
|
FloatPrefChanged(&sFloatPrefs[i]);
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
for (i = 0; i < NS_ARRAY_LENGTH(sColorPrefs); ++i) {
|
|
|
|
if (nsDependentString(aData).EqualsASCII(sColorPrefs[i])) {
|
|
|
|
ColorPrefChanged(i, sColorPrefs[i]);
|
|
|
|
return NS_OK;
|
2000-04-11 22:34:55 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-09-12 12:36:11 +00:00
|
|
|
return NS_OK;
|
2000-03-30 22:32:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//
|
|
|
|
// Read values from the user's preferences.
|
|
|
|
// This is done once at startup, but since the user's preferences
|
|
|
|
// haven't actually been read yet at that time, we also have to
|
|
|
|
// set a callback to inform us of changes to each pref.
|
|
|
|
//
|
|
|
|
void
|
|
|
|
nsXPLookAndFeel::Init()
|
|
|
|
{
|
|
|
|
// Say we're already initialized, and take the chance that it might fail;
|
|
|
|
// protects against some other process writing to our static variables.
|
|
|
|
sInitialized = PR_TRUE;
|
|
|
|
|
2005-09-12 12:36:11 +00:00
|
|
|
nsCOMPtr<nsIPrefBranch> prefs(do_GetService(NS_PREFSERVICE_CONTRACTID));
|
|
|
|
if (!prefs)
|
|
|
|
return;
|
|
|
|
nsCOMPtr<nsIPrefBranch2> prefBranchInternal(do_QueryInterface(prefs));
|
|
|
|
if (!prefBranchInternal)
|
2000-03-30 22:32:18 +00:00
|
|
|
return;
|
|
|
|
|
|
|
|
unsigned int i;
|
2005-09-12 12:36:11 +00:00
|
|
|
for (i = 0; i < NS_ARRAY_LENGTH(sIntPrefs); ++i) {
|
|
|
|
InitFromPref(&sIntPrefs[i], prefs);
|
|
|
|
prefBranchInternal->AddObserver(sIntPrefs[i].name, this, PR_FALSE);
|
|
|
|
}
|
2000-03-30 22:32:18 +00:00
|
|
|
|
2005-09-12 12:36:11 +00:00
|
|
|
for (i = 0; i < NS_ARRAY_LENGTH(sFloatPrefs); ++i) {
|
|
|
|
InitFromPref(&sFloatPrefs[i], prefs);
|
|
|
|
prefBranchInternal->AddObserver(sFloatPrefs[i].name, this, PR_FALSE);
|
|
|
|
}
|
2000-03-30 22:32:18 +00:00
|
|
|
|
2005-09-12 12:36:11 +00:00
|
|
|
for (i = 0; i < NS_ARRAY_LENGTH(sColorPrefs); ++i) {
|
|
|
|
InitColorFromPref(i, prefs);
|
|
|
|
prefBranchInternal->AddObserver(sColorPrefs[i], this, PR_FALSE);
|
|
|
|
}
|
2009-02-10 19:25:00 +00:00
|
|
|
|
|
|
|
PRBool val;
|
|
|
|
if (NS_SUCCEEDED(prefs->GetBoolPref("ui.use_native_colors", &val))) {
|
|
|
|
sUseNativeColors = val;
|
|
|
|
}
|
2000-03-30 22:32:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
nsXPLookAndFeel::~nsXPLookAndFeel()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2007-09-04 11:28:12 +00:00
|
|
|
PRBool
|
|
|
|
nsXPLookAndFeel::IsSpecialColor(const nsColorID aID, nscolor &aColor)
|
|
|
|
{
|
|
|
|
switch (aID) {
|
|
|
|
case eColor_TextSelectForeground:
|
|
|
|
return (aColor == NS_DONT_CHANGE_COLOR);
|
|
|
|
case eColor_IMESelectedRawTextBackground:
|
|
|
|
case eColor_IMESelectedConvertedTextBackground:
|
|
|
|
case eColor_IMERawInputBackground:
|
|
|
|
case eColor_IMEConvertedTextBackground:
|
|
|
|
case eColor_IMESelectedRawTextForeground:
|
|
|
|
case eColor_IMESelectedConvertedTextForeground:
|
|
|
|
case eColor_IMERawInputForeground:
|
|
|
|
case eColor_IMEConvertedTextForeground:
|
|
|
|
case eColor_IMERawInputUnderline:
|
|
|
|
case eColor_IMEConvertedTextUnderline:
|
|
|
|
case eColor_IMESelectedRawTextUnderline:
|
|
|
|
case eColor_IMESelectedConvertedTextUnderline:
|
2009-04-03 07:26:28 +00:00
|
|
|
case eColor_SpellCheckerUnderline:
|
|
|
|
return NS_IS_SELECTION_SPECIAL_COLOR(aColor);
|
2008-09-16 11:32:03 +00:00
|
|
|
default:
|
|
|
|
/*
|
|
|
|
* In GetColor(), every color that is not a special color is color
|
|
|
|
* corrected. Use PR_FALSE to make other colors color corrected.
|
|
|
|
*/
|
|
|
|
return PR_FALSE;
|
2007-09-04 11:28:12 +00:00
|
|
|
}
|
|
|
|
return PR_FALSE;
|
|
|
|
}
|
|
|
|
|
2000-03-30 22:32:18 +00:00
|
|
|
//
|
|
|
|
// All these routines will return NS_OK if they have a value,
|
|
|
|
// in which case the nsLookAndFeel should use that value;
|
|
|
|
// otherwise we'll return NS_ERROR_NOT_AVAILABLE, in which case, the
|
|
|
|
// platform-specific nsLookAndFeel should use its own values instead.
|
|
|
|
//
|
2005-09-12 12:36:11 +00:00
|
|
|
NS_IMETHODIMP
|
|
|
|
nsXPLookAndFeel::GetColor(const nsColorID aID, nscolor &aColor)
|
2000-03-30 22:32:18 +00:00
|
|
|
{
|
2000-04-11 22:34:55 +00:00
|
|
|
if (!sInitialized)
|
|
|
|
Init();
|
|
|
|
|
2001-04-17 00:46:07 +00:00
|
|
|
// define DEBUG_SYSTEM_COLOR_USE if you want to debug system color
|
|
|
|
// use in a skin that uses them. When set, it will make all system
|
|
|
|
// color pairs that are appropriate for foreground/background
|
|
|
|
// pairing the same. This means if the skin is using system colors
|
|
|
|
// correctly you will not be able to see *any* text.
|
|
|
|
#undef DEBUG_SYSTEM_COLOR_USE
|
|
|
|
|
|
|
|
#ifdef DEBUG_SYSTEM_COLOR_USE
|
|
|
|
{
|
|
|
|
nsresult rv = NS_OK;
|
|
|
|
switch (aID) {
|
|
|
|
// css2 http://www.w3.org/TR/REC-CSS2/ui.html#system-colors
|
|
|
|
case eColor_activecaption:
|
|
|
|
// active window caption background
|
|
|
|
case eColor_captiontext:
|
|
|
|
// text in active window caption
|
|
|
|
aColor = NS_RGB(0xff, 0x00, 0x00);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case eColor_highlight:
|
|
|
|
// background of selected item
|
|
|
|
case eColor_highlighttext:
|
|
|
|
// text of selected item
|
|
|
|
aColor = NS_RGB(0xff, 0xff, 0x00);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case eColor_inactivecaption:
|
|
|
|
// inactive window caption
|
|
|
|
case eColor_inactivecaptiontext:
|
|
|
|
// text in inactive window caption
|
|
|
|
aColor = NS_RGB(0x66, 0x66, 0x00);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case eColor_infobackground:
|
|
|
|
// tooltip background color
|
|
|
|
case eColor_infotext:
|
|
|
|
// tooltip text color
|
|
|
|
aColor = NS_RGB(0x00, 0xff, 0x00);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case eColor_menu:
|
|
|
|
// menu background
|
|
|
|
case eColor_menutext:
|
|
|
|
// menu text
|
|
|
|
aColor = NS_RGB(0x00, 0xff, 0xff);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case eColor_threedface:
|
|
|
|
case eColor_buttonface:
|
|
|
|
// 3-D face color
|
|
|
|
case eColor_buttontext:
|
|
|
|
// text on push buttons
|
|
|
|
aColor = NS_RGB(0x00, 0x66, 0x66);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case eColor_window:
|
|
|
|
case eColor_windowtext:
|
|
|
|
aColor = NS_RGB(0x00, 0x00, 0xff);
|
|
|
|
break;
|
|
|
|
|
|
|
|
// from the CSS3 working draft (not yet finalized)
|
|
|
|
// http://www.w3.org/tr/2000/wd-css3-userint-20000216.html#color
|
|
|
|
|
|
|
|
case eColor__moz_field:
|
|
|
|
case eColor__moz_fieldtext:
|
|
|
|
aColor = NS_RGB(0xff, 0x00, 0xff);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case eColor__moz_dialog:
|
|
|
|
case eColor__moz_dialogtext:
|
|
|
|
aColor = NS_RGB(0x66, 0x00, 0x66);
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
rv = NS_ERROR_NOT_AVAILABLE;
|
|
|
|
}
|
|
|
|
if (NS_SUCCEEDED(rv))
|
|
|
|
return rv;
|
|
|
|
}
|
|
|
|
#endif // DEBUG_SYSTEM_COLOR_USE
|
|
|
|
|
2001-11-06 02:41:04 +00:00
|
|
|
if (IS_COLOR_CACHED(aID)) {
|
|
|
|
aColor = sCachedColors[aID];
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2002-09-06 07:30:45 +00:00
|
|
|
// There are no system color settings for these, so set them manually
|
|
|
|
if (aID == eColor_TextSelectBackgroundDisabled) {
|
|
|
|
// This is used to gray out the selection when it's not focused
|
|
|
|
// Used with nsISelectionController::SELECTION_DISABLED
|
|
|
|
aColor = NS_RGB(0xb0, 0xb0, 0xb0);
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (aID == eColor_TextSelectBackgroundAttention) {
|
|
|
|
// This makes the selection stand out when typeaheadfind is on
|
|
|
|
// Used with nsISelectionController::SELECTION_ATTENTION
|
|
|
|
aColor = NS_RGB(0x38, 0xd8, 0x78);
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2008-07-30 20:48:56 +00:00
|
|
|
if (aID == eColor_TextHighlightBackground) {
|
|
|
|
// This makes the matched text stand out when findbar highlighting is on
|
|
|
|
// Used with nsISelectionController::SELECTION_FIND
|
2008-11-10 22:10:25 +00:00
|
|
|
aColor = NS_RGB(0xef, 0x0f, 0xff);
|
2008-07-30 20:48:56 +00:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2008-09-02 06:28:44 +00:00
|
|
|
if (aID == eColor_TextHighlightForeground) {
|
|
|
|
// The foreground color for the matched text in findbar highlighting
|
|
|
|
// Used with nsISelectionController::SELECTION_FIND
|
2008-11-10 22:10:25 +00:00
|
|
|
aColor = NS_RGB(0xff, 0xff, 0xff);
|
2008-09-02 06:28:44 +00:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2009-02-10 19:25:00 +00:00
|
|
|
if (sUseNativeColors && NS_SUCCEEDED(NativeGetColor(aID, aColor))) {
|
2008-08-12 04:55:36 +00:00
|
|
|
if ((gfxPlatform::GetCMSMode() == eCMSMode_All) && !IsSpecialColor(aID, aColor)) {
|
2009-04-07 16:02:11 +00:00
|
|
|
qcms_transform *transform = gfxPlatform::GetCMSInverseRGBTransform();
|
2007-08-30 16:21:16 +00:00
|
|
|
if (transform) {
|
|
|
|
PRUint8 color[3];
|
|
|
|
color[0] = NS_GET_R(aColor);
|
|
|
|
color[1] = NS_GET_G(aColor);
|
|
|
|
color[2] = NS_GET_B(aColor);
|
2009-04-07 16:02:11 +00:00
|
|
|
qcms_transform_data(transform, color, color, 1);
|
2007-08-30 16:21:16 +00:00
|
|
|
aColor = NS_RGB(color[0], color[1], color[2]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2001-11-06 02:41:04 +00:00
|
|
|
CACHE_COLOR(aID, aColor);
|
|
|
|
return NS_OK;
|
|
|
|
}
|
2000-04-11 22:34:55 +00:00
|
|
|
|
2000-03-30 22:32:18 +00:00
|
|
|
return NS_ERROR_NOT_AVAILABLE;
|
|
|
|
}
|
|
|
|
|
2005-09-12 12:36:11 +00:00
|
|
|
NS_IMETHODIMP
|
|
|
|
nsXPLookAndFeel::GetMetric(const nsMetricID aID, PRInt32& aMetric)
|
2000-03-30 22:32:18 +00:00
|
|
|
{
|
|
|
|
if (!sInitialized)
|
|
|
|
Init();
|
|
|
|
|
2006-07-19 22:13:18 +00:00
|
|
|
// Set the default values for these prefs. but allow different platforms
|
|
|
|
// to override them in their nsLookAndFeel if desired.
|
|
|
|
switch (aID) {
|
|
|
|
case eMetric_ScrollButtonLeftMouseButtonAction:
|
|
|
|
aMetric = 0;
|
|
|
|
return NS_OK;
|
|
|
|
case eMetric_ScrollButtonMiddleMouseButtonAction:
|
|
|
|
aMetric = 3;
|
|
|
|
return NS_OK;
|
|
|
|
case eMetric_ScrollButtonRightMouseButtonAction:
|
|
|
|
aMetric = 3;
|
|
|
|
return NS_OK;
|
2008-09-16 11:32:03 +00:00
|
|
|
default:
|
|
|
|
/*
|
|
|
|
* The metrics above are hardcoded platform defaults. All the other
|
|
|
|
* metrics are stored in sIntPrefs and can be changed at runtime.
|
|
|
|
*/
|
|
|
|
break;
|
2006-07-19 22:13:18 +00:00
|
|
|
}
|
|
|
|
|
2000-03-30 22:32:18 +00:00
|
|
|
for (unsigned int i = 0; i < ((sizeof (sIntPrefs) / sizeof (*sIntPrefs))); ++i)
|
|
|
|
if (sIntPrefs[i].isSet && (sIntPrefs[i].id == aID))
|
|
|
|
{
|
|
|
|
aMetric = sIntPrefs[i].intVar;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
return NS_ERROR_NOT_AVAILABLE;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
nsXPLookAndFeel::GetMetric(const nsMetricFloatID aID, float& aMetric)
|
|
|
|
{
|
|
|
|
if (!sInitialized)
|
|
|
|
Init();
|
|
|
|
|
|
|
|
for (unsigned int i = 0; i < ((sizeof (sFloatPrefs) / sizeof (*sFloatPrefs))); ++i)
|
|
|
|
if (sFloatPrefs[i].isSet && sFloatPrefs[i].id == aID)
|
|
|
|
{
|
|
|
|
aMetric = sFloatPrefs[i].floatVar;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
return NS_ERROR_NOT_AVAILABLE;
|
|
|
|
}
|
|
|
|
|
2001-12-17 22:51:39 +00:00
|
|
|
NS_IMETHODIMP
|
|
|
|
nsXPLookAndFeel::LookAndFeelChanged()
|
|
|
|
{
|
|
|
|
// Wipe out our color cache.
|
|
|
|
PRUint32 i;
|
|
|
|
for (i = 0; i < nsILookAndFeel::eColor_LAST_COLOR; i++)
|
|
|
|
sCachedColors[i] = 0;
|
|
|
|
for (i = 0; i < COLOR_CACHE_SIZE; i++)
|
|
|
|
sCachedColorBits[i] = 0;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2002-01-24 01:18:36 +00:00
|
|
|
#ifdef DEBUG
|
2000-03-30 22:32:18 +00:00
|
|
|
// This method returns the actual (or nearest estimate)
|
|
|
|
// of the Navigator size for a given form control for a given font
|
|
|
|
// and font size. This is used in NavQuirks mode to see how closely
|
|
|
|
// we match its size
|
|
|
|
NS_IMETHODIMP
|
|
|
|
nsXPLookAndFeel::GetNavSize(const nsMetricNavWidgetID aWidgetID,
|
|
|
|
const nsMetricNavFontID aFontID,
|
|
|
|
const PRInt32 aFontSize,
|
|
|
|
nsSize &aSize)
|
|
|
|
{
|
2001-11-06 02:41:04 +00:00
|
|
|
aSize.width = 0;
|
|
|
|
aSize.height = 0;
|
|
|
|
return NS_ERROR_NOT_IMPLEMENTED;
|
2000-03-30 22:32:18 +00:00
|
|
|
}
|
|
|
|
#endif
|