2006-08-30 22:06:44 +00:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
2012-05-21 11:12:37 +00:00
|
|
|
/* 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/. */
|
2006-08-30 22:06:44 +00:00
|
|
|
|
2007-01-18 06:34:07 +00:00
|
|
|
#ifndef nsNativeThemeCocoa_h_
|
|
|
|
#define nsNativeThemeCocoa_h_
|
|
|
|
|
|
|
|
#import <Carbon/Carbon.h>
|
2007-12-23 19:22:47 +00:00
|
|
|
#import <Cocoa/Cocoa.h>
|
2006-08-30 22:06:44 +00:00
|
|
|
|
|
|
|
#include "nsITheme.h"
|
|
|
|
#include "nsCOMPtr.h"
|
|
|
|
#include "nsIAtom.h"
|
|
|
|
#include "nsNativeTheme.h"
|
2008-03-04 20:51:54 +00:00
|
|
|
|
2009-09-16 22:06:16 +00:00
|
|
|
@class CellDrawView;
|
2011-04-21 09:07:32 +00:00
|
|
|
@class NSProgressBarCell;
|
2011-09-08 13:30:32 +00:00
|
|
|
@class ContextAwareSearchFieldCell;
|
2011-04-17 01:22:44 +00:00
|
|
|
class nsDeviceContext;
|
2011-08-08 14:42:45 +00:00
|
|
|
struct SegmentedControlRenderSettings;
|
2009-09-16 22:06:16 +00:00
|
|
|
|
2014-04-03 04:18:36 +00:00
|
|
|
namespace mozilla {
|
|
|
|
class EventStates;
|
|
|
|
} // namespace mozilla
|
|
|
|
|
2006-08-30 22:06:44 +00:00
|
|
|
class nsNativeThemeCocoa : private nsNativeTheme,
|
|
|
|
public nsITheme
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
nsNativeThemeCocoa();
|
|
|
|
|
2010-11-13 08:19:38 +00:00
|
|
|
NS_DECL_ISUPPORTS_INHERITED
|
2006-08-30 22:06:44 +00:00
|
|
|
|
|
|
|
// The nsITheme interface.
|
2011-04-08 01:04:40 +00:00
|
|
|
NS_IMETHOD DrawWidgetBackground(nsRenderingContext* aContext,
|
2006-08-30 22:06:44 +00:00
|
|
|
nsIFrame* aFrame,
|
2012-08-22 15:56:38 +00:00
|
|
|
uint8_t aWidgetType,
|
2006-08-30 22:06:44 +00:00
|
|
|
const nsRect& aRect,
|
2014-03-17 08:42:48 +00:00
|
|
|
const nsRect& aDirtyRect);
|
2011-04-17 01:22:44 +00:00
|
|
|
NS_IMETHOD GetWidgetBorder(nsDeviceContext* aContext,
|
2006-08-30 22:06:44 +00:00
|
|
|
nsIFrame* aFrame,
|
2012-08-22 15:56:38 +00:00
|
|
|
uint8_t aWidgetType,
|
2009-01-15 03:27:09 +00:00
|
|
|
nsIntMargin* aResult);
|
2006-08-30 22:06:44 +00:00
|
|
|
|
2011-09-29 06:19:26 +00:00
|
|
|
virtual bool GetWidgetPadding(nsDeviceContext* aContext,
|
2006-08-30 22:06:44 +00:00
|
|
|
nsIFrame* aFrame,
|
2012-08-22 15:56:38 +00:00
|
|
|
uint8_t aWidgetType,
|
2009-01-15 03:27:09 +00:00
|
|
|
nsIntMargin* aResult);
|
2006-08-30 22:06:44 +00:00
|
|
|
|
2011-09-29 06:19:26 +00:00
|
|
|
virtual bool GetWidgetOverflow(nsDeviceContext* aContext, nsIFrame* aFrame,
|
2012-08-22 15:56:38 +00:00
|
|
|
uint8_t aWidgetType, nsRect* aOverflowRect);
|
2007-02-17 02:48:58 +00:00
|
|
|
|
2014-06-27 09:19:00 +00:00
|
|
|
NS_IMETHOD GetMinimumWidgetSize(nsPresContext* aPresContext, nsIFrame* aFrame,
|
2012-08-22 15:56:38 +00:00
|
|
|
uint8_t aWidgetType,
|
2011-09-29 06:19:26 +00:00
|
|
|
nsIntSize* aResult, bool* aIsOverridable);
|
2012-08-22 15:56:38 +00:00
|
|
|
NS_IMETHOD WidgetStateChanged(nsIFrame* aFrame, uint8_t aWidgetType,
|
2011-09-29 06:19:26 +00:00
|
|
|
nsIAtom* aAttribute, bool* aShouldRepaint);
|
2006-08-30 22:06:44 +00:00
|
|
|
NS_IMETHOD ThemeChanged();
|
2012-08-22 15:56:38 +00:00
|
|
|
bool ThemeSupportsWidget(nsPresContext* aPresContext, nsIFrame* aFrame, uint8_t aWidgetType);
|
|
|
|
bool WidgetIsContainer(uint8_t aWidgetType);
|
2013-05-13 23:47:03 +00:00
|
|
|
bool ThemeDrawsFocusForWidget(uint8_t aWidgetType) MOZ_OVERRIDE;
|
2011-09-29 06:19:26 +00:00
|
|
|
bool ThemeNeedsComboboxDropmarker();
|
2013-09-27 15:24:32 +00:00
|
|
|
virtual bool WidgetAppearanceDependsOnWindowFocus(uint8_t aWidgetType) MOZ_OVERRIDE;
|
2014-08-28 00:15:33 +00:00
|
|
|
virtual bool NeedToClearBackgroundBehindWidget(uint8_t aWidgetType) MOZ_OVERRIDE;
|
2012-08-22 15:56:38 +00:00
|
|
|
virtual Transparency GetWidgetTransparency(nsIFrame* aFrame, uint8_t aWidgetType);
|
2006-08-30 22:06:44 +00:00
|
|
|
|
2013-04-17 06:51:52 +00:00
|
|
|
void DrawProgress(CGContextRef context, const HIRect& inBoxRect,
|
|
|
|
bool inIsIndeterminate, bool inIsHorizontal,
|
|
|
|
double inValue, double inMaxValue, nsIFrame* aFrame);
|
|
|
|
|
2014-08-28 00:15:27 +00:00
|
|
|
static void DrawNativeTitlebar(CGContextRef aContext, CGRect aTitlebarRect,
|
|
|
|
CGFloat aUnifiedHeight, BOOL aIsMain, BOOL aIsFlipped);
|
|
|
|
|
2014-07-08 21:23:18 +00:00
|
|
|
protected:
|
|
|
|
virtual ~nsNativeThemeCocoa();
|
2007-04-11 00:25:11 +00:00
|
|
|
|
2009-04-17 08:12:12 +00:00
|
|
|
nsIntMargin RTLAwareMargin(const nsIntMargin& aMargin, nsIFrame* aFrame);
|
2011-08-08 14:42:45 +00:00
|
|
|
nsIFrame* SeparatorResponsibility(nsIFrame* aBefore, nsIFrame* aAfter);
|
|
|
|
CGRect SeparatorAdjustedRect(CGRect aRect, nsIFrame* aLeft,
|
|
|
|
nsIFrame* aCurrent, nsIFrame* aRight);
|
2006-08-30 22:06:44 +00:00
|
|
|
|
|
|
|
// HITheme drawing routines
|
2008-09-22 08:57:42 +00:00
|
|
|
void DrawFrame(CGContextRef context, HIThemeFrameKind inKind,
|
2011-09-29 06:19:26 +00:00
|
|
|
const HIRect& inBoxRect, bool inReadOnly,
|
2014-04-03 04:18:36 +00:00
|
|
|
mozilla::EventStates inState);
|
2012-06-06 07:56:28 +00:00
|
|
|
void DrawMeter(CGContextRef context, const HIRect& inBoxRect,
|
|
|
|
nsIFrame* aFrame);
|
2011-08-08 14:42:45 +00:00
|
|
|
void DrawSegment(CGContextRef cgContext, const HIRect& inBoxRect,
|
2014-04-03 04:18:36 +00:00
|
|
|
mozilla::EventStates inState, nsIFrame* aFrame,
|
2011-08-08 14:42:45 +00:00
|
|
|
const SegmentedControlRenderSettings& aSettings);
|
2008-09-22 08:57:42 +00:00
|
|
|
void DrawTabPanel(CGContextRef context, const HIRect& inBoxRect, nsIFrame* aFrame);
|
|
|
|
void DrawScale(CGContextRef context, const HIRect& inBoxRect,
|
2014-04-03 04:18:36 +00:00
|
|
|
mozilla::EventStates inState, bool inDirection,
|
2012-08-22 15:56:38 +00:00
|
|
|
bool inIsReverse, int32_t inCurrentValue, int32_t inMinValue,
|
|
|
|
int32_t inMaxValue, nsIFrame* aFrame);
|
2011-09-29 06:19:26 +00:00
|
|
|
void DrawCheckboxOrRadio(CGContextRef cgContext, bool inCheckbox,
|
|
|
|
const HIRect& inBoxRect, bool inSelected,
|
2014-04-03 04:18:36 +00:00
|
|
|
mozilla::EventStates inState, nsIFrame* aFrame);
|
2010-09-20 01:16:49 +00:00
|
|
|
void DrawSearchField(CGContextRef cgContext, const HIRect& inBoxRect,
|
2014-04-03 04:18:36 +00:00
|
|
|
nsIFrame* aFrame, mozilla::EventStates inState);
|
2009-01-18 11:05:38 +00:00
|
|
|
void DrawPushButton(CGContextRef cgContext, const HIRect& inBoxRect,
|
2014-04-03 04:18:36 +00:00
|
|
|
mozilla::EventStates inState, uint8_t aWidgetType,
|
2014-02-27 17:12:16 +00:00
|
|
|
nsIFrame* aFrame);
|
2014-07-04 18:02:44 +00:00
|
|
|
void DrawMenuIcon(CGContextRef cgContext, const CGRect& aRect,
|
|
|
|
mozilla::EventStates inState, nsIFrame* aFrame,
|
|
|
|
const NSSize& aIconSize, const NSString* aImageName);
|
2008-09-22 08:57:42 +00:00
|
|
|
void DrawButton(CGContextRef context, ThemeButtonKind inKind,
|
2011-09-29 06:19:26 +00:00
|
|
|
const HIRect& inBoxRect, bool inIsDefault,
|
2010-09-20 01:16:49 +00:00
|
|
|
ThemeButtonValue inValue, ThemeButtonAdornment inAdornment,
|
2014-04-03 04:18:36 +00:00
|
|
|
mozilla::EventStates inState, nsIFrame* aFrame);
|
2014-06-14 12:48:08 +00:00
|
|
|
void DrawFocusOutline(CGContextRef cgContext, const HIRect& inBoxRect,
|
|
|
|
mozilla::EventStates inState, uint8_t aWidgetType,
|
|
|
|
nsIFrame* aFrame);
|
2010-10-20 11:26:32 +00:00
|
|
|
void DrawDropdown(CGContextRef context, const HIRect& inBoxRect,
|
2014-04-03 04:18:36 +00:00
|
|
|
mozilla::EventStates inState, uint8_t aWidgetType,
|
2010-10-20 11:26:32 +00:00
|
|
|
nsIFrame* aFrame);
|
2008-09-22 08:57:42 +00:00
|
|
|
void DrawSpinButtons(CGContextRef context, ThemeButtonKind inKind,
|
2010-10-20 11:26:32 +00:00
|
|
|
const HIRect& inBoxRect, ThemeDrawState inDrawState,
|
2014-04-03 04:18:36 +00:00
|
|
|
ThemeButtonAdornment inAdornment,
|
|
|
|
mozilla::EventStates inState, nsIFrame* aFrame);
|
2013-12-05 16:20:34 +00:00
|
|
|
void DrawSpinButton(CGContextRef context, ThemeButtonKind inKind,
|
|
|
|
const HIRect& inBoxRect, ThemeDrawState inDrawState,
|
2014-04-03 04:18:36 +00:00
|
|
|
ThemeButtonAdornment inAdornment,
|
|
|
|
mozilla::EventStates inState,
|
2013-12-05 16:20:34 +00:00
|
|
|
nsIFrame* aFrame, uint8_t aWidgetType);
|
2008-09-16 08:21:06 +00:00
|
|
|
void DrawUnifiedToolbar(CGContextRef cgContext, const HIRect& inBoxRect,
|
2009-12-30 15:23:51 +00:00
|
|
|
NSWindow* aWindow);
|
2009-01-06 15:46:59 +00:00
|
|
|
void DrawStatusBar(CGContextRef cgContext, const HIRect& inBoxRect,
|
|
|
|
nsIFrame *aFrame);
|
2009-09-27 21:58:58 +00:00
|
|
|
void DrawResizer(CGContextRef cgContext, const HIRect& aRect, nsIFrame *aFrame);
|
2008-09-16 08:21:06 +00:00
|
|
|
|
2007-04-11 00:25:11 +00:00
|
|
|
// Scrollbars
|
|
|
|
void DrawScrollbar(CGContextRef aCGContext, const HIRect& aBoxRect, nsIFrame *aFrame);
|
2014-04-03 04:18:36 +00:00
|
|
|
void GetScrollbarPressStates(nsIFrame *aFrame,
|
|
|
|
mozilla::EventStates aButtonStates[]);
|
2007-04-11 00:25:11 +00:00
|
|
|
void GetScrollbarDrawInfo (HIThemeTrackDrawInfo& aTdi, nsIFrame *aFrame,
|
2011-09-29 06:19:26 +00:00
|
|
|
const CGSize& aSize, bool aShouldGetButtonStates);
|
2007-04-11 00:25:11 +00:00
|
|
|
nsIFrame* GetParentScrollbarFrame(nsIFrame *aFrame);
|
2014-05-28 13:22:16 +00:00
|
|
|
bool IsParentScrollbarRolledOver(nsIFrame* aFrame);
|
2007-12-23 19:22:47 +00:00
|
|
|
|
|
|
|
private:
|
2014-02-27 17:12:16 +00:00
|
|
|
NSButtonCell* mHelpButtonCell;
|
2007-12-23 19:22:47 +00:00
|
|
|
NSButtonCell* mPushButtonCell;
|
2008-01-14 04:48:33 +00:00
|
|
|
NSButtonCell* mRadioButtonCell;
|
2008-10-13 16:58:40 +00:00
|
|
|
NSButtonCell* mCheckboxCell;
|
2011-09-08 13:30:32 +00:00
|
|
|
ContextAwareSearchFieldCell* mSearchFieldCell;
|
2009-01-31 16:49:29 +00:00
|
|
|
NSPopUpButtonCell* mDropdownCell;
|
2009-02-11 15:54:10 +00:00
|
|
|
NSComboBoxCell* mComboBoxCell;
|
2011-04-21 09:07:32 +00:00
|
|
|
NSProgressBarCell* mProgressBarCell;
|
2012-06-06 07:56:28 +00:00
|
|
|
NSLevelIndicatorCell* mMeterBarCell;
|
2009-09-16 22:06:16 +00:00
|
|
|
CellDrawView* mCellDrawView;
|
2006-08-30 22:06:44 +00:00
|
|
|
};
|
2007-01-18 06:34:07 +00:00
|
|
|
|
|
|
|
#endif // nsNativeThemeCocoa_h_
|