Back to index

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

#include <nsNativeThemeQt.h>

Inheritance diagram for nsNativeThemeQt:
Inheritance graph
[legend]
Collaboration diagram for nsNativeThemeQt:
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)
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 NS_HIDDEN_ (PRBool) GetWidgetPadding(nsIDeviceContext *aContext
 nsNativeThemeQt ()
virtual ~nsNativeThemeQt ()
virtual PRBool GetWidgetPadding (nsIDeviceContext *aContext, nsIFrame *aFrame, PRUint8 aWidgetType, nsMargin *aResult)=0
virtual PRBool GetWidgetOverflow (nsIDeviceContext *aContext, nsIFrame *aFrame, PRUint8 aWidgetType, nsRect *aResult)

Public Attributes

virtual nsIFrameaFrame
virtual nsIFrame PRUint8 aWidgetType
virtual nsIFrame PRUint8 nsMarginaResult

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

QComboBox * combo
int frameWidth
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 49 of file nsNativeThemeQt.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 57 of file nsNativeThemeQt.cpp.

{
    combo = new QComboBox((QWidget *)0);
    combo->resize(0, 0);
    ThemeChanged();
}

Here is the call graph for this function:

Definition at line 64 of file nsNativeThemeQt.cpp.

{
    delete combo;
}

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:

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

Implements nsITheme.

Definition at line 72 of file nsNativeThemeQt.cpp.

{
    nsRenderingContextQt *context = (nsRenderingContextQt *)aContext;
    QPainter *p = context->painter();

    //qDebug("aWidgetType = %d", aWidgetType);
    if (!p)
        return NS_OK;

    QStyle &s = qApp->style();
    const QColorGroup &cg = qApp->palette().active();

    QRect r = context->qRect(aRect);
    QRect cr = context->qRect(aClipRect);
    context->UpdateGC();
    //qDebug("rect=%d %d %d %d", aRect.x, aRect.y, aRect.width, aRect.height);
    p->save();
    p->translate(r.x(), r.y());
    r.moveBy(-r.x(), -r.y());

    QStyle::PrimitiveElement pe = QStyle::PE_CustomBase;
    QStyle::SFlags flags =  IsDisabled(aFrame) ?
                            QStyle::Style_Default :
                            QStyle::Style_Enabled;

    PRInt32 eventState = GetContentState(aFrame, aWidgetType);
    //qDebug("eventState = %d",  eventState);

    if (eventState & NS_EVENT_STATE_HOVER)
        flags |= QStyle::Style_MouseOver;
    if (eventState & NS_EVENT_STATE_FOCUS)
        flags |= QStyle::Style_HasFocus;
    if (eventState & NS_EVENT_STATE_ACTIVE)
        flags |= QStyle::Style_Down;

    switch (aWidgetType) {
    case NS_THEME_RADIO:
        flags |= (IsChecked(aFrame) ? QStyle::Style_On : QStyle::Style_Off);
        pe = QStyle::PE_ExclusiveIndicator;
        break;
    case NS_THEME_CHECKBOX:
        flags |= (IsChecked(aFrame) ? QStyle::Style_On : QStyle::Style_Off);
        pe = QStyle::PE_Indicator;
        break;
    case NS_THEME_SCROLLBAR:
    case NS_THEME_SCROLLBAR_TRACK_HORIZONTAL:
    case NS_THEME_SCROLLBAR_TRACK_VERTICAL:
        p->fillRect(r, qApp->palette().brush(QPalette::Active, QColorGroup::Background));
        break;
    case NS_THEME_SCROLLBAR_BUTTON_LEFT:
        flags |= QStyle::Style_Horizontal;
        // fall through
    case NS_THEME_SCROLLBAR_BUTTON_UP:
        pe = QStyle::PE_ScrollBarSubLine;
        break;
    case NS_THEME_SCROLLBAR_BUTTON_RIGHT:
        flags |= QStyle::Style_Horizontal;
        // fall through
    case NS_THEME_SCROLLBAR_BUTTON_DOWN:
        pe = QStyle::PE_ScrollBarAddLine;
        break;
    case NS_THEME_SCROLLBAR_GRIPPER_HORIZONTAL:
    case NS_THEME_SCROLLBAR_THUMB_HORIZONTAL:
        flags |= QStyle::Style_Horizontal;
        // fall through
    case NS_THEME_SCROLLBAR_GRIPPER_VERTICAL:
    case NS_THEME_SCROLLBAR_THUMB_VERTICAL:
        pe = QStyle::PE_ScrollBarSlider;
        break;
    case NS_THEME_BUTTON_BEVEL:
        pe = QStyle::PE_ButtonBevel;
        flags |= QStyle::Style_Raised;
        break;
    case NS_THEME_BUTTON:
       pe = IsDefaultButton(aFrame) ? QStyle::PE_ButtonDefault : QStyle::PE_ButtonCommand;
        flags |= QStyle::Style_Raised;
        break;
    case NS_THEME_DROPDOWN:
        s.drawComplexControl(QStyle::CC_ComboBox, p, combo, r, cg, flags, QStyle::SC_ComboBoxFrame);
        break;
    case NS_THEME_DROPDOWN_BUTTON:
        r.moveBy(frameWidth, -frameWidth);
        r.setHeight(r.height() + 2*frameWidth);
        s.drawComplexControl(QStyle::CC_ComboBox, p, combo, r, cg, flags, QStyle::SC_ComboBoxArrow);
        break;
    case NS_THEME_DROPDOWN_TEXT:
    case NS_THEME_DROPDOWN_TEXTFIELD:
        break;
    case NS_THEME_TEXTFIELD:
    case NS_THEME_LISTBOX:
        pe = QStyle::PE_PanelLineEdit;
        break;
    default:
        break;
    }
    if (pe != QStyle::PE_CustomBase)
        s.drawPrimitive(pe, p, r, cg, flags);
    p->restore();
    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 nsNativeThemeQt::GetMinimumWidgetSize ( nsIRenderingContext aContext,
nsIFrame aFrame,
PRUint8  aWidgetType,
nsSize aResult,
PRBool aIsOverridable 
) [virtual]

Implements nsITheme.

Definition at line 212 of file nsNativeThemeQt.cpp.

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

    QStyle &s = qApp->style();

    switch (aWidgetType) {
    case NS_THEME_RADIO:
    case NS_THEME_CHECKBOX: {
        QRect rect = s.subRect(aWidgetType == NS_THEME_CHECKBOX
                               ? QStyle::SR_CheckBoxIndicator
                               : QStyle::SR_RadioButtonIndicator,
                               0);
        (*aResult).width = rect.width();
        (*aResult).height = rect.height();
        break;
    }
    case NS_THEME_SCROLLBAR_BUTTON_UP:
    case NS_THEME_SCROLLBAR_BUTTON_DOWN:
    case NS_THEME_SCROLLBAR_BUTTON_LEFT:
    case NS_THEME_SCROLLBAR_BUTTON_RIGHT:
        (*aResult).width = s.pixelMetric(QStyle::PM_ScrollBarExtent);
        (*aResult).height = (*aResult).width;
        *aIsOverridable = PR_FALSE;
        break;
    case NS_THEME_SCROLLBAR_THUMB_VERTICAL:
        (*aResult).width = s.pixelMetric(QStyle::PM_ScrollBarExtent);
        (*aResult).height = s.pixelMetric(QStyle::PM_ScrollBarSliderMin);
        *aIsOverridable = PR_FALSE;
        break;
    case NS_THEME_SCROLLBAR_THUMB_HORIZONTAL:
        (*aResult).width = s.pixelMetric(QStyle::PM_ScrollBarSliderMin);
        (*aResult).height = s.pixelMetric(QStyle::PM_ScrollBarExtent);
        *aIsOverridable = PR_FALSE;
        break;
    case NS_THEME_SCROLLBAR_TRACK_VERTICAL:
        break;
    case NS_THEME_SCROLLBAR_TRACK_HORIZONTAL:
        break;
    case NS_THEME_DROPDOWN_BUTTON: {
        QRect r = s.querySubControlMetrics(QStyle::CC_ComboBox, combo, QStyle::SC_ComboBoxArrow);
        (*aResult).width = r.width() - 2*frameWidth;
        (*aResult).height = r.height() - 2*frameWidth;
        break;
    }
    case NS_THEME_DROPDOWN:
    case NS_THEME_DROPDOWN_TEXT:
    case NS_THEME_DROPDOWN_TEXTFIELD:
    case NS_THEME_TEXTFIELD:
        break;
    }
    return NS_OK;
}
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:

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 nsNativeThemeQt::GetWidgetBorder ( nsIDeviceContext aContext,
nsIFrame aFrame,
PRUint8  aWidgetType,
nsMargin aResult 
) [virtual]

Implements nsITheme.

Definition at line 178 of file nsNativeThemeQt.cpp.

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

    switch(aWidgetType) {
    case NS_THEME_TEXTFIELD:
    case NS_THEME_LISTBOX:
        (*aResult).top = (*aResult).bottom = (*aResult).left = (*aResult).right =
                         frameWidth;
    }

    return NS_OK;
}
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; }
virtual PRBool nsITheme::GetWidgetPadding ( nsIDeviceContext aContext,
nsIFrame aFrame,
PRUint8  aWidgetType,
nsMargin aResult 
) [pure virtual, inherited]

Implemented in nsNativeThemeMac, and nsNativeThemeWin.

Here is the caller graph for this function:

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:

virtual nsNativeThemeQt::NS_HIDDEN_ ( PRBool  ) [virtual]

Implements nsITheme.

Definition at line 279 of file nsNativeThemeQt.cpp.

{
    QStyle & s = qApp->style();
    frameWidth = s.pixelMetric(QStyle::PM_DefaultFrameWidth);
    return NS_OK;
}

Here is the caller graph for this function:

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

Implements nsITheme.

Definition at line 321 of file nsNativeThemeQt.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;
}
NS_IMETHODIMP nsNativeThemeQt::WidgetStateChanged ( nsIFrame aFrame,
PRUint8  aWidgetType,
nsIAtom aAttribute,
PRBool aShouldRepaint 
) [virtual]

Implements nsITheme.

Definition at line 270 of file nsNativeThemeQt.cpp.

{
    *aShouldRepaint = TRUE;
    return NS_OK;
}

Member Data Documentation

Definition at line 84 of file nsNativeThemeQt.h.

Definition at line 84 of file nsNativeThemeQt.h.

Definition at line 84 of file nsNativeThemeQt.h.

QComboBox* nsNativeThemeQt::combo [private]

Definition at line 92 of file nsNativeThemeQt.h.

Definition at line 93 of file nsNativeThemeQt.h.

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

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