michael@0: /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #ifndef nsNativeThemeCocoa_h_ michael@0: #define nsNativeThemeCocoa_h_ michael@0: michael@0: #import michael@0: #import michael@0: michael@0: #include "nsITheme.h" michael@0: #include "nsCOMPtr.h" michael@0: #include "nsIAtom.h" michael@0: #include "nsNativeTheme.h" michael@0: michael@0: @class CellDrawView; michael@0: @class NSProgressBarCell; michael@0: @class ContextAwareSearchFieldCell; michael@0: class nsDeviceContext; michael@0: struct SegmentedControlRenderSettings; michael@0: michael@0: namespace mozilla { michael@0: class EventStates; michael@0: } // namespace mozilla michael@0: michael@0: class nsNativeThemeCocoa : private nsNativeTheme, michael@0: public nsITheme michael@0: { michael@0: public: michael@0: nsNativeThemeCocoa(); michael@0: virtual ~nsNativeThemeCocoa(); michael@0: michael@0: NS_DECL_ISUPPORTS_INHERITED michael@0: michael@0: // The nsITheme interface. michael@0: NS_IMETHOD DrawWidgetBackground(nsRenderingContext* aContext, michael@0: nsIFrame* aFrame, michael@0: uint8_t aWidgetType, michael@0: const nsRect& aRect, michael@0: const nsRect& aDirtyRect); michael@0: NS_IMETHOD GetWidgetBorder(nsDeviceContext* aContext, michael@0: nsIFrame* aFrame, michael@0: uint8_t aWidgetType, michael@0: nsIntMargin* aResult); michael@0: michael@0: virtual bool GetWidgetPadding(nsDeviceContext* aContext, michael@0: nsIFrame* aFrame, michael@0: uint8_t aWidgetType, michael@0: nsIntMargin* aResult); michael@0: michael@0: virtual bool GetWidgetOverflow(nsDeviceContext* aContext, nsIFrame* aFrame, michael@0: uint8_t aWidgetType, nsRect* aOverflowRect); michael@0: michael@0: NS_IMETHOD GetMinimumWidgetSize(nsRenderingContext* aContext, nsIFrame* aFrame, michael@0: uint8_t aWidgetType, michael@0: nsIntSize* aResult, bool* aIsOverridable); michael@0: NS_IMETHOD WidgetStateChanged(nsIFrame* aFrame, uint8_t aWidgetType, michael@0: nsIAtom* aAttribute, bool* aShouldRepaint); michael@0: NS_IMETHOD ThemeChanged(); michael@0: bool ThemeSupportsWidget(nsPresContext* aPresContext, nsIFrame* aFrame, uint8_t aWidgetType); michael@0: bool WidgetIsContainer(uint8_t aWidgetType); michael@0: bool ThemeDrawsFocusForWidget(uint8_t aWidgetType) MOZ_OVERRIDE; michael@0: bool ThemeNeedsComboboxDropmarker(); michael@0: virtual bool WidgetAppearanceDependsOnWindowFocus(uint8_t aWidgetType) MOZ_OVERRIDE; michael@0: virtual Transparency GetWidgetTransparency(nsIFrame* aFrame, uint8_t aWidgetType); michael@0: michael@0: void DrawProgress(CGContextRef context, const HIRect& inBoxRect, michael@0: bool inIsIndeterminate, bool inIsHorizontal, michael@0: double inValue, double inMaxValue, nsIFrame* aFrame); michael@0: michael@0: protected: michael@0: michael@0: nsIntMargin RTLAwareMargin(const nsIntMargin& aMargin, nsIFrame* aFrame); michael@0: nsIFrame* SeparatorResponsibility(nsIFrame* aBefore, nsIFrame* aAfter); michael@0: CGRect SeparatorAdjustedRect(CGRect aRect, nsIFrame* aLeft, michael@0: nsIFrame* aCurrent, nsIFrame* aRight); michael@0: michael@0: // HITheme drawing routines michael@0: void DrawFrame(CGContextRef context, HIThemeFrameKind inKind, michael@0: const HIRect& inBoxRect, bool inReadOnly, michael@0: mozilla::EventStates inState); michael@0: void DrawMeter(CGContextRef context, const HIRect& inBoxRect, michael@0: nsIFrame* aFrame); michael@0: void DrawSegment(CGContextRef cgContext, const HIRect& inBoxRect, michael@0: mozilla::EventStates inState, nsIFrame* aFrame, michael@0: const SegmentedControlRenderSettings& aSettings); michael@0: void DrawTabPanel(CGContextRef context, const HIRect& inBoxRect, nsIFrame* aFrame); michael@0: void DrawScale(CGContextRef context, const HIRect& inBoxRect, michael@0: mozilla::EventStates inState, bool inDirection, michael@0: bool inIsReverse, int32_t inCurrentValue, int32_t inMinValue, michael@0: int32_t inMaxValue, nsIFrame* aFrame); michael@0: void DrawCheckboxOrRadio(CGContextRef cgContext, bool inCheckbox, michael@0: const HIRect& inBoxRect, bool inSelected, michael@0: mozilla::EventStates inState, nsIFrame* aFrame); michael@0: void DrawSearchField(CGContextRef cgContext, const HIRect& inBoxRect, michael@0: nsIFrame* aFrame, mozilla::EventStates inState); michael@0: void DrawPushButton(CGContextRef cgContext, const HIRect& inBoxRect, michael@0: mozilla::EventStates inState, uint8_t aWidgetType, michael@0: nsIFrame* aFrame); michael@0: void DrawButton(CGContextRef context, ThemeButtonKind inKind, michael@0: const HIRect& inBoxRect, bool inIsDefault, michael@0: ThemeButtonValue inValue, ThemeButtonAdornment inAdornment, michael@0: mozilla::EventStates inState, nsIFrame* aFrame); michael@0: void DrawDropdown(CGContextRef context, const HIRect& inBoxRect, michael@0: mozilla::EventStates inState, uint8_t aWidgetType, michael@0: nsIFrame* aFrame); michael@0: void DrawSpinButtons(CGContextRef context, ThemeButtonKind inKind, michael@0: const HIRect& inBoxRect, ThemeDrawState inDrawState, michael@0: ThemeButtonAdornment inAdornment, michael@0: mozilla::EventStates inState, nsIFrame* aFrame); michael@0: void DrawSpinButton(CGContextRef context, ThemeButtonKind inKind, michael@0: const HIRect& inBoxRect, ThemeDrawState inDrawState, michael@0: ThemeButtonAdornment inAdornment, michael@0: mozilla::EventStates inState, michael@0: nsIFrame* aFrame, uint8_t aWidgetType); michael@0: void DrawUnifiedToolbar(CGContextRef cgContext, const HIRect& inBoxRect, michael@0: NSWindow* aWindow); michael@0: void DrawStatusBar(CGContextRef cgContext, const HIRect& inBoxRect, michael@0: nsIFrame *aFrame); michael@0: void DrawNativeTitlebar(CGContextRef aContext, CGRect aTitlebarRect, michael@0: CGFloat aUnifiedHeight, BOOL aIsMain); michael@0: void DrawResizer(CGContextRef cgContext, const HIRect& aRect, nsIFrame *aFrame); michael@0: michael@0: // Scrollbars michael@0: void DrawScrollbar(CGContextRef aCGContext, const HIRect& aBoxRect, nsIFrame *aFrame); michael@0: void GetScrollbarPressStates(nsIFrame *aFrame, michael@0: mozilla::EventStates aButtonStates[]); michael@0: void GetScrollbarDrawInfo (HIThemeTrackDrawInfo& aTdi, nsIFrame *aFrame, michael@0: const CGSize& aSize, bool aShouldGetButtonStates); michael@0: nsIFrame* GetParentScrollbarFrame(nsIFrame *aFrame); michael@0: michael@0: private: michael@0: NSButtonCell* mHelpButtonCell; michael@0: NSButtonCell* mPushButtonCell; michael@0: NSButtonCell* mRadioButtonCell; michael@0: NSButtonCell* mCheckboxCell; michael@0: ContextAwareSearchFieldCell* mSearchFieldCell; michael@0: NSPopUpButtonCell* mDropdownCell; michael@0: NSComboBoxCell* mComboBoxCell; michael@0: NSProgressBarCell* mProgressBarCell; michael@0: NSLevelIndicatorCell* mMeterBarCell; michael@0: CellDrawView* mCellDrawView; michael@0: }; michael@0: michael@0: #endif // nsNativeThemeCocoa_h_