Back to index

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

#include <nsNativeThemeMac.h>

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

List of all members.

Public Member Functions

 nsNativeThemeMac ()
virtual ~nsNativeThemeMac ()
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)
virtual PRBool GetWidgetOverflow (nsIDeviceContext *aContext, nsIFrame *aFrame, PRUint8 aWidgetType, nsRect *aResult)

Protected Types

enum  {
  kAquaPushButtonEndcaps = 14, kAquaPushButtonTopBottom = 2, kAquaSmallPushButtonEndcaps = 10, kAquaDropdownLeftEndcap = 9,
  kAquaDropwdonRightEndcap = 20
}

Protected Member Functions

nsresult GetSystemColor (PRUint8 aWidgetType, nsILookAndFeel::nsColorID &aColorID)
nsresult GetSystemFont (PRUint8 aWidgetType, nsSystemFontID &aFont)
void DrawCheckbox (const Rect &inBoxRect, PRBool inChecked, PRBool inDisabled, PRInt32 inState)
void DrawSmallCheckbox (const Rect &inBoxRect, PRBool inChecked, PRBool inDisabled, PRInt32 inState)
void DrawRadio (const Rect &inBoxRect, PRBool inChecked, PRBool inDisabled, PRInt32 inState)
void DrawSmallRadio (const Rect &inBoxRect, PRBool inChecked, PRBool inDisabled, PRInt32 inState)
void DrawToolbar (const Rect &inBoxRect)
void DrawEditText (const Rect &inBoxRect, PRBool inIsDisabled)
void DrawListBox (const Rect &inBoxRect, PRBool inIsDisabled)
void DrawProgress (const Rect &inBoxRect, PRBool inIsDisabled, PRBool inIsIndeterminate, PRBool inIsHorizontal, PRInt32 inValue)
void DrawTab (const Rect &inBoxRect, PRBool inIsDisabled, PRBool inIsFrontmost, PRBool inIsHorizontal, PRBool inTabBottom, PRInt32 inState)
void DrawTabPanel (const Rect &inBoxRect, PRBool inIsDisabled)
void DrawSeparator (const Rect &inBoxRect, PRBool inIsDisabled)
void DrawButton (ThemeButtonKind inKind, const Rect &inBoxRect, PRBool inIsDefault, PRBool inDisabled, ThemeButtonValue inValue, ThemeButtonAdornment inAdornment, PRInt32 inState)
void DrawCheckboxRadio (ThemeButtonKind inKind, const Rect &inBoxRect, PRBool inChecked, PRBool inDisabled, PRInt32 inState)
void DrawMenu (const Rect &inBoxRect, PRBool inIsDisabled)
void DrawMenuItem (const Rect &inBoxRect, ThemeMenuItemType itemType, PRBool inIsDisabled, PRBool inHover)

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

ThemeEraseUPP mEraseProc
nsCOMPtr< nsIAtommMenuActiveAtom
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 47 of file nsNativeThemeMac.h.


Member Enumeration Documentation

anonymous enum [protected]
Enumerator:
kAquaPushButtonEndcaps 
kAquaPushButtonTopBottom 
kAquaSmallPushButtonEndcaps 
kAquaDropdownLeftEndcap 
kAquaDropwdonRightEndcap 

Definition at line 84 of file nsNativeThemeMac.h.

       {
    kAquaPushButtonEndcaps = 14,
    kAquaPushButtonTopBottom = 2,
    kAquaSmallPushButtonEndcaps = 10,

    kAquaDropdownLeftEndcap = 9,
    kAquaDropwdonRightEndcap = 20     // wider on right to encompass the button
  };
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 108 of file nsNativeThemeMac.cpp.

{
  if ( mEraseProc )
    ::DisposeThemeEraseUPP(mEraseProc);
}

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:

void nsNativeThemeMac::DrawButton ( ThemeButtonKind  inKind,
const Rect &  inBoxRect,
PRBool  inIsDefault,
PRBool  inDisabled,
ThemeButtonValue  inValue,
ThemeButtonAdornment  inAdornment,
PRInt32  inState 
) [protected]

Definition at line 161 of file nsNativeThemeMac.cpp.

{
  ThemeButtonDrawInfo info;

  info.value = inValue;
  info.adornment = inAdornment;

  if ( inDisabled )
    info.state = kThemeStateUnavailableInactive;
  else {
    info.state = ((inState & NS_EVENT_STATE_ACTIVE) && (inState & NS_EVENT_STATE_HOVER)) ? 
                    kThemeStatePressed : kThemeStateActive;
    if ( inState & NS_EVENT_STATE_FOCUS ) {
      // There is a bug in OS 10.2.x-10.3.x where if we are in a CG context and
      // draw the focus ring with DrawThemeButton(), there are ugly lines all
      // through the button.  This may get fixed in a dot-release, but until it
      // does, we can't draw the focus ring.
      if (inKind != kThemePushButton || nsRenderingContextMac::OnTigerOrLater())
        info.adornment = kThemeAdornmentFocus;
    }
    if ( inIsDefault )
      info.adornment |= kThemeAdornmentDefault;
  }
  ::DrawThemeButton ( &inBoxRect, inKind, &info, nsnull, mEraseProc, nsnull, 0L );
}

Here is the call graph for this function:

Here is the caller graph for this function:

void nsNativeThemeMac::DrawCheckbox ( const Rect &  inBoxRect,
PRBool  inChecked,
PRBool  inDisabled,
PRInt32  inState 
) [protected]

Definition at line 137 of file nsNativeThemeMac.cpp.

{
  DrawCheckboxRadio(kThemeCheckBox, inBoxRect, inChecked, inDisabled, inState);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void nsNativeThemeMac::DrawCheckboxRadio ( ThemeButtonKind  inKind,
const Rect &  inBoxRect,
PRBool  inChecked,
PRBool  inDisabled,
PRInt32  inState 
) [protected]

Definition at line 120 of file nsNativeThemeMac.cpp.

{
  ThemeButtonDrawInfo info;
  if ( inDisabled )
    info.state = kThemeStateInactive;
  else
    info.state = ((inState & NS_EVENT_STATE_ACTIVE) && (inState & NS_EVENT_STATE_HOVER)) ?
                     kThemeStatePressed : kThemeStateActive;
  info.value = inChecked ? kThemeButtonOn : kThemeButtonOff;
  info.adornment = (inState & NS_EVENT_STATE_FOCUS) ? kThemeAdornmentFocus : kThemeAdornmentNone;
  
  ::DrawThemeButton ( &inBoxRect, inKind, &info, nsnull, nsnull, nsnull, 0L );
}

Here is the caller graph for this function:

void nsNativeThemeMac::DrawEditText ( const Rect &  inBoxRect,
PRBool  inIsDisabled 
) [protected]

Definition at line 207 of file nsNativeThemeMac.cpp.

{
  Pattern whitePat;
  ::BackColor(whiteColor);
  ::BackPat(GetQDGlobalsWhite(&whitePat));
  ::EraseRect(&inBoxRect);
  
  ThemeDrawState drawState = inIsDisabled ? kThemeStateDisabled : kThemeStateActive;
  ::DrawThemeEditTextFrame(&inBoxRect, drawState);
}

Here is the caller graph for this function:

void nsNativeThemeMac::DrawListBox ( const Rect &  inBoxRect,
PRBool  inIsDisabled 
) [protected]

Definition at line 220 of file nsNativeThemeMac.cpp.

{
  Pattern whitePat;
  ::BackColor(whiteColor);
  ::BackPat(GetQDGlobalsWhite(&whitePat));
  ::EraseRect(&inBoxRect);
  
  ThemeDrawState drawState = inIsDisabled ? kThemeStateDisabled : kThemeStateActive;
  ::DrawThemeListBoxFrame(&inBoxRect, drawState);
}

Here is the caller graph for this function:

void nsNativeThemeMac::DrawMenu ( const Rect &  inBoxRect,
PRBool  inIsDisabled 
) [protected]

Definition at line 293 of file nsNativeThemeMac.cpp.

{
  ::EraseRect(&inBoxRect);
  ThemeMenuType menuType = inIsDisabled ? kThemeMenuTypeInactive : kThemeMenuTypePopUp;
  ::DrawThemeMenuBackground(&inBoxRect, menuType);
}

Here is the caller graph for this function:

void nsNativeThemeMac::DrawMenuItem ( const Rect &  inBoxRect,
ThemeMenuItemType  itemType,
PRBool  inIsDisabled,
PRBool  inHover 
) [protected]

Definition at line 301 of file nsNativeThemeMac.cpp.

{
  ThemeMenuState menuItemState;
  if (inIsDisabled)
    menuItemState = kThemeMenuDisabled;
  else if (inHover)
    menuItemState = kThemeMenuSelected;
  else
    menuItemState = kThemeMenuActive;

  // XXXmano: pass the right menu rect!
  ::DrawThemeMenuItem(&inBoxRect, &inBoxRect, inBoxRect.top,
                      inBoxRect.bottom, menuItemState, itemType, NULL, 0);
}

Here is the caller graph for this function:

void nsNativeThemeMac::DrawProgress ( const Rect &  inBoxRect,
PRBool  inIsDisabled,
PRBool  inIsIndeterminate,
PRBool  inIsHorizontal,
PRInt32  inValue 
) [protected]

Definition at line 233 of file nsNativeThemeMac.cpp.

{
  ThemeTrackDrawInfo info;
  static SInt32 sPhase = 0;
  
  info.kind = inIsIndeterminate ? kThemeMediumIndeterminateBar: kThemeMediumProgressBar;
  info.bounds = inBoxRect;
  info.min = 0;
  info.max = 100;
  info.value = inValue;
  info.attributes = inIsHorizontal ? kThemeTrackHorizontal : 0L;
  info.enableState = inIsDisabled ? kThemeTrackDisabled : kThemeTrackActive;
  info.trackInfo.progress.phase = sPhase++;       // animate for the next time we're called
  
  ::DrawThemeTrack(&info, nsnull, nsnull, 0L);
}

Here is the caller graph for this function:

void nsNativeThemeMac::DrawRadio ( const Rect &  inBoxRect,
PRBool  inChecked,
PRBool  inDisabled,
PRInt32  inState 
) [protected]

Definition at line 149 of file nsNativeThemeMac.cpp.

{
  DrawCheckboxRadio(kThemeRadioButton, inBoxRect, inChecked, inDisabled, inState);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void nsNativeThemeMac::DrawSeparator ( const Rect &  inBoxRect,
PRBool  inIsDisabled 
) [protected]

Definition at line 261 of file nsNativeThemeMac.cpp.

{
  ThemeDrawState drawState = inIsDisabled ? kThemeStateDisabled : kThemeStateActive;
  ::DrawThemeSeparator(&inBoxRect, drawState);
}

Here is the caller graph for this function:

void nsNativeThemeMac::DrawSmallCheckbox ( const Rect &  inBoxRect,
PRBool  inChecked,
PRBool  inDisabled,
PRInt32  inState 
) [protected]

Definition at line 143 of file nsNativeThemeMac.cpp.

{
  DrawCheckboxRadio(kThemeSmallCheckBox, inBoxRect, inChecked, inDisabled, inState);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void nsNativeThemeMac::DrawSmallRadio ( const Rect &  inBoxRect,
PRBool  inChecked,
PRBool  inDisabled,
PRInt32  inState 
) [protected]

Definition at line 155 of file nsNativeThemeMac.cpp.

{
  DrawCheckboxRadio(kThemeSmallRadioButton, inBoxRect, inChecked, inDisabled, inState);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void nsNativeThemeMac::DrawTab ( const Rect &  inBoxRect,
PRBool  inIsDisabled,
PRBool  inIsFrontmost,
PRBool  inIsHorizontal,
PRBool  inTabBottom,
PRInt32  inState 
) [protected]

Definition at line 269 of file nsNativeThemeMac.cpp.

{
  ThemeTabStyle style = 0L;
  if ( inIsFrontmost ) {
    if ( inIsDisabled ) 
      style = kThemeTabFrontInactive;
    else
      style = kThemeTabFront;
  }
  else {
    if ( inIsDisabled )
      style = kThemeTabNonFrontInactive;
    else if ( (inState & NS_EVENT_STATE_ACTIVE) && (inState & NS_EVENT_STATE_HOVER) )
      style = kThemeTabNonFrontPressed;
    else
      style = kThemeTabNonFront;  
  }

  ThemeTabDirection direction = inTabBottom ? kThemeTabSouth : kThemeTabNorth; // don't yet support vertical tabs
  ::DrawThemeTab(&inBoxRect, style, direction, nsnull, 0L);
}

Here is the caller graph for this function:

void nsNativeThemeMac::DrawTabPanel ( const Rect &  inBoxRect,
PRBool  inIsDisabled 
) [protected]

Definition at line 253 of file nsNativeThemeMac.cpp.

{
  ThemeDrawState drawState = inIsDisabled ? kThemeStateDisabled : kThemeStateActive;
  ::DrawThemeTabPane(&inBoxRect, drawState);
}

Here is the caller graph for this function:

void nsNativeThemeMac::DrawToolbar ( const Rect &  inBoxRect) [protected]

Definition at line 191 of file nsNativeThemeMac.cpp.

{
#if 0
  const PRInt32 kThemeBrushToolbarBackground = 52;    // from 3.4.1 headers
  ::SetThemeBackground(kThemeBrushToolbarBackground, 24, true);
  ::EraseRect(&inBoxRect);
  ::SetThemeBackground(kThemeBrushWhite, 24, true);
printf("told to draw at %ld %ld w %ld h %ld\n", inBoxRect.left, inBoxRect.top, inBoxRect.right-inBoxRect.left,
        inBoxRect.bottom - inBoxRect.top);
#endif
  ThemeDrawState drawState = kThemeStateActive;
  ::DrawThemeWindowHeader(&inBoxRect, drawState);
}

Here is the caller graph for this function:

NS_IMETHODIMP nsNativeThemeMac::DrawWidgetBackground ( nsIRenderingContext aContext,
nsIFrame aFrame,
PRUint8  aWidgetType,
const nsRect aRect,
const nsRect aClipRect 
) [virtual]

Implements nsITheme.

Definition at line 318 of file nsNativeThemeMac.cpp.

{
  // setup to draw into the correct port
  nsIDrawingSurface* surf;
  aContext->GetDrawingSurface(&surf);
  nsDrawingSurfaceMac* macSurface = (nsDrawingSurfaceMac*)surf;
  CGrafPtr port = nsnull;
  NS_ASSERTION(macSurface,"no surface!!!\n");
  if ( macSurface )
    macSurface->GetGrafPtr(&port);
  else
    return NS_ERROR_FAILURE;      // we won't get far w/out something to draw into
  StPortSetter temp(port);

  // save off the old clip rgn for later restoration. however, we're currently
  // not using the cliprect because aqua likes to draw shadows and stuff outside
  // the bounds we give it, and clipping to the exact rect looks horrible.
  StRegionFromPool oldClip;
  ::GetClip(oldClip);

  // transform rect coordinates to correct coord system
  nsTransform2D* transformMatrix;
  aContext->GetCurrentTransform(transformMatrix);
  nsRect transRect(aRect), transClipRect(aClipRect);
  Rect macRect;
  transformMatrix->TransformCoord(&transRect.x, &transRect.y, &transRect.width, &transRect.height);
  ConvertGeckoToNativeRect(transRect, macRect);
#ifdef CLIP_DRAWING
  Rect clipRect;
  transformMatrix->TransformCoord(&transClipRect.x, &transClipRect.y, &transClipRect.width, &transClipRect.height);
  ConvertGeckoToNativeRect(transClipRect, clipRect);
  ::ClipRect(&clipRect);
#endif

  PRInt32 eventState = GetContentState(aFrame, aWidgetType);

  switch ( aWidgetType ) {
  
    case NS_THEME_DIALOG:
      ::SetThemeBackground(kThemeBrushDialogBackgroundActive, 24, true);
      ::EraseRect(&macRect);
      ::SetThemeBackground(kThemeBrushWhite, 24, true);
      break;

    case NS_THEME_MENUPOPUP:
      ::SetThemeBackground(kThemeBrushDialogBackgroundActive, 24, true);
      DrawMenu(macRect, IsDisabled(aFrame));
      ::SetThemeBackground(kThemeBrushWhite, 24, true);
      break;

    case NS_THEME_MENUITEM:
      ::SetThemeBackground(kThemeBrushDialogBackgroundActive, 24, true);
      DrawMenuItem(macRect, kThemeMenuItemPlain, IsDisabled(aFrame), CheckBooleanAttr(aFrame, mMenuActiveAtom));
      ::SetThemeBackground(kThemeBrushWhite, 24, true);
      break;

    case NS_THEME_TOOLTIP:
    {
      RGBColor yellow = {65535,65535,45000};
      ::RGBBackColor(&yellow);
      ::EraseRect(&macRect);
      ::SetThemeBackground(kThemeBrushWhite, 24, true);
      break;
    }

    case NS_THEME_CHECKBOX:
      DrawCheckbox ( macRect, IsChecked(aFrame), IsDisabled(aFrame), eventState );
      break;    
    case NS_THEME_RADIO:
      DrawRadio ( macRect, IsSelected(aFrame), IsDisabled(aFrame), eventState );
      break;
    case NS_THEME_CHECKBOX_SMALL:
      if (transRect.height == 15) {
       // draw at 14x16, see comment in GetMinimumWidgetSize
        ++macRect.bottom;
      }
      DrawSmallCheckbox ( macRect, IsChecked(aFrame), IsDisabled(aFrame), eventState );
      break;
    case NS_THEME_RADIO_SMALL:
      if (transRect.height == 14) {
        // draw at 14x15, see comment in GetMinimumWidgetSize
        ++macRect.bottom;
      }
      DrawSmallRadio ( macRect, IsSelected(aFrame), IsDisabled(aFrame), eventState );
      break;
    case NS_THEME_BUTTON:
    case NS_THEME_BUTTON_SMALL:
      DrawButton ( kThemePushButton, macRect, IsDefaultButton(aFrame), IsDisabled(aFrame), 
                    kThemeButtonOn, kThemeAdornmentNone, eventState );
      break;      
    case NS_THEME_BUTTON_BEVEL:
      DrawButton ( kThemeMediumBevelButton, macRect, IsDefaultButton(aFrame), IsDisabled(aFrame), 
                    kThemeButtonOff, kThemeAdornmentNone, eventState );
      break;
    case NS_THEME_TOOLBAR_BUTTON:
      DrawButton ( kThemePushButton, macRect, IsDefaultButton(aFrame), IsDisabled(aFrame),
                    kThemeButtonOn, kThemeAdornmentNone, eventState );
      break;
    case NS_THEME_TOOLBAR_SEPARATOR:
      DrawSeparator ( macRect, IsDisabled(aFrame) );
      break;
      
    case NS_THEME_TOOLBAR:
    case NS_THEME_TOOLBOX:
    case NS_THEME_STATUSBAR:
      DrawToolbar ( macRect );
      break;
      
    case NS_THEME_DROPDOWN:
      DrawButton ( kThemePopupButton, macRect, IsDefaultButton(aFrame), IsDisabled(aFrame), 
                    kThemeButtonOn, kThemeAdornmentNone, eventState );
      break;
    case NS_THEME_DROPDOWN_BUTTON:
      // do nothing, this is covered by the DROPDOWN case
      break;

    case NS_THEME_TEXTFIELD:
      DrawEditText ( macRect, (IsDisabled(aFrame) || IsReadOnly(aFrame)) );
      break;
      
    case NS_THEME_PROGRESSBAR:
      DrawProgress ( macRect, IsDisabled(aFrame), IsIndeterminateProgress(aFrame), PR_TRUE, GetProgressValue(aFrame) );
      break;
    case NS_THEME_PROGRESSBAR_VERTICAL:
      DrawProgress ( macRect, IsDisabled(aFrame), IsIndeterminateProgress(aFrame), PR_FALSE, GetProgressValue(aFrame) );
      break;
    case NS_THEME_PROGRESSBAR_CHUNK:
    case NS_THEME_PROGRESSBAR_CHUNK_VERTICAL:
      // do nothing, covered by the progress bar cases above
      break;

    case NS_THEME_TREEVIEW_TWISTY:
      DrawButton ( kThemeDisclosureButton, macRect, PR_FALSE, IsDisabled(aFrame), 
                    kThemeDisclosureRight, kThemeAdornmentNone, eventState );
      break;
    case NS_THEME_TREEVIEW_TWISTY_OPEN:
      DrawButton ( kThemeDisclosureButton, macRect, PR_FALSE, IsDisabled(aFrame), 
                    kThemeDisclosureDown, kThemeAdornmentNone, eventState );
      break;
    case NS_THEME_TREEVIEW_HEADER_CELL:
    {
      TreeSortDirection sortDirection = GetTreeSortDirection(aFrame);
      DrawButton ( kThemeListHeaderButton, macRect, PR_FALSE, IsDisabled(aFrame), 
                    sortDirection == eTreeSortDirection_Natural ? kThemeButtonOff : kThemeButtonOn,
                    sortDirection == eTreeSortDirection_Descending ?
                    kThemeAdornmentHeaderButtonSortUp : kThemeAdornmentNone, eventState );      
      break;
    }
    case NS_THEME_TREEVIEW_TREEITEM:
    case NS_THEME_TREEVIEW:
      ::SetThemeBackground(kThemeBrushWhite, 24, true);
      ::EraseRect ( &macRect );
      break;
    case NS_THEME_TREEVIEW_HEADER:
      // do nothing, taken care of by individual header cells
    case NS_THEME_TREEVIEW_HEADER_SORTARROW:
      // do nothing, taken care of by treeview header
    case NS_THEME_TREEVIEW_LINE:
      // do nothing, these lines don't exist on macos
      break;
    case NS_THEME_SCROLLBAR_GRIPPER_HORIZONTAL:
    case NS_THEME_SCROLLBAR_GRIPPER_VERTICAL: 
    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_TRACK_HORIZONTAL:
    case NS_THEME_SCROLLBAR_TRACK_VERTICAL:
    case NS_THEME_SCROLLBAR_BUTTON_LEFT:
    case NS_THEME_SCROLLBAR_BUTTON_RIGHT:
      // Scrollbars are now native on mac, via nsNativeScrollbarFrame.
      // So, this should never be called.
      break;
    
    case NS_THEME_LISTBOX:
      DrawListBox(macRect, IsDisabled(aFrame));
      break;
    
    case NS_THEME_TAB:
      DrawTab(macRect, IsDisabled(aFrame), IsSelectedTab(aFrame), PR_TRUE, IsBottomTab(aFrame), eventState);
      break;      
    case NS_THEME_TAB_PANELS:
      DrawTabPanel(macRect, IsDisabled(aFrame));
      break;
  }

  ::SetClip(oldClip);
  
  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 nsNativeThemeMac::GetMinimumWidgetSize ( nsIRenderingContext aContext,
nsIFrame aFrame,
PRUint8  aWidgetType,
nsSize aResult,
PRBool aIsOverridable 
) [virtual]

Implements nsITheme.

Definition at line 576 of file nsNativeThemeMac.cpp.

{
  // XXX we should probably cache some of these metrics
  aResult->SizeTo(0,0);
  *aIsOverridable = PR_TRUE;
  
  switch ( aWidgetType ) {
  
    case NS_THEME_BUTTON:
    {
      SInt32 buttonHeight = 0;
      ::GetThemeMetric(kThemeMetricPushButtonHeight, &buttonHeight);
      aResult->SizeTo(kAquaPushButtonEndcaps*2, buttonHeight);
      break;
    }
      
    case NS_THEME_BUTTON_SMALL:
    {
      SInt32 buttonHeight = 0;
      ::GetThemeMetric(kThemeMetricSmallPushButtonHeight, &buttonHeight);
      aResult->SizeTo(kAquaSmallPushButtonEndcaps*2, buttonHeight);
      break;
    }

    case NS_THEME_CHECKBOX:
    {
      SInt32 boxHeight = 0, boxWidth = 0;
      ::GetThemeMetric(kThemeMetricCheckBoxWidth, &boxWidth);
      ::GetThemeMetric(kThemeMetricCheckBoxHeight, &boxHeight);
      aResult->SizeTo(boxWidth, boxHeight);
      *aIsOverridable = PR_FALSE;
      break;
    }
    
    case NS_THEME_RADIO:
    {
      SInt32 radioHeight = 0, radioWidth = 0;
      ::GetThemeMetric(kThemeMetricRadioButtonWidth, &radioWidth);
      ::GetThemeMetric(kThemeMetricRadioButtonHeight, &radioHeight);
      aResult->SizeTo(radioWidth, radioHeight);
      *aIsOverridable = PR_FALSE;
      break;
    }

    case NS_THEME_CHECKBOX_SMALL:
    {
      // Appearance manager (and the Aqua HIG) will tell us that a small
      // checkbox is 14x16.  This includes a transparent row at the bottom
      // of the image.  In order to allow the baseline for text to be aligned
      // with the bottom of the checkbox, we report the size as 14x15, but
      // we'll always tell appearance manager to draw it at 14x16.  This
      // will result in Gecko aligning text with the real bottom of the
      // checkbox.

      aResult->SizeTo(14, 15);
      *aIsOverridable = PR_FALSE;
      break;
    }

    case NS_THEME_RADIO_SMALL:
    {
      // Same as above, but appearance manager reports 14x15, and we
      // tell gecko 14x14.

      aResult->SizeTo(14, 14);
      *aIsOverridable = PR_FALSE;
      break;
    }

    case NS_THEME_DROPDOWN:
    {
      SInt32 popupHeight = 0;
      ::GetThemeMetric(kThemeMetricPopupButtonHeight, &popupHeight);
      aResult->SizeTo(0, popupHeight);
      break;
    }
    
    case NS_THEME_DROPDOWN_BUTTON:
      // the drawing for this is done by the dropdown, so just make this
      // zero sized.
      aResult->SizeTo(0,0);
      break;
      
    case NS_THEME_TEXTFIELD:
    {
      // at minimum, we should be tall enough for 9pt text.
      // I'm using hardcoded values here because the appearance manager
      // values for the frame size are incorrect.
      aResult->SizeTo(0, (2 + 2) /* top */ + 9 + (1 + 1) /* bottom */ );
      break;
    }
      
    case NS_THEME_PROGRESSBAR:
    {
      SInt32 barHeight = 0;
      ::GetThemeMetric(kThemeMetricNormalProgressBarThickness, &barHeight);
      aResult->SizeTo(0, barHeight);
      break;
    }

    case NS_THEME_TREEVIEW_TWISTY:
    case NS_THEME_TREEVIEW_TWISTY_OPEN:   
    {
      SInt32 twistyHeight = 0, twistyWidth = 0;
      ::GetThemeMetric(kThemeMetricDisclosureButtonWidth, &twistyWidth);
      ::GetThemeMetric(kThemeMetricDisclosureButtonHeight, &twistyHeight);
      aResult->SizeTo(twistyWidth, twistyHeight);
      *aIsOverridable = PR_FALSE;
      break;
    }
    
    case NS_THEME_TREEVIEW_HEADER:
    case NS_THEME_TREEVIEW_HEADER_CELL:
    {
      SInt32 headerHeight = 0;
      ::GetThemeMetric(kThemeMetricListHeaderHeight, &headerHeight);
      aResult->SizeTo(0, headerHeight);
      break;
    }
      
    case NS_THEME_SCROLLBAR:
    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_HORIZONTAL:
    case NS_THEME_SCROLLBAR_THUMB_VERTICAL:
    case NS_THEME_SCROLLBAR_GRIPPER_HORIZONTAL:
    case NS_THEME_SCROLLBAR_GRIPPER_VERTICAL:
    case NS_THEME_SCROLLBAR_TRACK_VERTICAL:
    case NS_THEME_SCROLLBAR_TRACK_HORIZONTAL:
    {
      // yeah, i know i'm cheating a little here, but i figure that it
      // really doesn't matter if the scrollbar is vertical or horizontal
      // and the width metric is a really good metric for every piece
      // of the scrollbar.
      SInt32 scrollbarWidth = 0;
      ::GetThemeMetric(kThemeMetricScrollBarWidth, &scrollbarWidth);
      aResult->SizeTo(scrollbarWidth, scrollbarWidth);
      *aIsOverridable = PR_FALSE;
      break;
    }

  }

  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:

nsresult nsNativeThemeMac::GetSystemColor ( PRUint8  aWidgetType,
nsILookAndFeel::nsColorID aColorID 
) [protected]
nsresult nsNativeThemeMac::GetSystemFont ( PRUint8  aWidgetType,
nsSystemFontID aFont 
) [protected]
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 nsNativeThemeMac::GetWidgetBorder ( nsIDeviceContext aContext,
nsIFrame aFrame,
PRUint8  aWidgetType,
nsMargin aResult 
) [virtual]

Implements nsITheme.

Definition at line 517 of file nsNativeThemeMac.cpp.

{
  aResult->SizeTo(0,0,0,0);
      
  // XXX we should probably cache some of these metrics
  
  switch ( aWidgetType ) {
  
    case NS_THEME_BUTTON:
      aResult->SizeTo(kAquaPushButtonEndcaps, kAquaPushButtonTopBottom, 
                          kAquaPushButtonEndcaps, kAquaPushButtonTopBottom);
      break;

    case NS_THEME_BUTTON_SMALL:
      aResult->SizeTo(kAquaSmallPushButtonEndcaps, kAquaPushButtonTopBottom,
                      kAquaSmallPushButtonEndcaps, kAquaPushButtonTopBottom);
      break;

    case NS_THEME_TOOLBAR_BUTTON:
      //aResult->SizeTo(5,5,5,5);    // 5px around the button in aqua
      break;

    case NS_THEME_DROPDOWN:
      aResult->SizeTo(kAquaDropdownLeftEndcap, kAquaPushButtonTopBottom, 
                        kAquaDropwdonRightEndcap, kAquaPushButtonTopBottom);
      break;
    
    case NS_THEME_TEXTFIELD:
    {
      aResult->SizeTo(2, 2, 2, 2);
      break;
    }

    case NS_THEME_LISTBOX:
    {
      SInt32 frameOutset = 0;
      ::GetThemeMetric(kThemeMetricListBoxFrameOutset, &frameOutset);
      aResult->SizeTo(frameOutset, frameOutset, frameOutset, frameOutset);
      break;
    }
      
  }
  
  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 nsNativeThemeMac::GetWidgetPadding ( nsIDeviceContext aContext,
nsIFrame aFrame,
PRUint8  aWidgetType,
nsMargin aResult 
) [virtual]

Implements nsITheme.

Definition at line 567 of file nsNativeThemeMac.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 776 of file nsNativeThemeMac.cpp.

{
  // what do we do here?
  return NS_OK;
}
PRBool nsNativeThemeMac::ThemeSupportsWidget ( nsPresContext aPresContext,
nsIFrame aFrame,
PRUint8  aWidgetType 
) [virtual]

Implements nsITheme.

Definition at line 784 of file nsNativeThemeMac.cpp.

{
#ifndef MOZ_WIDGET_COCOA
  // Only support HTML widgets for Cocoa
  if (aFrame && aFrame->GetContent()->IsContentOfType(nsIContent::eHTML))
    return PR_FALSE;
#endif

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

  PRBool retVal = PR_FALSE;
  
  switch ( aWidgetType ) {
    case NS_THEME_DIALOG:
    case NS_THEME_WINDOW:
    case NS_THEME_MENUPOPUP:
    case NS_THEME_MENUITEM:
    case NS_THEME_TOOLTIP:
    
    case NS_THEME_CHECKBOX:
    case NS_THEME_CHECKBOX_SMALL:
    case NS_THEME_CHECKBOX_CONTAINER:
    case NS_THEME_RADIO:
    case NS_THEME_RADIO_SMALL:
    case NS_THEME_RADIO_CONTAINER:
    case NS_THEME_BUTTON:
    case NS_THEME_BUTTON_SMALL:
    case NS_THEME_BUTTON_BEVEL:
    case NS_THEME_TOOLBAR:
    case NS_THEME_STATUSBAR:
    case NS_THEME_TEXTFIELD:
    //case NS_THEME_TOOLBOX:
    //case NS_THEME_TOOLBAR_BUTTON:
    case NS_THEME_PROGRESSBAR:
    case NS_THEME_PROGRESSBAR_VERTICAL:
    case NS_THEME_PROGRESSBAR_CHUNK:
    case NS_THEME_PROGRESSBAR_CHUNK_VERTICAL:
    case NS_THEME_TOOLBAR_SEPARATOR:
    
    case NS_THEME_TAB_PANELS:
    case NS_THEME_TAB:
    case NS_THEME_TAB_LEFT_EDGE:
    case NS_THEME_TAB_RIGHT_EDGE:
    
    case NS_THEME_TREEVIEW_TWISTY:
    case NS_THEME_TREEVIEW_TWISTY_OPEN:
    case NS_THEME_TREEVIEW:
    case NS_THEME_TREEVIEW_HEADER:
    case NS_THEME_TREEVIEW_HEADER_CELL:
    case NS_THEME_TREEVIEW_HEADER_SORTARROW:
    case NS_THEME_TREEVIEW_TREEITEM:
    case NS_THEME_TREEVIEW_LINE:
    
    case NS_THEME_SCROLLBAR:
    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_HORIZONTAL:
    case NS_THEME_SCROLLBAR_THUMB_VERTICAL:
    case NS_THEME_SCROLLBAR_GRIPPER_HORIZONTAL:
    case NS_THEME_SCROLLBAR_GRIPPER_VERTICAL:
    case NS_THEME_SCROLLBAR_TRACK_VERTICAL:
    case NS_THEME_SCROLLBAR_TRACK_HORIZONTAL:
      retVal = PR_TRUE;
      break;

    case NS_THEME_LISTBOX:
    case NS_THEME_DROPDOWN:
    case NS_THEME_DROPDOWN_BUTTON:
    case NS_THEME_DROPDOWN_TEXT:
      // Support listboxes and dropdowns regardless of styling,
      // since non-themed ones look totally wrong.
      return PR_TRUE;
  }

  return retVal ? !IsWidgetStyled(aPresContext, aFrame, aWidgetType) : PR_FALSE;
}

Here is the call graph for this function:

Implements nsITheme.

Definition at line 867 of file nsNativeThemeMac.cpp.

{
  // XXXdwh At some point flesh all of this out.
  switch ( aWidgetType ) {
   case NS_THEME_DROPDOWN_BUTTON:
   case NS_THEME_RADIO:
   case NS_THEME_CHECKBOX:
   case NS_THEME_PROGRESSBAR:
    return PR_FALSE;
    break;
  }
  return PR_TRUE;
}
NS_IMETHODIMP nsNativeThemeMac::WidgetStateChanged ( nsIFrame aFrame,
PRUint8  aWidgetType,
nsIAtom aAttribute,
PRBool aShouldRepaint 
) [virtual]

Implements nsITheme.

Definition at line 727 of file nsNativeThemeMac.cpp.

{
  // Some widget types just never change state.
  switch ( aWidgetType ) {
    case NS_THEME_TOOLBOX:
    case NS_THEME_TOOLBAR:
    case NS_THEME_TOOLBAR_BUTTON:
    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_PROGRESSBAR:
    case NS_THEME_PROGRESSBAR_VERTICAL:
    case NS_THEME_TOOLTIP:
    case NS_THEME_TAB_PANELS:
    case NS_THEME_TAB_PANEL:
    case NS_THEME_TEXTFIELD:
    case NS_THEME_DIALOG:
    case NS_THEME_MENUPOPUP:
      *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 == mMenuActiveAtom ||
        aAttribute == mSortDirectionAtom)
      *aShouldRepaint = PR_TRUE;
  }

  return NS_OK;
}

Member Data Documentation

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

Definition at line 161 of file nsNativeTheme.h.

Definition at line 160 of file nsNativeTheme.h.

ThemeEraseUPP nsNativeThemeMac::mEraseProc [private]

Definition at line 123 of file nsNativeThemeMac.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 124 of file nsNativeThemeMac.h.

Definition at line 163 of file nsNativeTheme.h.

Definition at line 162 of file nsNativeTheme.h.

Definition at line 166 of file nsNativeTheme.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: