2001-11-06 02:41:04 +00:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
2001-09-28 20:14:13 +00:00
|
|
|
/* ***** BEGIN LICENSE BLOCK *****
|
2004-04-18 22:01:16 +00:00
|
|
|
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
1999-06-28 23:39:35 +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/
|
1999-06-28 23:39:35 +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.
|
1999-06-28 23:39:35 +00:00
|
|
|
*
|
2000-08-07 20:48:09 +00:00
|
|
|
* The Original Code is mozilla.org code.
|
1999-06-28 23:39:35 +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-05-12 19:39:20 +00:00
|
|
|
*
|
2001-09-28 20:14:13 +00:00
|
|
|
* Contributor(s):
|
2004-04-18 22:01:16 +00:00
|
|
|
* John Fairhurst <john_fairhurst@iname.com>
|
|
|
|
* Michael Lowe <michael.lowe@bigfoot.com>
|
|
|
|
* Pierre Phaneuf <pp@ludusdesign.com>
|
2001-09-28 20:14:13 +00:00
|
|
|
*
|
|
|
|
* 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 ***** */
|
1999-06-28 23:39:35 +00:00
|
|
|
|
2000-08-07 20:48:09 +00:00
|
|
|
#define INCL_WIN
|
|
|
|
#include <os2.h>
|
2001-04-26 22:20:55 +00:00
|
|
|
#include "nsLookAndFeel.h"
|
2000-08-07 20:48:09 +00:00
|
|
|
#include "nsFont.h"
|
2001-10-02 21:24:16 +00:00
|
|
|
#include "nsSize.h"
|
2000-08-07 20:48:09 +00:00
|
|
|
|
2001-11-06 02:41:04 +00:00
|
|
|
nsLookAndFeel::nsLookAndFeel() : nsXPLookAndFeel()
|
2000-05-12 19:39:20 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
nsLookAndFeel::~nsLookAndFeel()
|
1999-06-28 23:39:35 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2001-11-06 02:41:04 +00:00
|
|
|
nsresult nsLookAndFeel::NativeGetColor(const nsColorID aID, nscolor &aColor)
|
1999-06-28 23:39:35 +00:00
|
|
|
{
|
2000-05-12 19:39:20 +00:00
|
|
|
nsresult res = NS_OK;
|
|
|
|
|
|
|
|
int idx;
|
|
|
|
switch (aID) {
|
|
|
|
case eColor_WindowBackground:
|
2000-08-07 20:48:09 +00:00
|
|
|
idx = SYSCLR_WINDOW;
|
2000-05-12 19:39:20 +00:00
|
|
|
break;
|
|
|
|
case eColor_WindowForeground:
|
2000-08-07 20:48:09 +00:00
|
|
|
idx = SYSCLR_WINDOWTEXT;
|
2000-05-12 19:39:20 +00:00
|
|
|
break;
|
|
|
|
case eColor_WidgetBackground:
|
2000-08-07 20:48:09 +00:00
|
|
|
idx = SYSCLR_BUTTONMIDDLE;
|
2000-05-12 19:39:20 +00:00
|
|
|
break;
|
|
|
|
case eColor_WidgetForeground:
|
2000-08-07 20:48:09 +00:00
|
|
|
idx = SYSCLR_WINDOWTEXT;
|
2000-05-12 19:39:20 +00:00
|
|
|
break;
|
|
|
|
case eColor_WidgetSelectBackground:
|
2000-08-07 20:48:09 +00:00
|
|
|
idx = SYSCLR_HILITEBACKGROUND;
|
2000-05-12 19:39:20 +00:00
|
|
|
break;
|
|
|
|
case eColor_WidgetSelectForeground:
|
2000-08-07 20:48:09 +00:00
|
|
|
idx = SYSCLR_HILITEFOREGROUND;
|
2000-05-12 19:39:20 +00:00
|
|
|
break;
|
|
|
|
case eColor_Widget3DHighlight:
|
2000-08-07 20:48:09 +00:00
|
|
|
idx = SYSCLR_BUTTONLIGHT;
|
2000-05-12 19:39:20 +00:00
|
|
|
break;
|
|
|
|
case eColor_Widget3DShadow:
|
2000-08-07 20:48:09 +00:00
|
|
|
idx = SYSCLR_BUTTONDARK;
|
2000-05-12 19:39:20 +00:00
|
|
|
break;
|
|
|
|
case eColor_TextBackground:
|
2000-08-07 20:48:09 +00:00
|
|
|
idx = SYSCLR_WINDOW;
|
2000-05-12 19:39:20 +00:00
|
|
|
break;
|
|
|
|
case eColor_TextForeground:
|
2000-08-07 20:48:09 +00:00
|
|
|
idx = SYSCLR_WINDOWTEXT;
|
2000-05-12 19:39:20 +00:00
|
|
|
break;
|
|
|
|
case eColor_TextSelectBackground:
|
2000-08-07 20:48:09 +00:00
|
|
|
idx = SYSCLR_HILITEBACKGROUND;
|
2000-05-12 19:39:20 +00:00
|
|
|
break;
|
|
|
|
case eColor_TextSelectForeground:
|
2000-08-07 20:48:09 +00:00
|
|
|
idx = SYSCLR_HILITEFOREGROUND;
|
2000-05-12 19:39:20 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
// New CSS 2 Color definitions
|
|
|
|
case eColor_activeborder:
|
2000-08-07 20:48:09 +00:00
|
|
|
idx = SYSCLR_ACTIVEBORDER;
|
2000-05-12 19:39:20 +00:00
|
|
|
break;
|
|
|
|
case eColor_activecaption:
|
2000-08-07 20:48:09 +00:00
|
|
|
idx = SYSCLR_ACTIVETITLETEXT;
|
2000-05-12 19:39:20 +00:00
|
|
|
break;
|
|
|
|
case eColor_appworkspace:
|
2000-08-07 20:48:09 +00:00
|
|
|
idx = SYSCLR_APPWORKSPACE;
|
2000-05-12 19:39:20 +00:00
|
|
|
break;
|
|
|
|
case eColor_background:
|
2000-08-07 20:48:09 +00:00
|
|
|
idx = SYSCLR_BACKGROUND;
|
2000-05-12 19:39:20 +00:00
|
|
|
break;
|
|
|
|
case eColor_buttonface:
|
2000-08-07 20:48:09 +00:00
|
|
|
idx = SYSCLR_BUTTONMIDDLE;
|
2000-05-12 19:39:20 +00:00
|
|
|
break;
|
|
|
|
case eColor_buttonhighlight:
|
2000-08-07 20:48:09 +00:00
|
|
|
idx = SYSCLR_BUTTONLIGHT;
|
2000-05-12 19:39:20 +00:00
|
|
|
break;
|
|
|
|
case eColor_buttonshadow:
|
2000-08-07 20:48:09 +00:00
|
|
|
idx = SYSCLR_BUTTONDARK;
|
2000-05-12 19:39:20 +00:00
|
|
|
break;
|
|
|
|
case eColor_buttontext:
|
2000-12-05 22:40:48 +00:00
|
|
|
idx = SYSCLR_MENUTEXT;
|
2000-05-12 19:39:20 +00:00
|
|
|
break;
|
|
|
|
case eColor_captiontext:
|
2000-08-07 20:48:09 +00:00
|
|
|
idx = SYSCLR_WINDOWTEXT;
|
2000-05-12 19:39:20 +00:00
|
|
|
break;
|
|
|
|
case eColor_graytext:
|
2000-08-07 20:48:09 +00:00
|
|
|
idx = SYSCLR_MENUDISABLEDTEXT;
|
2000-05-12 19:39:20 +00:00
|
|
|
break;
|
|
|
|
case eColor_highlight:
|
2000-09-14 13:04:58 +00:00
|
|
|
idx = SYSCLR_HILITEBACKGROUND;
|
2000-05-12 19:39:20 +00:00
|
|
|
break;
|
|
|
|
case eColor_highlighttext:
|
2000-09-14 13:04:58 +00:00
|
|
|
idx = SYSCLR_HILITEFOREGROUND;
|
2000-05-12 19:39:20 +00:00
|
|
|
break;
|
|
|
|
case eColor_inactiveborder:
|
2000-08-07 20:48:09 +00:00
|
|
|
idx = SYSCLR_INACTIVEBORDER;
|
2000-05-12 19:39:20 +00:00
|
|
|
break;
|
|
|
|
case eColor_inactivecaption:
|
2000-08-07 20:48:09 +00:00
|
|
|
idx = SYSCLR_INACTIVETITLE;
|
2000-05-12 19:39:20 +00:00
|
|
|
break;
|
|
|
|
case eColor_inactivecaptiontext:
|
2000-11-07 22:17:55 +00:00
|
|
|
idx = SYSCLR_INACTIVETITLETEXT;
|
2000-05-12 19:39:20 +00:00
|
|
|
break;
|
|
|
|
case eColor_infobackground:
|
2000-09-14 13:04:58 +00:00
|
|
|
aColor = NS_RGB( 255, 255, 228);
|
|
|
|
return res;
|
2000-05-12 19:39:20 +00:00
|
|
|
case eColor_infotext:
|
2000-08-07 20:48:09 +00:00
|
|
|
idx = SYSCLR_WINDOWTEXT;
|
2000-05-12 19:39:20 +00:00
|
|
|
break;
|
|
|
|
case eColor_menu:
|
2000-08-07 20:48:09 +00:00
|
|
|
idx = SYSCLR_MENU;
|
2000-05-12 19:39:20 +00:00
|
|
|
break;
|
|
|
|
case eColor_menutext:
|
2000-08-07 20:48:09 +00:00
|
|
|
idx = SYSCLR_MENUTEXT;
|
2000-05-12 19:39:20 +00:00
|
|
|
break;
|
|
|
|
case eColor_scrollbar:
|
2000-08-07 20:48:09 +00:00
|
|
|
idx = SYSCLR_SCROLLBAR;
|
2000-05-12 19:39:20 +00:00
|
|
|
break;
|
|
|
|
case eColor_threeddarkshadow:
|
2003-06-18 21:16:29 +00:00
|
|
|
idx = SYSCLR_BUTTONDARK;
|
2000-05-12 19:39:20 +00:00
|
|
|
break;
|
|
|
|
case eColor_threedface:
|
2000-08-07 20:48:09 +00:00
|
|
|
idx = SYSCLR_BUTTONMIDDLE;
|
2000-05-12 19:39:20 +00:00
|
|
|
break;
|
|
|
|
case eColor_threedhighlight:
|
2000-08-07 20:48:09 +00:00
|
|
|
idx = SYSCLR_BUTTONLIGHT;
|
2000-05-12 19:39:20 +00:00
|
|
|
break;
|
|
|
|
case eColor_threedlightshadow:
|
2000-08-07 20:48:09 +00:00
|
|
|
idx = SYSCLR_BUTTONMIDDLE;
|
2000-05-12 19:39:20 +00:00
|
|
|
break;
|
|
|
|
case eColor_threedshadow:
|
2000-12-05 22:40:48 +00:00
|
|
|
idx = SYSCLR_BUTTONDARK;
|
2000-05-12 19:39:20 +00:00
|
|
|
break;
|
|
|
|
case eColor_window:
|
2000-08-07 20:48:09 +00:00
|
|
|
idx = SYSCLR_WINDOW;
|
2000-05-12 19:39:20 +00:00
|
|
|
break;
|
|
|
|
case eColor_windowframe:
|
2000-08-07 20:48:09 +00:00
|
|
|
idx = SYSCLR_WINDOWFRAME;
|
2000-05-12 19:39:20 +00:00
|
|
|
break;
|
|
|
|
case eColor_windowtext:
|
2000-08-07 20:48:09 +00:00
|
|
|
idx = SYSCLR_WINDOWTEXT;
|
2000-05-12 19:39:20 +00:00
|
|
|
break;
|
2000-10-04 00:38:03 +00:00
|
|
|
case eColor__moz_field:
|
2002-01-15 23:07:03 +00:00
|
|
|
idx = SYSCLR_ENTRYFIELD;
|
2000-10-04 00:38:03 +00:00
|
|
|
break;
|
2001-04-17 00:46:07 +00:00
|
|
|
case eColor__moz_fieldtext:
|
|
|
|
idx = SYSCLR_WINDOWTEXT;
|
|
|
|
break;
|
|
|
|
case eColor__moz_dialog:
|
2002-01-15 23:07:03 +00:00
|
|
|
idx = SYSCLR_DIALOGBACKGROUND;
|
2001-04-17 00:46:07 +00:00
|
|
|
break;
|
|
|
|
case eColor__moz_dialogtext:
|
|
|
|
idx = SYSCLR_WINDOWTEXT;
|
|
|
|
break;
|
2003-06-18 21:16:29 +00:00
|
|
|
case eColor__moz_buttondefault:
|
|
|
|
idx = SYSCLR_BUTTONDEFAULT;
|
|
|
|
break;
|
2000-05-12 19:39:20 +00:00
|
|
|
default:
|
2000-08-07 20:48:09 +00:00
|
|
|
idx = SYSCLR_WINDOW;
|
2000-05-12 19:39:20 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
long lColor = WinQuerySysColor( HWND_DESKTOP, idx, 0);
|
|
|
|
|
|
|
|
int iRed = (lColor & RGB_RED) >> 16;
|
|
|
|
int iGreen = (lColor & RGB_GREEN) >> 8;
|
|
|
|
int iBlue = (lColor & RGB_BLUE);
|
|
|
|
|
2000-09-14 13:04:58 +00:00
|
|
|
aColor = NS_RGB( iRed, iGreen, iBlue);
|
2000-05-12 19:39:20 +00:00
|
|
|
|
|
|
|
return res;
|
1999-06-28 23:39:35 +00:00
|
|
|
}
|
2000-08-07 20:48:09 +00:00
|
|
|
|
1999-06-28 23:39:35 +00:00
|
|
|
NS_IMETHODIMP nsLookAndFeel::GetMetric(const nsMetricID aID, PRInt32 & aMetric)
|
|
|
|
{
|
2001-11-06 02:41:04 +00:00
|
|
|
nsresult res = nsXPLookAndFeel::GetMetric(aID, aMetric);
|
|
|
|
if (NS_SUCCEEDED(res))
|
2000-05-12 19:39:20 +00:00
|
|
|
return res;
|
2001-11-06 02:41:04 +00:00
|
|
|
res = NS_OK;
|
1999-06-28 23:39:35 +00:00
|
|
|
|
2000-05-12 19:39:20 +00:00
|
|
|
switch (aID) {
|
|
|
|
case eMetric_WindowTitleHeight:
|
2000-08-07 20:48:09 +00:00
|
|
|
aMetric = WinQuerySysValue( HWND_DESKTOP, SV_CYTITLEBAR);
|
2000-05-12 19:39:20 +00:00
|
|
|
break;
|
|
|
|
case eMetric_WindowBorderWidth:
|
2000-08-07 20:48:09 +00:00
|
|
|
aMetric = WinQuerySysValue( HWND_DESKTOP, SV_CXSIZEBORDER);
|
2000-05-12 19:39:20 +00:00
|
|
|
break;
|
|
|
|
case eMetric_WindowBorderHeight:
|
2000-08-07 20:48:09 +00:00
|
|
|
aMetric = WinQuerySysValue( HWND_DESKTOP, SV_CYSIZEBORDER);
|
2000-05-12 19:39:20 +00:00
|
|
|
break;
|
|
|
|
case eMetric_Widget3DBorder:
|
2000-08-07 20:48:09 +00:00
|
|
|
aMetric = WinQuerySysValue( HWND_DESKTOP, SV_CXBORDER);
|
2000-05-12 19:39:20 +00:00
|
|
|
break;
|
|
|
|
case eMetric_TextFieldBorder:
|
|
|
|
aMetric = 3;
|
|
|
|
break;
|
|
|
|
case eMetric_TextFieldHeight:
|
|
|
|
aMetric = 24;
|
|
|
|
break;
|
|
|
|
case eMetric_ButtonHorizontalInsidePaddingNavQuirks:
|
|
|
|
aMetric = 10;
|
|
|
|
break;
|
|
|
|
case eMetric_ButtonHorizontalInsidePaddingOffsetNavQuirks:
|
|
|
|
aMetric = 8;
|
|
|
|
break;
|
|
|
|
case eMetric_CheckboxSize:
|
|
|
|
aMetric = 12;
|
|
|
|
break;
|
|
|
|
case eMetric_RadioboxSize:
|
|
|
|
aMetric = 12;
|
|
|
|
break;
|
|
|
|
case eMetric_TextHorizontalInsideMinimumPadding:
|
|
|
|
aMetric = 3;
|
|
|
|
break;
|
|
|
|
case eMetric_TextVerticalInsidePadding:
|
|
|
|
aMetric = 0;
|
|
|
|
break;
|
|
|
|
case eMetric_TextShouldUseVerticalInsidePadding:
|
|
|
|
aMetric = 0;
|
|
|
|
break;
|
|
|
|
case eMetric_TextShouldUseHorizontalInsideMinimumPadding:
|
|
|
|
aMetric = 1;
|
|
|
|
break;
|
|
|
|
case eMetric_ListShouldUseHorizontalInsideMinimumPadding:
|
|
|
|
aMetric = 0;
|
|
|
|
break;
|
|
|
|
case eMetric_ListHorizontalInsideMinimumPadding:
|
|
|
|
aMetric = 3;
|
|
|
|
break;
|
|
|
|
case eMetric_ListShouldUseVerticalInsidePadding:
|
|
|
|
aMetric = 0;
|
|
|
|
break;
|
|
|
|
case eMetric_ListVerticalInsidePadding:
|
|
|
|
aMetric = 0;
|
|
|
|
break;
|
1999-07-14 22:16:59 +00:00
|
|
|
case eMetric_CaretBlinkTime:
|
2000-08-07 20:48:09 +00:00
|
|
|
aMetric = WinQuerySysValue( HWND_DESKTOP, SV_CURSORRATE);
|
1999-07-14 22:16:59 +00:00
|
|
|
break;
|
2004-10-13 01:12:14 +00:00
|
|
|
case eMetric_CaretWidth:
|
2000-08-07 20:48:09 +00:00
|
|
|
aMetric = 1;
|
|
|
|
break;
|
2001-04-05 19:53:13 +00:00
|
|
|
case eMetric_ShowCaretDuringSelection:
|
2001-03-21 14:30:31 +00:00
|
|
|
aMetric = 0;
|
|
|
|
break;
|
2002-10-05 15:39:33 +00:00
|
|
|
case eMetric_SelectTextfieldsOnKeyFocus:
|
|
|
|
// Do not select textfield content when focused by kbd
|
|
|
|
// used by nsEventStateManager::sTextfieldSelectModel
|
|
|
|
aMetric = 0;
|
|
|
|
break;
|
2000-08-07 20:48:09 +00:00
|
|
|
case eMetric_SubmenuDelay:
|
|
|
|
aMetric = 300;
|
1999-07-14 22:16:59 +00:00
|
|
|
break;
|
2000-08-07 20:48:09 +00:00
|
|
|
case eMetric_MenusCanOverlapOSBar:
|
|
|
|
// we want XUL popups to be able to overlap the task bar.
|
|
|
|
aMetric = 1;
|
2000-04-03 23:44:37 +00:00
|
|
|
break;
|
2000-11-30 01:51:14 +00:00
|
|
|
case eMetric_ScrollArrowStyle:
|
|
|
|
aMetric = eMetric_ScrollArrowStyleSingle;
|
|
|
|
break;
|
|
|
|
case eMetric_ScrollSliderStyle:
|
|
|
|
aMetric = eMetric_ScrollThumbStyleProportional;
|
|
|
|
break;
|
2003-03-16 23:26:31 +00:00
|
|
|
case eMetric_TreeOpenDelay:
|
|
|
|
aMetric = 1000;
|
|
|
|
break;
|
|
|
|
case eMetric_TreeCloseDelay:
|
|
|
|
aMetric = 0;
|
|
|
|
break;
|
|
|
|
case eMetric_TreeLazyScrollDelay:
|
|
|
|
aMetric = 150;
|
|
|
|
break;
|
|
|
|
case eMetric_TreeScrollDelay:
|
|
|
|
aMetric = 100;
|
|
|
|
break;
|
|
|
|
case eMetric_TreeScrollLinesMax:
|
|
|
|
aMetric = 3;
|
|
|
|
break;
|
2000-08-07 20:48:09 +00:00
|
|
|
|
2000-05-12 19:39:20 +00:00
|
|
|
default:
|
2000-11-30 01:51:14 +00:00
|
|
|
aMetric = 0;
|
2000-05-12 19:39:20 +00:00
|
|
|
res = NS_ERROR_FAILURE;
|
|
|
|
}
|
|
|
|
return res;
|
1999-06-28 23:39:35 +00:00
|
|
|
}
|
|
|
|
|
2000-05-12 19:39:20 +00:00
|
|
|
NS_IMETHODIMP nsLookAndFeel::GetMetric(const nsMetricFloatID aID, float & aMetric)
|
1999-06-28 23:39:35 +00:00
|
|
|
{
|
2001-11-06 02:41:04 +00:00
|
|
|
nsresult res = nsXPLookAndFeel::GetMetric(aID, aMetric);
|
|
|
|
if (NS_SUCCEEDED(res))
|
|
|
|
return res;
|
|
|
|
res = NS_OK;
|
2000-05-12 19:39:20 +00:00
|
|
|
|
|
|
|
switch (aID) {
|
|
|
|
case eMetricFloat_TextFieldVerticalInsidePadding:
|
|
|
|
aMetric = 0.25f;
|
|
|
|
break;
|
|
|
|
case eMetricFloat_TextFieldHorizontalInsidePadding:
|
|
|
|
aMetric = 1.025f;
|
|
|
|
break;
|
|
|
|
case eMetricFloat_TextAreaVerticalInsidePadding:
|
|
|
|
aMetric = 0.40f;
|
|
|
|
break;
|
|
|
|
case eMetricFloat_TextAreaHorizontalInsidePadding:
|
|
|
|
aMetric = 0.40f;
|
|
|
|
break;
|
|
|
|
case eMetricFloat_ListVerticalInsidePadding:
|
|
|
|
aMetric = 0.10f;
|
|
|
|
break;
|
|
|
|
case eMetricFloat_ListHorizontalInsidePadding:
|
|
|
|
aMetric = 0.40f;
|
|
|
|
break;
|
|
|
|
case eMetricFloat_ButtonVerticalInsidePadding:
|
|
|
|
aMetric = 0.25f;
|
|
|
|
break;
|
|
|
|
case eMetricFloat_ButtonHorizontalInsidePadding:
|
|
|
|
aMetric = 0.25f;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
aMetric = -1.0;
|
|
|
|
res = NS_ERROR_FAILURE;
|
|
|
|
}
|
|
|
|
return res;
|
1999-06-28 23:39:35 +00:00
|
|
|
}
|
1999-10-19 11:34:00 +00:00
|
|
|
|
2000-05-12 19:39:20 +00:00
|
|
|
|
1999-10-19 11:34:00 +00:00
|
|
|
#ifdef NS_DEBUG
|
2000-05-12 19:39:20 +00:00
|
|
|
|
1999-10-19 11:34:00 +00:00
|
|
|
NS_IMETHODIMP nsLookAndFeel::GetNavSize(const nsMetricNavWidgetID aWidgetID,
|
|
|
|
const nsMetricNavFontID aFontID,
|
|
|
|
const PRInt32 aFontSize,
|
|
|
|
nsSize &aSize)
|
|
|
|
{
|
2001-11-06 02:41:04 +00:00
|
|
|
nsresult rv = nsXPLookAndFeel::GetNavSize(aWidgetID, aFontID, aFontSize,
|
|
|
|
aSize);
|
|
|
|
if (NS_SUCCEEDED(rv))
|
2000-04-03 22:46:52 +00:00
|
|
|
return rv;
|
|
|
|
|
1999-10-19 11:34:00 +00:00
|
|
|
aSize.width = 0;
|
|
|
|
aSize.height = 0;
|
2000-08-07 20:48:09 +00:00
|
|
|
|
|
|
|
if (aFontSize < 1 || aFontSize > 7) {
|
|
|
|
return NS_ERROR_FAILURE;
|
|
|
|
}
|
|
|
|
|
|
|
|
PRInt32 kTextFieldWidths[2][7] = {
|
|
|
|
{106,147,169,211,253,338,506}, // Courier
|
|
|
|
{152,214,237,281,366,495,732} // sans-serif
|
|
|
|
};
|
|
|
|
|
|
|
|
PRInt32 kTextFieldHeights[2][7] = {
|
|
|
|
{18,21,24,27,33,45,63}, // Courier
|
|
|
|
{18,21,24,27,34,48,67} // sans-serif
|
|
|
|
};
|
|
|
|
|
|
|
|
PRInt32 kTextAreaWidths[2][7] = {
|
|
|
|
{121,163,184,226,268,352,520}, // Courier
|
|
|
|
{163,226,247,289,373,499,730} // sans-serif
|
|
|
|
};
|
|
|
|
|
|
|
|
PRInt32 kTextAreaHeights[2][7] = {
|
|
|
|
{40,44,48,52,60,76,100}, // Courier
|
|
|
|
{40,44,48,52,62,80,106} // sans-serif
|
|
|
|
};
|
|
|
|
|
|
|
|
switch (aWidgetID) {
|
|
|
|
case eMetricSize_TextField:
|
|
|
|
aSize.width = kTextFieldWidths[aFontID][aFontSize-1];
|
|
|
|
aSize.height = kTextFieldHeights[aFontID][aFontSize-1];
|
|
|
|
break;
|
|
|
|
case eMetricSize_TextArea:
|
|
|
|
aSize.width = kTextAreaWidths[aFontID][aFontSize-1];
|
|
|
|
aSize.height = kTextAreaHeights[aFontID][aFontSize-1];
|
|
|
|
break;
|
2004-04-23 19:08:41 +00:00
|
|
|
/* Added to avoid warning errors - these are not used right now */
|
|
|
|
case eMetricSize_ListBox:
|
|
|
|
case eMetricSize_ComboBox:
|
|
|
|
case eMetricSize_Radio:
|
|
|
|
case eMetricSize_CheckBox:
|
|
|
|
case eMetricSize_Button:
|
|
|
|
break;
|
2000-08-07 20:48:09 +00:00
|
|
|
} //switch
|
|
|
|
|
|
|
|
return NS_OK;
|
|
|
|
|
1999-10-19 11:34:00 +00:00
|
|
|
}
|
|
|
|
#endif
|