1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 #ifndef nsNativeThemeCocoa_h_
7 #define nsNativeThemeCocoa_h_
9 #import <Carbon/Carbon.h>
10 #import <Cocoa/Cocoa.h>
15 #include "nsNativeTheme.h"
18 @
class NSProgressBarCell
;
19 @
class ContextAwareSearchFieldCell
;
20 class nsDeviceContext
;
21 struct SegmentedControlRenderSettings
;
23 class nsNativeThemeCocoa
: private nsNativeTheme
,
28 virtual ~nsNativeThemeCocoa();
30 NS_DECL_ISUPPORTS_INHERITED
32 // The nsITheme interface.
33 NS_IMETHOD
DrawWidgetBackground(nsRenderingContext
* aContext
,
37 const nsRect
& aDirtyRect
);
38 NS_IMETHOD
GetWidgetBorder(nsDeviceContext
* aContext
,
41 nsIntMargin
* aResult
);
43 virtual bool GetWidgetPadding(nsDeviceContext
* aContext
,
46 nsIntMargin
* aResult
);
48 virtual bool GetWidgetOverflow(nsDeviceContext
* aContext
, nsIFrame
* aFrame
,
49 uint8_t aWidgetType
, nsRect
* aOverflowRect
);
51 NS_IMETHOD
GetMinimumWidgetSize(nsRenderingContext
* aContext
, nsIFrame
* aFrame
,
53 nsIntSize
* aResult
, bool* aIsOverridable
);
54 NS_IMETHOD
WidgetStateChanged(nsIFrame
* aFrame
, uint8_t aWidgetType
,
55 nsIAtom
* aAttribute
, bool* aShouldRepaint
);
56 NS_IMETHOD
ThemeChanged();
57 bool ThemeSupportsWidget(nsPresContext
* aPresContext
, nsIFrame
* aFrame
, uint8_t aWidgetType
);
58 bool WidgetIsContainer(uint8_t aWidgetType
);
59 bool ThemeDrawsFocusForWidget(uint8_t aWidgetType
) MOZ_OVERRIDE
;
60 bool ThemeNeedsComboboxDropmarker();
61 virtual bool WidgetAppearanceDependsOnWindowFocus(uint8_t aWidgetType
) MOZ_OVERRIDE
;
62 virtual Transparency
GetWidgetTransparency(nsIFrame
* aFrame
, uint8_t aWidgetType
);
64 void DrawProgress(CGContextRef context
, const HIRect
& inBoxRect
,
65 bool inIsIndeterminate
, bool inIsHorizontal
,
66 double inValue
, double inMaxValue
, nsIFrame
* aFrame
);
70 nsIntMargin
RTLAwareMargin(const nsIntMargin
& aMargin
, nsIFrame
* aFrame
);
71 nsIFrame
* SeparatorResponsibility(nsIFrame
* aBefore
, nsIFrame
* aAfter
);
72 CGRect
SeparatorAdjustedRect(CGRect aRect
, nsIFrame
* aLeft
,
73 nsIFrame
* aCurrent
, nsIFrame
* aRight
);
75 // HITheme drawing routines
76 void DrawFrame(CGContextRef context
, HIThemeFrameKind inKind
,
77 const HIRect
& inBoxRect
, bool inReadOnly
,
78 nsEventStates inState
);
79 void DrawMeter(CGContextRef context
, const HIRect
& inBoxRect
,
81 void DrawSegment(CGContextRef cgContext
, const HIRect
& inBoxRect
,
82 nsEventStates inState
, nsIFrame
* aFrame
,
83 const SegmentedControlRenderSettings
& aSettings
);
84 void DrawTabPanel(CGContextRef context
, const HIRect
& inBoxRect
, nsIFrame
* aFrame
);
85 void DrawScale(CGContextRef context
, const HIRect
& inBoxRect
,
86 nsEventStates inState
, bool inDirection
,
87 bool inIsReverse
, int32_t inCurrentValue
, int32_t inMinValue
,
88 int32_t inMaxValue
, nsIFrame
* aFrame
);
89 void DrawCheckboxOrRadio(CGContextRef cgContext
, bool inCheckbox
,
90 const HIRect
& inBoxRect
, bool inSelected
,
91 nsEventStates inState
, nsIFrame
* aFrame
);
92 void DrawSearchField(CGContextRef cgContext
, const HIRect
& inBoxRect
,
93 nsIFrame
* aFrame
, nsEventStates inState
);
94 void DrawPushButton(CGContextRef cgContext
, const HIRect
& inBoxRect
,
95 nsEventStates inState
, nsIFrame
* aFrame
);
96 void DrawButton(CGContextRef context
, ThemeButtonKind inKind
,
97 const HIRect
& inBoxRect
, bool inIsDefault
,
98 ThemeButtonValue inValue
, ThemeButtonAdornment inAdornment
,
99 nsEventStates inState
, nsIFrame
* aFrame
);
100 void DrawDropdown(CGContextRef context
, const HIRect
& inBoxRect
,
101 nsEventStates inState
, uint8_t aWidgetType
,
103 void DrawSpinButtons(CGContextRef context
, ThemeButtonKind inKind
,
104 const HIRect
& inBoxRect
, ThemeDrawState inDrawState
,
105 ThemeButtonAdornment inAdornment
, nsEventStates inState
,
107 void DrawSpinButton(CGContextRef context
, ThemeButtonKind inKind
,
108 const HIRect
& inBoxRect
, ThemeDrawState inDrawState
,
109 ThemeButtonAdornment inAdornment
, nsEventStates inState
,
110 nsIFrame
* aFrame
, uint8_t aWidgetType
);
111 void DrawUnifiedToolbar(CGContextRef cgContext
, const HIRect
& inBoxRect
,
113 void DrawStatusBar(CGContextRef cgContext
, const HIRect
& inBoxRect
,
115 void DrawNativeTitlebar(CGContextRef aContext
, CGRect aTitlebarRect
,
116 CGFloat aUnifiedHeight
, BOOL aIsMain
);
117 void DrawResizer(CGContextRef cgContext
, const HIRect
& aRect
, nsIFrame
*aFrame
);
120 void DrawScrollbar(CGContextRef aCGContext
, const HIRect
& aBoxRect
, nsIFrame
*aFrame
);
121 void GetScrollbarPressStates (nsIFrame
*aFrame
, nsEventStates aButtonStates
[]);
122 void GetScrollbarDrawInfo (HIThemeTrackDrawInfo
& aTdi
, nsIFrame
*aFrame
,
123 const CGSize
& aSize
, bool aShouldGetButtonStates
);
124 nsIFrame
* GetParentScrollbarFrame(nsIFrame
*aFrame
);
127 NSButtonCell
* mPushButtonCell
;
128 NSButtonCell
* mRadioButtonCell
;
129 NSButtonCell
* mCheckboxCell
;
130 ContextAwareSearchFieldCell
* mSearchFieldCell
;
131 NSPopUpButtonCell
* mDropdownCell
;
132 NSComboBoxCell
* mComboBoxCell
;
133 NSProgressBarCell
* mProgressBarCell
;
134 NSLevelIndicatorCell
* mMeterBarCell
;
135 CellDrawView
* mCellDrawView
;
138 #endif // nsNativeThemeCocoa_h_