Back to index

lightning-sunbird  0.9+nobinonly
Public Member Functions | Protected Member Functions | Private Types | Private Member Functions | Private Attributes | Static Private Attributes
nsNativeThemeWin Class Reference

#include <nsNativeThemeWin.h>

Inheritance diagram for nsNativeThemeWin:
Inheritance graph
[legend]
Collaboration diagram for nsNativeThemeWin:
Collaboration graph
[legend]

List of all members.

Public Member Functions

NS_DECL_ISUPPORTS NS_IMETHOD DrawWidgetBackground (nsIRenderingContext *aContext, nsIFrame *aFrame, PRUint8 aWidgetType, const nsRect &aRect, const nsRect &aClipRect)
NS_IMETHOD GetWidgetBorder (nsIDeviceContext *aContext, nsIFrame *aFrame, PRUint8 aWidgetType, nsMargin *aResult)
virtual PRBool GetWidgetPadding (nsIDeviceContext *aContext, nsIFrame *aFrame, PRUint8 aWidgetType, nsMargin *aResult)
NS_IMETHOD GetMinimumWidgetSize (nsIRenderingContext *aContext, nsIFrame *aFrame, PRUint8 aWidgetType, nsSize *aResult, PRBool *aIsOverridable)
NS_IMETHOD WidgetStateChanged (nsIFrame *aFrame, PRUint8 aWidgetType, nsIAtom *aAttribute, PRBool *aShouldRepaint)
NS_IMETHOD ThemeChanged ()
PRBool ThemeSupportsWidget (nsPresContext *aPresContext, nsIFrame *aFrame, PRUint8 aWidgetType)
PRBool WidgetIsContainer (PRUint8 aWidgetType)
 nsNativeThemeWin ()
virtual ~nsNativeThemeWin ()
virtual PRBool GetWidgetOverflow (nsIDeviceContext *aContext, nsIFrame *aFrame, PRUint8 aWidgetType, nsRect *aResult)

Protected Member Functions

void CloseData ()
HANDLE GetTheme (PRUint8 aWidgetType)
nsresult GetThemePartAndState (nsIFrame *aFrame, PRUint8 aWidgetType, PRInt32 &aPart, PRInt32 &aState)
nsresult ClassicGetThemePartAndState (nsIFrame *aFrame, PRUint8 aWidgetType, PRInt32 &aPart, PRInt32 &aState, PRBool &aFocused)
nsresult ClassicDrawWidgetBackground (nsIRenderingContext *aContext, nsIFrame *aFrame, PRUint8 aWidgetType, const nsRect &aRect, const nsRect &aClipRect)
nsresult ClassicGetWidgetBorder (nsIDeviceContext *aContext, nsIFrame *aFrame, PRUint8 aWidgetType, nsMargin *aResult)
nsresult ClassicGetMinimumWidgetSize (nsIRenderingContext *aContext, nsIFrame *aFrame, PRUint8 aWidgetType, nsSize *aResult, PRBool *aIsOverridable)
PRBool ClassicThemeSupportsWidget (nsPresContext *aPresContext, nsIFrame *aFrame, PRUint8 aWidgetType)

Private Types

enum  TreeSortDirection { eTreeSortDirection_Descending, eTreeSortDirection_Natural, eTreeSortDirection_Ascending }

Private Member Functions

PRInt32 GetContentState (nsIFrame *aFrame, PRUint8 aWidgetType)
PRBool IsWidgetStyled (nsPresContext *aPresContext, nsIFrame *aFrame, PRUint8 aWidgetType)
PRBool IsDisabled (nsIFrame *aFrame)
PRBool IsDefaultButton (nsIFrame *aFrame)
PRBool IsChecked (nsIFrame *aFrame)
PRBool IsSelected (nsIFrame *aFrame)
PRBool IsFocused (nsIFrame *aFrame)
PRBool IsSelectedTab (nsIFrame *aFrame)
PRBool IsCheckedButton (nsIFrame *aFrame)
TreeSortDirection GetTreeSortDirection (nsIFrame *aFrame)
PRBool IsBottomTab (nsIFrame *aFrame)
PRBool IsIndeterminateProgress (nsIFrame *aFrame)
PRInt32 GetProgressValue (nsIFrame *aFrame)
PRBool IsReadOnly (nsIFrame *aFrame)
nsIPresShellGetPresShell (nsIFrame *aFrame)
PRInt32 CheckIntAttr (nsIFrame *aFrame, nsIAtom *aAtom)
PRBool CheckBooleanAttr (nsIFrame *aFrame, nsIAtom *aAtom)

Private Attributes

HMODULE mThemeDLL
HANDLE mButtonTheme
HANDLE mTextFieldTheme
HANDLE mTooltipTheme
HANDLE mToolbarTheme
HANDLE mRebarTheme
HANDLE mProgressTheme
HANDLE mScrollbarTheme
HANDLE mStatusbarTheme
HANDLE mTabTheme
HANDLE mTreeViewTheme
HANDLE mComboBoxTheme
HANDLE mHeaderTheme
nsCOMPtr< nsIAtommInputAtom
nsCOMPtr< nsIAtommInputCheckedAtom
nsCOMPtr< nsIAtommTypeAtom
nsCOMPtr< nsIAtommDisabledAtom
nsCOMPtr< nsIAtommCheckedAtom
nsCOMPtr< nsIAtommSelectedAtom
nsCOMPtr< nsIAtommReadOnlyAtom
nsCOMPtr< nsIAtommFirstTabAtom
nsCOMPtr< nsIAtommFocusedAtom
nsCOMPtr< nsIAtommSortDirectionAtom

Static Private Attributes

static nsMargin sButtonBorderSize
static nsMargin sButtonDisabledBorderSize
static PRUint8 sButtonActiveBorderStyle = NS_STYLE_BORDER_STYLE_INSET
static PRUint8 sButtonInactiveBorderStyle = NS_STYLE_BORDER_STYLE_OUTSET
static nsILookAndFeel::nsColorID sButtonBorderColorID = nsILookAndFeel::eColor_threedface
static nsILookAndFeel::nsColorID sButtonDisabledBorderColorID = nsILookAndFeel::eColor_threedshadow
static nsILookAndFeel::nsColorID sButtonBGColorID = nsILookAndFeel::eColor_threedface
static nsILookAndFeel::nsColorID sButtonDisabledBGColorID = nsILookAndFeel::eColor_threedface
static nsMargin sTextfieldBorderSize
static PRUint8 sTextfieldBorderStyle = NS_STYLE_BORDER_STYLE_INSET
static nsILookAndFeel::nsColorID sTextfieldBorderColorID = nsILookAndFeel::eColor_threedface
static PRBool sTextfieldBGTransparent = PR_FALSE
static nsILookAndFeel::nsColorID sTextfieldBGColorID = nsILookAndFeel::eColor__moz_field
static nsILookAndFeel::nsColorID sTextfieldDisabledBGColorID = nsILookAndFeel::eColor_threedface
static nsMargin sListboxBorderSize
static PRUint8 sListboxBorderStyle = NS_STYLE_BORDER_STYLE_INSET
static nsILookAndFeel::nsColorID sListboxBorderColorID = nsILookAndFeel::eColor_threedface
static PRBool sListboxBGTransparent = PR_FALSE
static nsILookAndFeel::nsColorID sListboxBGColorID = nsILookAndFeel::eColor__moz_field
static nsILookAndFeel::nsColorID sListboxDisabledBGColorID = nsILookAndFeel::eColor_threedface

Detailed Description

Definition at line 46 of file nsNativeThemeWin.h.


Member Enumeration Documentation

enum nsNativeTheme::TreeSortDirection [protected, inherited]
Enumerator:
eTreeSortDirection_Descending 
eTreeSortDirection_Natural 
eTreeSortDirection_Ascending 

Definition at line 57 of file nsNativeTheme.h.


Constructor & Destructor Documentation

Definition at line 147 of file nsNativeThemeWin.cpp.

                                   {
  mThemeDLL = NULL;
  mButtonTheme = NULL;
  mTextFieldTheme = NULL;
  mTooltipTheme = NULL;
  mToolbarTheme = NULL;
  mRebarTheme = NULL;
  mProgressTheme = NULL;
  mScrollbarTheme = NULL;
  mStatusbarTheme = NULL;
  mTabTheme = NULL;
  mTreeViewTheme = NULL;
  mComboBoxTheme = NULL;
  mHeaderTheme = NULL;

  mThemeDLL = ::LoadLibrary(kThemeLibraryName);
  if (mThemeDLL) {
    openTheme = (OpenThemeDataPtr)GetProcAddress(mThemeDLL, "OpenThemeData");
    closeTheme = (CloseThemeDataPtr)GetProcAddress(mThemeDLL, "CloseThemeData");
    drawThemeBG = (DrawThemeBackgroundPtr)GetProcAddress(mThemeDLL, "DrawThemeBackground");
    getThemeContentRect = (GetThemeContentRectPtr)GetProcAddress(mThemeDLL, "GetThemeBackgroundContentRect");
    getThemePartSize = (GetThemePartSizePtr)GetProcAddress(mThemeDLL, "GetThemePartSize");
    getThemeSysFont = (GetThemeSysFontPtr)GetProcAddress(mThemeDLL, "GetThemeSysFont");
    getThemeColor = (GetThemeColorPtr)GetProcAddress(mThemeDLL, "GetThemeColor");
  }

  mInputAtom = do_GetAtom("input");
  mInputCheckedAtom = do_GetAtom("_moz-input-checked");
  mTypeAtom = do_GetAtom("type");

  // If there is a relevant change in forms.css for windows platform,
  // static widget style variables (e.g. sButtonBorderSize) should be 
  // reinitialized here.
}

Here is the call graph for this function:

Definition at line 182 of file nsNativeThemeWin.cpp.

                                    {
  if (!mThemeDLL)
    return;

  CloseData();
  
  if (mThemeDLL)
    ::FreeLibrary(mThemeDLL);
}

Here is the call graph for this function:


Member Function Documentation

PRBool nsNativeTheme::CheckBooleanAttr ( nsIFrame aFrame,
nsIAtom aAtom 
) [protected, inherited]

Definition at line 129 of file nsNativeTheme.cpp.

{
  if (!aFrame)
    return PR_FALSE;

  nsIContent* content = aFrame->GetContent();
  if (content->IsContentOfType(nsIContent::eHTML))
    return content->HasAttr(kNameSpaceID_None, aAtom);

  nsAutoString attr;
  content->GetAttr(kNameSpaceID_None, aAtom, attr);

  // For XML/XUL elements, an attribute must be equal to the literal
  // string "true" to be counted as true.  An empty string should _not_
  // be counted as true.

  return attr.EqualsLiteral("true");
}

Here is the call graph for this function:

Here is the caller graph for this function:

PRInt32 nsNativeTheme::CheckIntAttr ( nsIFrame aFrame,
nsIAtom aAtom 
) [protected, inherited]

Definition at line 149 of file nsNativeTheme.cpp.

{
  if (!aFrame)
    return 0;

  nsAutoString attr;
  aFrame->GetContent()->GetAttr(kNameSpaceID_None, aAtom, attr);
  PRInt32 err, value = attr.ToInteger(&err);
  if (NS_FAILED(err))
    return 0;

  return value;
}

Here is the call graph for this function:

Here is the caller graph for this function:

nsresult nsNativeThemeWin::ClassicDrawWidgetBackground ( nsIRenderingContext aContext,
nsIFrame aFrame,
PRUint8  aWidgetType,
const nsRect aRect,
const nsRect aClipRect 
) [protected]

Definition at line 1488 of file nsNativeThemeWin.cpp.

{         
  PRInt32 part, state;
  PRBool focused;
  nsresult rv;
  rv = ClassicGetThemePartAndState(aFrame, aWidgetType, part, state, focused);
  if (NS_FAILED(rv))
    return rv;

  nsTransform2D* transformMatrix;
  aContext->GetCurrentTransform(transformMatrix);
  RECT widgetRect;
       nsRect tr(aRect);
       transformMatrix->TransformCoord(&tr.x,&tr.y,&tr.width,&tr.height);
  GetNativeRect(tr, widgetRect); 

  HDC hdc = NS_STATIC_CAST(nsRenderingContextWin*, aContext)->mDC;

  switch (aWidgetType) { 
    // Draw button
    case NS_THEME_BUTTON: {
      if (focused) {
        // draw dark button focus border first
        HBRUSH brush;        
        brush = ::GetSysColorBrush(COLOR_3DDKSHADOW);
        if (brush)
          ::FrameRect(hdc, &widgetRect, brush);
        InflateRect(&widgetRect, -1, -1);
      }
      // fall-through...
    }
    // Draw controls supported by DrawFrameControl
    case NS_THEME_CHECKBOX:
    case NS_THEME_RADIO:
    case NS_THEME_SCROLLBAR_BUTTON_UP:
    case NS_THEME_SCROLLBAR_BUTTON_DOWN:
    case NS_THEME_SCROLLBAR_BUTTON_LEFT:
    case NS_THEME_SCROLLBAR_BUTTON_RIGHT:
    case NS_THEME_SPINNER_UP_BUTTON:
    case NS_THEME_SPINNER_DOWN_BUTTON:
    case NS_THEME_DROPDOWN_BUTTON:
    case NS_THEME_RESIZER: { 
      PRInt32 oldTA;
      // setup DC to make DrawFrameControl draw correctly
      oldTA = ::SetTextAlign(hdc, TA_TOP | TA_LEFT | TA_NOUPDATECP);
      ::DrawFrameControl(hdc, &widgetRect, part, state);
      ::SetTextAlign(hdc, oldTA);

      // Draw focus rectangles for HTML checkboxes and radio buttons
      // XXX it'd be nice to draw these outside of the frame
      if (focused && (aWidgetType == NS_THEME_CHECKBOX || aWidgetType == NS_THEME_RADIO)) {
        // setup DC to make DrawFocusRect draw correctly
        ::SetBrushOrgEx(hdc, widgetRect.left, widgetRect.top, NULL);
        PRInt32 oldColor;
        oldColor = ::SetTextColor(hdc, 0);
        // draw focus rectangle
        ::DrawFocusRect(hdc, &widgetRect);
        ::SetTextColor(hdc, oldColor);
      }

      return NS_OK;
    }
    // Draw controls with 2px 3D inset border
    case NS_THEME_TEXTFIELD:
    case NS_THEME_LISTBOX:
    case NS_THEME_DROPDOWN:
    case NS_THEME_DROPDOWN_TEXTFIELD: {
      // Draw inset edge
      ::DrawEdge(hdc, &widgetRect, EDGE_SUNKEN, BF_RECT | BF_ADJUST);

      // Fill in background
      if (IsDisabled(aFrame) ||
          (aFrame->GetContent()->IsContentOfType(nsIContent::eXUL) &&
           IsReadOnly(aFrame)))
        ::FillRect(hdc, &widgetRect, (HBRUSH) (COLOR_BTNFACE+1));
      else
        ::FillRect(hdc, &widgetRect, (HBRUSH) (COLOR_WINDOW+1));
      return NS_OK;
    }
    case NS_THEME_TREEVIEW: {
      // Draw inset edge
      ::DrawEdge(hdc, &widgetRect, EDGE_SUNKEN, BF_RECT | BF_ADJUST);

      // Fill in window color background
      ::FillRect(hdc, &widgetRect, (HBRUSH) (COLOR_WINDOW+1));
      
      return NS_OK;
    }
    // Draw ToolTip background
    case NS_THEME_TOOLTIP:
      HBRUSH brush;
      brush = ::GetSysColorBrush(COLOR_3DDKSHADOW);
      if (brush)
        ::FrameRect(hdc, &widgetRect, brush);
      InflateRect(&widgetRect, -1, -1);
      ::FillRect(hdc, &widgetRect, (HBRUSH) (COLOR_INFOBK+1));
      return NS_OK;
    // Draw 3D face background controls
    case NS_THEME_PROGRESSBAR:
    case NS_THEME_PROGRESSBAR_VERTICAL:
      // Draw 3D border
      ::DrawEdge(hdc, &widgetRect, BDR_SUNKENOUTER, BF_RECT | BF_MIDDLE);
      InflateRect(&widgetRect, -1, -1);
      // fall through
    case NS_THEME_TAB_PANEL:
    case NS_THEME_STATUSBAR:
    case NS_THEME_STATUSBAR_RESIZER_PANEL: {
      ::FillRect(hdc, &widgetRect, (HBRUSH) (COLOR_BTNFACE+1));
      return NS_OK;
    }
    // Draw 3D inset statusbar panel
    case NS_THEME_STATUSBAR_PANEL: {
      if (aFrame->GetNextSibling())
        widgetRect.right -= 2; // space between sibling status panels

      ::DrawEdge(hdc, &widgetRect, BDR_SUNKENOUTER, BF_RECT | BF_MIDDLE);
      return NS_OK;  
    }
    // Draw scrollbar thumb
    case NS_THEME_SCROLLBAR_THUMB_VERTICAL:
    case NS_THEME_SCROLLBAR_THUMB_HORIZONTAL:
      ::DrawEdge(hdc, &widgetRect, EDGE_RAISED, BF_RECT | BF_MIDDLE);
      return NS_OK;
    // Draw scrollbar track background
    case NS_THEME_SCROLLBAR_TRACK_VERTICAL:
    case NS_THEME_SCROLLBAR_TRACK_HORIZONTAL: {

      // Windows fills in the scrollbar track differently 
      // depending on whether these are equal
      DWORD color3D, colorScrollbar, colorWindow;

      color3D = ::GetSysColor(COLOR_3DFACE);      
      colorWindow = ::GetSysColor(COLOR_WINDOW);
      colorScrollbar = ::GetSysColor(COLOR_SCROLLBAR);
      
      if ((color3D != colorScrollbar) && (colorWindow != colorScrollbar))
        // Use solid brush
        ::FillRect(hdc, &widgetRect, (HBRUSH) (COLOR_SCROLLBAR+1));
      else
      {
        // Use checkerboard pattern brush
        HBRUSH brush, oldBrush = NULL;
        HBITMAP patBmp = NULL;
        COLORREF oldBackColor, oldForeColor;
        static WORD patBits[8] = {
          0xaa, 0x55, 0xaa, 0x55, 0xaa, 0x55, 0xaa, 0x55
        };
        
        patBmp = ::CreateBitmap(8, 8, 1, 1, patBits);
        if (patBmp) {
          brush = (HBRUSH) ::CreatePatternBrush(patBmp);
          if (brush) {        
            oldForeColor = ::SetTextColor(hdc, ::GetSysColor(COLOR_3DHILIGHT));
            oldBackColor = ::SetBkColor(hdc, color3D);

#ifndef WINCE
            ::UnrealizeObject(brush);
#endif
            ::SetBrushOrgEx(hdc, widgetRect.left, widgetRect.top, NULL);
            oldBrush = (HBRUSH) ::SelectObject(hdc, brush);

            ::FillRect(hdc, &widgetRect, brush);

            ::SetTextColor(hdc, oldForeColor);
            ::SetBkColor(hdc, oldBackColor);
            ::SelectObject(hdc, oldBrush);
            ::DeleteObject(brush);          
          }
          else
            ::FillRect(hdc, &widgetRect, (HBRUSH) (COLOR_SCROLLBAR+1));
          
          ::DeleteObject(patBmp);
        }
      }
      // XXX should invert the part of the track being clicked here
      // but the track is never :active
      return NS_OK;
    }
    case NS_THEME_PROGRESSBAR_CHUNK:
    case NS_THEME_PROGRESSBAR_CHUNK_VERTICAL:
      ::FillRect(hdc, &widgetRect, (HBRUSH) (COLOR_HIGHLIGHT+1));
      return NS_OK;
    // Draw Tab
    case NS_THEME_TAB:
    case NS_THEME_TAB_LEFT_EDGE:
    case NS_THEME_TAB_RIGHT_EDGE: {
      DrawTab(hdc, widgetRect,
        IsBottomTab(aFrame) ? BF_BOTTOM : BF_TOP, 
        IsSelectedTab(aFrame),
        aWidgetType != NS_THEME_TAB_RIGHT_EDGE,
        aWidgetType != NS_THEME_TAB_LEFT_EDGE);      

      return NS_OK;
    }
    case NS_THEME_TAB_PANELS:
      ::DrawEdge(hdc, &widgetRect, EDGE_RAISED, BF_SOFT | BF_MIDDLE |
          BF_LEFT | BF_RIGHT | BF_BOTTOM);
      return NS_OK;

  }
  return NS_ERROR_FAILURE;
}

Here is the call graph for this function:

Here is the caller graph for this function:

nsresult nsNativeThemeWin::ClassicGetMinimumWidgetSize ( nsIRenderingContext aContext,
nsIFrame aFrame,
PRUint8  aWidgetType,
nsSize aResult,
PRBool aIsOverridable 
) [protected]

Definition at line 1119 of file nsNativeThemeWin.cpp.

{
  (*aResult).width = (*aResult).height = 0;
  *aIsOverridable = PR_TRUE;
  switch (aWidgetType) {
    case NS_THEME_RADIO:
    case NS_THEME_CHECKBOX: 
      (*aResult).width = (*aResult).height = 13;
      break;
    case NS_THEME_SCROLLBAR_BUTTON_UP:
    case NS_THEME_SCROLLBAR_BUTTON_DOWN:
      (*aResult).width = ::GetSystemMetrics(SM_CXVSCROLL);
      (*aResult).height = ::GetSystemMetrics(SM_CYVSCROLL);
      *aIsOverridable = PR_FALSE;
      break;
    case NS_THEME_SCROLLBAR_BUTTON_LEFT:
    case NS_THEME_SCROLLBAR_BUTTON_RIGHT:
      (*aResult).width = ::GetSystemMetrics(SM_CXHSCROLL);
      (*aResult).height = ::GetSystemMetrics(SM_CYHSCROLL);
      *aIsOverridable = PR_FALSE;
      break;
    case NS_THEME_SCROLLBAR_TRACK_VERTICAL:
      // XXX HACK We should be able to have a minimum height for the scrollbar
      // track.  However, this causes problems when uncollapsing a scrollbar
      // inside a tree.  See bug 201379 for details.

        //      (*aResult).height = ::GetSystemMetrics(SM_CYVTHUMB) << 1;
      break;
    case NS_THEME_DROPDOWN_BUTTON:
      (*aResult).width = ::GetSystemMetrics(SM_CXVSCROLL);
      break;
    case NS_THEME_DROPDOWN:
    case NS_THEME_BUTTON:
    case NS_THEME_LISTBOX:
    case NS_THEME_TREEVIEW:
    case NS_THEME_TEXTFIELD:          
    case NS_THEME_DROPDOWN_TEXTFIELD:      
    case NS_THEME_STATUSBAR:
    case NS_THEME_STATUSBAR_PANEL:      
    case NS_THEME_STATUSBAR_RESIZER_PANEL:
    case NS_THEME_PROGRESSBAR_CHUNK:
    case NS_THEME_PROGRESSBAR_CHUNK_VERTICAL:
    case NS_THEME_TOOLTIP:
    case NS_THEME_PROGRESSBAR:
    case NS_THEME_PROGRESSBAR_VERTICAL:
    case NS_THEME_TAB:
    case NS_THEME_TAB_LEFT_EDGE:
    case NS_THEME_TAB_RIGHT_EDGE:
    case NS_THEME_TAB_PANEL:
    case NS_THEME_TAB_PANELS:
      // no minimum widget size
      break;
    case NS_THEME_RESIZER: {     
#ifndef WINCE
      NONCLIENTMETRICS nc;
      nc.cbSize = sizeof(nc);
      if (SystemParametersInfo(SPI_GETNONCLIENTMETRICS, sizeof(nc), &nc, 0))
        (*aResult).width = (*aResult).height = abs(nc.lfStatusFont.lfHeight) + 4;
      else
#endif
        (*aResult).width = (*aResult).height = 15;
      break;
    case NS_THEME_SCROLLBAR_THUMB_VERTICAL:        
      (*aResult).width = ::GetSystemMetrics(SM_CYVTHUMB);
      (*aResult).height = (*aResult).width >> 1;
      *aIsOverridable = PR_FALSE;
      break;
    case NS_THEME_SCROLLBAR_THUMB_HORIZONTAL:
      (*aResult).height = ::GetSystemMetrics(SM_CXHTHUMB);
      (*aResult).width = (*aResult).height >> 1;
      *aIsOverridable = PR_FALSE;
      break;
    case NS_THEME_SCROLLBAR_TRACK_HORIZONTAL:
      (*aResult).width = ::GetSystemMetrics(SM_CXHTHUMB) << 1;
      break;
    }
    default:
      return NS_ERROR_FAILURE;
  }  
  return NS_OK;
}

Here is the caller graph for this function:

nsresult nsNativeThemeWin::ClassicGetThemePartAndState ( nsIFrame aFrame,
PRUint8  aWidgetType,
PRInt32 aPart,
PRInt32 aState,
PRBool aFocused 
) [protected]

Definition at line 1204 of file nsNativeThemeWin.cpp.

{  
  switch (aWidgetType) {
    case NS_THEME_BUTTON: {
      PRInt32 contentState;

      aPart = DFC_BUTTON;
      aState = DFCS_BUTTONPUSH;
      aFocused = PR_FALSE;

      contentState = GetContentState(aFrame, aWidgetType);
      if (IsDisabled(aFrame))
        aState |= DFCS_INACTIVE;
      else {
        if (contentState & NS_EVENT_STATE_ACTIVE && contentState & NS_EVENT_STATE_HOVER) {
          aState |= DFCS_PUSHED;
          const nsStyleUserInterface *uiData = aFrame->GetStyleUserInterface();
          // The down state is flat if the button is focusable
          if (uiData->mUserFocus == NS_STYLE_USER_FOCUS_NORMAL) {
#ifndef WINCE
            if (!aFrame->GetContent()->IsContentOfType(nsIContent::eHTML))
              aState |= DFCS_FLAT;
#endif
            aFocused = PR_TRUE;
          }
        }
        if ((contentState & NS_EVENT_STATE_FOCUS) || 
          (aState == DFCS_BUTTONPUSH && IsDefaultButton(aFrame))) {
          aFocused = PR_TRUE;          
        }

      }

      return NS_OK;
    }
    case NS_THEME_CHECKBOX:
    case NS_THEME_RADIO: {
      PRInt32 contentState ;
      aFocused = PR_FALSE;

      aPart = DFC_BUTTON;
      aState = (aWidgetType == NS_THEME_CHECKBOX) ? DFCS_BUTTONCHECK : DFCS_BUTTONRADIO;
      nsIContent* content = aFrame->GetContent();
           
      if (content->IsContentOfType(nsIContent::eXUL)) {
        // XUL
        if (aWidgetType == NS_THEME_CHECKBOX) {
          if (IsChecked(aFrame))
            aState |= DFCS_CHECKED;
        }
        else
          if (IsSelected(aFrame))
            aState |= DFCS_CHECKED;
        contentState = GetContentState(aFrame, aWidgetType);
      }
      else {
        // HTML

        nsCOMPtr<nsIDOMHTMLInputElement> inputElt(do_QueryInterface(content));
        if (inputElt) {
          PRBool isChecked = PR_FALSE;
          inputElt->GetChecked(&isChecked);
          if (isChecked)
            aState |= DFCS_CHECKED;
        }
        contentState = GetContentState(aFrame, aWidgetType);
        if (contentState & NS_EVENT_STATE_FOCUS)
          aFocused = PR_TRUE;
      }

      if (IsDisabled(aFrame))
        aState |= DFCS_INACTIVE;
      else if (contentState & NS_EVENT_STATE_ACTIVE && contentState & NS_EVENT_STATE_HOVER)
        aState |= DFCS_PUSHED;
      
      return NS_OK;
    }
    case NS_THEME_LISTBOX:
    case NS_THEME_TREEVIEW:
    case NS_THEME_TEXTFIELD:
    case NS_THEME_DROPDOWN:
    case NS_THEME_DROPDOWN_TEXTFIELD:
    case NS_THEME_SCROLLBAR_THUMB_VERTICAL:
    case NS_THEME_SCROLLBAR_THUMB_HORIZONTAL:     
    case NS_THEME_SCROLLBAR_TRACK_VERTICAL:
    case NS_THEME_SCROLLBAR_TRACK_HORIZONTAL:      
    case NS_THEME_STATUSBAR:
    case NS_THEME_STATUSBAR_PANEL:
    case NS_THEME_STATUSBAR_RESIZER_PANEL:
    case NS_THEME_PROGRESSBAR_CHUNK:
    case NS_THEME_PROGRESSBAR_CHUNK_VERTICAL:
    case NS_THEME_TOOLTIP:
    case NS_THEME_PROGRESSBAR:
    case NS_THEME_PROGRESSBAR_VERTICAL:
    case NS_THEME_TAB:
    case NS_THEME_TAB_LEFT_EDGE:
    case NS_THEME_TAB_RIGHT_EDGE:
    case NS_THEME_TAB_PANEL:
    case NS_THEME_TAB_PANELS:
      // these don't use DrawFrameControl
      return NS_OK;
    case NS_THEME_DROPDOWN_BUTTON: {

      aPart = DFC_SCROLL;
      aState = DFCS_SCROLLCOMBOBOX;
      
      nsIContent* content = aFrame->GetContent();
      nsIFrame* parentFrame = aFrame->GetParent();
      nsCOMPtr<nsIMenuFrame> menuFrame(do_QueryInterface(parentFrame));
      if (menuFrame || (content && content->IsContentOfType(nsIContent::eHTML)) )
         // XUL menu lists and HTML selects get state from parent         
         aFrame = parentFrame;
         // XXX the button really shouldn't depress when clicking the 
         // parent, but the button frame is never :active for these controls..

      if (IsDisabled(aFrame))
        aState |= DFCS_INACTIVE;
      else {     
        PRInt32 eventState = GetContentState(aFrame, aWidgetType);
#ifndef WINCE
        if (eventState & NS_EVENT_STATE_HOVER && eventState & NS_EVENT_STATE_ACTIVE)
          aState |= DFCS_PUSHED | DFCS_FLAT;
#endif
      }

      return NS_OK;
    }
    case NS_THEME_SCROLLBAR_BUTTON_UP:
    case NS_THEME_SCROLLBAR_BUTTON_DOWN:
    case NS_THEME_SCROLLBAR_BUTTON_LEFT:
    case NS_THEME_SCROLLBAR_BUTTON_RIGHT: {
      PRInt32 contentState;

      aPart = DFC_SCROLL;
      switch (aWidgetType) {
        case NS_THEME_SCROLLBAR_BUTTON_UP:
          aState = DFCS_SCROLLUP;
          break;
        case NS_THEME_SCROLLBAR_BUTTON_DOWN:
          aState = DFCS_SCROLLDOWN;
          break;
        case NS_THEME_SCROLLBAR_BUTTON_LEFT:
          aState = DFCS_SCROLLLEFT;
          break;
        case NS_THEME_SCROLLBAR_BUTTON_RIGHT:
          aState = DFCS_SCROLLRIGHT;
          break;
      }      
      
      if (IsDisabled(aFrame))
        aState |= DFCS_INACTIVE;
      else {
        contentState = GetContentState(aFrame, aWidgetType);
#ifndef WINCE
        if (contentState & NS_EVENT_STATE_HOVER && contentState & NS_EVENT_STATE_ACTIVE)
          aState |= DFCS_PUSHED | DFCS_FLAT;      
#endif
      }

      return NS_OK;
    }
    case NS_THEME_SPINNER_UP_BUTTON:
    case NS_THEME_SPINNER_DOWN_BUTTON: {
      PRInt32 contentState;

      aPart = DFC_SCROLL;
      switch (aWidgetType) {
        case NS_THEME_SPINNER_UP_BUTTON:
          aState = DFCS_SCROLLUP;
          break;
        case NS_THEME_SPINNER_DOWN_BUTTON:
          aState = DFCS_SCROLLDOWN;
          break;
      }      
      
      if (IsDisabled(aFrame))
        aState |= DFCS_INACTIVE;
      else {
        contentState = GetContentState(aFrame, aWidgetType);
        if (contentState & NS_EVENT_STATE_HOVER && contentState & NS_EVENT_STATE_ACTIVE)
          aState |= DFCS_PUSHED;
      }

      return NS_OK;    
    }
    case NS_THEME_RESIZER:    
      aPart = DFC_SCROLL;
      aState = DFCS_SCROLLSIZEGRIP;
      return NS_OK;
  }
  return NS_ERROR_FAILURE;
}

Here is the call graph for this function:

Here is the caller graph for this function:

nsresult nsNativeThemeWin::ClassicGetWidgetBorder ( nsIDeviceContext aContext,
nsIFrame aFrame,
PRUint8  aWidgetType,
nsMargin aResult 
) [protected]

Definition at line 1056 of file nsNativeThemeWin.cpp.

{
  switch (aWidgetType) {
    case NS_THEME_BUTTON: {
      const nsStyleUserInterface *uiData = aFrame->GetStyleUserInterface();
      if (uiData->mUserFocus == NS_STYLE_USER_FOCUS_IGNORE) {
        // use different padding for non-focusable buttons
        (*aResult).top = (*aResult).left = 1;
        (*aResult).bottom = (*aResult).right = 2;
      }
      else
        (*aResult).top = (*aResult).left = (*aResult).bottom = (*aResult).right = 3; 
      break;  
    }
    case NS_THEME_STATUSBAR:
      (*aResult).bottom = (*aResult).left = (*aResult).right = 0;
      (*aResult).top = 2;
      break;
    case NS_THEME_LISTBOX:
    case NS_THEME_TREEVIEW:
    case NS_THEME_DROPDOWN:
    case NS_THEME_DROPDOWN_TEXTFIELD:
    case NS_THEME_TAB:
    case NS_THEME_TAB_LEFT_EDGE:
    case NS_THEME_TAB_RIGHT_EDGE:
      (*aResult).top = (*aResult).left = (*aResult).bottom = (*aResult).right = 2;
      break;
    case NS_THEME_TEXTFIELD: {
      (*aResult).top = (*aResult).bottom = 2;
      nsIContent* content = aFrame->GetContent();
      if (content && content->IsContentOfType(nsIContent::eHTML))
        // HTML text-fields need extra padding
        (*aResult).left = (*aResult).right = 3;
      else
        (*aResult).left = (*aResult).right = 2;
      break;
    }
    case NS_THEME_STATUSBAR_PANEL:
    case NS_THEME_STATUSBAR_RESIZER_PANEL: {
      (*aResult).top = 1;      
      (*aResult).left = 1;
      (*aResult).bottom = 1;
      (*aResult).right = aFrame->GetNextSibling() ? 3 : 1;
      break;
    }    
    case NS_THEME_TOOLTIP:
      (*aResult).top = (*aResult).left = (*aResult).bottom = (*aResult).right = 1;
      break;
    case NS_THEME_PROGRESSBAR:
    case NS_THEME_PROGRESSBAR_VERTICAL:
      (*aResult).top = (*aResult).left = (*aResult).bottom = (*aResult).right = 1;
      break;
    default:
      (*aResult).top = (*aResult).bottom = (*aResult).left = (*aResult).right = 0;
      break;
  }
  return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

PRBool nsNativeThemeWin::ClassicThemeSupportsWidget ( nsPresContext aPresContext,
nsIFrame aFrame,
PRUint8  aWidgetType 
) [protected]
NS_IMETHODIMP nsNativeThemeWin::DrawWidgetBackground ( nsIRenderingContext aContext,
nsIFrame aFrame,
PRUint8  aWidgetType,
const nsRect aRect,
const nsRect aClipRect 
) [virtual]

Implements nsITheme.

Definition at line 660 of file nsNativeThemeWin.cpp.

{
  HANDLE theme = GetTheme(aWidgetType);
  if (!theme)
    return ClassicDrawWidgetBackground(aContext, aFrame, aWidgetType, aRect, aClipRect); 

  if (!drawThemeBG)
    return NS_ERROR_FAILURE;    

  PRInt32 part, state;
  nsresult rv = GetThemePartAndState(aFrame, aWidgetType, part, state);
  if (NS_FAILED(rv))
    return rv;

  nsTransform2D* transformMatrix;
  aContext->GetCurrentTransform(transformMatrix);
  RECT widgetRect;
  RECT clipRect;
       nsRect tr(aRect);
  nsRect cr(aClipRect);
       transformMatrix->TransformCoord(&tr.x,&tr.y,&tr.width,&tr.height);
  GetNativeRect(tr, widgetRect);
  transformMatrix->TransformCoord(&cr.x,&cr.y,&cr.width,&cr.height);
  GetNativeRect(cr, clipRect);
  HDC hdc = NS_STATIC_CAST(nsRenderingContextWin*, aContext)->mDC;
  if (!hdc)
    return NS_ERROR_FAILURE;
  
  // For left edge and right edge tabs, we need to adjust the widget
  // rects and clip rects so that the edges don't get drawn.
  if (aWidgetType == NS_THEME_TAB_LEFT_EDGE || aWidgetType == NS_THEME_TAB_RIGHT_EDGE) {
    // HACK ALERT: There appears to be no way to really obtain this value, so we're forced
    // to just use the default value for Luna (which also happens to be correct for
    // all the other skins I've tried).
    PRInt32 edgeSize = 2;
    
    // Armed with the size of the edge, we now need to either shift to the left or to the
    // right.  The clip rect won't include this extra area, so we know that we're
    // effectively shifting the edge out of view (such that it won't be painted).
    if (aWidgetType == NS_THEME_TAB_LEFT_EDGE)
      // The right edge should not be drawn.  Extend our rect by the edge size.
      widgetRect.right += edgeSize;
    else
      // The left edge should not be drawn.  Move the widget rect's left coord back.
      widgetRect.left -= edgeSize;
  }
  
  drawThemeBG(theme, hdc, part, state, &widgetRect, &clipRect);

  // Draw focus rectangles for XP HTML checkboxes and radio buttons
  // XXX it'd be nice to draw these outside of the frame
  if ((aWidgetType == NS_THEME_CHECKBOX || aWidgetType == NS_THEME_RADIO)
      && aFrame->GetContent()->IsContentOfType(nsIContent::eHTML)) {
      PRInt32 contentState ;
      contentState = GetContentState(aFrame, aWidgetType);  
            
      if (contentState & NS_EVENT_STATE_FOCUS) {
        // setup DC to make DrawFocusRect draw correctly
        ::SetBrushOrgEx(hdc, widgetRect.left, widgetRect.top, NULL);
        PRInt32 oldColor;
        oldColor = ::SetTextColor(hdc, 0);
        // draw focus rectangle
        ::DrawFocusRect(hdc, &widgetRect);
        ::SetTextColor(hdc, oldColor);
      }
  }
  return NS_OK;
}

Here is the call graph for this function:

PRInt32 nsNativeTheme::GetContentState ( nsIFrame aFrame,
PRUint8  aWidgetType 
) [protected, inherited]

Definition at line 102 of file nsNativeTheme.cpp.

{
  if (!aFrame)
    return 0;

  PRBool isXULCheckboxRadio = 
    (aWidgetType == NS_THEME_CHECKBOX || aWidgetType == NS_THEME_RADIO) &&
    aFrame->GetContent()->IsContentOfType(nsIContent::eXUL);
  if (isXULCheckboxRadio)
    aFrame = aFrame->GetParent();

  nsIPresShell *shell = GetPresShell(aFrame);
  if (!shell)
    return 0;

  PRInt32 flags = 0;
  shell->GetPresContext()->EventStateManager()->GetContentState(aFrame->GetContent(), flags);
  
  if (isXULCheckboxRadio && aWidgetType == NS_THEME_RADIO) {
    if (IsFocused(aFrame))
      flags |= NS_EVENT_STATE_FOCUS;
  }
  
  return flags;
}

Here is the call graph for this function:

Here is the caller graph for this function:

NS_IMETHODIMP nsNativeThemeWin::GetMinimumWidgetSize ( nsIRenderingContext aContext,
nsIFrame aFrame,
PRUint8  aWidgetType,
nsSize aResult,
PRBool aIsOverridable 
) [virtual]

Implements nsITheme.

Definition at line 809 of file nsNativeThemeWin.cpp.

{
  (*aResult).width = (*aResult).height = 0;
  *aIsOverridable = PR_TRUE;

  HANDLE theme = GetTheme(aWidgetType);
  if (!theme)
    return ClassicGetMinimumWidgetSize(aContext, aFrame, aWidgetType, aResult, aIsOverridable);
 
  if (aWidgetType == NS_THEME_TOOLBOX || aWidgetType == NS_THEME_TOOLBAR || 
      aWidgetType == NS_THEME_STATUSBAR || aWidgetType == NS_THEME_PROGRESSBAR_CHUNK ||
      aWidgetType == NS_THEME_PROGRESSBAR_CHUNK_VERTICAL ||
      aWidgetType == NS_THEME_TAB_PANELS || aWidgetType == NS_THEME_TAB_PANEL ||
      aWidgetType == NS_THEME_LISTBOX || aWidgetType == NS_THEME_TREEVIEW)
    return NS_OK; // Don't worry about it.

  if (!getThemePartSize)
    return NS_ERROR_FAILURE;
  
  // Call GetSystemMetrics to determine size for WinXP scrollbars
  // (GetThemeSysSize API returns the optimal size for the theme, but 
  //  Windows appears to always use metrics when drawing standard scrollbars)
  switch (aWidgetType) {
    case NS_THEME_SCROLLBAR_THUMB_VERTICAL:
    case NS_THEME_SCROLLBAR_THUMB_HORIZONTAL:
    case NS_THEME_SCROLLBAR_BUTTON_UP:
    case NS_THEME_SCROLLBAR_BUTTON_DOWN:
    case NS_THEME_SCROLLBAR_BUTTON_LEFT:
    case NS_THEME_SCROLLBAR_BUTTON_RIGHT:
    case NS_THEME_SCROLLBAR_TRACK_HORIZONTAL:
    case NS_THEME_SCROLLBAR_TRACK_VERTICAL:
    case NS_THEME_DROPDOWN_BUTTON: 
      return ClassicGetMinimumWidgetSize(aContext, aFrame, aWidgetType, aResult, aIsOverridable);
  }

  PRInt32 part, state;
  nsresult rv = GetThemePartAndState(aFrame, aWidgetType, part, state);
  if (NS_FAILED(rv))
    return rv;

  HDC hdc = ((nsRenderingContextWin*)aContext)->mDC;
  if (!hdc)
    return NS_ERROR_FAILURE;

  PRInt32 sizeReq = 1; // Best-fit size.
  if (aWidgetType == NS_THEME_PROGRESSBAR ||
      aWidgetType == NS_THEME_PROGRESSBAR_VERTICAL)
    sizeReq = 0; // Best-fit size for progress meters is too large for most 
                 // themes.
                 // In our app, we want these widgets to be able to really shrink down,
                 // so use the min-size request value (of 0).
  
  SIZE sz;
  getThemePartSize(theme, hdc, part, state, NULL, sizeReq, &sz);
  aResult->width = sz.cx;
  aResult->height = sz.cy;

  return NS_OK;
}

Here is the call graph for this function:

nsIPresShell * nsNativeTheme::GetPresShell ( nsIFrame aFrame) [protected, inherited]

Definition at line 90 of file nsNativeTheme.cpp.

{
  if (!aFrame)
    return nsnull;

  // this is a workaround for the egcs 1.1.2 not inliningg
  // aFrame->GetPresContext(), which causes an undefined symbol
  nsPresContext *context = aFrame->GetStyleContext()->GetRuleNode()->GetPresContext();
  return context ? context->GetPresShell() : nsnull;
}

Here is the call graph for this function:

Here is the caller graph for this function:

PRInt32 nsNativeTheme::GetProgressValue ( nsIFrame aFrame) [inline, protected, inherited]

Definition at line 139 of file nsNativeTheme.h.

                                             {
    return CheckIntAttr(aFrame, mValueAtom);
  }

Here is the call graph for this function:

Here is the caller graph for this function:

HANDLE nsNativeThemeWin::GetTheme ( PRUint8  aWidgetType) [protected]

Definition at line 201 of file nsNativeThemeWin.cpp.

{ 
  if (!mThemeDLL)
    return NULL;

  switch (aWidgetType) {
    case NS_THEME_BUTTON:
    case NS_THEME_RADIO:
    case NS_THEME_CHECKBOX: {
      if (!mButtonTheme)
        mButtonTheme = openTheme(NULL, L"Button");
      return mButtonTheme;
    }
    case NS_THEME_TEXTFIELD:
    case NS_THEME_DROPDOWN: {
      if (!mTextFieldTheme)
        mTextFieldTheme = openTheme(NULL, L"Edit");
      return mTextFieldTheme;
    }
    case NS_THEME_TOOLTIP: {
      if (!mTooltipTheme)
        mTooltipTheme = openTheme(NULL, L"Tooltip");
      return mTooltipTheme;
    }
    case NS_THEME_TOOLBOX: {
      if (!mRebarTheme)
        mRebarTheme = openTheme(NULL, L"Rebar");
      return mRebarTheme;
    }
    case NS_THEME_TOOLBAR:
    case NS_THEME_TOOLBAR_BUTTON: {
      if (!mToolbarTheme)
        mToolbarTheme = openTheme(NULL, L"Toolbar");
      return mToolbarTheme;
    }
    case NS_THEME_PROGRESSBAR:
    case NS_THEME_PROGRESSBAR_VERTICAL:
    case NS_THEME_PROGRESSBAR_CHUNK:
    case NS_THEME_PROGRESSBAR_CHUNK_VERTICAL: {
      if (!mProgressTheme)
        mProgressTheme = openTheme(NULL, L"Progress");
      return mProgressTheme;
    }
    case NS_THEME_TAB:
    case NS_THEME_TAB_LEFT_EDGE:
    case NS_THEME_TAB_RIGHT_EDGE:
    case NS_THEME_TAB_PANEL:
    case NS_THEME_TAB_PANELS: {
      if (!mTabTheme)
        mTabTheme = openTheme(NULL, L"Tab");
      return mTabTheme;
    }
    case NS_THEME_SCROLLBAR:
    case NS_THEME_SCROLLBAR_TRACK_VERTICAL:
    case NS_THEME_SCROLLBAR_TRACK_HORIZONTAL:
    case NS_THEME_SCROLLBAR_BUTTON_UP:
    case NS_THEME_SCROLLBAR_BUTTON_DOWN:
    case NS_THEME_SCROLLBAR_BUTTON_LEFT:
    case NS_THEME_SCROLLBAR_BUTTON_RIGHT:
    case NS_THEME_SCROLLBAR_THUMB_VERTICAL:
    case NS_THEME_SCROLLBAR_THUMB_HORIZONTAL:
    case NS_THEME_SCROLLBAR_GRIPPER_VERTICAL:
    case NS_THEME_SCROLLBAR_GRIPPER_HORIZONTAL:
    {
      if (!mScrollbarTheme)
        mScrollbarTheme = openTheme(NULL, L"Scrollbar");
      return mScrollbarTheme;
    }
    case NS_THEME_STATUSBAR:
    case NS_THEME_STATUSBAR_PANEL:
    case NS_THEME_STATUSBAR_RESIZER_PANEL:
    case NS_THEME_RESIZER:
    {
      if (!mStatusbarTheme)
        mStatusbarTheme = openTheme(NULL, L"Status");
      return mStatusbarTheme;
    }
    case NS_THEME_DROPDOWN_BUTTON: {
      if (!mComboBoxTheme)
        mComboBoxTheme = openTheme(NULL, L"Combobox");
      return mComboBoxTheme;
    }
    case NS_THEME_TREEVIEW_HEADER_CELL:
    case NS_THEME_TREEVIEW_HEADER_SORTARROW: {
      if (!mHeaderTheme)
        mHeaderTheme = openTheme(NULL, L"Header");
      return mHeaderTheme;
    }
    case NS_THEME_LISTBOX:
    case NS_THEME_LISTBOX_LISTITEM:
    case NS_THEME_TREEVIEW:
    case NS_THEME_TREEVIEW_TWISTY_OPEN:
    case NS_THEME_TREEVIEW_TREEITEM: {
      if (!mTreeViewTheme)
        mTreeViewTheme = openTheme(NULL, L"Listview");
      return mTreeViewTheme;
    }
  }
  return NULL;
}

Here is the caller graph for this function:

nsresult nsNativeThemeWin::GetThemePartAndState ( nsIFrame aFrame,
PRUint8  aWidgetType,
PRInt32 aPart,
PRInt32 aState 
) [protected]

Definition at line 303 of file nsNativeThemeWin.cpp.

{
  switch (aWidgetType) {
    case NS_THEME_BUTTON: {
      aPart = BP_BUTTON;
      if (!aFrame) {
        aState = TS_NORMAL;
        return NS_OK;
      }

      if (IsDisabled(aFrame)) {
        aState = TS_DISABLED;
        return NS_OK;
      }
      PRInt32 eventState = GetContentState(aFrame, aWidgetType);
      if (eventState & NS_EVENT_STATE_HOVER && eventState & NS_EVENT_STATE_ACTIVE)
        aState = TS_ACTIVE;
      else if (eventState & NS_EVENT_STATE_FOCUS)
        aState = TS_FOCUSED;
      else if (eventState & NS_EVENT_STATE_HOVER)
        aState = TS_HOVER;
      else 
        aState = TS_NORMAL;
      
      // Check for default dialog buttons.  These buttons should always look
      // focused.
      if (aState == TS_NORMAL && IsDefaultButton(aFrame))
        aState = TS_FOCUSED;
      return NS_OK;
    }
    case NS_THEME_CHECKBOX:
    case NS_THEME_RADIO: {
      aPart = (aWidgetType == NS_THEME_CHECKBOX) ? BP_CHECKBOX : BP_RADIO; 

      // XXXdwh This check will need to be more complicated, since HTML radio groups
      // use checked, but XUL radio groups use selected.  There will need to be an
      // IsContentOfType test for HTML vs. XUL here.
      nsIAtom* atom = (aWidgetType == NS_THEME_CHECKBOX) ? mCheckedAtom : mSelectedAtom;

      PRBool isHTML = PR_FALSE;
      PRBool isHTMLChecked = PR_FALSE;
      PRBool isXULCheckboxRadio = PR_FALSE;
      
      if (!aFrame)
        aState = TS_NORMAL;
      else {
        // For XUL checkboxes and radio buttons, the state of the parent
        // determines our state.
        nsIContent* content = aFrame->GetContent();
        PRBool isXULCheckboxRadio = content->IsContentOfType(nsIContent::eXUL);
        if (!isXULCheckboxRadio) {
          // Attempt a QI.
          nsCOMPtr<nsIDOMHTMLInputElement> inputElt(do_QueryInterface(content));
          if (inputElt) {
            inputElt->GetChecked(&isHTMLChecked);
            isHTML = PR_TRUE;
          }
        }

        if (IsDisabled(isXULCheckboxRadio ? aFrame->GetParent(): aFrame))
          aState = TS_DISABLED;
        else {
          PRInt32 eventState = GetContentState(aFrame, aWidgetType);
          if (eventState & NS_EVENT_STATE_HOVER && eventState & NS_EVENT_STATE_ACTIVE)
            aState = TS_ACTIVE;
          else if (eventState & NS_EVENT_STATE_HOVER)
            aState = TS_HOVER;
          else 
            aState = TS_NORMAL;
        }
      }

      if (isHTML) {
        if (isHTMLChecked)
          aState += 4;
      }
      else if (aWidgetType == NS_THEME_CHECKBOX ?
               IsChecked(aFrame) : IsSelected(aFrame))
        aState += 4; // 4 unchecked states, 4 checked states.
      return NS_OK;
    }
    case NS_THEME_TEXTFIELD:
    case NS_THEME_DROPDOWN: {
      aPart = TFP_TEXTFIELD;
      if (!aFrame) {
        aState = TS_NORMAL;
        return NS_OK;
      }

      if (IsDisabled(aFrame)) {
        aState = TS_DISABLED;
        return NS_OK;
      }

      if (IsReadOnly(aFrame)) {
        aState = TFS_READONLY;
        return NS_OK;
      }

      PRInt32 eventState = GetContentState(aFrame, aWidgetType);
      if (eventState & NS_EVENT_STATE_HOVER && eventState & NS_EVENT_STATE_ACTIVE)
        aState = TS_ACTIVE;
      else if (eventState & NS_EVENT_STATE_FOCUS)
        aState = TS_FOCUSED;
      else if (eventState & NS_EVENT_STATE_HOVER)
        aState = TS_HOVER;
      else 
        aState = TS_NORMAL;
      
      return NS_OK;
    }
    case NS_THEME_TOOLTIP: {
      aPart = TTP_STANDARD;
      aState = TS_NORMAL;
      return NS_OK;
    }
    case NS_THEME_PROGRESSBAR: {
      aPart = PP_BAR;
      aState = TS_NORMAL;
      return NS_OK;
    }
    case NS_THEME_PROGRESSBAR_CHUNK: {
      aPart = PP_CHUNK;
      aState = TS_NORMAL;
      return NS_OK;
    }
    case NS_THEME_PROGRESSBAR_VERTICAL: {
      aPart = PP_BARVERT;
      aState = TS_NORMAL;
      return NS_OK;
    }
    case NS_THEME_PROGRESSBAR_CHUNK_VERTICAL: {
      aPart = PP_CHUNKVERT;
      aState = TS_NORMAL;
      return NS_OK;
    }
    case NS_THEME_TOOLBAR_BUTTON: {
      aPart = BP_BUTTON;
      if (!aFrame) {
        aState = TS_NORMAL;
        return NS_OK;
      }

      if (IsDisabled(aFrame)) {
        aState = TS_DISABLED;
        return NS_OK;
      }
      PRInt32 eventState = GetContentState(aFrame, aWidgetType);
      if (eventState & NS_EVENT_STATE_HOVER && eventState & NS_EVENT_STATE_ACTIVE)
        aState = TS_ACTIVE;
      else if (eventState & NS_EVENT_STATE_HOVER) {
        if (IsCheckedButton(aFrame))
          aState = TB_HOVER_CHECKED;
        else
          aState = TS_HOVER;
      }
      else {
        if (IsCheckedButton(aFrame))
          aState = TB_CHECKED;
        else
          aState = TS_NORMAL;
      }
     
      return NS_OK;
    }
    case NS_THEME_SCROLLBAR_BUTTON_UP:
    case NS_THEME_SCROLLBAR_BUTTON_DOWN:
    case NS_THEME_SCROLLBAR_BUTTON_LEFT:
    case NS_THEME_SCROLLBAR_BUTTON_RIGHT: {
      aPart = SP_BUTTON;
      aState = (aWidgetType - NS_THEME_SCROLLBAR_BUTTON_UP)*4;
      if (!aFrame)
        aState += TS_NORMAL;
      else if (IsDisabled(aFrame))
        aState += TS_DISABLED;
      else {
        PRInt32 eventState = GetContentState(aFrame, aWidgetType);
        if (eventState & NS_EVENT_STATE_HOVER && eventState & NS_EVENT_STATE_ACTIVE)
          aState += TS_ACTIVE;
        else if (eventState & NS_EVENT_STATE_HOVER)
          aState += TS_HOVER;
        else
          aState += TS_NORMAL;
      }
      return NS_OK;
    }
    case NS_THEME_SCROLLBAR_TRACK_HORIZONTAL:
    case NS_THEME_SCROLLBAR_TRACK_VERTICAL: {
      aPart = (aWidgetType == NS_THEME_SCROLLBAR_TRACK_HORIZONTAL) ?
              SP_TRACKSTARTHOR : SP_TRACKSTARTVERT;
      aState = TS_NORMAL;
      return NS_OK;
    }
    case NS_THEME_SCROLLBAR_THUMB_HORIZONTAL:
    case NS_THEME_SCROLLBAR_THUMB_VERTICAL: {
      aPart = (aWidgetType == NS_THEME_SCROLLBAR_THUMB_HORIZONTAL) ?
              SP_THUMBHOR : SP_THUMBVERT;
      if (!aFrame)
        aState = TS_NORMAL;
      else if (IsDisabled(aFrame))
        aState = TS_DISABLED;
      else {
        PRInt32 eventState = GetContentState(aFrame, aWidgetType);
        if (eventState & NS_EVENT_STATE_ACTIVE) // Hover is not also a requirement for
                                                // the thumb, since the drag is not canceled
                                                // when you move outside the thumb.
          aState = TS_ACTIVE;
        else if (eventState & NS_EVENT_STATE_HOVER)
          aState = TS_HOVER;
        else 
          aState = TS_NORMAL;
      }
      return NS_OK;
    }
    case NS_THEME_SCROLLBAR_GRIPPER_VERTICAL:
    case NS_THEME_SCROLLBAR_GRIPPER_HORIZONTAL: {
      aPart = (aWidgetType == NS_THEME_SCROLLBAR_GRIPPER_HORIZONTAL) ?
              SP_GRIPPERHOR : SP_GRIPPERVERT;
      if (!aFrame)
        aState = TS_NORMAL;
      else if (IsDisabled(aFrame))
        aState = TS_DISABLED;
      else {
        // XXXdwh The gripper needs to get a hover attribute set on it, since it
        // never goes into :hover.
        PRInt32 eventState = GetContentState(aFrame, aWidgetType);
        if (eventState & NS_EVENT_STATE_ACTIVE) // Hover is not also a requirement for
                                                // the gripper, since the drag is not canceled
                                                // when you move outside the gripper.
          aState = TS_ACTIVE;
        else if (eventState & NS_EVENT_STATE_HOVER)
          aState = TS_HOVER;
        else 
          aState = TS_NORMAL;
      }
      return NS_OK;
    }
    case NS_THEME_TOOLBOX:
    case NS_THEME_STATUSBAR:
    case NS_THEME_SCROLLBAR: {
      aPart = aState = 0;
      return NS_OK; // These have no part or state.
    }
    case NS_THEME_STATUSBAR_PANEL:
    case NS_THEME_STATUSBAR_RESIZER_PANEL:
    case NS_THEME_RESIZER: {
      aPart = (aWidgetType - NS_THEME_STATUSBAR_PANEL) + 1;
      aState = TS_NORMAL;
      return NS_OK;
    }
    case NS_THEME_TREEVIEW:
    case NS_THEME_LISTBOX: {
      aPart = TREEVIEW_BODY;
      aState = TS_NORMAL;
      return NS_OK;
    }
    case NS_THEME_TAB_PANELS: {
      aPart = TABP_PANELS;
      aState = TS_NORMAL;
      return NS_OK;
    }
    case NS_THEME_TAB_PANEL: {
      aPart = TABP_PANEL;
      aState = TS_NORMAL;
      return NS_OK;
    }
    case NS_THEME_TAB:
    case NS_THEME_TAB_LEFT_EDGE:
    case NS_THEME_TAB_RIGHT_EDGE: {
      aPart = TABP_TAB;
      if (!aFrame) {
        aState = TS_NORMAL;
        return NS_OK;
      }
      
      if (IsDisabled(aFrame)) {
        aState = TS_DISABLED;
        return NS_OK;
      }

      if (IsSelectedTab(aFrame)) {
        aPart = TABP_TAB_SELECTED;
        aState = TS_ACTIVE; // The selected tab is always "pressed".
      }
      else {
        PRInt32 eventState = GetContentState(aFrame, aWidgetType);
        if (eventState & NS_EVENT_STATE_HOVER && eventState & NS_EVENT_STATE_ACTIVE)
          aState = TS_ACTIVE;
        else if (eventState & NS_EVENT_STATE_FOCUS)
          aState = TS_FOCUSED;
        else if (eventState & NS_EVENT_STATE_HOVER)
          aState = TS_HOVER;
        else 
          aState = TS_NORMAL;
      }
      
      return NS_OK;
    }
    case NS_THEME_TREEVIEW_HEADER_SORTARROW: {
      // XXX Probably will never work due to a bug in the Luna theme.
      aPart = 4;
      aState = 1;
      return NS_OK;
    }
    case NS_THEME_TREEVIEW_HEADER_CELL: {
      aPart = 1;
      if (!aFrame) {
        aState = TS_NORMAL;
        return NS_OK;
      }
      
      PRInt32 eventState = GetContentState(aFrame, aWidgetType);
      if (eventState & NS_EVENT_STATE_HOVER && eventState & NS_EVENT_STATE_ACTIVE)
        aState = TS_ACTIVE;
      else if (eventState & NS_EVENT_STATE_FOCUS)
        aState = TS_FOCUSED;
      else if (eventState & NS_EVENT_STATE_HOVER)
        aState = TS_HOVER;
      else 
        aState = TS_NORMAL;
      
      return NS_OK;
    }
    case NS_THEME_DROPDOWN_BUTTON: {
      aPart = CBP_DROPMARKER;

      nsIContent* content = aFrame->GetContent();

      nsIFrame* parentFrame = aFrame->GetParent();
      nsCOMPtr<nsIMenuFrame> menuFrame(do_QueryInterface(parentFrame));
      if (menuFrame || (content && content->IsContentOfType(nsIContent::eHTML)) )
         // XUL menu lists and HTML selects get state from parent         
         aFrame = parentFrame;

      if (IsDisabled(aFrame))
        aState = TS_DISABLED;
      else {     
        PRInt32 eventState = GetContentState(aFrame, aWidgetType);
        if (eventState & NS_EVENT_STATE_HOVER && eventState & NS_EVENT_STATE_ACTIVE)
          aState = TS_ACTIVE;
        else if (eventState & NS_EVENT_STATE_HOVER)
          aState = TS_HOVER;
        else 
          aState = TS_NORMAL;
      }

      return NS_OK;
    }
  }

  aPart = 0;
  aState = 0;
  return NS_ERROR_FAILURE;
}

Here is the call graph for this function:

Here is the caller graph for this function:

TreeSortDirection nsNativeTheme::GetTreeSortDirection ( nsIFrame aFrame) [inline, protected, inherited]

Definition at line 111 of file nsNativeTheme.h.

                                                           {
    nsAutoString sortdir;
    if (GetAttr(aFrame, mSortDirectionAtom, sortdir)) {
      if (sortdir.EqualsLiteral("descending"))
        return eTreeSortDirection_Descending;
      else if (sortdir.EqualsLiteral("ascending"))
        return eTreeSortDirection_Ascending;
    }

    return eTreeSortDirection_Natural;
  }

Here is the call graph for this function:

Here is the caller graph for this function:

NS_IMETHODIMP nsNativeThemeWin::GetWidgetBorder ( nsIDeviceContext aContext,
nsIFrame aFrame,
PRUint8  aWidgetType,
nsMargin aResult 
) [virtual]

Implements nsITheme.

Definition at line 734 of file nsNativeThemeWin.cpp.

{
  HANDLE theme = GetTheme(aWidgetType);
  if (!theme)
    return ClassicGetWidgetBorder(aContext, aFrame, aWidgetType, aResult); 

  (*aResult).top = (*aResult).bottom = (*aResult).left = (*aResult).right = 0;

  if (!WidgetIsContainer(aWidgetType) ||
      aWidgetType == NS_THEME_TOOLBOX || aWidgetType == NS_THEME_TOOLBAR || 
      aWidgetType == NS_THEME_STATUSBAR || 
      aWidgetType == NS_THEME_RESIZER || aWidgetType == NS_THEME_TAB_PANEL ||
      aWidgetType == NS_THEME_SCROLLBAR_TRACK_HORIZONTAL ||
      aWidgetType == NS_THEME_SCROLLBAR_TRACK_VERTICAL)
    return NS_OK; // Don't worry about it.
 
  if (!getThemeContentRect)
    return NS_ERROR_FAILURE;

  PRInt32 part, state;
  nsresult rv = GetThemePartAndState(aFrame, aWidgetType, part, state);
  if (NS_FAILED(rv))
    return rv;

  // Get our info.
  RECT outerRect; // Create a fake outer rect.
  outerRect.top = outerRect.left = 100;
  outerRect.right = outerRect.bottom = 200;
  RECT contentRect(outerRect);
  HRESULT res = getThemeContentRect(theme, NULL, part, state, &outerRect, &contentRect);
  
  if (FAILED(res))
    return NS_ERROR_FAILURE;

  // Now compute the delta in each direction and place it in our
  // nsMargin struct.
  aResult->top = contentRect.top - outerRect.top;
  aResult->bottom = outerRect.bottom - contentRect.bottom;
  aResult->left = contentRect.left - outerRect.left;
  aResult->right = outerRect.right - contentRect.right;

  // Remove the edges for tabs that are before or after the selected tab,
  if (aWidgetType == NS_THEME_TAB_LEFT_EDGE)
    // Remove the right edge, since we won't be drawing it.
    aResult->right = 0;
  else if (aWidgetType == NS_THEME_TAB_RIGHT_EDGE)
    // Remove the left edge, since we won't be drawing it.
    aResult->left = 0;

  if (aFrame && aWidgetType == NS_THEME_TEXTFIELD) {
    nsIContent* content = aFrame->GetContent();
    if (content && content->IsContentOfType(nsIContent::eHTML)) {
      // We need to pad textfields by 1 pixel, since the caret will draw
      // flush against the edge by default if we don't.
      aResult->left++;
      aResult->right++;
    }
  }

  return NS_OK;
}

Here is the call graph for this function:

virtual PRBool nsITheme::GetWidgetOverflow ( nsIDeviceContext aContext,
nsIFrame aFrame,
PRUint8  aWidgetType,
nsRect aResult 
) [inline, virtual, inherited]

Definition at line 92 of file nsITheme.h.

  { return PR_FALSE; }
PRBool nsNativeThemeWin::GetWidgetPadding ( nsIDeviceContext aContext,
nsIFrame aFrame,
PRUint8  aWidgetType,
nsMargin aResult 
) [virtual]

Implements nsITheme.

Definition at line 800 of file nsNativeThemeWin.cpp.

{
  return PR_FALSE;
}
PRBool nsNativeTheme::IsBottomTab ( nsIFrame aFrame) [inline, protected, inherited]

Definition at line 124 of file nsNativeTheme.h.

                                       {
    nsAutoString classStr;
    if (GetAttr(aFrame, mClassAtom, classStr))
      return classStr.Find("tab-bottom") != kNotFound;
    return PR_FALSE;
  }

Here is the call graph for this function:

Here is the caller graph for this function:

PRBool nsNativeTheme::IsChecked ( nsIFrame aFrame) [inline, protected, inherited]

Definition at line 87 of file nsNativeTheme.h.

                                     {
    return GetCheckedOrSelected(aFrame, PR_FALSE);
  }

Here is the call graph for this function:

Here is the caller graph for this function:

PRBool nsNativeTheme::IsCheckedButton ( nsIFrame aFrame) [inline, protected, inherited]

Definition at line 106 of file nsNativeTheme.h.

                                           {
    return CheckBooleanAttr(aFrame, mCheckedAtom);
  }

Here is the call graph for this function:

Here is the caller graph for this function:

PRBool nsNativeTheme::IsDefaultButton ( nsIFrame aFrame) [inline, protected, inherited]

Definition at line 82 of file nsNativeTheme.h.

                                           {
    return CheckBooleanAttr(aFrame, mDefaultAtom);
  }

Here is the call graph for this function:

Here is the caller graph for this function:

PRBool nsNativeTheme::IsDisabled ( nsIFrame aFrame) [inline, protected, inherited]

Definition at line 77 of file nsNativeTheme.h.

                                      {
    return CheckBooleanAttr(aFrame, mDisabledAtom);
  }

Here is the call graph for this function:

Here is the caller graph for this function:

PRBool nsNativeTheme::IsFocused ( nsIFrame aFrame) [inline, protected, inherited]

Definition at line 96 of file nsNativeTheme.h.

                                     {
    return CheckBooleanAttr(aFrame, mFocusedAtom);
  }

Here is the call graph for this function:

Here is the caller graph for this function:

PRBool nsNativeTheme::IsIndeterminateProgress ( nsIFrame aFrame) [inline, protected, inherited]

Definition at line 132 of file nsNativeTheme.h.

                                                   {
    nsAutoString mode;
    if (GetAttr(aFrame, mModeAtom, mode))
      return mode.EqualsLiteral("undetermined");
    return PR_FALSE;
  }

Here is the call graph for this function:

Here is the caller graph for this function:

PRBool nsNativeTheme::IsReadOnly ( nsIFrame aFrame) [inline, protected, inherited]

Definition at line 144 of file nsNativeTheme.h.

                                      {
      return CheckBooleanAttr(aFrame, mReadOnlyAtom);
  }

Here is the call graph for this function:

Here is the caller graph for this function:

PRBool nsNativeTheme::IsSelected ( nsIFrame aFrame) [inline, protected, inherited]

Definition at line 92 of file nsNativeTheme.h.

                                      {
    return GetCheckedOrSelected(aFrame, PR_TRUE);
  }

Here is the call graph for this function:

Here is the caller graph for this function:

PRBool nsNativeTheme::IsSelectedTab ( nsIFrame aFrame) [inline, protected, inherited]

Definition at line 101 of file nsNativeTheme.h.

                                         {
    return CheckBooleanAttr(aFrame, mSelectedAtom);
  }

Here is the call graph for this function:

Here is the caller graph for this function:

PRBool nsNativeTheme::IsWidgetStyled ( nsPresContext aPresContext,
nsIFrame aFrame,
PRUint8  aWidgetType 
) [protected, inherited]

Definition at line 209 of file nsNativeTheme.cpp.

{
  // Check for specific widgets to see if HTML has overridden the style.
  if (aFrame && (aWidgetType == NS_THEME_BUTTON ||
                 aWidgetType == NS_THEME_TEXTFIELD ||
                 aWidgetType == NS_THEME_LISTBOX ||
                 aWidgetType == NS_THEME_DROPDOWN)) {

    if (aFrame->GetContent()->IsContentOfType(nsIContent::eHTML)) {
      nscolor defaultBGColor, defaultBorderColor;
      PRUint8 defaultBorderStyle;
      nsMargin defaultBorderSize;
      PRBool defaultBGTransparent = PR_FALSE;

      float p2t;
      p2t = aPresContext->PixelsToTwips();

      nsILookAndFeel *lookAndFeel = aPresContext->LookAndFeel();

      switch (aWidgetType) {
      case NS_THEME_BUTTON:
        if (IsDisabled(aFrame)) {
          ConvertMarginToTwips(sButtonDisabledBorderSize, defaultBorderSize, p2t);
          defaultBorderStyle = sButtonInactiveBorderStyle;
          lookAndFeel->GetColor(sButtonDisabledBorderColorID,
                                defaultBorderColor);
          lookAndFeel->GetColor(sButtonDisabledBGColorID,
                                defaultBGColor);
        } else {
          PRInt32 contentState = GetContentState(aFrame, aWidgetType);
          ConvertMarginToTwips(sButtonBorderSize, defaultBorderSize, p2t);
          if (contentState & NS_EVENT_STATE_HOVER &&
              contentState & NS_EVENT_STATE_ACTIVE)
            defaultBorderStyle = sButtonActiveBorderStyle;
          else
            defaultBorderStyle = sButtonInactiveBorderStyle;
          lookAndFeel->GetColor(sButtonBorderColorID,
                                defaultBorderColor);
          lookAndFeel->GetColor(sButtonBGColorID,
                                defaultBGColor);
        }
        break;

      case NS_THEME_TEXTFIELD:
        defaultBorderStyle = sTextfieldBorderStyle;
        ConvertMarginToTwips(sTextfieldBorderSize, defaultBorderSize, p2t);
        lookAndFeel->GetColor(sTextfieldBorderColorID,
                              defaultBorderColor);
        if (!(defaultBGTransparent = sTextfieldBGTransparent)) {
          if (IsDisabled(aFrame))
            lookAndFeel->GetColor(sTextfieldDisabledBGColorID,
                                  defaultBGColor);
          else
            lookAndFeel->GetColor(sTextfieldBGColorID,
                                  defaultBGColor);
        }
        break;

      case NS_THEME_LISTBOX:
      case NS_THEME_DROPDOWN:
        defaultBorderStyle = sListboxBorderStyle;
        ConvertMarginToTwips(sListboxBorderSize, defaultBorderSize, p2t);
        lookAndFeel->GetColor(sListboxBorderColorID,
                              defaultBorderColor);
        if (!(defaultBGTransparent = sListboxBGTransparent)) {
          if (IsDisabled(aFrame))
            lookAndFeel->GetColor(sListboxDisabledBGColorID,
                                  defaultBGColor);
          else
            lookAndFeel->GetColor(sListboxBGColorID,
                                  defaultBGColor);
        }
        break;

      default:
        NS_ERROR("nsNativeTheme::IsWidgetStyled widget type not handled");
        return PR_FALSE;
      }

      // Check whether background differs from default
      const nsStyleBackground* ourBG = aFrame->GetStyleBackground();

      if (defaultBGTransparent) {
        if (!(ourBG->mBackgroundFlags & NS_STYLE_BG_COLOR_TRANSPARENT))
          return PR_TRUE;
      } else if (ourBG->mBackgroundColor != defaultBGColor ||
                 ourBG->mBackgroundFlags & NS_STYLE_BG_COLOR_TRANSPARENT)
        return PR_TRUE;

      if (!(ourBG->mBackgroundFlags & NS_STYLE_BG_IMAGE_NONE))
        return PR_TRUE;

      // Check whether border style or color differs from default
      const nsStyleBorder* ourBorder = aFrame->GetStyleBorder();

      for (PRInt32 i = 0; i < 4; ++i) {
        if (ourBorder->GetBorderStyle(i) != defaultBorderStyle)
          return PR_TRUE;

        PRBool borderFG, borderClear;
        nscolor borderColor;
        ourBorder->GetBorderColor(i, borderColor, borderFG, borderClear);
        if (borderColor != defaultBorderColor || borderClear)
          return PR_TRUE;
      }

      // Check whether border size differs from default
      if (ourBorder->GetBorder() != defaultBorderSize)
        return PR_TRUE;
    }
  }

  return PR_FALSE;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Implements nsITheme.

Definition at line 965 of file nsNativeThemeWin.cpp.

{
  CloseData();
  return NS_OK;
}

Here is the call graph for this function:

PRBool nsNativeThemeWin::ThemeSupportsWidget ( nsPresContext aPresContext,
nsIFrame aFrame,
PRUint8  aWidgetType 
) [virtual]

Implements nsITheme.

Definition at line 972 of file nsNativeThemeWin.cpp.

{
  // XXXdwh We can go even further and call the API to ask if support exists for
  // specific widgets.

  if (aPresContext && !aPresContext->PresShell()->IsThemeSupportEnabled())
    return PR_FALSE;

  HANDLE theme = NULL;
  if (aWidgetType == NS_THEME_CHECKBOX_CONTAINER)
    theme = GetTheme(NS_THEME_CHECKBOX);
  else if (aWidgetType == NS_THEME_RADIO_CONTAINER)
    theme = GetTheme(NS_THEME_RADIO);
  else
    theme = GetTheme(aWidgetType);

  if ((theme) || (!theme && ClassicThemeSupportsWidget(aPresContext, aFrame, aWidgetType)))
    // turn off theming for some HTML widgets styled by the page
    return (!IsWidgetStyled(aPresContext, aFrame, aWidgetType));
  
  return PR_FALSE;
}

Here is the call graph for this function:

Implements nsITheme.

Definition at line 998 of file nsNativeThemeWin.cpp.

{
  // XXXdwh At some point flesh all of this out.
  if (aWidgetType == NS_THEME_DROPDOWN_BUTTON || 
      aWidgetType == NS_THEME_RADIO ||
      aWidgetType == NS_THEME_CHECKBOX)
    return PR_FALSE;
  return PR_TRUE;
}

Here is the caller graph for this function:

NS_IMETHODIMP nsNativeThemeWin::WidgetStateChanged ( nsIFrame aFrame,
PRUint8  aWidgetType,
nsIAtom aAttribute,
PRBool aShouldRepaint 
) [virtual]

Implements nsITheme.

Definition at line 872 of file nsNativeThemeWin.cpp.

{
  // Some widget types just never change state.
  if (aWidgetType == NS_THEME_TOOLBOX || aWidgetType == NS_THEME_TOOLBAR ||
      aWidgetType == NS_THEME_SCROLLBAR_TRACK_VERTICAL || 
      aWidgetType == NS_THEME_SCROLLBAR_TRACK_HORIZONTAL || 
      aWidgetType == NS_THEME_STATUSBAR || aWidgetType == NS_THEME_STATUSBAR_PANEL ||
      aWidgetType == NS_THEME_STATUSBAR_RESIZER_PANEL ||
      aWidgetType == NS_THEME_PROGRESSBAR_CHUNK ||
      aWidgetType == NS_THEME_PROGRESSBAR_CHUNK_VERTICAL ||
      aWidgetType == NS_THEME_PROGRESSBAR ||
      aWidgetType == NS_THEME_PROGRESSBAR_VERTICAL ||
      aWidgetType == NS_THEME_TOOLTIP ||
      aWidgetType == NS_THEME_TAB_PANELS ||
      aWidgetType == NS_THEME_TAB_PANEL) {
    *aShouldRepaint = PR_FALSE;
    return NS_OK;
  }

  // XXXdwh Not sure what can really be done here.  Can at least guess for
  // specific widgets that they're highly unlikely to have certain states.
  // For example, a toolbar doesn't care about any states.
  if (!aAttribute) {
    // Hover/focus/active changed.  Always repaint.
    *aShouldRepaint = PR_TRUE;
  }
  else {
    // Check the attribute to see if it's relevant.  
    // disabled, checked, dlgtype, default, etc.
    *aShouldRepaint = PR_FALSE;
    if (aAttribute == mDisabledAtom || aAttribute == mCheckedAtom ||
        aAttribute == mSelectedAtom || aAttribute == mReadOnlyAtom)
      *aShouldRepaint = PR_TRUE;
  }

  return NS_OK;
}

Member Data Documentation

Definition at line 115 of file nsNativeThemeWin.h.

nsCOMPtr<nsIAtom> nsNativeTheme::mCheckedAtom [protected, inherited]

Definition at line 161 of file nsNativeTheme.h.

Definition at line 125 of file nsNativeThemeWin.h.

Definition at line 160 of file nsNativeTheme.h.

Definition at line 164 of file nsNativeTheme.h.

nsCOMPtr<nsIAtom> nsNativeTheme::mFocusedAtom [protected, inherited]

Definition at line 165 of file nsNativeTheme.h.

Definition at line 126 of file nsNativeThemeWin.h.

Definition at line 128 of file nsNativeThemeWin.h.

Definition at line 129 of file nsNativeThemeWin.h.

Definition at line 120 of file nsNativeThemeWin.h.

Definition at line 163 of file nsNativeTheme.h.

Definition at line 119 of file nsNativeThemeWin.h.

Definition at line 121 of file nsNativeThemeWin.h.

Definition at line 162 of file nsNativeTheme.h.

Definition at line 166 of file nsNativeTheme.h.

Definition at line 122 of file nsNativeThemeWin.h.

Definition at line 123 of file nsNativeThemeWin.h.

Definition at line 116 of file nsNativeThemeWin.h.

HMODULE nsNativeThemeWin::mThemeDLL [private]

Definition at line 114 of file nsNativeThemeWin.h.

Definition at line 118 of file nsNativeThemeWin.h.

Definition at line 117 of file nsNativeThemeWin.h.

Definition at line 124 of file nsNativeThemeWin.h.

Definition at line 130 of file nsNativeThemeWin.h.

Definition at line 172 of file nsNativeTheme.h.

Definition at line 176 of file nsNativeTheme.h.

Definition at line 174 of file nsNativeTheme.h.

nsMargin nsNativeTheme::sButtonBorderSize [static, protected, inherited]

Definition at line 170 of file nsNativeTheme.h.

Definition at line 177 of file nsNativeTheme.h.

Definition at line 175 of file nsNativeTheme.h.

nsMargin nsNativeTheme::sButtonDisabledBorderSize [static, protected, inherited]

Definition at line 171 of file nsNativeTheme.h.

Definition at line 173 of file nsNativeTheme.h.

Definition at line 188 of file nsNativeTheme.h.

PRBool nsNativeTheme::sListboxBGTransparent = PR_FALSE [static, protected, inherited]

Definition at line 187 of file nsNativeTheme.h.

Definition at line 186 of file nsNativeTheme.h.

nsMargin nsNativeTheme::sListboxBorderSize [static, protected, inherited]

Definition at line 184 of file nsNativeTheme.h.

Definition at line 185 of file nsNativeTheme.h.

Definition at line 189 of file nsNativeTheme.h.

Definition at line 182 of file nsNativeTheme.h.

PRBool nsNativeTheme::sTextfieldBGTransparent = PR_FALSE [static, protected, inherited]

Definition at line 181 of file nsNativeTheme.h.

Definition at line 180 of file nsNativeTheme.h.

nsMargin nsNativeTheme::sTextfieldBorderSize [static, protected, inherited]

Definition at line 178 of file nsNativeTheme.h.

Definition at line 179 of file nsNativeTheme.h.

Definition at line 183 of file nsNativeTheme.h.


The documentation for this class was generated from the following files: