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