Bumping manifests a=b2g-bump
[gecko.git] / widget / windows / nsNativeThemeWin.h
blob07ef3363d839855477ca2dd697d2ddabccde5fd2
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
3 * This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7 #ifndef nsNativeThemeWin_h
8 #define nsNativeThemeWin_h
10 #include "nsITheme.h"
11 #include "nsCOMPtr.h"
12 #include "nsIAtom.h"
13 #include "nsNativeTheme.h"
14 #include "gfxTypes.h"
15 #include <windows.h>
16 #include "mozilla/TimeStamp.h"
18 struct nsIntRect;
19 struct nsIntSize;
21 class nsNativeThemeWin : private nsNativeTheme,
22 public nsITheme {
23 virtual ~nsNativeThemeWin();
25 public:
26 typedef mozilla::TimeStamp TimeStamp;
27 typedef mozilla::TimeDuration TimeDuration;
29 NS_DECL_ISUPPORTS_INHERITED
31 // The nsITheme interface.
32 NS_IMETHOD DrawWidgetBackground(nsRenderingContext* aContext,
33 nsIFrame* aFrame,
34 uint8_t aWidgetType,
35 const nsRect& aRect,
36 const nsRect& aDirtyRect);
38 NS_IMETHOD GetWidgetBorder(nsDeviceContext* aContext,
39 nsIFrame* aFrame,
40 uint8_t aWidgetType,
41 nsIntMargin* aResult);
43 virtual bool GetWidgetPadding(nsDeviceContext* aContext,
44 nsIFrame* aFrame,
45 uint8_t aWidgetType,
46 nsIntMargin* aResult);
48 virtual bool GetWidgetOverflow(nsDeviceContext* aContext,
49 nsIFrame* aFrame,
50 uint8_t aWidgetType,
51 nsRect* aOverflowRect);
53 NS_IMETHOD GetMinimumWidgetSize(nsPresContext* aPresContext, nsIFrame* aFrame,
54 uint8_t aWidgetType,
55 nsIntSize* aResult,
56 bool* aIsOverridable);
58 virtual Transparency GetWidgetTransparency(nsIFrame* aFrame, uint8_t aWidgetType);
60 NS_IMETHOD WidgetStateChanged(nsIFrame* aFrame, uint8_t aWidgetType,
61 nsIAtom* aAttribute, bool* aShouldRepaint);
63 NS_IMETHOD ThemeChanged();
65 bool ThemeSupportsWidget(nsPresContext* aPresContext,
66 nsIFrame* aFrame,
67 uint8_t aWidgetType);
69 bool WidgetIsContainer(uint8_t aWidgetType);
71 bool ThemeDrawsFocusForWidget(uint8_t aWidgetType) MOZ_OVERRIDE;
73 bool ThemeNeedsComboboxDropmarker();
75 virtual bool WidgetAppearanceDependsOnWindowFocus(uint8_t aWidgetType) MOZ_OVERRIDE;
77 virtual bool ShouldHideScrollbars() MOZ_OVERRIDE;
79 nsNativeThemeWin();
81 protected:
82 HANDLE GetTheme(uint8_t aWidgetType);
83 nsresult GetThemePartAndState(nsIFrame* aFrame, uint8_t aWidgetType,
84 int32_t& aPart, int32_t& aState);
85 nsresult ClassicGetThemePartAndState(nsIFrame* aFrame, uint8_t aWidgetType,
86 int32_t& aPart, int32_t& aState, bool& aFocused);
87 nsresult ClassicDrawWidgetBackground(nsRenderingContext* aContext,
88 nsIFrame* aFrame,
89 uint8_t aWidgetType,
90 const nsRect& aRect,
91 const nsRect& aClipRect);
92 nsresult ClassicGetWidgetBorder(nsDeviceContext* aContext,
93 nsIFrame* aFrame,
94 uint8_t aWidgetType,
95 nsIntMargin* aResult);
96 bool ClassicGetWidgetPadding(nsDeviceContext* aContext,
97 nsIFrame* aFrame,
98 uint8_t aWidgetType,
99 nsIntMargin* aResult);
100 nsresult ClassicGetMinimumWidgetSize(nsPresContext* aPresContext, nsIFrame* aFrame,
101 uint8_t aWidgetType,
102 nsIntSize* aResult,
103 bool* aIsOverridable);
104 bool ClassicThemeSupportsWidget(nsPresContext* aPresContext,
105 nsIFrame* aFrame,
106 uint8_t aWidgetType);
107 void DrawCheckedRect(HDC hdc, const RECT& rc, int32_t fore, int32_t back,
108 HBRUSH defaultBack);
109 uint32_t GetWidgetNativeDrawingFlags(uint8_t aWidgetType);
110 int32_t StandardGetState(nsIFrame* aFrame, uint8_t aWidgetType, bool wantFocused);
111 bool IsMenuActive(nsIFrame* aFrame, uint8_t aWidgetType);
112 RECT CalculateProgressOverlayRect(nsIFrame* aFrame, RECT* aWidgetRect,
113 bool aIsVertical, bool aIsIndeterminate,
114 bool aIsClassic);
115 void DrawThemedProgressMeter(nsIFrame* aFrame, int aWidgetType,
116 HANDLE aTheme, HDC aHdc,
117 int aPart, int aState,
118 RECT* aWidgetRect, RECT* aClipRect,
119 gfxFloat aAppUnits);
121 private:
122 TimeStamp mProgressDeterminateTimeStamp;
123 TimeStamp mProgressIndeterminateTimeStamp;
126 #endif