2001-11-06 05:41:04 +03:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
2001-09-29 00:14:13 +04:00
|
|
|
/* ***** BEGIN LICENSE BLOCK *****
|
2004-04-19 02:01:16 +04:00
|
|
|
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
1998-07-29 22:55:25 +04:00
|
|
|
*
|
2004-04-19 02:01:16 +04: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/
|
1998-07-29 22:55:25 +04:00
|
|
|
*
|
2001-09-29 00:14:13 +04: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.
|
1998-07-29 22:55:25 +04:00
|
|
|
*
|
1999-11-06 06:40:37 +03:00
|
|
|
* The Original Code is mozilla.org code.
|
|
|
|
*
|
2004-04-19 02:01:16 +04:00
|
|
|
* The Initial Developer of the Original Code is
|
2001-09-29 00:14:13 +04:00
|
|
|
* Netscape Communications Corporation.
|
|
|
|
* Portions created by the Initial Developer are Copyright (C) 1998
|
|
|
|
* the Initial Developer. All Rights Reserved.
|
1999-11-06 06:40:37 +03:00
|
|
|
*
|
2001-09-29 00:14:13 +04:00
|
|
|
* Contributor(s):
|
2004-04-19 02:01:16 +04:00
|
|
|
* Michael Lowe <michael.lowe@bigfoot.com>
|
2006-07-19 23:47:19 +04:00
|
|
|
* Jens Bannmann <jens.b@web.de>
|
2006-10-10 17:18:25 +04:00
|
|
|
* Ryan Jones <sciguyryan@gmail.com>
|
2008-04-08 22:36:53 +04:00
|
|
|
* Ehsan Akhgari <ehsan.akhgari@gmail.com>
|
2001-09-29 00:14:13 +04:00
|
|
|
*
|
|
|
|
* Alternatively, the contents of this file may be used under the terms of
|
2004-04-19 02:01:16 +04:00
|
|
|
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
2001-09-29 00:14:13 +04: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-19 02:01:16 +04:00
|
|
|
* use your version of this file under the terms of the MPL, indicate your
|
2001-09-29 00:14:13 +04: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-19 02:01:16 +04:00
|
|
|
* the terms of any one of the MPL, the GPL or the LGPL.
|
2001-09-29 00:14:13 +04:00
|
|
|
*
|
|
|
|
* ***** END LICENSE BLOCK ***** */
|
1998-07-29 22:55:25 +04:00
|
|
|
|
|
|
|
#include "nsLookAndFeel.h"
|
1999-01-22 02:59:14 +03:00
|
|
|
#include <windows.h>
|
2006-07-19 23:47:19 +04:00
|
|
|
#include <shellapi.h>
|
2001-05-25 18:48:31 +04:00
|
|
|
#include "nsWindow.h"
|
2011-03-31 16:26:49 +04:00
|
|
|
#include "nsStyleConsts.h"
|
2008-07-17 21:19:10 +04:00
|
|
|
#include "nsUXThemeData.h"
|
|
|
|
#include "nsUXThemeConstants.h"
|
2005-10-07 04:31:36 +04:00
|
|
|
|
2008-07-17 21:19:10 +04:00
|
|
|
static nsresult GetColorFromTheme(nsUXThemeClass cls,
|
|
|
|
PRInt32 aPart,
|
|
|
|
PRInt32 aState,
|
|
|
|
PRInt32 aPropId,
|
|
|
|
nscolor &aColor)
|
|
|
|
{
|
|
|
|
COLORREF color;
|
2012-02-08 20:00:45 +04:00
|
|
|
HRESULT hr = GetThemeColor(nsUXThemeData::GetTheme(cls), aPart, aState, aPropId, &color);
|
2008-07-17 21:19:10 +04:00
|
|
|
if (hr == S_OK)
|
|
|
|
{
|
|
|
|
aColor = COLOREF_2_NSRGB(color);
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
return NS_ERROR_FAILURE;
|
|
|
|
}
|
|
|
|
|
2007-01-04 21:43:26 +03:00
|
|
|
static PRInt32 GetSystemParam(long flag, PRInt32 def)
|
|
|
|
{
|
2006-10-10 17:18:25 +04:00
|
|
|
DWORD value;
|
2007-01-04 21:43:26 +03:00
|
|
|
return ::SystemParametersInfo(flag, 0, &value, 0) ? value : def;
|
2006-10-10 17:18:25 +04:00
|
|
|
}
|
|
|
|
|
2001-11-06 05:41:04 +03:00
|
|
|
nsLookAndFeel::nsLookAndFeel() : nsXPLookAndFeel()
|
1998-09-15 00:40:49 +04:00
|
|
|
{
|
1998-07-29 22:55:25 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
nsLookAndFeel::~nsLookAndFeel()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2011-09-09 06:27:13 +04:00
|
|
|
nsresult
|
|
|
|
nsLookAndFeel::NativeGetColor(ColorID aID, nscolor &aColor)
|
1998-07-29 22:55:25 +04:00
|
|
|
{
|
1998-12-21 19:53:49 +03:00
|
|
|
nsresult res = NS_OK;
|
2000-03-31 02:42:40 +04:00
|
|
|
|
1998-12-21 19:53:49 +03:00
|
|
|
int idx;
|
|
|
|
switch (aID) {
|
2011-09-09 06:27:13 +04:00
|
|
|
case eColorID_WindowBackground:
|
1998-07-29 22:55:25 +04:00
|
|
|
idx = COLOR_WINDOW;
|
|
|
|
break;
|
2011-09-09 06:27:13 +04:00
|
|
|
case eColorID_WindowForeground:
|
1998-07-29 22:55:25 +04:00
|
|
|
idx = COLOR_WINDOWTEXT;
|
|
|
|
break;
|
2011-09-09 06:27:13 +04:00
|
|
|
case eColorID_WidgetBackground:
|
1998-07-29 22:55:25 +04:00
|
|
|
idx = COLOR_BTNFACE;
|
|
|
|
break;
|
2011-09-09 06:27:13 +04:00
|
|
|
case eColorID_WidgetForeground:
|
1998-07-29 22:55:25 +04:00
|
|
|
idx = COLOR_BTNTEXT;
|
|
|
|
break;
|
2011-09-09 06:27:13 +04:00
|
|
|
case eColorID_WidgetSelectBackground:
|
1998-07-29 22:55:25 +04:00
|
|
|
idx = COLOR_HIGHLIGHT;
|
|
|
|
break;
|
2011-09-09 06:27:13 +04:00
|
|
|
case eColorID_WidgetSelectForeground:
|
1998-07-29 22:55:25 +04:00
|
|
|
idx = COLOR_HIGHLIGHTTEXT;
|
|
|
|
break;
|
2011-09-09 06:27:13 +04:00
|
|
|
case eColorID_Widget3DHighlight:
|
1998-07-29 22:55:25 +04:00
|
|
|
idx = COLOR_BTNHIGHLIGHT;
|
|
|
|
break;
|
2011-09-09 06:27:13 +04:00
|
|
|
case eColorID_Widget3DShadow:
|
1998-07-29 22:55:25 +04:00
|
|
|
idx = COLOR_BTNSHADOW;
|
|
|
|
break;
|
2011-09-09 06:27:13 +04:00
|
|
|
case eColorID_TextBackground:
|
1998-07-29 22:55:25 +04:00
|
|
|
idx = COLOR_WINDOW;
|
|
|
|
break;
|
2011-09-09 06:27:13 +04:00
|
|
|
case eColorID_TextForeground:
|
1998-07-29 22:55:25 +04:00
|
|
|
idx = COLOR_WINDOWTEXT;
|
|
|
|
break;
|
2011-09-09 06:27:13 +04:00
|
|
|
case eColorID_TextSelectBackground:
|
|
|
|
case eColorID_IMESelectedRawTextBackground:
|
|
|
|
case eColorID_IMESelectedConvertedTextBackground:
|
1998-07-29 22:55:25 +04:00
|
|
|
idx = COLOR_HIGHLIGHT;
|
|
|
|
break;
|
2011-09-09 06:27:13 +04:00
|
|
|
case eColorID_TextSelectForeground:
|
|
|
|
case eColorID_IMESelectedRawTextForeground:
|
|
|
|
case eColorID_IMESelectedConvertedTextForeground:
|
1998-07-29 22:55:25 +04:00
|
|
|
idx = COLOR_HIGHLIGHTTEXT;
|
|
|
|
break;
|
2011-09-09 06:27:13 +04:00
|
|
|
case eColorID_IMERawInputBackground:
|
|
|
|
case eColorID_IMEConvertedTextBackground:
|
2005-09-17 15:34:27 +04:00
|
|
|
aColor = NS_TRANSPARENT;
|
|
|
|
return NS_OK;
|
2011-09-09 06:27:13 +04:00
|
|
|
case eColorID_IMERawInputForeground:
|
|
|
|
case eColorID_IMEConvertedTextForeground:
|
2005-09-17 15:34:27 +04:00
|
|
|
aColor = NS_SAME_AS_FOREGROUND_COLOR;
|
|
|
|
return NS_OK;
|
2011-09-09 06:27:13 +04:00
|
|
|
case eColorID_IMERawInputUnderline:
|
|
|
|
case eColorID_IMEConvertedTextUnderline:
|
2005-09-17 15:34:27 +04:00
|
|
|
aColor = NS_SAME_AS_FOREGROUND_COLOR;
|
|
|
|
return NS_OK;
|
2011-09-09 06:27:13 +04:00
|
|
|
case eColorID_IMESelectedRawTextUnderline:
|
|
|
|
case eColorID_IMESelectedConvertedTextUnderline:
|
2005-09-17 15:34:27 +04:00
|
|
|
aColor = NS_TRANSPARENT;
|
|
|
|
return NS_OK;
|
2011-09-09 06:27:13 +04:00
|
|
|
case eColorID_SpellCheckerUnderline:
|
2009-04-03 11:26:28 +04:00
|
|
|
aColor = NS_RGB(0xff, 0, 0);
|
|
|
|
return NS_OK;
|
1999-09-10 22:30:55 +04:00
|
|
|
|
|
|
|
// New CSS 2 Color definitions
|
2011-09-09 06:27:13 +04:00
|
|
|
case eColorID_activeborder:
|
1999-09-10 22:30:55 +04:00
|
|
|
idx = COLOR_ACTIVEBORDER;
|
|
|
|
break;
|
2011-09-09 06:27:13 +04:00
|
|
|
case eColorID_activecaption:
|
1999-09-10 22:30:55 +04:00
|
|
|
idx = COLOR_ACTIVECAPTION;
|
|
|
|
break;
|
2011-09-09 06:27:13 +04:00
|
|
|
case eColorID_appworkspace:
|
1999-10-24 07:03:38 +04:00
|
|
|
idx = COLOR_APPWORKSPACE;
|
1999-09-10 22:30:55 +04:00
|
|
|
break;
|
2011-09-09 06:27:13 +04:00
|
|
|
case eColorID_background:
|
2001-04-17 04:46:07 +04:00
|
|
|
idx = COLOR_BACKGROUND;
|
1999-09-10 22:30:55 +04:00
|
|
|
break;
|
2011-09-09 06:27:13 +04:00
|
|
|
case eColorID_buttonface:
|
|
|
|
case eColorID__moz_buttonhoverface:
|
1999-09-10 22:30:55 +04:00
|
|
|
idx = COLOR_BTNFACE;
|
|
|
|
break;
|
2011-09-09 06:27:13 +04:00
|
|
|
case eColorID_buttonhighlight:
|
1999-09-10 22:30:55 +04:00
|
|
|
idx = COLOR_BTNHIGHLIGHT;
|
|
|
|
break;
|
2011-09-09 06:27:13 +04:00
|
|
|
case eColorID_buttonshadow:
|
1999-09-10 22:30:55 +04:00
|
|
|
idx = COLOR_BTNSHADOW;
|
|
|
|
break;
|
2011-09-09 06:27:13 +04:00
|
|
|
case eColorID_buttontext:
|
|
|
|
case eColorID__moz_buttonhovertext:
|
1999-09-10 22:30:55 +04:00
|
|
|
idx = COLOR_BTNTEXT;
|
|
|
|
break;
|
2011-09-09 06:27:13 +04:00
|
|
|
case eColorID_captiontext:
|
1999-09-10 22:30:55 +04:00
|
|
|
idx = COLOR_CAPTIONTEXT;
|
|
|
|
break;
|
2011-09-09 06:27:13 +04:00
|
|
|
case eColorID_graytext:
|
1999-09-10 22:30:55 +04:00
|
|
|
idx = COLOR_GRAYTEXT;
|
|
|
|
break;
|
2011-09-09 06:27:13 +04:00
|
|
|
case eColorID_highlight:
|
|
|
|
case eColorID__moz_html_cellhighlight:
|
|
|
|
case eColorID__moz_menuhover:
|
1999-09-10 22:30:55 +04:00
|
|
|
idx = COLOR_HIGHLIGHT;
|
|
|
|
break;
|
2011-09-09 06:27:13 +04:00
|
|
|
case eColorID__moz_menubarhovertext:
|
2012-02-08 20:00:45 +04:00
|
|
|
if (!nsUXThemeData::sIsVistaOrLater || !IsAppThemed())
|
2007-08-06 21:45:57 +04:00
|
|
|
{
|
2008-07-17 21:19:10 +04:00
|
|
|
idx = nsUXThemeData::sFlatMenus ?
|
2007-08-06 21:45:57 +04:00
|
|
|
COLOR_HIGHLIGHTTEXT :
|
|
|
|
COLOR_MENUTEXT;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
// Fall through
|
2011-09-09 06:27:13 +04:00
|
|
|
case eColorID__moz_menuhovertext:
|
2012-02-08 20:00:45 +04:00
|
|
|
if (IsAppThemed() && nsUXThemeData::sIsVistaOrLater)
|
2007-08-06 21:45:57 +04:00
|
|
|
{
|
2008-07-17 21:19:10 +04:00
|
|
|
res = ::GetColorFromTheme(eUXMenu,
|
|
|
|
MENU_POPUPITEM, MPI_HOT, TMT_TEXTCOLOR, aColor);
|
2008-04-29 23:27:23 +04:00
|
|
|
if (NS_SUCCEEDED(res))
|
|
|
|
return res;
|
2007-08-06 21:45:57 +04:00
|
|
|
// fall through to highlight case
|
|
|
|
}
|
2011-09-09 06:27:13 +04:00
|
|
|
case eColorID_highlighttext:
|
|
|
|
case eColorID__moz_html_cellhighlighttext:
|
1999-09-10 22:30:55 +04:00
|
|
|
idx = COLOR_HIGHLIGHTTEXT;
|
|
|
|
break;
|
2011-09-09 06:27:13 +04:00
|
|
|
case eColorID_inactiveborder:
|
1999-09-10 22:30:55 +04:00
|
|
|
idx = COLOR_INACTIVEBORDER;
|
|
|
|
break;
|
2011-09-09 06:27:13 +04:00
|
|
|
case eColorID_inactivecaption:
|
1999-09-10 22:30:55 +04:00
|
|
|
idx = COLOR_INACTIVECAPTION;
|
|
|
|
break;
|
2011-09-09 06:27:13 +04:00
|
|
|
case eColorID_inactivecaptiontext:
|
1999-09-10 22:30:55 +04:00
|
|
|
idx = COLOR_INACTIVECAPTIONTEXT;
|
|
|
|
break;
|
2011-09-09 06:27:13 +04:00
|
|
|
case eColorID_infobackground:
|
1999-09-10 22:30:55 +04:00
|
|
|
idx = COLOR_INFOBK;
|
|
|
|
break;
|
2011-09-09 06:27:13 +04:00
|
|
|
case eColorID_infotext:
|
1999-09-10 22:30:55 +04:00
|
|
|
idx = COLOR_INFOTEXT;
|
|
|
|
break;
|
2011-09-09 06:27:13 +04:00
|
|
|
case eColorID_menu:
|
1999-09-10 22:30:55 +04:00
|
|
|
idx = COLOR_MENU;
|
|
|
|
break;
|
2011-09-09 06:27:13 +04:00
|
|
|
case eColorID_menutext:
|
|
|
|
case eColorID__moz_menubartext:
|
1999-09-10 22:30:55 +04:00
|
|
|
idx = COLOR_MENUTEXT;
|
|
|
|
break;
|
2011-09-09 06:27:13 +04:00
|
|
|
case eColorID_scrollbar:
|
1999-09-10 22:30:55 +04:00
|
|
|
idx = COLOR_SCROLLBAR;
|
|
|
|
break;
|
2011-09-09 06:27:13 +04:00
|
|
|
case eColorID_threeddarkshadow:
|
1999-09-10 22:30:55 +04:00
|
|
|
idx = COLOR_3DDKSHADOW;
|
|
|
|
break;
|
2011-09-09 06:27:13 +04:00
|
|
|
case eColorID_threedface:
|
1999-09-10 22:30:55 +04:00
|
|
|
idx = COLOR_3DFACE;
|
|
|
|
break;
|
2011-09-09 06:27:13 +04:00
|
|
|
case eColorID_threedhighlight:
|
1999-09-10 22:30:55 +04:00
|
|
|
idx = COLOR_3DHIGHLIGHT;
|
|
|
|
break;
|
2011-09-09 06:27:13 +04:00
|
|
|
case eColorID_threedlightshadow:
|
1999-09-10 22:30:55 +04:00
|
|
|
idx = COLOR_3DLIGHT;
|
|
|
|
break;
|
2011-09-09 06:27:13 +04:00
|
|
|
case eColorID_threedshadow:
|
1999-09-10 22:30:55 +04:00
|
|
|
idx = COLOR_3DSHADOW;
|
|
|
|
break;
|
2011-09-09 06:27:13 +04:00
|
|
|
case eColorID_window:
|
1999-09-10 22:30:55 +04:00
|
|
|
idx = COLOR_WINDOW;
|
|
|
|
break;
|
2011-09-09 06:27:13 +04:00
|
|
|
case eColorID_windowframe:
|
1999-09-10 22:30:55 +04:00
|
|
|
idx = COLOR_WINDOWFRAME;
|
|
|
|
break;
|
2011-09-09 06:27:13 +04:00
|
|
|
case eColorID_windowtext:
|
1999-09-10 22:30:55 +04:00
|
|
|
idx = COLOR_WINDOWTEXT;
|
|
|
|
break;
|
2011-09-09 06:27:13 +04:00
|
|
|
case eColorID__moz_eventreerow:
|
|
|
|
case eColorID__moz_oddtreerow:
|
|
|
|
case eColorID__moz_field:
|
|
|
|
case eColorID__moz_combobox:
|
2001-04-17 04:46:07 +04:00
|
|
|
idx = COLOR_WINDOW;
|
|
|
|
break;
|
2011-09-09 06:27:13 +04:00
|
|
|
case eColorID__moz_fieldtext:
|
|
|
|
case eColorID__moz_comboboxtext:
|
2001-04-17 04:46:07 +04:00
|
|
|
idx = COLOR_WINDOWTEXT;
|
|
|
|
break;
|
2011-09-09 06:27:13 +04:00
|
|
|
case eColorID__moz_dialog:
|
|
|
|
case eColorID__moz_cellhighlight:
|
2001-04-17 04:46:07 +04:00
|
|
|
idx = COLOR_3DFACE;
|
|
|
|
break;
|
2011-09-09 06:27:13 +04:00
|
|
|
case eColorID__moz_win_mediatext:
|
2012-02-08 20:00:45 +04:00
|
|
|
if (IsAppThemed() && nsUXThemeData::sIsVistaOrLater) {
|
2008-07-17 21:19:10 +04:00
|
|
|
res = ::GetColorFromTheme(eUXMediaToolbar,
|
|
|
|
TP_BUTTON, TS_NORMAL, TMT_TEXTCOLOR, aColor);
|
2008-04-29 23:27:23 +04:00
|
|
|
if (NS_SUCCEEDED(res))
|
|
|
|
return res;
|
|
|
|
}
|
2009-01-05 21:17:44 +03:00
|
|
|
// if we've gotten here just return -moz-dialogtext instead
|
2008-04-29 23:27:23 +04:00
|
|
|
idx = COLOR_WINDOWTEXT;
|
|
|
|
break;
|
2011-09-09 06:27:13 +04:00
|
|
|
case eColorID__moz_win_communicationstext:
|
2012-02-08 20:00:45 +04:00
|
|
|
if (IsAppThemed() && nsUXThemeData::sIsVistaOrLater)
|
2008-04-29 23:27:23 +04:00
|
|
|
{
|
2008-07-17 21:19:10 +04:00
|
|
|
res = ::GetColorFromTheme(eUXCommunicationsToolbar,
|
|
|
|
TP_BUTTON, TS_NORMAL, TMT_TEXTCOLOR, aColor);
|
2008-04-29 23:27:23 +04:00
|
|
|
if (NS_SUCCEEDED(res))
|
|
|
|
return res;
|
|
|
|
}
|
2009-01-05 21:17:44 +03:00
|
|
|
// if we've gotten here just return -moz-dialogtext instead
|
2008-04-29 23:27:23 +04:00
|
|
|
idx = COLOR_WINDOWTEXT;
|
|
|
|
break;
|
2011-09-09 06:27:13 +04:00
|
|
|
case eColorID__moz_dialogtext:
|
|
|
|
case eColorID__moz_cellhighlighttext:
|
2001-04-17 04:46:07 +04:00
|
|
|
idx = COLOR_WINDOWTEXT;
|
|
|
|
break;
|
2011-09-09 06:27:13 +04:00
|
|
|
case eColorID__moz_dragtargetzone:
|
2003-06-19 01:16:29 +04:00
|
|
|
idx = COLOR_HIGHLIGHTTEXT;
|
|
|
|
break;
|
2011-09-09 06:27:13 +04:00
|
|
|
case eColorID__moz_buttondefault:
|
2003-06-19 01:16:29 +04:00
|
|
|
idx = COLOR_3DDKSHADOW;
|
|
|
|
break;
|
2011-09-09 06:27:13 +04:00
|
|
|
case eColorID__moz_nativehyperlinktext:
|
2008-07-11 22:34:53 +04:00
|
|
|
idx = COLOR_HOTLIGHT;
|
|
|
|
break;
|
1998-07-29 22:55:25 +04:00
|
|
|
default:
|
2003-06-19 01:16:29 +04:00
|
|
|
idx = COLOR_WINDOW;
|
|
|
|
break;
|
1998-07-29 22:55:25 +04:00
|
|
|
}
|
|
|
|
|
2001-05-25 18:48:31 +04:00
|
|
|
DWORD color = ::GetSysColor(idx);
|
|
|
|
aColor = COLOREF_2_NSRGB(color);
|
1998-07-29 22:55:25 +04:00
|
|
|
|
1998-12-21 19:53:49 +03:00
|
|
|
return res;
|
1998-09-02 00:54:39 +04:00
|
|
|
}
|
2001-04-17 04:46:07 +04:00
|
|
|
|
2011-09-09 06:27:13 +04:00
|
|
|
nsresult
|
|
|
|
nsLookAndFeel::GetIntImpl(IntID aID, PRInt32 &aResult)
|
1998-07-29 22:55:25 +04:00
|
|
|
{
|
2011-09-09 06:27:13 +04:00
|
|
|
nsresult res = nsXPLookAndFeel::GetIntImpl(aID, aResult);
|
2001-11-06 05:41:04 +03:00
|
|
|
if (NS_SUCCEEDED(res))
|
|
|
|
return res;
|
|
|
|
res = NS_OK;
|
2000-03-31 02:42:40 +04:00
|
|
|
|
1998-12-21 19:53:49 +03:00
|
|
|
switch (aID) {
|
2011-09-09 06:27:13 +04:00
|
|
|
case eIntID_CaretBlinkTime:
|
|
|
|
aResult = (PRInt32)::GetCaretBlinkTime();
|
1999-07-15 02:16:59 +04:00
|
|
|
break;
|
2011-09-09 06:27:13 +04:00
|
|
|
case eIntID_CaretWidth:
|
|
|
|
aResult = 1;
|
2000-07-29 02:12:45 +04:00
|
|
|
break;
|
2011-09-09 06:27:13 +04:00
|
|
|
case eIntID_ShowCaretDuringSelection:
|
|
|
|
aResult = 0;
|
2000-12-28 06:27:23 +03:00
|
|
|
break;
|
2011-09-09 06:27:13 +04:00
|
|
|
case eIntID_SelectTextfieldsOnKeyFocus:
|
2002-10-05 19:39:33 +04:00
|
|
|
// Select textfield content when focused by kbd
|
|
|
|
// used by nsEventStateManager::sTextfieldSelectModel
|
2011-09-09 06:27:13 +04:00
|
|
|
aResult = 1;
|
2002-10-05 19:39:33 +04:00
|
|
|
break;
|
2011-09-09 06:27:13 +04:00
|
|
|
case eIntID_SubmenuDelay:
|
2007-01-04 21:43:26 +03:00
|
|
|
// This will default to the Windows' default
|
2006-10-10 17:18:25 +04:00
|
|
|
// (400ms) on error.
|
2011-09-09 06:27:13 +04:00
|
|
|
aResult = GetSystemParam(SPI_GETMENUSHOWDELAY, 400);
|
2000-01-22 00:56:09 +03:00
|
|
|
break;
|
2011-12-16 13:18:48 +04:00
|
|
|
case eIntID_TooltipDelay:
|
|
|
|
aResult = 500;
|
|
|
|
break;
|
2011-09-09 06:27:13 +04:00
|
|
|
case eIntID_MenusCanOverlapOSBar:
|
2000-03-22 05:55:12 +03:00
|
|
|
// we want XUL popups to be able to overlap the task bar.
|
2011-09-09 06:27:13 +04:00
|
|
|
aResult = 1;
|
2000-03-22 05:55:12 +03:00
|
|
|
break;
|
2011-09-09 06:27:13 +04:00
|
|
|
case eIntID_DragThresholdX:
|
2003-05-02 22:20:38 +04:00
|
|
|
// The system metric is the number of pixels at which a drag should
|
|
|
|
// start. Our look and feel metric is the number of pixels you can
|
|
|
|
// move before starting a drag, so subtract 1.
|
|
|
|
|
2011-09-09 06:27:13 +04:00
|
|
|
aResult = ::GetSystemMetrics(SM_CXDRAG) - 1;
|
2003-05-02 22:20:38 +04:00
|
|
|
break;
|
2011-09-09 06:27:13 +04:00
|
|
|
case eIntID_DragThresholdY:
|
|
|
|
aResult = ::GetSystemMetrics(SM_CYDRAG) - 1;
|
2003-05-02 22:20:38 +04:00
|
|
|
break;
|
2011-09-09 06:27:13 +04:00
|
|
|
case eIntID_UseAccessibilityTheme:
|
2004-06-08 23:34:55 +04:00
|
|
|
// High contrast is a misnomer under Win32 -- any theme can be used with it,
|
|
|
|
// e.g. normal contrast with large fonts, low contrast, etc.
|
|
|
|
// The high contrast flag really means -- use this theme and don't override it.
|
|
|
|
HIGHCONTRAST contrastThemeInfo;
|
|
|
|
contrastThemeInfo.cbSize = sizeof(contrastThemeInfo);
|
2007-01-04 21:43:26 +03:00
|
|
|
::SystemParametersInfo(SPI_GETHIGHCONTRAST, 0, &contrastThemeInfo, 0);
|
|
|
|
|
2011-09-09 06:27:13 +04:00
|
|
|
aResult = ((contrastThemeInfo.dwFlags & HCF_HIGHCONTRASTON) != 0);
|
2004-06-08 23:34:55 +04:00
|
|
|
break;
|
2011-09-09 06:27:13 +04:00
|
|
|
case eIntID_ScrollArrowStyle:
|
|
|
|
aResult = eScrollArrowStyle_Single;
|
2000-11-30 04:51:14 +03:00
|
|
|
break;
|
2011-09-09 06:27:13 +04:00
|
|
|
case eIntID_ScrollSliderStyle:
|
|
|
|
aResult = eScrollThumbStyle_Proportional;
|
2000-11-30 04:51:14 +03:00
|
|
|
break;
|
2011-09-09 06:27:13 +04:00
|
|
|
case eIntID_TreeOpenDelay:
|
|
|
|
aResult = 1000;
|
2003-03-17 02:26:31 +03:00
|
|
|
break;
|
2011-09-09 06:27:13 +04:00
|
|
|
case eIntID_TreeCloseDelay:
|
|
|
|
aResult = 0;
|
2003-03-17 02:26:31 +03:00
|
|
|
break;
|
2011-09-09 06:27:13 +04:00
|
|
|
case eIntID_TreeLazyScrollDelay:
|
|
|
|
aResult = 150;
|
2003-03-17 02:26:31 +03:00
|
|
|
break;
|
2011-09-09 06:27:13 +04:00
|
|
|
case eIntID_TreeScrollDelay:
|
|
|
|
aResult = 100;
|
2003-03-17 02:26:31 +03:00
|
|
|
break;
|
2011-09-09 06:27:13 +04:00
|
|
|
case eIntID_TreeScrollLinesMax:
|
|
|
|
aResult = 3;
|
2003-03-17 02:26:31 +03:00
|
|
|
break;
|
2011-09-09 06:27:13 +04:00
|
|
|
case eIntID_WindowsClassic:
|
2012-02-08 20:00:45 +04:00
|
|
|
aResult = !IsAppThemed();
|
2009-08-11 06:59:06 +04:00
|
|
|
break;
|
2011-09-09 06:27:13 +04:00
|
|
|
case eIntID_TouchEnabled:
|
|
|
|
aResult = 0;
|
2009-08-11 06:59:06 +04:00
|
|
|
PRInt32 touchCapabilities;
|
|
|
|
touchCapabilities = ::GetSystemMetrics(SM_DIGITIZER);
|
|
|
|
if ((touchCapabilities & NID_READY) &&
|
|
|
|
(touchCapabilities & (NID_EXTERNAL_TOUCH | NID_INTEGRATED_TOUCH))) {
|
2011-09-09 06:27:13 +04:00
|
|
|
aResult = 1;
|
2009-08-11 06:59:06 +04:00
|
|
|
}
|
2008-08-18 21:33:08 +04:00
|
|
|
break;
|
2011-09-09 06:27:13 +04:00
|
|
|
case eIntID_WindowsDefaultTheme:
|
|
|
|
aResult = nsUXThemeData::IsDefaultWindowTheme();
|
2010-10-10 00:53:44 +04:00
|
|
|
break;
|
2011-09-09 06:27:13 +04:00
|
|
|
case eIntID_WindowsThemeIdentifier:
|
|
|
|
aResult = nsUXThemeData::GetNativeThemeId();
|
2008-04-08 22:36:53 +04:00
|
|
|
break;
|
2011-09-09 06:27:13 +04:00
|
|
|
case eIntID_MacGraphiteTheme:
|
|
|
|
case eIntID_MacLionTheme:
|
|
|
|
case eIntID_MaemoClassic:
|
|
|
|
aResult = 0;
|
2008-09-17 20:23:58 +04:00
|
|
|
res = NS_ERROR_NOT_IMPLEMENTED;
|
|
|
|
break;
|
2011-09-09 06:27:13 +04:00
|
|
|
case eIntID_DWMCompositor:
|
|
|
|
aResult = nsUXThemeData::CheckForCompositor();
|
2008-08-13 04:44:14 +04:00
|
|
|
break;
|
2011-09-09 06:27:13 +04:00
|
|
|
case eIntID_AlertNotificationOrigin:
|
|
|
|
aResult = 0;
|
2006-07-19 23:47:19 +04:00
|
|
|
{
|
|
|
|
// Get task bar window handle
|
2008-08-30 01:26:56 +04:00
|
|
|
HWND shellWindow = FindWindowW(L"Shell_TrayWnd", NULL);
|
2006-07-19 23:47:19 +04:00
|
|
|
|
|
|
|
if (shellWindow != NULL)
|
|
|
|
{
|
|
|
|
// Determine position
|
|
|
|
APPBARDATA appBarData;
|
|
|
|
appBarData.hWnd = shellWindow;
|
|
|
|
appBarData.cbSize = sizeof(appBarData);
|
2012-02-08 20:00:45 +04:00
|
|
|
if (SHAppBarMessage(ABM_GETTASKBARPOS, &appBarData))
|
2006-07-19 23:47:19 +04:00
|
|
|
{
|
2011-09-09 06:27:12 +04:00
|
|
|
// Set alert origin as a bit field - see LookAndFeel.h
|
2006-07-19 23:47:19 +04:00
|
|
|
// 0 represents bottom right, sliding vertically.
|
|
|
|
switch(appBarData.uEdge)
|
|
|
|
{
|
|
|
|
case ABE_LEFT:
|
2011-09-09 06:27:13 +04:00
|
|
|
aResult = NS_ALERT_HORIZONTAL | NS_ALERT_LEFT;
|
2006-07-19 23:47:19 +04:00
|
|
|
break;
|
|
|
|
case ABE_RIGHT:
|
2011-09-09 06:27:13 +04:00
|
|
|
aResult = NS_ALERT_HORIZONTAL;
|
2006-07-19 23:47:19 +04:00
|
|
|
break;
|
|
|
|
case ABE_TOP:
|
2011-09-09 06:27:13 +04:00
|
|
|
aResult = NS_ALERT_TOP;
|
2006-12-06 23:52:09 +03:00
|
|
|
// fall through for the right-to-left handling.
|
2006-07-19 23:47:19 +04:00
|
|
|
case ABE_BOTTOM:
|
2006-12-06 23:52:09 +03:00
|
|
|
// If the task bar is right-to-left,
|
|
|
|
// move the origin to the left
|
|
|
|
if (::GetWindowLong(shellWindow, GWL_EXSTYLE) &
|
|
|
|
WS_EX_LAYOUTRTL)
|
2011-09-09 06:27:13 +04:00
|
|
|
aResult |= NS_ALERT_LEFT;
|
2006-07-19 23:47:19 +04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
2011-09-09 06:27:13 +04:00
|
|
|
case eIntID_IMERawInputUnderlineStyle:
|
|
|
|
case eIntID_IMEConvertedTextUnderlineStyle:
|
|
|
|
aResult = NS_STYLE_TEXT_DECORATION_STYLE_DASHED;
|
2007-08-17 00:35:18 +04:00
|
|
|
break;
|
2011-09-09 06:27:13 +04:00
|
|
|
case eIntID_IMESelectedRawTextUnderlineStyle:
|
|
|
|
case eIntID_IMESelectedConvertedTextUnderline:
|
|
|
|
aResult = NS_STYLE_TEXT_DECORATION_STYLE_NONE;
|
2007-08-17 00:35:18 +04:00
|
|
|
break;
|
2011-09-09 06:27:13 +04:00
|
|
|
case eIntID_SpellCheckerUnderlineStyle:
|
|
|
|
aResult = NS_STYLE_TEXT_DECORATION_STYLE_WAVY;
|
2009-04-03 11:26:28 +04:00
|
|
|
break;
|
2011-11-18 03:41:35 +04:00
|
|
|
case eIntID_ScrollbarButtonAutoRepeatBehavior:
|
|
|
|
aResult = 0;
|
|
|
|
break;
|
1998-07-29 22:55:25 +04:00
|
|
|
default:
|
2011-09-09 06:27:13 +04:00
|
|
|
aResult = 0;
|
1998-09-02 00:54:39 +04:00
|
|
|
res = NS_ERROR_FAILURE;
|
1998-07-29 22:55:25 +04:00
|
|
|
}
|
1998-12-21 19:53:49 +03:00
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
2011-09-09 06:27:13 +04:00
|
|
|
nsresult
|
|
|
|
nsLookAndFeel::GetFloatImpl(FloatID aID, float &aResult)
|
1998-12-21 19:53:49 +03:00
|
|
|
{
|
2011-09-09 06:27:13 +04:00
|
|
|
nsresult res = nsXPLookAndFeel::GetFloatImpl(aID, aResult);
|
2001-11-06 05:41:04 +03:00
|
|
|
if (NS_SUCCEEDED(res))
|
|
|
|
return res;
|
|
|
|
res = NS_OK;
|
2000-03-31 02:42:40 +04:00
|
|
|
|
1998-12-21 19:53:49 +03:00
|
|
|
switch (aID) {
|
2011-09-09 06:27:13 +04:00
|
|
|
case eFloatID_IMEUnderlineRelativeSize:
|
|
|
|
aResult = 1.0f;
|
2005-09-17 15:34:27 +04:00
|
|
|
break;
|
2011-09-09 06:27:13 +04:00
|
|
|
case eFloatID_SpellCheckerUnderlineRelativeSize:
|
|
|
|
aResult = 1.0f;
|
2009-04-03 11:26:28 +04:00
|
|
|
break;
|
1998-12-21 19:53:49 +03:00
|
|
|
default:
|
2011-09-09 06:27:13 +04:00
|
|
|
aResult = -1.0;
|
1998-12-21 19:53:49 +03:00
|
|
|
res = NS_ERROR_FAILURE;
|
|
|
|
}
|
|
|
|
return res;
|
1998-07-29 22:55:25 +04:00
|
|
|
}
|
|
|
|
|
2006-10-27 02:32:30 +04:00
|
|
|
/* virtual */
|
2011-09-09 06:27:13 +04:00
|
|
|
PRUnichar
|
|
|
|
nsLookAndFeel::GetPasswordCharacterImpl()
|
2006-10-27 02:32:30 +04:00
|
|
|
{
|
2009-07-09 04:26:30 +04:00
|
|
|
#define UNICODE_BLACK_CIRCLE_CHAR 0x25cf
|
2012-02-08 20:00:45 +04:00
|
|
|
return UNICODE_BLACK_CIRCLE_CHAR;
|
2006-10-27 02:32:30 +04:00
|
|
|
}
|