LCOV - code coverage report
Current view: directory - objdir/dist/include - nsITheme.h (source / functions) Found Hit Coverage
Test: app.info Lines: 5 0 0.0 %
Date: 2012-06-02 Functions: 3 0 0.0 %

       1                 : /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
       2                 :  *
       3                 :  * ***** BEGIN LICENSE BLOCK *****
       4                 :  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
       5                 :  *
       6                 :  * The contents of this file are subject to the Mozilla Public License Version
       7                 :  * 1.1 (the "License"); you may not use this file except in compliance with
       8                 :  * the License. You may obtain a copy of the License at
       9                 :  * http://www.mozilla.org/MPL/
      10                 :  *
      11                 :  * Software distributed under the License is distributed on an "AS IS" basis,
      12                 :  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
      13                 :  * for the specific language governing rights and limitations under the
      14                 :  * License.
      15                 :  *
      16                 :  * The Original Code is the Mozilla browser.
      17                 :  *
      18                 :  * The Initial Developer of the Original Code is
      19                 :  * Netscape Communications Corporation.
      20                 :  * Portions created by the Initial Developer are Copyright (C) 1999
      21                 :  * the Initial Developer. All Rights Reserved.
      22                 :  *
      23                 :  * Contributor(s):
      24                 :  *
      25                 :  * Alternatively, the contents of this file may be used under the terms of
      26                 :  * either of the GNU General Public License Version 2 or later (the "GPL"),
      27                 :  * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
      28                 :  * in which case the provisions of the GPL or the LGPL are applicable instead
      29                 :  * of those above. If you wish to allow use of your version of this file only
      30                 :  * under the terms of either the GPL or the LGPL, and not to allow others to
      31                 :  * use your version of this file under the terms of the MPL, indicate your
      32                 :  * decision by deleting the provisions above and replace them with the notice
      33                 :  * and other provisions required by the GPL or the LGPL. If you do not delete
      34                 :  * the provisions above, a recipient may use your version of this file under
      35                 :  * the terms of any one of the MPL, the GPL or the LGPL.
      36                 :  *
      37                 :  * ***** END LICENSE BLOCK ***** */
      38                 : 
      39                 : /* service providing platform-specific native rendering for widgets */
      40                 : 
      41                 : #ifndef nsITheme_h_
      42                 : #define nsITheme_h_
      43                 : 
      44                 : #include "nsISupports.h"
      45                 : #include "nsCOMPtr.h"
      46                 : #include "nsColor.h"
      47                 : 
      48                 : struct nsRect;
      49                 : struct nsIntRect;
      50                 : struct nsIntSize;
      51                 : struct nsFont;
      52                 : struct nsIntMargin;
      53                 : class nsPresContext;
      54                 : class nsRenderingContext;
      55                 : class nsDeviceContext;
      56                 : class nsIFrame;
      57                 : class nsIContent;
      58                 : class nsIAtom;
      59                 : class nsIWidget;
      60                 : 
      61                 : // IID for the nsITheme interface
      62                 : // {b0f3efe9-0bd4-4f6b-8daa-0ec7f6006822}
      63                 :  #define NS_ITHEME_IID     \
      64                 : { 0xb0f3efe9, 0x0bd4, 0x4f6b, { 0x8d, 0xaa, 0x0e, 0xc7, 0xf6, 0x00, 0x68, 0x22 } }
      65                 : // {D930E29B-6909-44e5-AB4B-AF10D6923705}
      66                 : #define NS_THEMERENDERER_CID \
      67                 : { 0xd930e29b, 0x6909, 0x44e5, { 0xab, 0x4b, 0xaf, 0x10, 0xd6, 0x92, 0x37, 0x5 } }
      68                 : 
      69                 : enum nsTransparencyMode {
      70                 :   eTransparencyOpaque = 0,  // Fully opaque
      71                 :   eTransparencyTransparent, // Parts of the window may be transparent
      72                 :   eTransparencyGlass,       // Transparent parts of the window have Vista AeroGlass effect applied
      73                 :   eTransparencyBorderlessGlass // As above, but without a border around the opaque areas when there would otherwise be one with eTransparencyGlass
      74                 : };
      75                 : 
      76                 : /**
      77                 :  * nsITheme is a service that provides platform-specific native
      78                 :  * rendering for widgets.  In other words, it provides the necessary
      79                 :  * operations to draw a rendering object (an nsIFrame) as a native
      80                 :  * widget.
      81                 :  *
      82                 :  * All the methods on nsITheme take a rendering context or device
      83                 :  * context, a frame (the rendering object), and a widget type (one of
      84                 :  * the constants in nsThemeConstants.h).
      85                 :  */
      86               0 : class nsITheme: public nsISupports {
      87                 : public:
      88                 :   NS_DECLARE_STATIC_IID_ACCESSOR(NS_ITHEME_IID)
      89                 : 
      90                 :   /**
      91                 :    * Draw the actual theme background.
      92                 :    * @param aContext the context to draw into
      93                 :    * @param aFrame the frame for the widget that we're drawing
      94                 :    * @param aWidgetType the -moz-appearance value to draw
      95                 :    * @param aRect the rectangle defining the area occupied by the widget
      96                 :    * @param aDirtyRect the rectangle that needs to be drawn
      97                 :    */
      98                 :   NS_IMETHOD DrawWidgetBackground(nsRenderingContext* aContext,
      99                 :                                   nsIFrame* aFrame,
     100                 :                                   PRUint8 aWidgetType,
     101                 :                                   const nsRect& aRect,
     102                 :                                   const nsRect& aDirtyRect) = 0;
     103                 : 
     104                 :   /**
     105                 :    * Get the computed CSS border for the widget, in pixels.
     106                 :    */
     107                 :   NS_IMETHOD GetWidgetBorder(nsDeviceContext* aContext, 
     108                 :                              nsIFrame* aFrame,
     109                 :                              PRUint8 aWidgetType,
     110                 :                              nsIntMargin* aResult)=0;
     111                 : 
     112                 :   /**
     113                 :    * This method can return false to indicate that the CSS padding
     114                 :    * value should be used.  Otherwise, it will fill in aResult with the
     115                 :    * computed padding, in pixels, and return true.
     116                 :    *
     117                 :    * XXXldb This ought to be required to return true for non-containers
     118                 :    * so that we don't let specified padding that has no effect change
     119                 :    * the computed padding and potentially the size.
     120                 :    */
     121                 :   virtual bool GetWidgetPadding(nsDeviceContext* aContext,
     122                 :                                   nsIFrame* aFrame,
     123                 :                                   PRUint8 aWidgetType,
     124                 :                                   nsIntMargin* aResult) = 0;
     125                 : 
     126                 :   /**
     127                 :    * On entry, *aResult is positioned at 0,0 and sized to the new size
     128                 :    * of aFrame (aFrame->GetSize() may be stale and should not be used).
     129                 :    * This method can return false to indicate that no special
     130                 :    * overflow area is required by the native widget. Otherwise it will
     131                 :    * fill in aResult with the desired overflow area, in appunits, relative
     132                 :    * to the frame origin, and return true.
     133                 :    *
     134                 :    * This overflow area is used to determine what area needs to be
     135                 :    * repainted when the widget changes.  However, it does not affect the
     136                 :    * widget's size or what area is reachable by scrollbars.  (In other
     137                 :    * words, in layout terms, it affects visual overflow but not
     138                 :    * scrollable overflow.)
     139                 :    */
     140               0 :   virtual bool GetWidgetOverflow(nsDeviceContext* aContext,
     141                 :                                    nsIFrame* aFrame,
     142                 :                                    PRUint8 aWidgetType,
     143                 :                                    /*INOUT*/ nsRect* aOverflowRect)
     144               0 :   { return false; }
     145                 : 
     146                 :   /**
     147                 :    * Get the minimum border-box size of a widget, in *pixels* (in
     148                 :    * |aResult|).  If |aIsOverridable| is set to true, this size is a
     149                 :    * minimum size; if false, this size is the only valid size for the
     150                 :    * widget.
     151                 :    */
     152                 :   NS_IMETHOD GetMinimumWidgetSize(nsRenderingContext* aContext,
     153                 :                                   nsIFrame* aFrame,
     154                 :                                   PRUint8 aWidgetType,
     155                 :                                   nsIntSize* aResult,
     156                 :                                   bool* aIsOverridable)=0;
     157                 : 
     158                 : 
     159                 :   enum Transparency {
     160                 :     eOpaque = 0,
     161                 :     eTransparent,
     162                 :     eUnknownTransparency
     163                 :   };
     164                 : 
     165                 :   /**
     166                 :    * Returns what we know about the transparency of the widget.
     167                 :    */
     168               0 :   virtual Transparency GetWidgetTransparency(nsIFrame* aFrame, PRUint8 aWidgetType)
     169               0 :   { return eUnknownTransparency; }
     170                 : 
     171                 :   NS_IMETHOD WidgetStateChanged(nsIFrame* aFrame, PRUint8 aWidgetType, 
     172                 :                                 nsIAtom* aAttribute, bool* aShouldRepaint)=0;
     173                 : 
     174                 :   NS_IMETHOD ThemeChanged()=0;
     175                 : 
     176                 :   /**
     177                 :    * Can the nsITheme implementation handle this widget?
     178                 :    */
     179                 :   virtual bool ThemeSupportsWidget(nsPresContext* aPresContext,
     180                 :                                      nsIFrame* aFrame,
     181                 :                                      PRUint8 aWidgetType)=0;
     182                 : 
     183                 :   virtual bool WidgetIsContainer(PRUint8 aWidgetType)=0;
     184                 : 
     185                 :   /**
     186                 :    * Does the nsITheme implementation draw its own focus ring for this widget?
     187                 :    */
     188                 :   virtual bool ThemeDrawsFocusForWidget(nsPresContext* aPresContext,
     189                 :                                           nsIFrame* aFrame,
     190                 :                                           PRUint8 aWidgetType)=0;
     191                 :   
     192                 :   /**
     193                 :     * Should we insert a dropmarker inside of combobox button?
     194                 :    */
     195                 :   virtual bool ThemeNeedsComboboxDropmarker()=0;
     196                 : };
     197                 : 
     198                 : NS_DEFINE_STATIC_IID_ACCESSOR(nsITheme, NS_ITHEME_IID)
     199                 : 
     200                 : // Creator function
     201                 : extern nsresult NS_NewNativeTheme(nsISupports *aOuter, REFNSIID aIID, void **aResult);
     202                 : 
     203                 : #endif

Generated by: LCOV version 1.7