Bug 454376 add -lCrun -lCstd for Solaris OS_LIBS, r=bsmedberg
[wine-gecko.git] / widget / public / nsILookAndFeel.h
blob7af2c8e8e4fb6c5e088b58ba4a0e7469b3e0842f
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
13 * License.
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.
22 * Contributor(s):
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"
41 #include "nsColor.h"
43 // for |#ifdef NS_DEBUG|
44 struct nsSize;
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 {
54 public:
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.
59 typedef enum {
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
95 eColor_activeborder,
96 eColor_activecaption,
97 eColor_appworkspace,
98 eColor_background,
99 eColor_buttonface,
100 eColor_buttonhighlight,
101 eColor_buttonshadow,
102 eColor_buttontext,
103 eColor_captiontext,
104 eColor_graytext,
105 eColor_highlight,
106 eColor_highlighttext,
107 eColor_inactiveborder,
108 eColor_inactivecaption,
109 eColor_inactivecaptiontext,
110 eColor_infobackground,
111 eColor_infotext,
112 eColor_menu,
113 eColor_menutext,
114 eColor_scrollbar,
115 eColor_threeddarkshadow,
116 eColor_threedface,
117 eColor_threedhighlight,
118 eColor_threedlightshadow,
119 eColor_threedshadow,
120 eColor_window,
121 eColor_windowframe,
122 eColor_windowtext,
124 eColor__moz_buttondefault,
125 // Colors which will hopefully become CSS3
126 eColor__moz_field,
127 eColor__moz_fieldtext,
128 eColor__moz_dialog,
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
155 //all of the accent colours
156 eColor__moz_mac_accentlightesthighlight,
157 eColor__moz_mac_accentregularhighlight,
158 eColor__moz_mac_accentface,
159 eColor__moz_mac_accentlightshadow,
160 eColor__moz_mac_accentregularshadow,
161 eColor__moz_mac_accentdarkshadow,
162 eColor__moz_mac_accentdarkestshadow,
164 //new in 10.2
165 eColor__moz_mac_alternateprimaryhighlight, //active list highlight
166 eColor__moz_mac_secondaryhighlight, //inactive light hightlight
168 // vista rebars
169 eColor__moz_win_mediatext, // media rebar text
170 eColor__moz_win_communicationstext, // communications rebar text
172 // Hyperlink color extracted from the system, not affected by the browser.anchor_color user pref.
173 // There is no OS-specified safe background color for this text,
174 // but it is used regularly within Windows and the Gnome DE on Dialog and Window colors.
175 eColor__moz_nativehyperlinktext,
177 // keep this one last, please
178 eColor_LAST_COLOR
179 } nsColorID;
181 // When modifying this list, also modify nsXPLookAndFeel::sIntPrefs
182 // in widget/src/xpwidgts/nsXPLookAndFeel.cpp.
183 typedef enum {
184 eMetric_WindowTitleHeight,
185 eMetric_WindowBorderWidth,
186 eMetric_WindowBorderHeight,
187 eMetric_Widget3DBorder,
188 eMetric_TextFieldBorder, // Native border size
189 eMetric_TextFieldHeight,
190 eMetric_TextVerticalInsidePadding, // needed only because of GTK
191 eMetric_TextShouldUseVerticalInsidePadding, // needed only because of GTK
192 eMetric_TextHorizontalInsideMinimumPadding,
193 eMetric_TextShouldUseHorizontalInsideMinimumPadding, // needed only because of GTK
194 eMetric_ButtonHorizontalInsidePaddingNavQuirks,
195 eMetric_ButtonHorizontalInsidePaddingOffsetNavQuirks,
196 eMetric_CheckboxSize,
197 eMetric_RadioboxSize,
199 eMetric_ListShouldUseHorizontalInsideMinimumPadding, // needed only because of GTK
200 eMetric_ListHorizontalInsideMinimumPadding,
202 eMetric_ListShouldUseVerticalInsidePadding, // needed only because of GTK
203 eMetric_ListVerticalInsidePadding, // needed only because of GTK
205 eMetric_CaretBlinkTime, // default, may be overriden by OS
206 eMetric_CaretWidth, // pixel width of caret
207 eMetric_ShowCaretDuringSelection, // show the caret when text is selected?
208 eMetric_SelectTextfieldsOnKeyFocus, // select textfields when focused via tab/accesskey?
209 eMetric_SubmenuDelay, // delay before submenus open
210 eMetric_MenusCanOverlapOSBar, // can popups overlap menu/task bar?
211 eMetric_SkipNavigatingDisabledMenuItem, // skip navigating to disabled menu item?
212 eMetric_DragFullWindow, // show window contents while dragging?
213 eMetric_DragThresholdX, // begin a drag if the mouse is moved further than the threshold while the button is down
214 eMetric_DragThresholdY,
215 eMetric_UseAccessibilityTheme, // Accessibility theme being used?
216 eMetric_IsScreenReaderActive, // Screen reader being used?
218 eMetric_ScrollArrowStyle, // position of scroll arrows in a scrollbar
219 eMetric_ScrollSliderStyle, // is scroll thumb proportional or fixed?
221 eMetric_ScrollButtonLeftMouseButtonAction, // each button can take one of four values:
222 eMetric_ScrollButtonMiddleMouseButtonAction, // 0 - scrolls one line, 1 - scrolls one page
223 eMetric_ScrollButtonRightMouseButtonAction, // 2 - scrolls to end, 3 - button ignored
225 eMetric_TreeOpenDelay, // delay for opening spring loaded folders
226 eMetric_TreeCloseDelay, // delay for closing spring loaded folders
227 eMetric_TreeLazyScrollDelay, // delay for triggering the tree scrolling
228 eMetric_TreeScrollDelay, // delay for scrolling the tree
229 eMetric_TreeScrollLinesMax, // the maximum number of lines to be scrolled at ones
230 eMetric_TabFocusModel, // What type of tab-order to use
233 * A Boolean value to determine whether the Windows default theme is
234 * being used.
236 * The value of this metric is not used on other platforms. These platforms
237 * should return NS_ERROR_NOT_IMPLEMENTED when queried for this metric.
239 eMetric_WindowsDefaultTheme,
242 * A Boolean value to determine whether the DWM compositor is being used
244 * This metric is not used on non-Windows platforms. These platforms
245 * should return NS_ERROR_NOT_IMPLEMENTED when queried for this metric.
247 eMetric_DWMCompositor,
250 * A Boolean value to determine whether Windows is themed (Classic vs.
251 * uxtheme)
253 * This is Windows-specific and is not implemented on other platforms
254 * (will return the default of NS_ERROR_FAILURE).
256 eMetric_WindowsClassic,
259 * A Boolean value to determine whether the Mac graphite theme is
260 * being used.
262 * The value of this metric is not used on other platforms. These platforms
263 * should return NS_ERROR_NOT_IMPLEMENTED when queried for this metric.
265 eMetric_MacGraphiteTheme,
268 * eMetric_AlertNotificationOrigin indicates from which corner of the
269 * screen alerts slide in, and from which direction (horizontal/vertical).
270 * 0, the default, represents bottom right, sliding vertically.
271 * Use any bitwise combination of the following constants:
272 * NS_ALERT_HORIZONTAL (1), NS_ALERT_LEFT (2), NS_ALERT_TOP (4).
274 * 6 4
275 * +-----------+
276 * 7| |5
277 * | |
278 * 3| |1
279 * +-----------+
280 * 2 0
282 eMetric_AlertNotificationOrigin,
285 * If true, clicking on a scrollbar (not as in dragging the thumb) defaults
286 * to scrolling the view corresponding to the clicked point. Otherwise, we
287 * only do so if the scrollbar is clicked using the middle mouse button or
288 * if shift is pressed when the scrollbar is clicked.
290 eMetric_ScrollToClick,
293 * IME underline styles, the values should be NS_DECORATION_LINE_STYLE_*.
294 * They are defined below.
296 eMetric_IMERawInputUnderlineStyle,
297 eMetric_IMESelectedRawTextUnderlineStyle,
298 eMetric_IMEConvertedTextUnderlineStyle,
299 eMetric_IMESelectedConvertedTextUnderline,
302 * If this metric != 0, show icons in menus.
304 eMetric_ImagesInMenus
305 } nsMetricID;
307 enum {
308 eMetric_ScrollArrowStartBackward = 0x1000,
309 eMetric_ScrollArrowStartForward = 0x0100,
310 eMetric_ScrollArrowEndBackward = 0x0010,
311 eMetric_ScrollArrowEndForward = 0x0001,
312 eMetric_ScrollArrowStyleSingle = // single arrow at each end
313 eMetric_ScrollArrowStartBackward|eMetric_ScrollArrowEndForward,
314 eMetric_ScrollArrowStyleBothAtBottom = // both arrows at bottom/right, none at top/left
315 eMetric_ScrollArrowEndBackward|eMetric_ScrollArrowEndForward,
316 eMetric_ScrollArrowStyleBothAtEachEnd = // both arrows at both ends
317 eMetric_ScrollArrowEndBackward|eMetric_ScrollArrowEndForward|
318 eMetric_ScrollArrowStartBackward|eMetric_ScrollArrowStartForward,
319 eMetric_ScrollArrowStyleBothAtTop = // both arrows at top/left, none at bottom/right
320 eMetric_ScrollArrowStartBackward|eMetric_ScrollArrowStartForward
322 enum {
323 eMetric_ScrollThumbStyleNormal,
324 eMetric_ScrollThumbStyleProportional
327 // When modifying this list, also modify nsXPLookAndFeel::sFloatPrefs
328 // in widget/src/xpwidgts/nsXPLookAndFeel.cpp.
329 typedef enum {
330 eMetricFloat_TextFieldVerticalInsidePadding,
331 eMetricFloat_TextFieldHorizontalInsidePadding,
332 eMetricFloat_TextAreaVerticalInsidePadding,
333 eMetricFloat_TextAreaHorizontalInsidePadding,
334 eMetricFloat_ListVerticalInsidePadding,
335 eMetricFloat_ListHorizontalInsidePadding,
336 eMetricFloat_ButtonVerticalInsidePadding,
337 eMetricFloat_ButtonHorizontalInsidePadding,
338 eMetricFloat_IMEUnderlineRelativeSize,
340 // The width/height ratio of the cursor. If used, the CaretWidth int metric
341 // should be added to the calculated caret width.
342 eMetricFloat_CaretAspectRatio
343 } nsMetricFloatID;
345 NS_IMETHOD GetColor(const nsColorID aID, nscolor &aColor) = 0;
346 NS_IMETHOD GetMetric(const nsMetricID aID, PRInt32 & aMetric) = 0;
347 NS_IMETHOD GetMetric(const nsMetricFloatID aID, float & aMetric) = 0;
348 virtual PRUnichar GetPasswordCharacter()
350 return PRUnichar('*');
353 NS_IMETHOD LookAndFeelChanged() = 0;
356 #ifdef NS_DEBUG
357 typedef enum {
358 eMetricSize_TextField = 0,
359 eMetricSize_TextArea = 1,
360 eMetricSize_ListBox = 2,
361 eMetricSize_ComboBox = 3,
362 eMetricSize_Radio = 4,
363 eMetricSize_CheckBox = 5,
364 eMetricSize_Button = 6
365 } nsMetricNavWidgetID;
367 typedef enum {
368 eMetricSize_Courier = 0,
369 eMetricSize_SansSerif = 1
370 } nsMetricNavFontID;
372 // This method returns the actual (or nearest estimate)
373 // of the Navigator size for a given form control for a given font
374 // and font size. This is used in NavQuirks mode to see how closely
375 // we match its size
376 NS_IMETHOD GetNavSize(const nsMetricNavWidgetID aWidgetID,
377 const nsMetricNavFontID aFontID,
378 const PRInt32 aFontSize,
379 nsSize &aSize) = 0;
380 #endif
383 NS_DEFINE_STATIC_IID_ACCESSOR(nsILookAndFeel, NS_ILOOKANDFEEL_IID)
386 // On the Mac, GetColor(eColor_TextSelectForeground, color) returns this
387 // constant to specify that the foreground color should not be changed
388 // (ie. a colored text keeps its colors when selected).
389 // Of course if other plaforms work like the Mac, they can use it too.
390 #define NS_DONT_CHANGE_COLOR NS_RGB(0x01, 0x01, 0x01)
392 // --------------------------------
393 // Special colors for eColor_IME*
394 // --------------------------------
396 // For background color only.
397 #define NS_TRANSPARENT NS_RGBA(0x01, 0x00, 0x00, 0x00)
398 // For foreground color only.
399 #define NS_SAME_AS_FOREGROUND_COLOR NS_RGBA(0x02, 0x00, 0x00, 0x00)
400 #define NS_40PERCENT_FOREGROUND_COLOR NS_RGBA(0x03, 0x00, 0x00, 0x00)
402 #define NS_IS_IME_SPECIAL_COLOR(c) ((c) == NS_TRANSPARENT || \
403 (c) == NS_SAME_AS_FOREGROUND_COLOR || \
404 (c) == NS_40PERCENT_FOREGROUND_COLOR)
406 // -------------------------------------------------
407 // Underline styles for eMetric_IME*UnderlineStyle
408 // -------------------------------------------------
410 #define NS_UNDERLINE_STYLE_NONE 0
411 #define NS_UNDERLINE_STYLE_DOTTED 1
412 #define NS_UNDERLINE_STYLE_DASHED 2
413 #define NS_UNDERLINE_STYLE_SOLID 3
414 #define NS_UNDERLINE_STYLE_DOUBLE 4
416 #define NS_IS_VALID_UNDERLINE_STYLE(s) \
417 (NS_UNDERLINE_STYLE_NONE <= (s) && (s) <= NS_UNDERLINE_STYLE_DOUBLE)
419 // ------------------------------------------
420 // Bits for eMetric_AlertNotificationOrigin
421 // ------------------------------------------
423 #define NS_ALERT_HORIZONTAL 1
424 #define NS_ALERT_LEFT 2
425 #define NS_ALERT_TOP 4
427 #endif /* __nsILookAndFeel */