michael@0: /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- michael@0: * 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 nsNativeThemeWin_h michael@0: #define nsNativeThemeWin_h michael@0: michael@0: #include "nsITheme.h" michael@0: #include "nsCOMPtr.h" michael@0: #include "nsIAtom.h" michael@0: #include "nsNativeTheme.h" michael@0: #include "gfxTypes.h" michael@0: #include michael@0: #include "mozilla/TimeStamp.h" michael@0: michael@0: struct nsIntRect; michael@0: struct nsIntSize; michael@0: michael@0: class nsNativeThemeWin : private nsNativeTheme, michael@0: public nsITheme { michael@0: public: michael@0: typedef mozilla::TimeStamp TimeStamp; michael@0: typedef mozilla::TimeDuration TimeDuration; 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: 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, michael@0: nsIFrame* aFrame, michael@0: uint8_t aWidgetType, michael@0: nsRect* aOverflowRect); michael@0: michael@0: NS_IMETHOD GetMinimumWidgetSize(nsRenderingContext* aContext, nsIFrame* aFrame, michael@0: uint8_t aWidgetType, michael@0: nsIntSize* aResult, michael@0: bool* aIsOverridable); michael@0: michael@0: virtual Transparency GetWidgetTransparency(nsIFrame* aFrame, uint8_t aWidgetType); michael@0: michael@0: NS_IMETHOD WidgetStateChanged(nsIFrame* aFrame, uint8_t aWidgetType, michael@0: nsIAtom* aAttribute, bool* aShouldRepaint); michael@0: michael@0: NS_IMETHOD ThemeChanged(); michael@0: michael@0: bool ThemeSupportsWidget(nsPresContext* aPresContext, michael@0: nsIFrame* aFrame, michael@0: uint8_t aWidgetType); michael@0: michael@0: bool WidgetIsContainer(uint8_t aWidgetType); michael@0: michael@0: bool ThemeDrawsFocusForWidget(uint8_t aWidgetType) MOZ_OVERRIDE; michael@0: michael@0: bool ThemeNeedsComboboxDropmarker(); michael@0: michael@0: virtual bool WidgetAppearanceDependsOnWindowFocus(uint8_t aWidgetType) MOZ_OVERRIDE; michael@0: michael@0: virtual bool ShouldHideScrollbars() MOZ_OVERRIDE; michael@0: michael@0: nsNativeThemeWin(); michael@0: virtual ~nsNativeThemeWin(); michael@0: michael@0: protected: michael@0: HANDLE GetTheme(uint8_t aWidgetType); michael@0: nsresult GetThemePartAndState(nsIFrame* aFrame, uint8_t aWidgetType, michael@0: int32_t& aPart, int32_t& aState); michael@0: nsresult ClassicGetThemePartAndState(nsIFrame* aFrame, uint8_t aWidgetType, michael@0: int32_t& aPart, int32_t& aState, bool& aFocused); michael@0: nsresult ClassicDrawWidgetBackground(nsRenderingContext* aContext, michael@0: nsIFrame* aFrame, michael@0: uint8_t aWidgetType, michael@0: const nsRect& aRect, michael@0: const nsRect& aClipRect); michael@0: nsresult ClassicGetWidgetBorder(nsDeviceContext* aContext, michael@0: nsIFrame* aFrame, michael@0: uint8_t aWidgetType, michael@0: nsIntMargin* aResult); michael@0: bool ClassicGetWidgetPadding(nsDeviceContext* aContext, michael@0: nsIFrame* aFrame, michael@0: uint8_t aWidgetType, michael@0: nsIntMargin* aResult); michael@0: nsresult ClassicGetMinimumWidgetSize(nsRenderingContext* aContext, nsIFrame* aFrame, michael@0: uint8_t aWidgetType, michael@0: nsIntSize* aResult, michael@0: bool* aIsOverridable); michael@0: bool ClassicThemeSupportsWidget(nsPresContext* aPresContext, michael@0: nsIFrame* aFrame, michael@0: uint8_t aWidgetType); michael@0: void DrawCheckedRect(HDC hdc, const RECT& rc, int32_t fore, int32_t back, michael@0: HBRUSH defaultBack); michael@0: uint32_t GetWidgetNativeDrawingFlags(uint8_t aWidgetType); michael@0: int32_t StandardGetState(nsIFrame* aFrame, uint8_t aWidgetType, bool wantFocused); michael@0: bool IsMenuActive(nsIFrame* aFrame, uint8_t aWidgetType); michael@0: RECT CalculateProgressOverlayRect(nsIFrame* aFrame, RECT* aWidgetRect, michael@0: bool aIsVertical, bool aIsIndeterminate, michael@0: bool aIsClassic); michael@0: void DrawThemedProgressMeter(nsIFrame* aFrame, int aWidgetType, michael@0: HANDLE aTheme, HDC aHdc, michael@0: int aPart, int aState, michael@0: RECT* aWidgetRect, RECT* aClipRect, michael@0: gfxFloat aAppUnits); michael@0: michael@0: private: michael@0: TimeStamp mProgressDeterminateTimeStamp; michael@0: TimeStamp mProgressIndeterminateTimeStamp; michael@0: }; michael@0: michael@0: #endif