Back to index

lightning-sunbird  0.9+nobinonly
nsILookAndFeel.h
Go to the documentation of this file.
00001 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
00002 /* ***** BEGIN LICENSE BLOCK *****
00003  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
00004  *
00005  * The contents of this file are subject to the Mozilla Public License Version
00006  * 1.1 (the "License"); you may not use this file except in compliance with
00007  * the License. You may obtain a copy of the License at
00008  * http://www.mozilla.org/MPL/
00009  *
00010  * Software distributed under the License is distributed on an "AS IS" basis,
00011  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
00012  * for the specific language governing rights and limitations under the
00013  * License.
00014  *
00015  * The Original Code is mozilla.org code.
00016  *
00017  * The Initial Developer of the Original Code is
00018  * Netscape Communications Corporation.
00019  * Portions created by the Initial Developer are Copyright (C) 1998
00020  * the Initial Developer. All Rights Reserved.
00021  *
00022  * Contributor(s):
00023  *
00024  * Alternatively, the contents of this file may be used under the terms of
00025  * either the GNU General Public License Version 2 or later (the "GPL"), or
00026  * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
00027  * in which case the provisions of the GPL or the LGPL are applicable instead
00028  * of those above. If you wish to allow use of your version of this file only
00029  * under the terms of either the GPL or the LGPL, and not to allow others to
00030  * use your version of this file under the terms of the MPL, indicate your
00031  * decision by deleting the provisions above and replace them with the notice
00032  * and other provisions required by the GPL or the LGPL. If you do not delete
00033  * the provisions above, a recipient may use your version of this file under
00034  * the terms of any one of the MPL, the GPL or the LGPL.
00035  *
00036  * ***** END LICENSE BLOCK ***** */
00037 
00038 #ifndef __nsILookAndFeel
00039 #define __nsILookAndFeel
00040 #include "nsISupports.h"
00041 #include "nsColor.h"
00042 
00043   // for |#ifdef NS_DEBUG|
00044 struct nsSize;
00045 
00046 
00047 // {ED0B4802-9F50-4f69-9509-6949C69999E4}
00048 #define NS_ILOOKANDFEEL_IID \
00049 { 0xed0b4802, 0x9f50, 0x4f69, \
00050     { 0x95, 0x9, 0x69, 0x49, 0xc6, 0x99, 0x99, 0xe4 } }
00051 
00052 class nsILookAndFeel: public nsISupports {
00053 public:
00054     NS_DEFINE_STATIC_IID_ACCESSOR(NS_ILOOKANDFEEL_IID)
00055 
00056   // When modifying this list, also modify nsXPLookAndFeel::sColorPrefs
00057   // in widget/src/xpwidgts/nsXPLookAndFeel.cpp.
00058   typedef enum {
00059 
00060     // WARNING : NO NEGATIVE VALUE IN THIS ENUMERATION
00061     // see patch in bug 57757 for more information
00062 
00063     eColor_WindowBackground,
00064     eColor_WindowForeground,
00065     eColor_WidgetBackground,
00066     eColor_WidgetForeground,
00067     eColor_WidgetSelectBackground,
00068     eColor_WidgetSelectForeground,
00069     eColor_Widget3DHighlight,
00070     eColor_Widget3DShadow,
00071     eColor_TextBackground,
00072     eColor_TextForeground,
00073     eColor_TextSelectBackground,
00074     eColor_TextSelectForeground,
00075     eColor_TextSelectBackgroundDisabled,
00076     eColor_TextSelectBackgroundAttention,
00077 
00078     // New CSS 2 color definitions
00079     eColor_activeborder,
00080     eColor_activecaption,
00081     eColor_appworkspace,
00082     eColor_background,
00083     eColor_buttonface,
00084     eColor_buttonhighlight,
00085     eColor_buttonshadow,
00086     eColor_buttontext,
00087     eColor_captiontext,
00088     eColor_graytext,
00089     eColor_highlight,
00090     eColor_highlighttext,
00091     eColor_inactiveborder,
00092     eColor_inactivecaption,
00093     eColor_inactivecaptiontext,
00094     eColor_infobackground,
00095     eColor_infotext,
00096     eColor_menu,
00097     eColor_menutext,
00098     eColor_scrollbar,
00099     eColor_threeddarkshadow,
00100     eColor_threedface,
00101     eColor_threedhighlight,
00102     eColor_threedlightshadow,
00103     eColor_threedshadow,
00104     eColor_window,
00105     eColor_windowframe,
00106     eColor_windowtext,
00107 
00108     eColor__moz_buttondefault,
00109     // Colors which will hopefully become CSS3
00110     eColor__moz_field,
00111     eColor__moz_fieldtext,
00112     eColor__moz_dialog,
00113     eColor__moz_dialogtext,
00114     eColor__moz_dragtargetzone,                         //used to highlight valid regions to drop something onto
00115 
00116     eColor__moz_cellhighlight,                               //used to cell text background, selected but not focus
00117     eColor__moz_cellhighlighttext,                           //used to cell text, selected but not focus
00118     eColor__moz_buttonhoverface,                             //used to button text background, when mouse is over
00119     eColor__moz_buttonhovertext,                             //used to button text, when mouse is over
00120     eColor__moz_menuhover,                                   //used to menu item background, when mouse is over
00121     eColor__moz_menuhovertext,                               //used to menu item text, when mouse is over
00122 
00123     //colours needed by Mac Classic skin
00124     eColor__moz_mac_focusring,                          //ring around text fields and lists
00125     eColor__moz_mac_menuselect,                         //colour used when mouse is over a menu item
00126     eColor__moz_mac_menushadow,                         //colour used to do shadows on menu items
00127     eColor__moz_mac_menutextdisable,                    // color used to display text for disabled menu items
00128     eColor__moz_mac_menutextselect,                     //colour used to display text while mouse is over a menu item
00129 
00130        //all of the accent colours
00131        eColor__moz_mac_accentlightesthighlight,
00132     eColor__moz_mac_accentregularhighlight,
00133     eColor__moz_mac_accentface,
00134     eColor__moz_mac_accentlightshadow,
00135     eColor__moz_mac_accentregularshadow,
00136     eColor__moz_mac_accentdarkshadow,
00137     eColor__moz_mac_accentdarkestshadow,
00138     
00139     //new in 10.2
00140     eColor__moz_mac_alternateprimaryhighlight, //active list highlight
00141     eColor__moz_mac_secondaryhighlight,        //inactive light hightlight
00142   
00143     // keep this one last, please
00144     eColor_LAST_COLOR
00145   } nsColorID;
00146 
00147   // When modifying this list, also modify nsXPLookAndFeel::sIntPrefs
00148   // in widget/src/xpwidgts/nsXPLookAndFeel.cpp.
00149   typedef enum {
00150     eMetric_WindowTitleHeight,
00151     eMetric_WindowBorderWidth,
00152     eMetric_WindowBorderHeight,
00153     eMetric_Widget3DBorder,
00154     eMetric_TextFieldBorder,                              // Native border size
00155     eMetric_TextFieldHeight,
00156     eMetric_TextVerticalInsidePadding,                    // needed only because of GTK
00157     eMetric_TextShouldUseVerticalInsidePadding,           // needed only because of GTK
00158     eMetric_TextHorizontalInsideMinimumPadding,  
00159     eMetric_TextShouldUseHorizontalInsideMinimumPadding,  // needed only because of GTK
00160     eMetric_ButtonHorizontalInsidePaddingNavQuirks,  
00161     eMetric_ButtonHorizontalInsidePaddingOffsetNavQuirks, 
00162     eMetric_CheckboxSize,
00163     eMetric_RadioboxSize,
00164     
00165     eMetric_ListShouldUseHorizontalInsideMinimumPadding,  // needed only because of GTK
00166     eMetric_ListHorizontalInsideMinimumPadding,         
00167 
00168     eMetric_ListShouldUseVerticalInsidePadding,           // needed only because of GTK
00169     eMetric_ListVerticalInsidePadding,                    // needed only because of GTK
00170 
00171     eMetric_CaretBlinkTime,                               // default, may be overriden by OS
00172     eMetric_CaretWidth,                                   // pixel width of caret
00173     eMetric_ShowCaretDuringSelection,                       // show the caret when text is selected?
00174     eMetric_SelectTextfieldsOnKeyFocus,                   // select textfields when focused via tab/accesskey?
00175     eMetric_SubmenuDelay,                                 // delay before submenus open
00176     eMetric_MenusCanOverlapOSBar,                         // can popups overlap menu/task bar?
00177     eMetric_SkipNavigatingDisabledMenuItem,               // skip navigating to disabled menu item?
00178     eMetric_DragFullWindow,                               // show window contents while dragging?
00179     eMetric_DragThresholdX,                               // begin a drag if the mouse is moved further than the threshold while the button is down
00180     eMetric_DragThresholdY,
00181     eMetric_UseAccessibilityTheme,                        // Accessibility theme being used?
00182     eMetric_IsScreenReaderActive,                         // Screen reader being used?
00183 
00184     eMetric_ScrollArrowStyle,                             // position of scroll arrows in a scrollbar
00185     eMetric_ScrollSliderStyle,                            // is scroll thumb proportional or fixed?
00186 
00187     eMetric_TreeOpenDelay,                                // delay for opening spring loaded folders
00188     eMetric_TreeCloseDelay,                               // delay for closing spring loaded folders
00189     eMetric_TreeLazyScrollDelay,                          // delay for triggering the tree scrolling
00190     eMetric_TreeScrollDelay,                              // delay for scrolling the tree
00191     eMetric_TreeScrollLinesMax,                           // the maximum number of lines to be scrolled at ones
00192     eMetric_TabFocusModel,                                // What type of tab-order to use
00193 
00194     /*
00195      * eMetric_AlertNotificationOrigin indicates from which corner of the
00196      * screen alerts slide in, and from which direction (horizontal/vertical).
00197      * 0, the default, represents bottom right, sliding vertically.
00198      * Use any bitwise combination of the following constants:
00199      * NS_ALERT_HORIZONTAL (1), NS_ALERT_LEFT (2), NS_ALERT_TOP (4).
00200      *
00201      *       6       4
00202      *     +-----------+
00203      *    7|           |5
00204      *     |           |
00205      *    3|           |1
00206      *     +-----------+
00207      *       2       0
00208      */
00209     eMetric_AlertNotificationOrigin
00210   } nsMetricID;
00211 
00212   enum {
00213     eMetric_ScrollArrowStyleSingle,                       // single arrow at each end
00214     eMetric_ScrollArrowStyleBothAtBottom,                 // both arrows at bottom/right, none at top/left
00215     eMetric_ScrollArrowStyleBothAtEachEnd,                // both arrows at both ends
00216     eMetric_ScrollArrowStyleBothAtTop                     // both arrows at top/left, none at bottom/right
00217   };
00218   enum {
00219     eMetric_ScrollThumbStyleNormal,
00220     eMetric_ScrollThumbStyleProportional
00221   };
00222   
00223   // When modifying this list, also modify nsXPLookAndFeel::sFloatPrefs
00224   // in widget/src/xpwidgts/nsXPLookAndFeel.cpp.
00225   typedef enum {
00226     eMetricFloat_TextFieldVerticalInsidePadding,
00227     eMetricFloat_TextFieldHorizontalInsidePadding,
00228     eMetricFloat_TextAreaVerticalInsidePadding,
00229     eMetricFloat_TextAreaHorizontalInsidePadding,
00230     eMetricFloat_ListVerticalInsidePadding,
00231     eMetricFloat_ListHorizontalInsidePadding,
00232     eMetricFloat_ButtonVerticalInsidePadding,
00233     eMetricFloat_ButtonHorizontalInsidePadding
00234   } nsMetricFloatID;
00235 
00236   NS_IMETHOD GetColor(const nsColorID aID, nscolor &aColor) = 0;
00237   NS_IMETHOD GetMetric(const nsMetricID aID, PRInt32 & aMetric) = 0;
00238   NS_IMETHOD GetMetric(const nsMetricFloatID aID, float & aMetric) = 0;
00239   
00240   NS_IMETHOD LookAndFeelChanged() = 0;
00241 
00242 
00243 #ifdef NS_DEBUG
00244   typedef enum {
00245     eMetricSize_TextField = 0,
00246     eMetricSize_TextArea  = 1,
00247     eMetricSize_ListBox   = 2,
00248     eMetricSize_ComboBox  = 3,
00249     eMetricSize_Radio     = 4,
00250     eMetricSize_CheckBox  = 5,
00251     eMetricSize_Button    = 6
00252   } nsMetricNavWidgetID;
00253 
00254   typedef enum {
00255     eMetricSize_Courier   = 0,
00256     eMetricSize_SansSerif = 1
00257   } nsMetricNavFontID;
00258 
00259   // This method returns the actual (or nearest estimate) 
00260   // of the Navigator size for a given form control for a given font
00261   // and font size. This is used in NavQuirks mode to see how closely
00262   // we match its size
00263   NS_IMETHOD GetNavSize(const nsMetricNavWidgetID aWidgetID,
00264                         const nsMetricNavFontID   aFontID, 
00265                         const PRInt32             aFontSize, 
00266                         nsSize &aSize) = 0;
00267 #endif
00268 };
00269 
00270        // On the Mac, GetColor(eColor_TextSelectForeground, color) returns this
00271        // constant to specify that the foreground color should not be changed
00272        // (ie. a colored text keeps its colors  when selected).
00273        // Of course if other plaforms work like the Mac, they can use it too.
00274 #define NS_DONT_CHANGE_COLOR       NS_RGB(0x01, 0x01, 0x01)
00275 
00276 
00277 // ------------------------------------------
00278 //  Bits for eMetric_AlertNotificationOrigin
00279 // ------------------------------------------
00280 
00281 #define NS_ALERT_HORIZONTAL 1
00282 #define NS_ALERT_LEFT       2
00283 #define NS_ALERT_TOP        4
00284 
00285 #endif /* __nsILookAndFeel */