/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- *//* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */// This defines a common base class for nsITheme implementations, to reduce// code duplication.#include"nsAlgorithm.h"#include"nsIAtom.h"#include"nsCOMPtr.h"#include"nsString.h"#include"nsMargin.h"#include"nsGkAtoms.h"#include"nsTArray.h"#include"nsITimer.h"#include"nsIContent.h"classnsIFrame;classnsIPresShell;classnsPresContext;namespacemozilla{classEventStates;}// namespace mozillaclassnsNativeTheme:publicnsITimerCallback{protected:virtual~nsNativeTheme(){}NS_DECL_ISUPPORTSNS_DECL_NSITIMERCALLBACKenumScrollbarButtonType{eScrollbarButton_UpTop=0,eScrollbarButton_Down=1<<0,eScrollbarButton_Bottom=1<<1};enumTreeSortDirection{eTreeSortDirection_Descending,eTreeSortDirection_Natural,eTreeSortDirection_Ascending};nsNativeTheme();// Returns the content state (hover, focus, etc), see EventStateManager.hmozilla::EventStatesGetContentState(nsIFrame*aFrame,uint8_taWidgetType);// Returns whether the widget is already styled by content// Normally called from ThemeSupportsWidget to turn off native theming// for elements that are already styled.boolIsWidgetStyled(nsPresContext*aPresContext,nsIFrame*aFrame,uint8_taWidgetType);// Accessors to widget-specific state informationboolIsDisabled(nsIFrame*aFrame,mozilla::EventStatesaEventStates);// RTL chrome directionstaticboolIsFrameRTL(nsIFrame*aFrame);boolIsHTMLContent(nsIFrame*aFrame);// button:boolIsDefaultButton(nsIFrame*aFrame){returnCheckBooleanAttr(aFrame,nsGkAtoms::_default);}boolIsButtonTypeMenu(nsIFrame*aFrame);// checkbox:boolIsChecked(nsIFrame*aFrame){returnGetCheckedOrSelected(aFrame,false);}// radiobutton:boolIsSelected(nsIFrame*aFrame){returnGetCheckedOrSelected(aFrame,true);}boolIsFocused(nsIFrame*aFrame){returnCheckBooleanAttr(aFrame,nsGkAtoms::focused);}// scrollbar button:int32_tGetScrollbarButtonType(nsIFrame*aFrame);// tab:boolIsSelectedTab(nsIFrame*aFrame){returnCheckBooleanAttr(aFrame,nsGkAtoms::visuallyselected);}boolIsNextToSelectedTab(nsIFrame*aFrame,int32_taOffset);boolIsBeforeSelectedTab(nsIFrame*aFrame){returnIsNextToSelectedTab(aFrame,-1);}boolIsAfterSelectedTab(nsIFrame*aFrame){returnIsNextToSelectedTab(aFrame,1);}boolIsLeftToSelectedTab(nsIFrame*aFrame){returnIsFrameRTL(aFrame)?IsAfterSelectedTab(aFrame):IsBeforeSelectedTab(aFrame);}boolIsRightToSelectedTab(nsIFrame*aFrame){returnIsFrameRTL(aFrame)?IsBeforeSelectedTab(aFrame):IsAfterSelectedTab(aFrame);}// button / toolbarbutton:boolIsCheckedButton(nsIFrame*aFrame){returnCheckBooleanAttr(aFrame,nsGkAtoms::checked);}boolIsSelectedButton(nsIFrame*aFrame){returnCheckBooleanAttr(aFrame,nsGkAtoms::checked)||CheckBooleanAttr(aFrame,nsGkAtoms::selected);}boolIsOpenButton(nsIFrame*aFrame){returnCheckBooleanAttr(aFrame,nsGkAtoms::open);}boolIsPressedButton(nsIFrame*aFrame);// treeheadercell:TreeSortDirectionGetTreeSortDirection(nsIFrame*aFrame);boolIsLastTreeHeaderCell(nsIFrame*aFrame);// tab:boolIsBottomTab(nsIFrame*aFrame);boolIsFirstTab(nsIFrame*aFrame);boolIsHorizontal(nsIFrame*aFrame);// progressbar:boolIsIndeterminateProgress(nsIFrame*aFrame,mozilla::EventStatesaEventStates);boolIsVerticalProgress(nsIFrame*aFrame);// meter:boolIsVerticalMeter(nsIFrame*aFrame);// textfield:boolIsReadOnly(nsIFrame*aFrame){returnCheckBooleanAttr(aFrame,nsGkAtoms::readonly);}// menupopup:boolIsSubmenu(nsIFrame*aFrame,bool*aLeftOfParent);// True if it's not a menubar item or menulist itemboolIsRegularMenuItem(nsIFrame*aFrame);boolIsMenuListEditable(nsIFrame*aFrame);nsIPresShell*GetPresShell(nsIFrame*aFrame);staticboolCheckBooleanAttr(nsIFrame*aFrame,nsIAtom*aAtom);staticint32_tCheckIntAttr(nsIFrame*aFrame,nsIAtom*aAtom,int32_tdefaultValue);// Helpers for progressbar.staticdoubleGetProgressValue(nsIFrame*aFrame);staticdoubleGetProgressMaxValue(nsIFrame*aFrame);boolGetCheckedOrSelected(nsIFrame*aFrame,boolaCheckSelected);boolGetIndeterminate(nsIFrame*aFrame);boolQueueAnimatedContentForRefresh(nsIContent*aContent,uint32_taMinimumFrameRate);nsIFrame*GetAdjacentSiblingFrameWithSameAppearance(nsIFrame*aFrame,boolaNextSibling);boolIsRangeHorizontal(nsIFrame*aFrame);// scrollbarboolIsDarkBackground(nsIFrame*aFrame);private:uint32_tmAnimatedContentTimeout;nsCOMPtr<nsITimer>mAnimatedContentTimer;AutoTArray<nsCOMPtr<nsIContent>,20>mAnimatedContentList;};