2008-04-19 15:31:50 +00:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
|
|
|
/* ***** BEGIN LICENSE BLOCK *****
|
|
|
|
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
|
|
|
*
|
|
|
|
* 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/
|
|
|
|
*
|
|
|
|
* 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.
|
|
|
|
*
|
|
|
|
* The Original Code is mozilla.org code.
|
|
|
|
*
|
|
|
|
* The Initial Developer of the Original Code is
|
|
|
|
* Netscape Communications Corporation.
|
|
|
|
* Portions created by the Initial Developer are Copyright (C) 1998
|
|
|
|
* the Initial Developer. All Rights Reserved.
|
|
|
|
*
|
|
|
|
* Contributor(s):
|
|
|
|
* Lars Knoll <knoll@kde.org>
|
|
|
|
* Zack Rusin <zack@kde.org>
|
|
|
|
* John C. Griggs <johng@corel.com>
|
|
|
|
*
|
|
|
|
* Alternatively, the contents of this file may be used under the terms of
|
|
|
|
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
|
|
|
* 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
|
|
|
|
* use your version of this file under the terms of the MPL, indicate your
|
|
|
|
* 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
|
|
|
|
* the terms of any one of the MPL, the GPL or the LGPL.
|
|
|
|
*
|
|
|
|
* ***** END LICENSE BLOCK ***** */
|
|
|
|
|
2008-04-19 16:04:22 +00:00
|
|
|
#include <QPalette>
|
|
|
|
#include <QApplication>
|
|
|
|
#include <QStyle>
|
2010-03-04 21:51:42 +00:00
|
|
|
|
|
|
|
#include "nsLookAndFeel.h"
|
2011-03-31 12:26:49 +00:00
|
|
|
#include "nsStyleConsts.h"
|
2010-03-04 21:51:42 +00:00
|
|
|
|
2008-04-19 16:07:20 +00:00
|
|
|
#include <qglobal.h>
|
2008-04-19 15:31:50 +00:00
|
|
|
|
2008-04-19 16:07:10 +00:00
|
|
|
#undef NS_LOOKANDFEEL_DEBUG
|
|
|
|
#ifdef NS_LOOKANDFEEL_DEBUG
|
|
|
|
#include <QDebug>
|
|
|
|
#endif
|
|
|
|
|
2008-04-19 15:31:50 +00:00
|
|
|
#define QCOLOR_TO_NS_RGB(c) \
|
|
|
|
((nscolor)NS_RGB(c.red(),c.green(),c.blue()))
|
|
|
|
|
|
|
|
nsLookAndFeel::nsLookAndFeel() : nsXPLookAndFeel()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
nsLookAndFeel::~nsLookAndFeel()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2011-09-09 02:27:13 +00:00
|
|
|
nsresult
|
|
|
|
nsLookAndFeel::NativeGetColor(ColorID aID, nscolor &aColor)
|
2008-04-19 15:31:50 +00:00
|
|
|
{
|
2008-04-19 16:04:37 +00:00
|
|
|
nsresult res = NS_OK;
|
|
|
|
|
|
|
|
if (!qApp)
|
|
|
|
return NS_ERROR_FAILURE;
|
|
|
|
|
|
|
|
QPalette palette = qApp->palette();
|
|
|
|
|
|
|
|
switch (aID) {
|
2011-09-09 02:27:13 +00:00
|
|
|
case eColorID_WindowBackground:
|
2008-04-19 16:07:10 +00:00
|
|
|
aColor = QCOLOR_TO_NS_RGB(palette.color(QPalette::Normal, QPalette::Window));
|
2008-04-19 16:04:37 +00:00
|
|
|
break;
|
|
|
|
|
2011-09-09 02:27:13 +00:00
|
|
|
case eColorID_WindowForeground:
|
2008-04-19 16:07:10 +00:00
|
|
|
aColor = QCOLOR_TO_NS_RGB(palette.color(QPalette::Normal, QPalette::Window));
|
2008-04-19 16:04:37 +00:00
|
|
|
break;
|
|
|
|
|
2011-09-09 02:27:13 +00:00
|
|
|
case eColorID_WidgetBackground:
|
2008-04-19 16:07:10 +00:00
|
|
|
aColor = QCOLOR_TO_NS_RGB(palette.color(QPalette::Normal, QPalette::Window));
|
2008-04-19 16:04:37 +00:00
|
|
|
break;
|
|
|
|
|
2011-09-09 02:27:13 +00:00
|
|
|
case eColorID_WidgetForeground:
|
2008-04-19 16:07:10 +00:00
|
|
|
aColor = QCOLOR_TO_NS_RGB(palette.color(QPalette::Normal, QPalette::WindowText));
|
2008-04-19 16:04:37 +00:00
|
|
|
break;
|
|
|
|
|
2011-09-09 02:27:13 +00:00
|
|
|
case eColorID_WidgetSelectBackground:
|
2008-04-19 16:07:10 +00:00
|
|
|
aColor = QCOLOR_TO_NS_RGB(palette.color(QPalette::Normal, QPalette::Window));
|
2008-04-19 16:04:37 +00:00
|
|
|
break;
|
|
|
|
|
2011-09-09 02:27:13 +00:00
|
|
|
case eColorID_WidgetSelectForeground:
|
2008-04-19 16:07:10 +00:00
|
|
|
aColor = QCOLOR_TO_NS_RGB(palette.color(QPalette::Normal, QPalette::WindowText));
|
2008-04-19 16:04:37 +00:00
|
|
|
break;
|
|
|
|
|
2011-09-09 02:27:13 +00:00
|
|
|
case eColorID_Widget3DHighlight:
|
2008-04-19 16:04:37 +00:00
|
|
|
aColor = NS_RGB(0xa0,0xa0,0xa0);
|
|
|
|
break;
|
|
|
|
|
2011-09-09 02:27:13 +00:00
|
|
|
case eColorID_Widget3DShadow:
|
2008-04-19 16:04:37 +00:00
|
|
|
aColor = NS_RGB(0x40,0x40,0x40);
|
|
|
|
break;
|
|
|
|
|
2011-09-09 02:27:13 +00:00
|
|
|
case eColorID_TextBackground:
|
2008-04-19 16:07:10 +00:00
|
|
|
aColor = QCOLOR_TO_NS_RGB(palette.color(QPalette::Normal, QPalette::Window));
|
2008-04-19 16:04:37 +00:00
|
|
|
break;
|
|
|
|
|
2011-09-09 02:27:13 +00:00
|
|
|
case eColorID_TextForeground:
|
2008-04-19 16:09:56 +00:00
|
|
|
aColor = QCOLOR_TO_NS_RGB(palette.color(QPalette::Normal, QPalette::WindowText));
|
2008-04-19 16:04:37 +00:00
|
|
|
break;
|
|
|
|
|
2011-09-09 02:27:13 +00:00
|
|
|
case eColorID_TextSelectBackground:
|
|
|
|
case eColorID_IMESelectedRawTextBackground:
|
|
|
|
case eColorID_IMESelectedConvertedTextBackground:
|
2008-04-19 16:07:10 +00:00
|
|
|
aColor = QCOLOR_TO_NS_RGB(palette.color(QPalette::Normal, QPalette::Highlight));
|
2008-04-19 16:04:37 +00:00
|
|
|
break;
|
|
|
|
|
2011-09-09 02:27:13 +00:00
|
|
|
case eColorID_TextSelectForeground:
|
|
|
|
case eColorID_IMESelectedRawTextForeground:
|
|
|
|
case eColorID_IMESelectedConvertedTextForeground:
|
2008-04-19 16:07:10 +00:00
|
|
|
aColor = QCOLOR_TO_NS_RGB(palette.color(QPalette::Normal, QPalette::HighlightedText));
|
2008-04-19 16:04:37 +00:00
|
|
|
break;
|
|
|
|
|
2011-09-09 02:27:13 +00:00
|
|
|
case eColorID_IMERawInputBackground:
|
|
|
|
case eColorID_IMEConvertedTextBackground:
|
2008-04-19 16:04:37 +00:00
|
|
|
aColor = NS_TRANSPARENT;
|
|
|
|
break;
|
|
|
|
|
2011-09-09 02:27:13 +00:00
|
|
|
case eColorID_IMERawInputForeground:
|
|
|
|
case eColorID_IMEConvertedTextForeground:
|
2008-04-19 16:04:37 +00:00
|
|
|
aColor = NS_SAME_AS_FOREGROUND_COLOR;
|
|
|
|
break;
|
|
|
|
|
2011-09-09 02:27:13 +00:00
|
|
|
case eColorID_IMERawInputUnderline:
|
|
|
|
case eColorID_IMEConvertedTextUnderline:
|
2008-04-19 16:04:37 +00:00
|
|
|
aColor = NS_SAME_AS_FOREGROUND_COLOR;
|
|
|
|
break;
|
|
|
|
|
2011-09-09 02:27:13 +00:00
|
|
|
case eColorID_IMESelectedRawTextUnderline:
|
|
|
|
case eColorID_IMESelectedConvertedTextUnderline:
|
2008-04-19 16:04:37 +00:00
|
|
|
aColor = NS_TRANSPARENT;
|
|
|
|
break;
|
|
|
|
|
2011-09-09 02:27:13 +00:00
|
|
|
case eColorID_SpellCheckerUnderline:
|
2009-04-03 07:26:28 +00:00
|
|
|
aColor = NS_RGB(0xff, 0, 0);
|
|
|
|
break;
|
|
|
|
|
2011-09-09 02:27:13 +00:00
|
|
|
case eColorID_activeborder:
|
2008-04-19 16:07:10 +00:00
|
|
|
aColor = QCOLOR_TO_NS_RGB(palette.color(QPalette::Normal, QPalette::Window));
|
2008-04-19 16:04:37 +00:00
|
|
|
break;
|
|
|
|
|
2011-09-09 02:27:13 +00:00
|
|
|
case eColorID_activecaption:
|
2008-04-19 16:07:10 +00:00
|
|
|
aColor = QCOLOR_TO_NS_RGB(palette.color(QPalette::Normal, QPalette::Window));
|
2008-04-19 16:04:37 +00:00
|
|
|
break;
|
|
|
|
|
2011-09-09 02:27:13 +00:00
|
|
|
case eColorID_appworkspace:
|
2008-04-19 16:07:10 +00:00
|
|
|
aColor = QCOLOR_TO_NS_RGB(palette.color(QPalette::Normal, QPalette::Window));
|
2008-04-19 16:04:37 +00:00
|
|
|
break;
|
|
|
|
|
2011-09-09 02:27:13 +00:00
|
|
|
case eColorID_background:
|
2008-04-19 16:07:10 +00:00
|
|
|
aColor = QCOLOR_TO_NS_RGB(palette.color(QPalette::Normal, QPalette::Window));
|
2008-04-19 16:04:37 +00:00
|
|
|
break;
|
|
|
|
|
2011-09-09 02:27:13 +00:00
|
|
|
case eColorID_captiontext:
|
2008-04-19 16:07:10 +00:00
|
|
|
aColor = QCOLOR_TO_NS_RGB(palette.color(QPalette::Normal, QPalette::Text));
|
2008-04-19 16:04:37 +00:00
|
|
|
break;
|
|
|
|
|
2011-09-09 02:27:13 +00:00
|
|
|
case eColorID_graytext:
|
2008-04-19 16:04:37 +00:00
|
|
|
aColor = QCOLOR_TO_NS_RGB(palette.color(QPalette::Disabled, QPalette::Text));
|
|
|
|
break;
|
|
|
|
|
2011-09-09 02:27:13 +00:00
|
|
|
case eColorID_highlight:
|
2008-04-19 16:07:10 +00:00
|
|
|
aColor = QCOLOR_TO_NS_RGB(palette.color(QPalette::Normal, QPalette::Highlight));
|
2008-04-19 16:04:37 +00:00
|
|
|
break;
|
|
|
|
|
2011-09-09 02:27:13 +00:00
|
|
|
case eColorID_highlighttext:
|
2008-04-19 16:07:10 +00:00
|
|
|
aColor = QCOLOR_TO_NS_RGB(palette.color(QPalette::Normal, QPalette::HighlightedText));
|
2008-04-19 16:04:37 +00:00
|
|
|
break;
|
|
|
|
|
2011-09-09 02:27:13 +00:00
|
|
|
case eColorID_inactiveborder:
|
2008-04-19 16:07:10 +00:00
|
|
|
aColor = QCOLOR_TO_NS_RGB(palette.color(QPalette::Disabled, QPalette::Window));
|
2008-04-19 16:04:37 +00:00
|
|
|
break;
|
|
|
|
|
2011-09-09 02:27:13 +00:00
|
|
|
case eColorID_inactivecaption:
|
2008-04-19 16:07:10 +00:00
|
|
|
aColor = QCOLOR_TO_NS_RGB(palette.color(QPalette::Disabled, QPalette::Window));
|
2008-04-19 16:04:37 +00:00
|
|
|
break;
|
|
|
|
|
2011-09-09 02:27:13 +00:00
|
|
|
case eColorID_inactivecaptiontext:
|
2008-04-19 16:04:37 +00:00
|
|
|
aColor = QCOLOR_TO_NS_RGB(palette.color(QPalette::Disabled, QPalette::Text));
|
|
|
|
break;
|
|
|
|
|
2011-09-09 02:27:13 +00:00
|
|
|
case eColorID_infobackground:
|
2008-04-19 16:07:34 +00:00
|
|
|
#if (QT_VERSION >= QT_VERSION_CHECK(4, 4, 0))
|
2008-04-19 16:07:15 +00:00
|
|
|
aColor = QCOLOR_TO_NS_RGB(palette.color(QPalette::Normal, QPalette::ToolTipBase));
|
2008-04-19 16:07:20 +00:00
|
|
|
#else
|
|
|
|
aColor = QCOLOR_TO_NS_RGB(palette.color(QPalette::Normal, QPalette::Base));
|
|
|
|
#endif
|
2008-04-19 16:04:37 +00:00
|
|
|
break;
|
|
|
|
|
2011-09-09 02:27:13 +00:00
|
|
|
case eColorID_infotext:
|
2008-04-19 16:07:34 +00:00
|
|
|
#if (QT_VERSION >= QT_VERSION_CHECK(4, 4, 0))
|
2008-04-19 16:07:15 +00:00
|
|
|
aColor = QCOLOR_TO_NS_RGB(palette.color(QPalette::Normal, QPalette::ToolTipText));
|
2008-04-19 16:07:20 +00:00
|
|
|
#else
|
|
|
|
aColor = QCOLOR_TO_NS_RGB(palette.color(QPalette::Normal, QPalette::Text));
|
|
|
|
#endif
|
2008-04-19 16:04:37 +00:00
|
|
|
break;
|
|
|
|
|
2011-09-09 02:27:13 +00:00
|
|
|
case eColorID_menu:
|
2008-04-19 16:07:10 +00:00
|
|
|
aColor = QCOLOR_TO_NS_RGB(palette.color(QPalette::Normal, QPalette::Window));
|
2008-04-19 16:04:37 +00:00
|
|
|
break;
|
|
|
|
|
2011-09-09 02:27:13 +00:00
|
|
|
case eColorID_menutext:
|
|
|
|
case eColorID__moz_menubartext:
|
2008-04-19 16:07:10 +00:00
|
|
|
aColor = QCOLOR_TO_NS_RGB(palette.color(QPalette::Normal, QPalette::Text));
|
2008-04-19 16:04:37 +00:00
|
|
|
break;
|
|
|
|
|
2011-09-09 02:27:13 +00:00
|
|
|
case eColorID_scrollbar:
|
2008-04-19 16:07:15 +00:00
|
|
|
aColor = QCOLOR_TO_NS_RGB(palette.color(QPalette::Normal, QPalette::Mid));
|
2008-04-19 16:04:37 +00:00
|
|
|
break;
|
|
|
|
|
2011-09-09 02:27:13 +00:00
|
|
|
case eColorID_threedface:
|
|
|
|
case eColorID_buttonface:
|
2008-04-19 16:07:10 +00:00
|
|
|
aColor = QCOLOR_TO_NS_RGB(palette.color(QPalette::Normal, QPalette::Button));
|
2008-04-19 16:04:37 +00:00
|
|
|
break;
|
|
|
|
|
2011-09-09 02:27:13 +00:00
|
|
|
case eColorID_buttonhighlight:
|
|
|
|
case eColorID_threedhighlight:
|
2008-04-19 16:07:15 +00:00
|
|
|
aColor = QCOLOR_TO_NS_RGB(palette.color(QPalette::Normal, QPalette::Dark));
|
2008-04-19 16:04:37 +00:00
|
|
|
break;
|
|
|
|
|
2011-09-09 02:27:13 +00:00
|
|
|
case eColorID_buttontext:
|
2008-04-19 16:07:10 +00:00
|
|
|
aColor = QCOLOR_TO_NS_RGB(palette.color(QPalette::Normal, QPalette::ButtonText));
|
2008-04-19 16:04:37 +00:00
|
|
|
break;
|
|
|
|
|
2011-09-09 02:27:13 +00:00
|
|
|
case eColorID_buttonshadow:
|
|
|
|
case eColorID_threedshadow:
|
2008-04-19 16:07:15 +00:00
|
|
|
aColor = QCOLOR_TO_NS_RGB(palette.color(QPalette::Normal, QPalette::Dark));
|
2008-04-19 16:04:37 +00:00
|
|
|
break;
|
|
|
|
|
2011-09-09 02:27:13 +00:00
|
|
|
case eColorID_threeddarkshadow:
|
2008-04-19 16:07:15 +00:00
|
|
|
aColor = QCOLOR_TO_NS_RGB(palette.color(QPalette::Normal, QPalette::Shadow));
|
2008-04-19 16:04:37 +00:00
|
|
|
break;
|
|
|
|
|
2011-09-09 02:27:13 +00:00
|
|
|
case eColorID_threedlightshadow:
|
2008-04-19 16:07:10 +00:00
|
|
|
aColor = QCOLOR_TO_NS_RGB(palette.color(QPalette::Normal, QPalette::Light));
|
2008-04-19 16:04:37 +00:00
|
|
|
break;
|
|
|
|
|
2011-09-09 02:27:13 +00:00
|
|
|
case eColorID_window:
|
|
|
|
case eColorID_windowframe:
|
2008-04-19 16:07:10 +00:00
|
|
|
aColor = QCOLOR_TO_NS_RGB(palette.color(QPalette::Normal, QPalette::Window));
|
2008-04-19 16:04:37 +00:00
|
|
|
break;
|
|
|
|
|
2011-09-09 02:27:13 +00:00
|
|
|
case eColorID_windowtext:
|
2008-04-19 16:07:10 +00:00
|
|
|
aColor = QCOLOR_TO_NS_RGB(palette.color(QPalette::Normal, QPalette::Text));
|
2008-04-19 16:04:37 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
// from the CSS3 working draft (not yet finalized)
|
|
|
|
// http://www.w3.org/tr/2000/wd-css3-userint-20000216.html#color
|
|
|
|
|
2011-09-09 02:27:13 +00:00
|
|
|
case eColorID__moz_buttondefault:
|
2008-04-19 16:09:56 +00:00
|
|
|
aColor = QCOLOR_TO_NS_RGB(palette.color(QPalette::Normal, QPalette::Button));
|
|
|
|
break;
|
2008-04-19 16:04:37 +00:00
|
|
|
|
2011-09-09 02:27:13 +00:00
|
|
|
case eColorID__moz_field:
|
|
|
|
case eColorID__moz_combobox:
|
2008-04-19 16:09:56 +00:00
|
|
|
aColor = QCOLOR_TO_NS_RGB(palette.color(QPalette::Normal, QPalette::Base));
|
|
|
|
break;
|
|
|
|
|
2011-09-09 02:27:13 +00:00
|
|
|
case eColorID__moz_fieldtext:
|
|
|
|
case eColorID__moz_comboboxtext:
|
2008-04-19 16:09:56 +00:00
|
|
|
aColor = QCOLOR_TO_NS_RGB(palette.color(QPalette::Normal, QPalette::Text));
|
|
|
|
break;
|
|
|
|
|
2011-09-09 02:27:13 +00:00
|
|
|
case eColorID__moz_dialog:
|
2008-04-19 16:09:56 +00:00
|
|
|
aColor = QCOLOR_TO_NS_RGB(palette.color(QPalette::Normal, QPalette::Window));
|
|
|
|
break;
|
2008-04-19 16:04:37 +00:00
|
|
|
|
2011-09-09 02:27:13 +00:00
|
|
|
case eColorID__moz_dialogtext:
|
2008-04-19 16:09:56 +00:00
|
|
|
aColor = QCOLOR_TO_NS_RGB(palette.color(QPalette::Normal, QPalette::WindowText));
|
|
|
|
break;
|
2008-04-19 16:04:37 +00:00
|
|
|
|
2011-09-09 02:27:13 +00:00
|
|
|
case eColorID__moz_dragtargetzone:
|
2008-04-19 16:09:56 +00:00
|
|
|
aColor = QCOLOR_TO_NS_RGB(palette.color(QPalette::Normal, QPalette::Window));
|
|
|
|
break;
|
2008-04-19 16:04:37 +00:00
|
|
|
|
2011-09-09 02:27:13 +00:00
|
|
|
case eColorID__moz_buttonhovertext:
|
2008-04-19 16:09:56 +00:00
|
|
|
aColor = QCOLOR_TO_NS_RGB(palette.color(QPalette::Normal, QPalette::ButtonText));
|
|
|
|
break;
|
2008-04-19 16:07:10 +00:00
|
|
|
|
2011-09-09 02:27:13 +00:00
|
|
|
case eColorID__moz_menuhovertext:
|
|
|
|
case eColorID__moz_menubarhovertext:
|
2008-04-19 16:09:56 +00:00
|
|
|
aColor = QCOLOR_TO_NS_RGB(palette.color(QPalette::Normal, QPalette::Text));
|
|
|
|
break;
|
2008-04-19 16:07:20 +00:00
|
|
|
|
2008-04-19 16:09:56 +00:00
|
|
|
default:
|
|
|
|
aColor = 0;
|
|
|
|
res = NS_ERROR_FAILURE;
|
|
|
|
break;
|
2008-04-19 16:04:37 +00:00
|
|
|
}
|
|
|
|
return res;
|
2008-04-19 15:31:50 +00:00
|
|
|
}
|
|
|
|
|
2008-04-19 16:07:10 +00:00
|
|
|
#ifdef NS_LOOKANDFEEL_DEBUG
|
2008-04-19 15:31:50 +00:00
|
|
|
static const char *metricToString[] = {
|
2011-09-09 02:27:13 +00:00
|
|
|
"eIntID_CaretBlinkTime",
|
|
|
|
"eIntID_CaretWidth",
|
|
|
|
"eIntID_ShowCaretDuringSelection",
|
|
|
|
"eIntID_SelectTextfieldsOnKeyFocus",
|
|
|
|
"eIntID_SubmenuDelay",
|
|
|
|
"eIntID_MenusCanOverlapOSBar",
|
|
|
|
"eIntID_SkipNavigatingDisabledMenuItem",
|
|
|
|
"eIntID_DragThresholdX",
|
|
|
|
"eIntID_DragThresholdY",
|
|
|
|
"eIntID_UseAccessibilityTheme",
|
|
|
|
"eIntID_ScrollArrowStyle",
|
|
|
|
"eIntID_ScrollSliderStyle",
|
|
|
|
"eIntID_ScrollButtonLeftMouseButtonAction",
|
|
|
|
"eIntID_ScrollButtonMiddleMouseButtonAction",
|
|
|
|
"eIntID_ScrollButtonRightMouseButtonAction",
|
|
|
|
"eIntID_TreeOpenDelay",
|
|
|
|
"eIntID_TreeCloseDelay",
|
|
|
|
"eIntID_TreeLazyScrollDelay",
|
|
|
|
"eIntID_TreeScrollDelay",
|
|
|
|
"eIntID_TreeScrollLinesMax",
|
|
|
|
"eIntID_TabFocusModel",
|
|
|
|
"eIntID_WindowsDefaultTheme",
|
|
|
|
"eIntID_AlertNotificationOrigin",
|
|
|
|
"eIntID_ScrollToClick",
|
|
|
|
"eIntID_IMERawInputUnderlineStyle",
|
|
|
|
"eIntID_IMESelectedRawTextUnderlineStyle",
|
|
|
|
"eIntID_IMEConvertedTextUnderlineStyle",
|
|
|
|
"eIntID_IMESelectedConvertedTextUnderline",
|
|
|
|
"eIntID_ImagesInMenus"
|
2008-04-19 15:31:50 +00:00
|
|
|
};
|
2008-04-19 16:07:10 +00:00
|
|
|
#endif
|
2008-04-19 15:31:50 +00:00
|
|
|
|
2011-09-09 02:27:13 +00:00
|
|
|
nsresult
|
|
|
|
nsLookAndFeel::GetIntImpl(IntID aID, PRInt32 &aResult)
|
2008-04-19 15:31:50 +00:00
|
|
|
{
|
2008-04-19 16:07:10 +00:00
|
|
|
#ifdef NS_LOOKANDFEEL_DEBUG
|
2011-09-09 02:27:13 +00:00
|
|
|
qDebug("nsLookAndFeel::GetIntImpl aID = %s", metricToString[aID]);
|
2008-04-19 16:07:10 +00:00
|
|
|
#endif
|
|
|
|
|
2011-09-09 02:27:13 +00:00
|
|
|
nsresult res = nsXPLookAndFeel::GetIntImpl(aID, aResult);
|
2008-04-19 16:04:37 +00:00
|
|
|
if (NS_SUCCEEDED(res))
|
|
|
|
return res;
|
2008-04-19 16:07:10 +00:00
|
|
|
|
2008-04-19 16:04:37 +00:00
|
|
|
res = NS_OK;
|
|
|
|
|
|
|
|
switch (aID) {
|
2011-09-09 02:27:13 +00:00
|
|
|
case eIntID_CaretBlinkTime:
|
|
|
|
aResult = 500;
|
2008-04-19 16:04:37 +00:00
|
|
|
break;
|
|
|
|
|
2011-09-09 02:27:13 +00:00
|
|
|
case eIntID_CaretWidth:
|
|
|
|
aResult = 1;
|
2008-04-19 16:04:37 +00:00
|
|
|
break;
|
|
|
|
|
2011-09-09 02:27:13 +00:00
|
|
|
case eIntID_ShowCaretDuringSelection:
|
|
|
|
aResult = 0;
|
2008-04-19 16:04:37 +00:00
|
|
|
break;
|
|
|
|
|
2011-09-09 02:27:13 +00:00
|
|
|
case eIntID_SelectTextfieldsOnKeyFocus:
|
2008-04-19 16:04:37 +00:00
|
|
|
// Select textfield content when focused by kbd
|
|
|
|
// used by nsEventStateManager::sTextfieldSelectModel
|
2011-09-09 02:27:13 +00:00
|
|
|
aResult = 1;
|
2008-04-19 16:04:37 +00:00
|
|
|
break;
|
|
|
|
|
2011-09-09 02:27:13 +00:00
|
|
|
case eIntID_SubmenuDelay:
|
|
|
|
aResult = 200;
|
2008-04-19 16:04:37 +00:00
|
|
|
break;
|
|
|
|
|
2011-12-16 09:18:48 +00:00
|
|
|
case eIntID_TooltipDelay:
|
|
|
|
aResult = 500;
|
|
|
|
break;
|
|
|
|
|
2011-09-09 02:27:13 +00:00
|
|
|
case eIntID_MenusCanOverlapOSBar:
|
2008-04-19 16:04:37 +00:00
|
|
|
// we want XUL popups to be able to overlap the task bar.
|
2011-09-09 02:27:13 +00:00
|
|
|
aResult = 1;
|
2008-04-19 16:04:37 +00:00
|
|
|
break;
|
|
|
|
|
2011-09-09 02:27:13 +00:00
|
|
|
case eIntID_ScrollArrowStyle:
|
|
|
|
aResult = eScrollArrowStyle_Single;
|
2008-04-19 16:04:37 +00:00
|
|
|
break;
|
|
|
|
|
2011-09-09 02:27:13 +00:00
|
|
|
case eIntID_ScrollSliderStyle:
|
|
|
|
aResult = eScrollThumbStyle_Proportional;
|
2008-04-19 16:04:37 +00:00
|
|
|
break;
|
|
|
|
|
2011-09-09 02:27:13 +00:00
|
|
|
case eIntID_TouchEnabled:
|
2010-02-04 14:42:47 +00:00
|
|
|
#ifdef MOZ_PLATFORM_MAEMO
|
2010-02-04 14:49:55 +00:00
|
|
|
// All known Maemo devices are touch enabled.
|
2011-09-09 02:27:13 +00:00
|
|
|
aResult = 1;
|
2010-02-04 14:42:47 +00:00
|
|
|
#else
|
2011-09-09 02:27:13 +00:00
|
|
|
aResult = 0;
|
2010-02-04 14:42:47 +00:00
|
|
|
res = NS_ERROR_NOT_IMPLEMENTED;
|
|
|
|
#endif
|
|
|
|
break;
|
|
|
|
|
2011-09-09 02:27:13 +00:00
|
|
|
case eIntID_WindowsDefaultTheme:
|
|
|
|
case eIntID_MaemoClassic:
|
|
|
|
aResult = 0;
|
2008-04-19 16:07:10 +00:00
|
|
|
res = NS_ERROR_NOT_IMPLEMENTED;
|
|
|
|
break;
|
|
|
|
|
2011-09-09 02:27:13 +00:00
|
|
|
case eIntID_SpellCheckerUnderlineStyle:
|
|
|
|
aResult = NS_STYLE_TEXT_DECORATION_STYLE_WAVY;
|
2009-04-03 07:26:28 +00:00
|
|
|
break;
|
|
|
|
|
2011-11-17 23:41:35 +00:00
|
|
|
case eIntID_ScrollbarButtonAutoRepeatBehavior:
|
|
|
|
aResult = 1;
|
|
|
|
break;
|
|
|
|
|
2008-04-19 16:04:37 +00:00
|
|
|
default:
|
2011-09-09 02:27:13 +00:00
|
|
|
aResult = 0;
|
2008-04-19 16:04:37 +00:00
|
|
|
res = NS_ERROR_FAILURE;
|
|
|
|
}
|
|
|
|
return res;
|
2008-04-19 15:31:50 +00:00
|
|
|
}
|
|
|
|
|
2008-04-19 16:07:10 +00:00
|
|
|
#ifdef NS_LOOKANDFEEL_DEBUG
|
|
|
|
static const char *floatMetricToString[] = {
|
2011-09-09 02:27:13 +00:00
|
|
|
"eFloatID_IMEUnderlineRelativeSize"
|
2008-04-19 16:07:10 +00:00
|
|
|
};
|
|
|
|
#endif
|
|
|
|
|
2011-09-09 02:27:13 +00:00
|
|
|
nsresult
|
|
|
|
nsLookAndFeel::GetFloatImpl(FloatID aID, float &aResult)
|
2008-04-19 15:31:50 +00:00
|
|
|
{
|
2008-04-19 16:07:10 +00:00
|
|
|
#ifdef NS_LOOKANDFEEL_DEBUG
|
2011-09-09 02:27:13 +00:00
|
|
|
qDebug("nsLookAndFeel::GetFloatImpl aID = %s", floatMetricToString[aID]);
|
2008-04-19 16:07:10 +00:00
|
|
|
#endif
|
|
|
|
|
2011-09-09 02:27:13 +00:00
|
|
|
nsresult res = nsXPLookAndFeel::GetFloatImpl(aID, aResult);
|
2008-04-19 16:04:37 +00:00
|
|
|
if (NS_SUCCEEDED(res))
|
|
|
|
return res;
|
|
|
|
res = NS_OK;
|
|
|
|
|
|
|
|
switch (aID) {
|
2011-09-09 02:27:13 +00:00
|
|
|
case eFloatID_IMEUnderlineRelativeSize:
|
|
|
|
aResult = 1.0f;
|
2008-04-19 16:04:37 +00:00
|
|
|
break;
|
|
|
|
|
2011-09-09 02:27:13 +00:00
|
|
|
case eFloatID_SpellCheckerUnderlineRelativeSize:
|
|
|
|
aResult = 1.0f;
|
2009-04-03 07:26:28 +00:00
|
|
|
break;
|
|
|
|
|
2008-04-19 16:04:37 +00:00
|
|
|
default:
|
2011-09-09 02:27:13 +00:00
|
|
|
aResult = -1.0;
|
2008-04-19 16:04:37 +00:00
|
|
|
res = NS_ERROR_FAILURE;
|
2008-04-19 16:07:10 +00:00
|
|
|
break;
|
2008-04-19 16:04:37 +00:00
|
|
|
}
|
|
|
|
return res;
|
2008-04-19 15:31:50 +00:00
|
|
|
}
|