1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /* ***** BEGIN LICENSE BLOCK *****
3 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
5 * The contents of this file are subject to the Mozilla Public License Version
6 * 1.1 (the "License"); you may not use this file except in compliance with
7 * the License. You may obtain a copy of the License at
8 * http://www.mozilla.org/MPL/
10 * Software distributed under the License is distributed on an "AS IS" basis,
11 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
12 * for the specific language governing rights and limitations under the
15 * The Original Code is mozilla.org code.
17 * The Initial Developer of the Original Code is
18 * Netscape Communications Corporation.
19 * Portions created by the Initial Developer are Copyright (C) 1998
20 * the Initial Developer. All Rights Reserved.
24 * Alternatively, the contents of this file may be used under the terms of
25 * either the GNU General Public License Version 2 or later (the "GPL"), or
26 * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
27 * in which case the provisions of the GPL or the LGPL are applicable instead
28 * of those above. If you wish to allow use of your version of this file only
29 * under the terms of either the GPL or the LGPL, and not to allow others to
30 * use your version of this file under the terms of the MPL, indicate your
31 * decision by deleting the provisions above and replace them with the notice
32 * and other provisions required by the GPL or the LGPL. If you do not delete
33 * the provisions above, a recipient may use your version of this file under
34 * the terms of any one of the MPL, the GPL or the LGPL.
36 * ***** END LICENSE BLOCK ***** */
38 #ifndef __nsILookAndFeel
39 #define __nsILookAndFeel
40 #include "nsISupports.h"
43 // for |#ifdef NS_DEBUG|
47 // {6672E0EA-C936-11DC-9BB7-0014850B592F}
48 #define NS_ILOOKANDFEEL_IID \
49 { 0x6672e0ea, 0xc936, 0x11dc, \
50 { 0x9b, 0xb7, 0x00, 0x14, 0x85, 0x0b, 0x59, 0x2f} }
53 class nsILookAndFeel
: public nsISupports
{
55 NS_DECLARE_STATIC_IID_ACCESSOR(NS_ILOOKANDFEEL_IID
)
57 // When modifying this list, also modify nsXPLookAndFeel::sColorPrefs
58 // in widget/src/xpwidgts/nsXPLookAndFeel.cpp.
61 // WARNING : NO NEGATIVE VALUE IN THIS ENUMERATION
62 // see patch in bug 57757 for more information
64 eColor_WindowBackground
,
65 eColor_WindowForeground
,
66 eColor_WidgetBackground
,
67 eColor_WidgetForeground
,
68 eColor_WidgetSelectBackground
,
69 eColor_WidgetSelectForeground
,
70 eColor_Widget3DHighlight
,
71 eColor_Widget3DShadow
,
72 eColor_TextBackground
,
73 eColor_TextForeground
,
74 eColor_TextSelectBackground
,
75 eColor_TextSelectForeground
,
76 eColor_TextSelectBackgroundDisabled
,
77 eColor_TextSelectBackgroundAttention
,
78 eColor_TextHighlightBackground
,
79 eColor_TextHighlightForeground
,
81 eColor_IMERawInputBackground
,
82 eColor_IMERawInputForeground
,
83 eColor_IMERawInputUnderline
,
84 eColor_IMESelectedRawTextBackground
,
85 eColor_IMESelectedRawTextForeground
,
86 eColor_IMESelectedRawTextUnderline
,
87 eColor_IMEConvertedTextBackground
,
88 eColor_IMEConvertedTextForeground
,
89 eColor_IMEConvertedTextUnderline
,
90 eColor_IMESelectedConvertedTextBackground
,
91 eColor_IMESelectedConvertedTextForeground
,
92 eColor_IMESelectedConvertedTextUnderline
,
94 // New CSS 2 color definitions
100 eColor_buttonhighlight
,
106 eColor_highlighttext
,
107 eColor_inactiveborder
,
108 eColor_inactivecaption
,
109 eColor_inactivecaptiontext
,
110 eColor_infobackground
,
115 eColor_threeddarkshadow
,
117 eColor_threedhighlight
,
118 eColor_threedlightshadow
,
124 eColor__moz_buttondefault
,
125 // Colors which will hopefully become CSS3
127 eColor__moz_fieldtext
,
129 eColor__moz_dialogtext
,
130 eColor__moz_dragtargetzone
, //used to highlight valid regions to drop something onto
132 eColor__moz_cellhighlight
, //used to cell text background, selected but not focus
133 eColor__moz_cellhighlighttext
, //used to cell text, selected but not focus
134 eColor__moz_html_cellhighlight
, //used to html select cell text background, selected but not focus
135 eColor__moz_html_cellhighlighttext
, //used to html select cell text, selected but not focus
136 eColor__moz_buttonhoverface
, //used to button text background, when mouse is over
137 eColor__moz_buttonhovertext
, //used to button text, when mouse is over
138 eColor__moz_menuhover
, //used to menu item background, when mouse is over
139 eColor__moz_menuhovertext
, //used to menu item text, when mouse is over
140 eColor__moz_menubarhovertext
, //used to menu bar item text, when mouse is over
141 // On platforms where these colors are the same as
142 // -moz-field, use -moz-fieldtext as foreground color
143 eColor__moz_eventreerow
,
144 eColor__moz_oddtreerow
,
146 // colors needed by the Mac OS X theme
147 eColor__moz_mac_chrome_active
, // background color of chrome toolbars in active windows
148 eColor__moz_mac_chrome_inactive
, // background color of chrome toolbars in inactive windows
149 eColor__moz_mac_focusring
, //ring around text fields and lists
150 eColor__moz_mac_menuselect
, //colour used when mouse is over a menu item
151 eColor__moz_mac_menushadow
, //colour used to do shadows on menu items
152 eColor__moz_mac_menutextdisable
, // color used to display text for disabled menu items
153 eColor__moz_mac_menutextselect
, //colour used to display text while mouse is over a menu item
154 eColor__moz_mac_disabledtoolbartext
, // text color of disabled text on toolbars
156 //all of the accent colours
157 eColor__moz_mac_accentlightesthighlight
,
158 eColor__moz_mac_accentregularhighlight
,
159 eColor__moz_mac_accentface
,
160 eColor__moz_mac_accentlightshadow
,
161 eColor__moz_mac_accentregularshadow
,
162 eColor__moz_mac_accentdarkshadow
,
163 eColor__moz_mac_accentdarkestshadow
,
166 eColor__moz_mac_alternateprimaryhighlight
, //active list highlight
167 eColor__moz_mac_secondaryhighlight
, //inactive light hightlight
170 eColor__moz_win_mediatext
, // media rebar text
171 eColor__moz_win_communicationstext
, // communications rebar text
173 // Hyperlink color extracted from the system, not affected by the browser.anchor_color user pref.
174 // There is no OS-specified safe background color for this text,
175 // but it is used regularly within Windows and the Gnome DE on Dialog and Window colors.
176 eColor__moz_nativehyperlinktext
,
178 // keep this one last, please
182 // When modifying this list, also modify nsXPLookAndFeel::sIntPrefs
183 // in widget/src/xpwidgts/nsXPLookAndFeel.cpp.
185 eMetric_WindowTitleHeight
,
186 eMetric_WindowBorderWidth
,
187 eMetric_WindowBorderHeight
,
188 eMetric_Widget3DBorder
,
189 eMetric_TextFieldBorder
, // Native border size
190 eMetric_TextFieldHeight
,
191 eMetric_TextVerticalInsidePadding
, // needed only because of GTK
192 eMetric_TextShouldUseVerticalInsidePadding
, // needed only because of GTK
193 eMetric_TextHorizontalInsideMinimumPadding
,
194 eMetric_TextShouldUseHorizontalInsideMinimumPadding
, // needed only because of GTK
195 eMetric_ButtonHorizontalInsidePaddingNavQuirks
,
196 eMetric_ButtonHorizontalInsidePaddingOffsetNavQuirks
,
197 eMetric_CheckboxSize
,
198 eMetric_RadioboxSize
,
200 eMetric_ListShouldUseHorizontalInsideMinimumPadding
, // needed only because of GTK
201 eMetric_ListHorizontalInsideMinimumPadding
,
203 eMetric_ListShouldUseVerticalInsidePadding
, // needed only because of GTK
204 eMetric_ListVerticalInsidePadding
, // needed only because of GTK
206 eMetric_CaretBlinkTime
, // default, may be overriden by OS
207 eMetric_CaretWidth
, // pixel width of caret
208 eMetric_ShowCaretDuringSelection
, // show the caret when text is selected?
209 eMetric_SelectTextfieldsOnKeyFocus
, // select textfields when focused via tab/accesskey?
210 eMetric_SubmenuDelay
, // delay before submenus open
211 eMetric_MenusCanOverlapOSBar
, // can popups overlap menu/task bar?
212 eMetric_SkipNavigatingDisabledMenuItem
, // skip navigating to disabled menu item?
213 eMetric_DragFullWindow
, // show window contents while dragging?
214 eMetric_DragThresholdX
, // begin a drag if the mouse is moved further than the threshold while the button is down
215 eMetric_DragThresholdY
,
216 eMetric_UseAccessibilityTheme
, // Accessibility theme being used?
217 eMetric_IsScreenReaderActive
, // Screen reader being used?
219 eMetric_ScrollArrowStyle
, // position of scroll arrows in a scrollbar
220 eMetric_ScrollSliderStyle
, // is scroll thumb proportional or fixed?
222 eMetric_ScrollButtonLeftMouseButtonAction
, // each button can take one of four values:
223 eMetric_ScrollButtonMiddleMouseButtonAction
, // 0 - scrolls one line, 1 - scrolls one page
224 eMetric_ScrollButtonRightMouseButtonAction
, // 2 - scrolls to end, 3 - button ignored
226 eMetric_TreeOpenDelay
, // delay for opening spring loaded folders
227 eMetric_TreeCloseDelay
, // delay for closing spring loaded folders
228 eMetric_TreeLazyScrollDelay
, // delay for triggering the tree scrolling
229 eMetric_TreeScrollDelay
, // delay for scrolling the tree
230 eMetric_TreeScrollLinesMax
, // the maximum number of lines to be scrolled at ones
231 eMetric_TabFocusModel
, // What type of tab-order to use
234 * A Boolean value to determine whether the Windows default theme is
237 * The value of this metric is not used on other platforms. These platforms
238 * should return NS_ERROR_NOT_IMPLEMENTED when queried for this metric.
240 eMetric_WindowsDefaultTheme
,
243 * A Boolean value to determine whether the DWM compositor is being used
245 * This metric is not used on non-Windows platforms. These platforms
246 * should return NS_ERROR_NOT_IMPLEMENTED when queried for this metric.
248 eMetric_DWMCompositor
,
251 * A Boolean value to determine whether Windows is themed (Classic vs.
254 * This is Windows-specific and is not implemented on other platforms
255 * (will return the default of NS_ERROR_FAILURE).
257 eMetric_WindowsClassic
,
260 * A Boolean value to determine whether the Mac graphite theme is
263 * The value of this metric is not used on other platforms. These platforms
264 * should return NS_ERROR_NOT_IMPLEMENTED when queried for this metric.
266 eMetric_MacGraphiteTheme
,
269 * eMetric_AlertNotificationOrigin indicates from which corner of the
270 * screen alerts slide in, and from which direction (horizontal/vertical).
271 * 0, the default, represents bottom right, sliding vertically.
272 * Use any bitwise combination of the following constants:
273 * NS_ALERT_HORIZONTAL (1), NS_ALERT_LEFT (2), NS_ALERT_TOP (4).
283 eMetric_AlertNotificationOrigin
,
286 * If true, clicking on a scrollbar (not as in dragging the thumb) defaults
287 * to scrolling the view corresponding to the clicked point. Otherwise, we
288 * only do so if the scrollbar is clicked using the middle mouse button or
289 * if shift is pressed when the scrollbar is clicked.
291 eMetric_ScrollToClick
,
294 * IME underline styles, the values should be NS_DECORATION_LINE_STYLE_*.
295 * They are defined below.
297 eMetric_IMERawInputUnderlineStyle
,
298 eMetric_IMESelectedRawTextUnderlineStyle
,
299 eMetric_IMEConvertedTextUnderlineStyle
,
300 eMetric_IMESelectedConvertedTextUnderline
,
303 * If this metric != 0, show icons in menus.
305 eMetric_ImagesInMenus
309 eMetric_ScrollArrowStartBackward
= 0x1000,
310 eMetric_ScrollArrowStartForward
= 0x0100,
311 eMetric_ScrollArrowEndBackward
= 0x0010,
312 eMetric_ScrollArrowEndForward
= 0x0001,
313 eMetric_ScrollArrowStyleSingle
= // single arrow at each end
314 eMetric_ScrollArrowStartBackward
|eMetric_ScrollArrowEndForward
,
315 eMetric_ScrollArrowStyleBothAtBottom
= // both arrows at bottom/right, none at top/left
316 eMetric_ScrollArrowEndBackward
|eMetric_ScrollArrowEndForward
,
317 eMetric_ScrollArrowStyleBothAtEachEnd
= // both arrows at both ends
318 eMetric_ScrollArrowEndBackward
|eMetric_ScrollArrowEndForward
|
319 eMetric_ScrollArrowStartBackward
|eMetric_ScrollArrowStartForward
,
320 eMetric_ScrollArrowStyleBothAtTop
= // both arrows at top/left, none at bottom/right
321 eMetric_ScrollArrowStartBackward
|eMetric_ScrollArrowStartForward
324 eMetric_ScrollThumbStyleNormal
,
325 eMetric_ScrollThumbStyleProportional
328 // When modifying this list, also modify nsXPLookAndFeel::sFloatPrefs
329 // in widget/src/xpwidgts/nsXPLookAndFeel.cpp.
331 eMetricFloat_TextFieldVerticalInsidePadding
,
332 eMetricFloat_TextFieldHorizontalInsidePadding
,
333 eMetricFloat_TextAreaVerticalInsidePadding
,
334 eMetricFloat_TextAreaHorizontalInsidePadding
,
335 eMetricFloat_ListVerticalInsidePadding
,
336 eMetricFloat_ListHorizontalInsidePadding
,
337 eMetricFloat_ButtonVerticalInsidePadding
,
338 eMetricFloat_ButtonHorizontalInsidePadding
,
339 eMetricFloat_IMEUnderlineRelativeSize
,
341 // The width/height ratio of the cursor. If used, the CaretWidth int metric
342 // should be added to the calculated caret width.
343 eMetricFloat_CaretAspectRatio
346 NS_IMETHOD
GetColor(const nsColorID aID
, nscolor
&aColor
) = 0;
347 NS_IMETHOD
GetMetric(const nsMetricID aID
, PRInt32
& aMetric
) = 0;
348 NS_IMETHOD
GetMetric(const nsMetricFloatID aID
, float & aMetric
) = 0;
349 virtual PRUnichar
GetPasswordCharacter()
351 return PRUnichar('*');
354 NS_IMETHOD
LookAndFeelChanged() = 0;
359 eMetricSize_TextField
= 0,
360 eMetricSize_TextArea
= 1,
361 eMetricSize_ListBox
= 2,
362 eMetricSize_ComboBox
= 3,
363 eMetricSize_Radio
= 4,
364 eMetricSize_CheckBox
= 5,
365 eMetricSize_Button
= 6
366 } nsMetricNavWidgetID
;
369 eMetricSize_Courier
= 0,
370 eMetricSize_SansSerif
= 1
373 // This method returns the actual (or nearest estimate)
374 // of the Navigator size for a given form control for a given font
375 // and font size. This is used in NavQuirks mode to see how closely
377 NS_IMETHOD
GetNavSize(const nsMetricNavWidgetID aWidgetID
,
378 const nsMetricNavFontID aFontID
,
379 const PRInt32 aFontSize
,
384 NS_DEFINE_STATIC_IID_ACCESSOR(nsILookAndFeel
, NS_ILOOKANDFEEL_IID
)
387 // On the Mac, GetColor(eColor_TextSelectForeground, color) returns this
388 // constant to specify that the foreground color should not be changed
389 // (ie. a colored text keeps its colors when selected).
390 // Of course if other plaforms work like the Mac, they can use it too.
391 #define NS_DONT_CHANGE_COLOR NS_RGB(0x01, 0x01, 0x01)
393 // --------------------------------
394 // Special colors for eColor_IME*
395 // --------------------------------
397 // For background color only.
398 #define NS_TRANSPARENT NS_RGBA(0x01, 0x00, 0x00, 0x00)
399 // For foreground color only.
400 #define NS_SAME_AS_FOREGROUND_COLOR NS_RGBA(0x02, 0x00, 0x00, 0x00)
401 #define NS_40PERCENT_FOREGROUND_COLOR NS_RGBA(0x03, 0x00, 0x00, 0x00)
403 #define NS_IS_IME_SPECIAL_COLOR(c) ((c) == NS_TRANSPARENT || \
404 (c) == NS_SAME_AS_FOREGROUND_COLOR || \
405 (c) == NS_40PERCENT_FOREGROUND_COLOR)
407 // -------------------------------------------------
408 // Underline styles for eMetric_IME*UnderlineStyle
409 // -------------------------------------------------
411 #define NS_UNDERLINE_STYLE_NONE 0
412 #define NS_UNDERLINE_STYLE_DOTTED 1
413 #define NS_UNDERLINE_STYLE_DASHED 2
414 #define NS_UNDERLINE_STYLE_SOLID 3
415 #define NS_UNDERLINE_STYLE_DOUBLE 4
417 #define NS_IS_VALID_UNDERLINE_STYLE(s) \
418 (NS_UNDERLINE_STYLE_NONE <= (s) && (s) <= NS_UNDERLINE_STYLE_DOUBLE)
420 // ------------------------------------------
421 // Bits for eMetric_AlertNotificationOrigin
422 // ------------------------------------------
424 #define NS_ALERT_HORIZONTAL 1
425 #define NS_ALERT_LEFT 2
426 #define NS_ALERT_TOP 4
428 #endif /* __nsILookAndFeel */