2014-02-20 18:09:02 -08:00
|
|
|
/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
|
|
|
/* Copyright 2012 Mozilla Foundation and Mozilla contributors
|
|
|
|
*
|
|
|
|
* Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
|
|
|
|
*
|
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
* See the License for the specific language governing permissions and
|
|
|
|
* limitations under the License.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <QGuiApplication>
|
2012-02-20 15:19:48 -08:00
|
|
|
#include <QFont>
|
2014-02-20 18:09:02 -08:00
|
|
|
#include <QScreen>
|
2014-10-07 07:05:17 -07:00
|
|
|
#include <QPalette>
|
|
|
|
#include <QStyle>
|
|
|
|
#include <QStyleFactory>
|
2008-04-19 09:07:10 -07:00
|
|
|
|
2012-02-20 15:19:48 -08:00
|
|
|
#include "nsLookAndFeel.h"
|
|
|
|
#include "nsStyleConsts.h"
|
2014-02-20 18:09:02 -08:00
|
|
|
#include "gfxFont.h"
|
|
|
|
#include "gfxFontConstants.h"
|
|
|
|
#include "mozilla/gfx/2D.h"
|
2012-02-20 15:19:48 -08:00
|
|
|
|
2014-02-20 18:09:02 -08:00
|
|
|
static const char16_t UNICODE_BULLET = 0x2022;
|
2008-04-19 08:31:50 -07:00
|
|
|
|
2014-10-07 07:05:17 -07:00
|
|
|
#define QCOLOR_TO_NS_RGB(c) \
|
|
|
|
((nscolor)NS_RGB(c.red(),c.green(),c.blue()))
|
|
|
|
|
2012-02-20 15:19:48 -08:00
|
|
|
nsLookAndFeel::nsLookAndFeel()
|
2014-02-20 18:09:02 -08:00
|
|
|
: nsXPLookAndFeel()
|
2008-04-19 08:31:50 -07:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
nsLookAndFeel::~nsLookAndFeel()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2011-09-08 19:27:13 -07:00
|
|
|
nsresult
|
|
|
|
nsLookAndFeel::NativeGetColor(ColorID aID, nscolor &aColor)
|
2008-04-19 08:31:50 -07:00
|
|
|
{
|
2014-02-20 18:09:02 -08:00
|
|
|
nsresult rv = NS_OK;
|
|
|
|
|
|
|
|
#define BG_PRELIGHT_COLOR NS_RGB(0xee,0xee,0xee)
|
|
|
|
#define FG_PRELIGHT_COLOR NS_RGB(0x77,0x77,0x77)
|
2014-10-07 07:05:17 -07:00
|
|
|
#define RED_COLOR NS_RGB(0xff,0x00,0x00)
|
|
|
|
|
|
|
|
QPalette palette = QGuiApplication::palette();
|
2014-02-20 18:09:02 -08:00
|
|
|
|
|
|
|
switch (aID) {
|
|
|
|
// These colors don't seem to be used for anything anymore in Mozilla
|
|
|
|
// (except here at least TextSelectBackground and TextSelectForeground)
|
|
|
|
// The CSS2 colors below are used.
|
2011-09-08 19:27:13 -07:00
|
|
|
case eColorID_WindowBackground:
|
2014-10-07 07:05:17 -07:00
|
|
|
aColor = QCOLOR_TO_NS_RGB(palette.color(QPalette::Normal, QPalette::Window));
|
2014-02-20 18:09:02 -08:00
|
|
|
break;
|
2011-09-08 19:27:13 -07:00
|
|
|
case eColorID_WindowForeground:
|
2014-10-07 07:05:17 -07:00
|
|
|
aColor = QCOLOR_TO_NS_RGB(palette.color(QPalette::Normal, QPalette::WindowText));
|
2014-02-20 18:09:02 -08:00
|
|
|
break;
|
2011-09-08 19:27:13 -07:00
|
|
|
case eColorID_WidgetBackground:
|
2014-10-07 07:05:17 -07:00
|
|
|
aColor = QCOLOR_TO_NS_RGB(palette.color(QPalette::Normal, QPalette::Window));
|
2014-02-20 18:09:02 -08:00
|
|
|
break;
|
2011-09-08 19:27:13 -07:00
|
|
|
case eColorID_WidgetForeground:
|
2014-10-07 07:05:17 -07:00
|
|
|
aColor = QCOLOR_TO_NS_RGB(palette.color(QPalette::Normal, QPalette::WindowText));
|
2014-02-20 18:09:02 -08:00
|
|
|
break;
|
2011-09-08 19:27:13 -07:00
|
|
|
case eColorID_WidgetSelectBackground:
|
2014-10-07 07:05:17 -07:00
|
|
|
aColor = QCOLOR_TO_NS_RGB(palette.color(QPalette::Normal, QPalette::Window));
|
2014-02-20 18:09:02 -08:00
|
|
|
break;
|
2011-09-08 19:27:13 -07:00
|
|
|
case eColorID_WidgetSelectForeground:
|
2014-10-07 07:05:17 -07:00
|
|
|
aColor = QCOLOR_TO_NS_RGB(palette.color(QPalette::Normal, QPalette::WindowText));
|
2014-02-20 18:09:02 -08:00
|
|
|
break;
|
2011-09-08 19:27:13 -07:00
|
|
|
case eColorID_Widget3DHighlight:
|
2014-02-20 18:09:02 -08:00
|
|
|
aColor = NS_RGB(0xa0,0xa0,0xa0);
|
|
|
|
break;
|
2011-09-08 19:27:13 -07:00
|
|
|
case eColorID_Widget3DShadow:
|
2014-02-20 18:09:02 -08:00
|
|
|
aColor = NS_RGB(0x40,0x40,0x40);
|
|
|
|
break;
|
2011-09-08 19:27:13 -07:00
|
|
|
case eColorID_TextBackground:
|
2014-02-20 18:09:02 -08:00
|
|
|
// not used?
|
2014-10-07 07:05:17 -07:00
|
|
|
aColor = QCOLOR_TO_NS_RGB(palette.color(QPalette::Normal, QPalette::Window));
|
2014-02-20 18:09:02 -08:00
|
|
|
break;
|
2011-09-08 19:27:13 -07:00
|
|
|
case eColorID_TextForeground:
|
2014-02-20 18:09:02 -08:00
|
|
|
// not used?
|
2014-10-07 07:05:17 -07:00
|
|
|
aColor = QCOLOR_TO_NS_RGB(palette.color(QPalette::Normal, QPalette::WindowText));
|
2014-02-20 18:09:02 -08:00
|
|
|
break;
|
2011-09-08 19:27:13 -07:00
|
|
|
case eColorID_TextSelectBackground:
|
|
|
|
case eColorID_IMESelectedRawTextBackground:
|
|
|
|
case eColorID_IMESelectedConvertedTextBackground:
|
2014-02-20 18:09:02 -08:00
|
|
|
// still used
|
2014-10-07 07:05:17 -07:00
|
|
|
aColor = QCOLOR_TO_NS_RGB(palette.color(QPalette::Normal, QPalette::Highlight));
|
2014-02-20 18:09:02 -08:00
|
|
|
break;
|
2011-09-08 19:27:13 -07:00
|
|
|
case eColorID_TextSelectForeground:
|
|
|
|
case eColorID_IMESelectedRawTextForeground:
|
|
|
|
case eColorID_IMESelectedConvertedTextForeground:
|
2014-02-20 18:09:02 -08:00
|
|
|
// still used
|
2014-10-07 07:05:17 -07:00
|
|
|
aColor = QCOLOR_TO_NS_RGB(palette.color(QPalette::Normal, QPalette::HighlightedText));
|
2014-02-20 18:09:02 -08:00
|
|
|
break;
|
2011-09-08 19:27:13 -07:00
|
|
|
case eColorID_IMERawInputBackground:
|
|
|
|
case eColorID_IMEConvertedTextBackground:
|
2014-02-20 18:09:02 -08:00
|
|
|
aColor = NS_TRANSPARENT;
|
|
|
|
break;
|
2011-09-08 19:27:13 -07:00
|
|
|
case eColorID_IMERawInputForeground:
|
|
|
|
case eColorID_IMEConvertedTextForeground:
|
2014-02-20 18:09:02 -08:00
|
|
|
aColor = NS_SAME_AS_FOREGROUND_COLOR;
|
|
|
|
break;
|
2011-09-08 19:27:13 -07:00
|
|
|
case eColorID_IMERawInputUnderline:
|
|
|
|
case eColorID_IMEConvertedTextUnderline:
|
2014-02-20 18:09:02 -08:00
|
|
|
aColor = NS_SAME_AS_FOREGROUND_COLOR;
|
|
|
|
break;
|
2011-09-08 19:27:13 -07:00
|
|
|
case eColorID_IMESelectedRawTextUnderline:
|
|
|
|
case eColorID_IMESelectedConvertedTextUnderline:
|
2014-02-20 18:09:02 -08:00
|
|
|
aColor = NS_TRANSPARENT;
|
|
|
|
break;
|
2011-09-08 19:27:13 -07:00
|
|
|
case eColorID_SpellCheckerUnderline:
|
2014-10-07 07:05:17 -07:00
|
|
|
aColor = RED_COLOR;
|
|
|
|
break;
|
2009-04-03 00:26:28 -07:00
|
|
|
|
2014-02-20 18:09:02 -08:00
|
|
|
// css2 http://www.w3.org/TR/REC-CSS2/ui.html#system-colors
|
2011-09-08 19:27:13 -07:00
|
|
|
case eColorID_activeborder:
|
2014-02-20 18:09:02 -08:00
|
|
|
// active window border
|
2014-10-07 07:05:17 -07:00
|
|
|
aColor = QCOLOR_TO_NS_RGB(palette.color(QPalette::Normal, QPalette::Window));
|
2014-02-20 18:09:02 -08:00
|
|
|
break;
|
2011-09-08 19:27:13 -07:00
|
|
|
case eColorID_activecaption:
|
2014-02-20 18:09:02 -08:00
|
|
|
// active window caption background
|
2014-10-07 07:05:17 -07:00
|
|
|
aColor = QCOLOR_TO_NS_RGB(palette.color(QPalette::Normal, QPalette::Window));
|
2014-02-20 18:09:02 -08:00
|
|
|
break;
|
2011-09-08 19:27:13 -07:00
|
|
|
case eColorID_appworkspace:
|
2014-02-20 18:09:02 -08:00
|
|
|
// MDI background color
|
2014-10-07 07:05:17 -07:00
|
|
|
aColor = QCOLOR_TO_NS_RGB(palette.color(QPalette::Normal, QPalette::Window));
|
2014-02-20 18:09:02 -08:00
|
|
|
break;
|
2011-09-08 19:27:13 -07:00
|
|
|
case eColorID_background:
|
2014-02-20 18:09:02 -08:00
|
|
|
// desktop background
|
2014-10-07 07:05:17 -07:00
|
|
|
aColor = QCOLOR_TO_NS_RGB(palette.color(QPalette::Normal, QPalette::Window));
|
2014-02-20 18:09:02 -08:00
|
|
|
break;
|
2011-09-08 19:27:13 -07:00
|
|
|
case eColorID_captiontext:
|
2014-02-20 18:09:02 -08:00
|
|
|
// text in active window caption, size box, and scrollbar arrow box (!)
|
2014-10-07 07:05:17 -07:00
|
|
|
aColor = QCOLOR_TO_NS_RGB(palette.color(QPalette::Normal, QPalette::Text));
|
2014-02-20 18:09:02 -08:00
|
|
|
break;
|
2011-09-08 19:27:13 -07:00
|
|
|
case eColorID_graytext:
|
2014-02-20 18:09:02 -08:00
|
|
|
// disabled text in windows, menus, etc.
|
2014-10-07 07:05:17 -07:00
|
|
|
aColor = QCOLOR_TO_NS_RGB(palette.color(QPalette::Disabled, QPalette::Text));
|
2014-02-20 18:09:02 -08:00
|
|
|
break;
|
2011-09-08 19:27:13 -07:00
|
|
|
case eColorID_highlight:
|
2014-02-20 18:09:02 -08:00
|
|
|
// background of selected item
|
2014-10-07 07:05:17 -07:00
|
|
|
aColor = QCOLOR_TO_NS_RGB(palette.color(QPalette::Normal, QPalette::Highlight));
|
2014-02-20 18:09:02 -08:00
|
|
|
break;
|
2011-09-08 19:27:13 -07:00
|
|
|
case eColorID_highlighttext:
|
2014-02-20 18:09:02 -08:00
|
|
|
// text of selected item
|
2014-10-07 07:05:17 -07:00
|
|
|
aColor = QCOLOR_TO_NS_RGB(palette.color(QPalette::Normal, QPalette::HighlightedText));
|
2014-02-20 18:09:02 -08:00
|
|
|
break;
|
2011-09-08 19:27:13 -07:00
|
|
|
case eColorID_inactiveborder:
|
2014-02-20 18:09:02 -08:00
|
|
|
// inactive window border
|
2014-10-07 07:05:17 -07:00
|
|
|
aColor = QCOLOR_TO_NS_RGB(palette.color(QPalette::Disabled, QPalette::Window));
|
2014-02-20 18:09:02 -08:00
|
|
|
break;
|
2011-09-08 19:27:13 -07:00
|
|
|
case eColorID_inactivecaption:
|
2014-02-20 18:09:02 -08:00
|
|
|
// inactive window caption
|
2014-10-07 07:05:17 -07:00
|
|
|
aColor = QCOLOR_TO_NS_RGB(palette.color(QPalette::Disabled, QPalette::Window));
|
2014-02-20 18:09:02 -08:00
|
|
|
break;
|
2011-09-08 19:27:13 -07:00
|
|
|
case eColorID_inactivecaptiontext:
|
2014-02-20 18:09:02 -08:00
|
|
|
// text in inactive window caption
|
2014-10-07 07:05:17 -07:00
|
|
|
aColor = QCOLOR_TO_NS_RGB(palette.color(QPalette::Disabled, QPalette::Text));
|
2014-02-20 18:09:02 -08:00
|
|
|
break;
|
2011-09-08 19:27:13 -07:00
|
|
|
case eColorID_infobackground:
|
2014-02-20 18:09:02 -08:00
|
|
|
// tooltip background color
|
2014-10-07 07:05:17 -07:00
|
|
|
aColor = QCOLOR_TO_NS_RGB(palette.color(QPalette::Normal, QPalette::ToolTipBase));
|
2014-02-20 18:09:02 -08:00
|
|
|
break;
|
2011-09-08 19:27:13 -07:00
|
|
|
case eColorID_infotext:
|
2014-02-20 18:09:02 -08:00
|
|
|
// tooltip text color
|
2014-10-07 07:05:17 -07:00
|
|
|
aColor = QCOLOR_TO_NS_RGB(palette.color(QPalette::Normal, QPalette::ToolTipText));
|
2014-02-20 18:09:02 -08:00
|
|
|
break;
|
2011-09-08 19:27:13 -07:00
|
|
|
case eColorID_menu:
|
2014-02-20 18:09:02 -08:00
|
|
|
// menu background
|
2014-10-07 07:05:17 -07:00
|
|
|
aColor = QCOLOR_TO_NS_RGB(palette.color(QPalette::Normal, QPalette::Window));
|
2014-02-20 18:09:02 -08:00
|
|
|
break;
|
2011-09-08 19:27:13 -07:00
|
|
|
case eColorID_menutext:
|
2014-02-20 18:09:02 -08:00
|
|
|
// menu text
|
2014-10-07 07:05:17 -07:00
|
|
|
aColor = QCOLOR_TO_NS_RGB(palette.color(QPalette::Normal, QPalette::Text));
|
2014-02-20 18:09:02 -08:00
|
|
|
break;
|
2011-09-08 19:27:13 -07:00
|
|
|
case eColorID_scrollbar:
|
2014-02-20 18:09:02 -08:00
|
|
|
// scrollbar gray area
|
2014-10-07 07:05:17 -07:00
|
|
|
aColor = QCOLOR_TO_NS_RGB(palette.color(QPalette::Normal, QPalette::Mid));
|
2014-02-20 18:09:02 -08:00
|
|
|
break;
|
2008-04-19 09:04:37 -07:00
|
|
|
|
2011-09-08 19:27:13 -07:00
|
|
|
case eColorID_threedface:
|
|
|
|
case eColorID_buttonface:
|
2014-02-20 18:09:02 -08:00
|
|
|
// 3-D face color
|
2014-10-07 07:05:17 -07:00
|
|
|
aColor = QCOLOR_TO_NS_RGB(palette.color(QPalette::Normal, QPalette::Button));
|
2014-02-20 18:09:02 -08:00
|
|
|
break;
|
|
|
|
|
|
|
|
case eColorID_buttontext:
|
|
|
|
// text on push buttons
|
2014-10-07 07:05:17 -07:00
|
|
|
aColor = QCOLOR_TO_NS_RGB(palette.color(QPalette::Normal, QPalette::ButtonText));
|
2014-02-20 18:09:02 -08:00
|
|
|
break;
|
2008-04-19 09:04:37 -07:00
|
|
|
|
2011-09-08 19:27:13 -07:00
|
|
|
case eColorID_buttonhighlight:
|
2014-02-20 18:09:02 -08:00
|
|
|
// 3-D highlighted edge color
|
2011-09-08 19:27:13 -07:00
|
|
|
case eColorID_threedhighlight:
|
2014-02-20 18:09:02 -08:00
|
|
|
// 3-D highlighted outer edge color
|
2014-10-07 07:05:17 -07:00
|
|
|
aColor = QCOLOR_TO_NS_RGB(palette.color(QPalette::Normal, QPalette::Dark));
|
2014-02-20 18:09:02 -08:00
|
|
|
break;
|
2008-04-19 09:04:37 -07:00
|
|
|
|
2014-02-20 18:09:02 -08:00
|
|
|
case eColorID_threedlightshadow:
|
|
|
|
// 3-D highlighted inner edge color
|
2014-10-07 07:05:17 -07:00
|
|
|
aColor = QCOLOR_TO_NS_RGB(palette.color(QPalette::Normal, QPalette::Light));
|
2014-02-20 18:09:02 -08:00
|
|
|
break;
|
2008-04-19 09:04:37 -07:00
|
|
|
|
2011-09-08 19:27:13 -07:00
|
|
|
case eColorID_buttonshadow:
|
2014-02-20 18:09:02 -08:00
|
|
|
// 3-D shadow edge color
|
2011-09-08 19:27:13 -07:00
|
|
|
case eColorID_threedshadow:
|
2014-02-20 18:09:02 -08:00
|
|
|
// 3-D shadow inner edge color
|
2014-10-07 07:05:17 -07:00
|
|
|
aColor = QCOLOR_TO_NS_RGB(palette.color(QPalette::Normal, QPalette::Dark));
|
2014-02-20 18:09:02 -08:00
|
|
|
break;
|
2008-04-19 09:04:37 -07:00
|
|
|
|
2011-09-08 19:27:13 -07:00
|
|
|
case eColorID_threeddarkshadow:
|
2014-02-20 18:09:02 -08:00
|
|
|
// 3-D shadow outer edge color
|
2014-10-07 07:05:17 -07:00
|
|
|
aColor = QCOLOR_TO_NS_RGB(palette.color(QPalette::Normal, QPalette::Shadow));
|
2014-02-20 18:09:02 -08:00
|
|
|
break;
|
2008-04-19 09:04:37 -07:00
|
|
|
|
2011-09-08 19:27:13 -07:00
|
|
|
case eColorID_window:
|
|
|
|
case eColorID_windowframe:
|
2014-10-07 07:05:17 -07:00
|
|
|
aColor = QCOLOR_TO_NS_RGB(palette.color(QPalette::Normal, QPalette::Window));
|
2014-02-20 18:09:02 -08:00
|
|
|
break;
|
2008-04-19 09:04:37 -07:00
|
|
|
|
2011-09-08 19:27:13 -07:00
|
|
|
case eColorID_windowtext:
|
2014-10-07 07:05:17 -07:00
|
|
|
aColor = QCOLOR_TO_NS_RGB(palette.color(QPalette::Normal, QPalette::Text));
|
2014-02-20 18:09:02 -08:00
|
|
|
break;
|
2008-04-19 09:04:37 -07:00
|
|
|
|
2014-02-20 18:09:02 -08:00
|
|
|
case eColorID__moz_eventreerow:
|
2011-09-08 19:27:13 -07:00
|
|
|
case eColorID__moz_field:
|
2014-10-07 07:05:17 -07:00
|
|
|
aColor = QCOLOR_TO_NS_RGB(palette.color(QPalette::Normal, QPalette::Base));
|
2014-02-20 18:09:02 -08:00
|
|
|
break;
|
2011-09-08 19:27:13 -07:00
|
|
|
case eColorID__moz_fieldtext:
|
2014-10-07 07:05:17 -07:00
|
|
|
aColor = QCOLOR_TO_NS_RGB(palette.color(QPalette::Normal, QPalette::Text));
|
2014-02-20 18:09:02 -08:00
|
|
|
break;
|
2011-09-08 19:27:13 -07:00
|
|
|
case eColorID__moz_dialog:
|
2014-10-07 07:05:17 -07:00
|
|
|
aColor = QCOLOR_TO_NS_RGB(palette.color(QPalette::Normal, QPalette::Window));
|
2014-02-20 18:09:02 -08:00
|
|
|
break;
|
2011-09-08 19:27:13 -07:00
|
|
|
case eColorID__moz_dialogtext:
|
2014-10-07 07:05:17 -07:00
|
|
|
aColor = QCOLOR_TO_NS_RGB(palette.color(QPalette::Normal, QPalette::WindowText));
|
2014-02-20 18:09:02 -08:00
|
|
|
break;
|
2011-09-08 19:27:13 -07:00
|
|
|
case eColorID__moz_dragtargetzone:
|
2014-10-07 07:05:17 -07:00
|
|
|
aColor = QCOLOR_TO_NS_RGB(palette.color(QPalette::Normal, QPalette::Window));
|
2014-02-20 18:09:02 -08:00
|
|
|
break;
|
|
|
|
case eColorID__moz_buttondefault:
|
|
|
|
// default button border color
|
2014-10-07 07:05:17 -07:00
|
|
|
aColor = QCOLOR_TO_NS_RGB(palette.color(QPalette::Normal, QPalette::Button));
|
2014-02-20 18:09:02 -08:00
|
|
|
break;
|
|
|
|
case eColorID__moz_buttonhoverface:
|
|
|
|
aColor = BG_PRELIGHT_COLOR;
|
|
|
|
break;
|
2011-09-08 19:27:13 -07:00
|
|
|
case eColorID__moz_buttonhovertext:
|
2014-02-20 18:09:02 -08:00
|
|
|
aColor = FG_PRELIGHT_COLOR;
|
|
|
|
break;
|
|
|
|
case eColorID__moz_cellhighlight:
|
|
|
|
case eColorID__moz_html_cellhighlight:
|
2014-10-07 07:05:17 -07:00
|
|
|
aColor = QCOLOR_TO_NS_RGB(palette.color(QPalette::Normal, QPalette::Highlight));
|
2014-02-20 18:09:02 -08:00
|
|
|
break;
|
|
|
|
case eColorID__moz_cellhighlighttext:
|
|
|
|
case eColorID__moz_html_cellhighlighttext:
|
2014-10-07 07:05:17 -07:00
|
|
|
aColor = QCOLOR_TO_NS_RGB(palette.color(QPalette::Normal, QPalette::HighlightedText));
|
2014-02-20 18:09:02 -08:00
|
|
|
break;
|
|
|
|
case eColorID__moz_menuhover:
|
|
|
|
aColor = BG_PRELIGHT_COLOR;
|
|
|
|
break;
|
2011-09-08 19:27:13 -07:00
|
|
|
case eColorID__moz_menuhovertext:
|
2014-10-07 07:05:17 -07:00
|
|
|
aColor = QCOLOR_TO_NS_RGB(palette.color(QPalette::Normal, QPalette::Text));
|
2014-02-20 18:09:02 -08:00
|
|
|
break;
|
|
|
|
case eColorID__moz_oddtreerow:
|
|
|
|
aColor = NS_TRANSPARENT;
|
|
|
|
break;
|
|
|
|
case eColorID__moz_nativehyperlinktext:
|
|
|
|
aColor = NS_SAME_AS_FOREGROUND_COLOR;
|
|
|
|
break;
|
|
|
|
case eColorID__moz_comboboxtext:
|
2014-10-07 07:05:17 -07:00
|
|
|
aColor = QCOLOR_TO_NS_RGB(palette.color(QPalette::Normal, QPalette::Text));
|
2014-02-20 18:09:02 -08:00
|
|
|
break;
|
|
|
|
case eColorID__moz_combobox:
|
2014-10-07 07:05:17 -07:00
|
|
|
aColor = QCOLOR_TO_NS_RGB(palette.color(QPalette::Normal, QPalette::Base));
|
2014-02-20 18:09:02 -08:00
|
|
|
break;
|
|
|
|
case eColorID__moz_menubartext:
|
2014-10-07 07:05:17 -07:00
|
|
|
aColor = QCOLOR_TO_NS_RGB(palette.color(QPalette::Normal, QPalette::Text));
|
2014-02-20 18:09:02 -08:00
|
|
|
break;
|
2011-09-08 19:27:13 -07:00
|
|
|
case eColorID__moz_menubarhovertext:
|
2014-10-07 07:05:17 -07:00
|
|
|
aColor = QCOLOR_TO_NS_RGB(palette.color(QPalette::Normal, QPalette::Text));
|
2014-02-20 18:09:02 -08:00
|
|
|
break;
|
2008-04-19 09:09:56 -07:00
|
|
|
default:
|
2014-02-20 18:09:02 -08:00
|
|
|
/* default color is BLACK */
|
|
|
|
aColor = 0;
|
|
|
|
rv = NS_ERROR_FAILURE;
|
|
|
|
break;
|
|
|
|
}
|
2008-04-19 08:31:50 -07:00
|
|
|
|
2014-02-20 18:09:02 -08:00
|
|
|
return rv;
|
|
|
|
}
|
2008-04-19 08:31:50 -07:00
|
|
|
|
2011-09-08 19:27:13 -07:00
|
|
|
nsresult
|
2012-08-22 08:56:38 -07:00
|
|
|
nsLookAndFeel::GetIntImpl(IntID aID, int32_t &aResult)
|
2008-04-19 08:31:50 -07:00
|
|
|
{
|
2014-02-20 18:09:02 -08:00
|
|
|
nsresult rv = nsXPLookAndFeel::GetIntImpl(aID, aResult);
|
|
|
|
if (NS_SUCCEEDED(rv))
|
|
|
|
return rv;
|
|
|
|
|
|
|
|
rv = NS_OK;
|
|
|
|
|
|
|
|
switch (aID) {
|
|
|
|
case eIntID_CaretBlinkTime:
|
|
|
|
aResult = 500;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case eIntID_CaretWidth:
|
|
|
|
aResult = 1;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case eIntID_ShowCaretDuringSelection:
|
|
|
|
aResult = 0;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case eIntID_SelectTextfieldsOnKeyFocus:
|
|
|
|
// Select textfield content when focused by kbd
|
2014-03-31 21:09:23 -07:00
|
|
|
// used by EventStateManager::sTextfieldSelectModel
|
2014-02-20 18:09:02 -08:00
|
|
|
aResult = 1;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case eIntID_SubmenuDelay:
|
|
|
|
aResult = 200;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case eIntID_TooltipDelay:
|
|
|
|
aResult = 500;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case eIntID_MenusCanOverlapOSBar:
|
|
|
|
// we want XUL popups to be able to overlap the task bar.
|
|
|
|
aResult = 1;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case eIntID_ScrollArrowStyle:
|
|
|
|
aResult = eScrollArrowStyle_Single;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case eIntID_ScrollSliderStyle:
|
|
|
|
aResult = eScrollThumbStyle_Proportional;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case eIntID_TouchEnabled:
|
|
|
|
aResult = 1;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case eIntID_WindowsDefaultTheme:
|
|
|
|
case eIntID_WindowsThemeIdentifier:
|
|
|
|
case eIntID_OperatingSystemVersionIdentifier:
|
|
|
|
aResult = 0;
|
|
|
|
rv = NS_ERROR_NOT_IMPLEMENTED;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case eIntID_IMERawInputUnderlineStyle:
|
|
|
|
case eIntID_IMEConvertedTextUnderlineStyle:
|
|
|
|
aResult = NS_STYLE_TEXT_DECORATION_STYLE_SOLID;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case eIntID_IMESelectedRawTextUnderlineStyle:
|
|
|
|
case eIntID_IMESelectedConvertedTextUnderline:
|
|
|
|
aResult = NS_STYLE_TEXT_DECORATION_STYLE_NONE;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case eIntID_SpellCheckerUnderlineStyle:
|
|
|
|
aResult = NS_STYLE_TEXT_DECORATION_STYLE_WAVY;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case eIntID_ScrollbarButtonAutoRepeatBehavior:
|
|
|
|
aResult = 0;
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
aResult = 0;
|
|
|
|
rv = NS_ERROR_FAILURE;
|
|
|
|
}
|
|
|
|
|
|
|
|
return rv;
|
2008-04-19 08:31:50 -07:00
|
|
|
}
|
|
|
|
|
2011-09-08 19:27:13 -07:00
|
|
|
nsresult
|
|
|
|
nsLookAndFeel::GetFloatImpl(FloatID aID, float &aResult)
|
2008-04-19 08:31:50 -07:00
|
|
|
{
|
2011-09-08 19:27:13 -07:00
|
|
|
nsresult res = nsXPLookAndFeel::GetFloatImpl(aID, aResult);
|
2008-04-19 09:04:37 -07:00
|
|
|
if (NS_SUCCEEDED(res))
|
2012-02-20 15:19:48 -08:00
|
|
|
return res;
|
2008-04-19 09:04:37 -07:00
|
|
|
res = NS_OK;
|
|
|
|
|
|
|
|
switch (aID) {
|
2011-09-08 19:27:13 -07:00
|
|
|
case eFloatID_IMEUnderlineRelativeSize:
|
2014-02-20 18:09:02 -08:00
|
|
|
aResult = 1.0f;
|
|
|
|
break;
|
2011-09-08 19:27:13 -07:00
|
|
|
case eFloatID_SpellCheckerUnderlineRelativeSize:
|
2014-02-20 18:09:02 -08:00
|
|
|
aResult = 1.0f;
|
|
|
|
break;
|
2008-04-19 09:04:37 -07:00
|
|
|
default:
|
2014-02-20 18:09:02 -08:00
|
|
|
aResult = -1.0;
|
|
|
|
res = NS_ERROR_FAILURE;
|
|
|
|
}
|
2008-04-19 09:04:37 -07:00
|
|
|
return res;
|
2008-04-19 08:31:50 -07:00
|
|
|
}
|
2012-02-20 15:19:48 -08:00
|
|
|
|
2014-02-20 18:09:02 -08:00
|
|
|
/*virtual*/
|
|
|
|
bool
|
|
|
|
nsLookAndFeel::GetFontImpl(FontID aID, nsString& aFontName,
|
|
|
|
gfxFontStyle& aFontStyle,
|
|
|
|
float aDevPixPerCSSPixel)
|
2012-02-20 15:19:48 -08:00
|
|
|
{
|
2014-02-20 18:09:02 -08:00
|
|
|
QFont qFont = QGuiApplication::font();
|
2012-02-20 15:19:48 -08:00
|
|
|
|
|
|
|
NS_NAMED_LITERAL_STRING(quote, "\"");
|
2014-01-04 07:02:17 -08:00
|
|
|
nsString family((char16_t*)qFont.family().data());
|
2014-02-20 18:09:02 -08:00
|
|
|
aFontName = quote + family + quote;
|
2012-02-20 15:19:48 -08:00
|
|
|
|
2014-02-20 18:09:02 -08:00
|
|
|
aFontStyle.systemFont = true;
|
|
|
|
aFontStyle.style = qFont.style();
|
|
|
|
aFontStyle.weight = qFont.weight();
|
|
|
|
aFontStyle.stretch = qFont.stretch();
|
2012-02-20 15:19:48 -08:00
|
|
|
// use pixel size directly if it is set, otherwise compute from point size
|
|
|
|
if (qFont.pixelSize() != -1) {
|
2014-02-20 18:09:02 -08:00
|
|
|
aFontStyle.size = qFont.pixelSize();
|
2012-02-20 15:19:48 -08:00
|
|
|
} else {
|
2014-02-20 18:09:02 -08:00
|
|
|
aFontStyle.size = qFont.pointSizeF() * qApp->primaryScreen()->logicalDotsPerInch() / 72.0f;
|
2012-02-20 15:19:48 -08:00
|
|
|
}
|
2014-02-20 18:09:02 -08:00
|
|
|
|
|
|
|
return true;
|
2012-02-20 15:19:48 -08:00
|
|
|
}
|
|
|
|
|
2014-02-20 18:09:02 -08:00
|
|
|
/*virtual*/
|
2012-02-20 15:19:48 -08:00
|
|
|
bool
|
2014-02-20 18:09:02 -08:00
|
|
|
nsLookAndFeel::GetEchoPasswordImpl() {
|
|
|
|
return true;
|
|
|
|
}
|
2012-02-20 15:19:48 -08:00
|
|
|
|
2014-02-20 18:09:02 -08:00
|
|
|
/*virtual*/
|
|
|
|
uint32_t
|
|
|
|
nsLookAndFeel::GetPasswordMaskDelayImpl()
|
|
|
|
{
|
|
|
|
// Same value on Android framework
|
|
|
|
return 1500;
|
2012-02-20 15:19:48 -08:00
|
|
|
}
|
|
|
|
|
2014-02-20 18:09:02 -08:00
|
|
|
/* virtual */
|
|
|
|
char16_t
|
|
|
|
nsLookAndFeel::GetPasswordCharacterImpl()
|
2012-02-20 15:19:48 -08:00
|
|
|
{
|
2014-02-20 18:09:02 -08:00
|
|
|
return UNICODE_BULLET;
|
2012-02-20 15:19:48 -08:00
|
|
|
}
|