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
|
|
|
|
2018-04-15 06:19:18 +03:00
|
|
|
#include "mozilla/Variant.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-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;
|
2017-11-19 02:53:54 +03:00
|
|
|
namespace gfx {
|
|
|
|
class DrawTarget;
|
|
|
|
} // namespace gfx
|
2014-04-03 08:18:36 +04:00
|
|
|
} // 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,
|
2017-11-16 19:36:52 +03:00
|
|
|
eThemeGeometryTypeVibrantTitlebarLight,
|
|
|
|
eThemeGeometryTypeVibrantTitlebarDark,
|
2015-02-05 01:25:18 +03:00
|
|
|
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
|
|
|
};
|
|
|
|
|
2018-04-15 05:00:18 +03:00
|
|
|
enum class MenuIcon : uint8_t {
|
|
|
|
eCheckmark,
|
|
|
|
eMenuArrow,
|
|
|
|
eMenuDownScrollArrow,
|
|
|
|
eMenuUpScrollArrow
|
|
|
|
};
|
|
|
|
|
2017-12-01 01:50:33 +03:00
|
|
|
enum class CheckboxOrRadioState : uint8_t {
|
|
|
|
eOff,
|
|
|
|
eOn,
|
|
|
|
eIndeterminate
|
|
|
|
};
|
|
|
|
|
2018-04-15 04:48:09 +03:00
|
|
|
enum class ButtonType : uint8_t {
|
|
|
|
eRegularPushButton,
|
|
|
|
eDefaultPushButton,
|
|
|
|
eRegularBevelButton,
|
|
|
|
eDefaultBevelButton,
|
2017-12-01 00:47:59 +03:00
|
|
|
eRoundedBezelPushButton,
|
|
|
|
eSquareBezelPushButton,
|
2018-04-15 04:48:09 +03:00
|
|
|
eArrowButton,
|
2017-12-01 00:47:59 +03:00
|
|
|
eHelpButton,
|
2018-04-15 04:48:09 +03:00
|
|
|
eTreeTwistyPointingRight,
|
2017-12-01 00:47:59 +03:00
|
|
|
eTreeTwistyPointingDown,
|
|
|
|
eDisclosureButtonClosed,
|
|
|
|
eDisclosureButtonOpen
|
2018-04-15 04:48:09 +03:00
|
|
|
};
|
|
|
|
|
2018-04-15 05:14:19 +03:00
|
|
|
enum class SpinButton : uint8_t {
|
|
|
|
eUp,
|
|
|
|
eDown
|
|
|
|
};
|
|
|
|
|
2018-04-15 05:26:24 +03:00
|
|
|
enum class SegmentType : uint8_t {
|
|
|
|
eToolbarButton,
|
|
|
|
eTab
|
|
|
|
};
|
|
|
|
|
2017-12-01 02:59:27 +03:00
|
|
|
enum class OptimumState : uint8_t {
|
|
|
|
eOptimum,
|
|
|
|
eSubOptimum,
|
|
|
|
eSubSubOptimum
|
|
|
|
};
|
|
|
|
|
2018-04-15 04:13:10 +03:00
|
|
|
struct ControlParams {
|
|
|
|
ControlParams()
|
|
|
|
: disabled(false)
|
|
|
|
, insideActiveWindow(false)
|
|
|
|
, pressed(false)
|
|
|
|
, focused(false)
|
|
|
|
, rtl(false)
|
|
|
|
{}
|
|
|
|
|
|
|
|
bool disabled : 1;
|
|
|
|
bool insideActiveWindow : 1;
|
|
|
|
bool pressed : 1;
|
|
|
|
bool focused : 1;
|
|
|
|
bool rtl : 1;
|
|
|
|
};
|
|
|
|
|
2018-04-15 04:56:23 +03:00
|
|
|
struct MenuBackgroundParams {
|
|
|
|
mozilla::Maybe<mozilla::gfx::Color> vibrancyColor;
|
|
|
|
bool disabled = false;
|
|
|
|
bool submenuRightOfParent = false;
|
|
|
|
};
|
|
|
|
|
2018-04-15 05:00:18 +03:00
|
|
|
struct MenuIconParams {
|
|
|
|
MenuIcon icon = MenuIcon::eCheckmark;
|
|
|
|
bool disabled = false;
|
|
|
|
bool insideActiveMenuItem = false;
|
|
|
|
bool centerHorizontally = false;
|
|
|
|
bool rtl = false;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct MenuItemParams {
|
|
|
|
mozilla::Maybe<mozilla::gfx::Color> vibrancyColor;
|
|
|
|
bool checked = false;
|
|
|
|
bool disabled = false;
|
|
|
|
bool selected = false;
|
|
|
|
bool rtl = false;
|
|
|
|
};
|
|
|
|
|
2017-12-01 01:50:33 +03:00
|
|
|
struct CheckboxOrRadioParams {
|
|
|
|
ControlParams controlParams;
|
|
|
|
CheckboxOrRadioState state = CheckboxOrRadioState::eOff;
|
|
|
|
float verticalAlignFactor = 0.5f;
|
|
|
|
};
|
|
|
|
|
2018-04-15 04:48:09 +03:00
|
|
|
struct ButtonParams {
|
|
|
|
ControlParams controlParams;
|
|
|
|
ButtonType button = ButtonType::eRegularPushButton;
|
|
|
|
};
|
|
|
|
|
2018-04-15 05:07:23 +03:00
|
|
|
struct DropdownParams {
|
|
|
|
ControlParams controlParams;
|
|
|
|
bool pullsDown = false;
|
|
|
|
bool editable = false;
|
|
|
|
};
|
|
|
|
|
2018-04-15 05:14:19 +03:00
|
|
|
struct SpinButtonParams {
|
|
|
|
mozilla::Maybe<SpinButton> pressedButton;
|
|
|
|
bool disabled = false;
|
|
|
|
bool insideActiveWindow = false;
|
|
|
|
};
|
|
|
|
|
2018-04-15 05:26:24 +03:00
|
|
|
struct SegmentParams {
|
|
|
|
SegmentType segmentType = SegmentType::eToolbarButton;
|
|
|
|
bool insideActiveWindow = false;
|
|
|
|
bool pressed = false;
|
|
|
|
bool selected = false;
|
|
|
|
bool focused = false;
|
|
|
|
bool atLeftEnd = false;
|
|
|
|
bool atRightEnd = false;
|
|
|
|
bool drawsLeftSeparator = false;
|
|
|
|
bool drawsRightSeparator = false;
|
|
|
|
bool rtl = false;
|
|
|
|
};
|
|
|
|
|
2017-12-01 02:46:37 +03:00
|
|
|
struct UnifiedToolbarParams {
|
|
|
|
float unifiedHeight = 0.0f;
|
|
|
|
bool isMain = false;
|
|
|
|
};
|
|
|
|
|
2018-04-15 05:29:57 +03:00
|
|
|
struct TextBoxParams {
|
|
|
|
bool disabled = false;
|
|
|
|
bool focused = false;
|
|
|
|
};
|
|
|
|
|
2017-12-01 02:51:24 +03:00
|
|
|
struct SearchFieldParams {
|
|
|
|
float verticalAlignFactor = 0.5f;
|
|
|
|
bool insideToolbar = false;
|
|
|
|
bool disabled = false;
|
|
|
|
bool focused = false;
|
|
|
|
bool rtl = false;
|
|
|
|
};
|
|
|
|
|
2018-04-15 05:43:04 +03:00
|
|
|
struct ProgressParams {
|
|
|
|
double value = 0.0;
|
|
|
|
double max = 0.0;
|
|
|
|
float verticalAlignFactor = 0.5f;
|
|
|
|
bool insideActiveWindow = false;
|
|
|
|
bool indeterminate = false;
|
|
|
|
bool horizontal = false;
|
|
|
|
bool rtl = false;
|
|
|
|
};
|
|
|
|
|
2017-12-01 02:59:27 +03:00
|
|
|
struct MeterParams {
|
|
|
|
double value = 0;
|
|
|
|
double min = 0;
|
|
|
|
double max = 0;
|
|
|
|
OptimumState optimumState = OptimumState::eOptimum;
|
|
|
|
float verticalAlignFactor = 0.5f;
|
|
|
|
bool horizontal = true;
|
|
|
|
bool rtl = false;
|
|
|
|
};
|
|
|
|
|
2018-04-15 04:22:08 +03:00
|
|
|
struct TreeHeaderCellParams {
|
|
|
|
ControlParams controlParams;
|
|
|
|
TreeSortDirection sortDirection = eTreeSortDirection_Natural;
|
|
|
|
bool lastTreeHeaderCell = false;
|
|
|
|
};
|
|
|
|
|
2018-04-15 06:06:29 +03:00
|
|
|
struct ScaleParams {
|
|
|
|
int32_t value = 0;
|
|
|
|
int32_t min = 0;
|
|
|
|
int32_t max = 0;
|
|
|
|
bool insideActiveWindow = false;
|
|
|
|
bool disabled = false;
|
|
|
|
bool focused = false;
|
|
|
|
bool horizontal = true;
|
|
|
|
bool reverse = false;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct ScrollbarParams {
|
|
|
|
ScrollbarParams()
|
|
|
|
: overlay(false)
|
|
|
|
, rolledOver(false)
|
|
|
|
, small(false)
|
|
|
|
, horizontal(false)
|
|
|
|
, rtl(false)
|
|
|
|
, onDarkBackground(false)
|
2018-06-22 07:17:22 +03:00
|
|
|
, custom(false)
|
2018-04-15 06:06:29 +03:00
|
|
|
{}
|
|
|
|
|
|
|
|
bool overlay : 1;
|
|
|
|
bool rolledOver : 1;
|
|
|
|
bool small : 1;
|
|
|
|
bool horizontal : 1;
|
|
|
|
bool rtl : 1;
|
|
|
|
bool onDarkBackground : 1;
|
2018-06-22 07:17:22 +03:00
|
|
|
bool custom : 1;
|
|
|
|
// Two colors only used when custom is true.
|
|
|
|
nscolor trackColor = NS_RGBA(0, 0, 0, 0);
|
|
|
|
nscolor faceColor = NS_RGBA(0, 0, 0, 0);
|
2018-04-15 06:06:29 +03:00
|
|
|
};
|
|
|
|
|
2018-04-15 06:19:18 +03:00
|
|
|
enum Widget : uint8_t {
|
|
|
|
eColorFill, // mozilla::gfx::Color
|
|
|
|
eSheetBackground,
|
|
|
|
eDialogBackground,
|
|
|
|
eMenuBackground, // MenuBackgroundParams
|
|
|
|
eMenuIcon, // MenuIconParams
|
|
|
|
eMenuItem, // MenuItemParams
|
|
|
|
eMenuSeparator, // MenuItemParams
|
|
|
|
eTooltip,
|
|
|
|
eCheckbox, // CheckboxOrRadioParams
|
|
|
|
eRadio, // CheckboxOrRadioParams
|
|
|
|
eButton, // ButtonParams
|
|
|
|
eDropdown, // DropdownParams
|
|
|
|
eFocusOutline,
|
|
|
|
eSpinButtons, // SpinButtonParams
|
|
|
|
eSpinButtonUp, // SpinButtonParams
|
|
|
|
eSpinButtonDown, // SpinButtonParams
|
|
|
|
eSegment, // SegmentParams
|
|
|
|
eSeparator,
|
|
|
|
eUnifiedToolbar, // UnifiedToolbarParams
|
|
|
|
eToolbar, // bool
|
|
|
|
eNativeTitlebar, // UnifiedToolbarParams
|
|
|
|
eStatusBar, // bool
|
|
|
|
eGroupBox,
|
|
|
|
eTextBox, // TextBoxParams
|
|
|
|
eSearchField, // SearchFieldParams
|
|
|
|
eProgressBar, // ProgressParams
|
|
|
|
eMeter, // MeterParams
|
|
|
|
eTreeHeaderCell, // TreeHeaderCellParams
|
|
|
|
eScale, // ScaleParams
|
|
|
|
eScrollbarThumb, // ScrollbarParams
|
|
|
|
eScrollbarTrack, // ScrollbarParams
|
2018-06-25 02:56:38 +03:00
|
|
|
eScrollCorner, // ScrollbarParams
|
2018-04-15 06:19:18 +03:00
|
|
|
eMultilineTextField, // bool
|
|
|
|
eListBox,
|
|
|
|
eSourceList, // bool
|
|
|
|
eActiveSourceListSelection, // bool
|
|
|
|
eInactiveSourceListSelection, // bool
|
|
|
|
eTabPanel,
|
|
|
|
eResizer
|
|
|
|
};
|
|
|
|
|
|
|
|
struct WidgetInfo {
|
|
|
|
static WidgetInfo ColorFill(const mozilla::gfx::Color& aParams) { return WidgetInfo(Widget::eColorFill, aParams); }
|
|
|
|
static WidgetInfo SheetBackground() { return WidgetInfo(Widget::eSheetBackground, false); }
|
|
|
|
static WidgetInfo DialogBackground() { return WidgetInfo(Widget::eDialogBackground, false); }
|
|
|
|
static WidgetInfo MenuBackground(const MenuBackgroundParams& aParams) { return WidgetInfo(Widget::eMenuBackground, aParams); }
|
|
|
|
static WidgetInfo MenuIcon(const MenuIconParams& aParams) { return WidgetInfo(Widget::eMenuIcon, aParams); }
|
|
|
|
static WidgetInfo MenuItem(const MenuItemParams& aParams) { return WidgetInfo(Widget::eMenuItem, aParams); }
|
|
|
|
static WidgetInfo MenuSeparator(const MenuItemParams& aParams) { return WidgetInfo(Widget::eMenuSeparator, aParams); }
|
|
|
|
static WidgetInfo Tooltip() { return WidgetInfo(Widget::eTooltip, false); }
|
|
|
|
static WidgetInfo Checkbox(const CheckboxOrRadioParams& aParams) { return WidgetInfo(Widget::eCheckbox, aParams); }
|
|
|
|
static WidgetInfo Radio(const CheckboxOrRadioParams& aParams) { return WidgetInfo(Widget::eRadio, aParams); }
|
|
|
|
static WidgetInfo Button(const ButtonParams& aParams) { return WidgetInfo(Widget::eButton, aParams); }
|
|
|
|
static WidgetInfo Dropdown(const DropdownParams& aParams) { return WidgetInfo(Widget::eDropdown, aParams); }
|
|
|
|
static WidgetInfo FocusOutline() { return WidgetInfo(Widget::eFocusOutline, false); }
|
|
|
|
static WidgetInfo SpinButtons(const SpinButtonParams& aParams) { return WidgetInfo(Widget::eSpinButtons, aParams); }
|
|
|
|
static WidgetInfo SpinButtonUp(const SpinButtonParams& aParams) { return WidgetInfo(Widget::eSpinButtonUp, aParams); }
|
|
|
|
static WidgetInfo SpinButtonDown(const SpinButtonParams& aParams) { return WidgetInfo(Widget::eSpinButtonDown, aParams); }
|
|
|
|
static WidgetInfo Segment(const SegmentParams& aParams) { return WidgetInfo(Widget::eSegment, aParams); }
|
|
|
|
static WidgetInfo Separator() { return WidgetInfo(Widget::eSeparator, false); }
|
|
|
|
static WidgetInfo UnifiedToolbar(const UnifiedToolbarParams& aParams) { return WidgetInfo(Widget::eUnifiedToolbar, aParams); }
|
|
|
|
static WidgetInfo Toolbar(bool aParams) { return WidgetInfo(Widget::eToolbar, aParams); }
|
|
|
|
static WidgetInfo NativeTitlebar(const UnifiedToolbarParams& aParams) { return WidgetInfo(Widget::eNativeTitlebar, aParams); }
|
|
|
|
static WidgetInfo StatusBar(bool aParams) { return WidgetInfo(Widget::eStatusBar, aParams); }
|
|
|
|
static WidgetInfo GroupBox() { return WidgetInfo(Widget::eGroupBox, false); }
|
|
|
|
static WidgetInfo TextBox(const TextBoxParams& aParams) { return WidgetInfo(Widget::eTextBox, aParams); }
|
|
|
|
static WidgetInfo SearchField(const SearchFieldParams& aParams) { return WidgetInfo(Widget::eSearchField, aParams); }
|
|
|
|
static WidgetInfo ProgressBar(const ProgressParams& aParams) { return WidgetInfo(Widget::eProgressBar, aParams); }
|
|
|
|
static WidgetInfo Meter(const MeterParams& aParams) { return WidgetInfo(Widget::eMeter, aParams); }
|
|
|
|
static WidgetInfo TreeHeaderCell(const TreeHeaderCellParams& aParams) { return WidgetInfo(Widget::eTreeHeaderCell, aParams); }
|
|
|
|
static WidgetInfo Scale(const ScaleParams& aParams) { return WidgetInfo(Widget::eScale, aParams); }
|
|
|
|
static WidgetInfo ScrollbarThumb(const ScrollbarParams& aParams) { return WidgetInfo(Widget::eScrollbarThumb, aParams); }
|
|
|
|
static WidgetInfo ScrollbarTrack(const ScrollbarParams& aParams) { return WidgetInfo(Widget::eScrollbarTrack, aParams); }
|
2018-06-25 02:56:38 +03:00
|
|
|
static WidgetInfo ScrollCorner(const ScrollbarParams& aParams) { return WidgetInfo(Widget::eScrollCorner, aParams); }
|
2018-04-15 06:19:18 +03:00
|
|
|
static WidgetInfo MultilineTextField(bool aParams) { return WidgetInfo(Widget::eMultilineTextField, aParams); }
|
|
|
|
static WidgetInfo ListBox() { return WidgetInfo(Widget::eListBox, false); }
|
|
|
|
static WidgetInfo SourceList(bool aParams) { return WidgetInfo(Widget::eSourceList, aParams); }
|
|
|
|
static WidgetInfo ActiveSourceListSelection(bool aParams) { return WidgetInfo(Widget::eActiveSourceListSelection, aParams); }
|
|
|
|
static WidgetInfo InactiveSourceListSelection(bool aParams) { return WidgetInfo(Widget::eInactiveSourceListSelection, aParams); }
|
|
|
|
static WidgetInfo TabPanel(bool aParams) { return WidgetInfo(Widget::eTabPanel, aParams); }
|
|
|
|
static WidgetInfo Resizer(bool aParams) { return WidgetInfo(Widget::eResizer, aParams); }
|
|
|
|
|
|
|
|
template<typename T>
|
|
|
|
T Params() const
|
|
|
|
{
|
|
|
|
MOZ_RELEASE_ASSERT(mVariant.is<T>());
|
|
|
|
return mVariant.as<T>();
|
|
|
|
}
|
|
|
|
|
|
|
|
enum Widget Widget() const { return mWidget; }
|
|
|
|
|
|
|
|
private:
|
|
|
|
template<typename T> WidgetInfo(enum Widget aWidget, const T& aParams)
|
|
|
|
: mVariant(aParams)
|
|
|
|
, mWidget(aWidget)
|
|
|
|
{}
|
|
|
|
|
|
|
|
mozilla::Variant<
|
|
|
|
mozilla::gfx::Color,
|
|
|
|
MenuBackgroundParams,
|
|
|
|
MenuIconParams,
|
|
|
|
MenuItemParams,
|
|
|
|
CheckboxOrRadioParams,
|
|
|
|
ButtonParams,
|
|
|
|
DropdownParams,
|
|
|
|
SpinButtonParams,
|
|
|
|
SegmentParams,
|
|
|
|
UnifiedToolbarParams,
|
|
|
|
TextBoxParams,
|
|
|
|
SearchFieldParams,
|
|
|
|
ProgressParams,
|
|
|
|
MeterParams,
|
|
|
|
TreeHeaderCellParams,
|
|
|
|
ScaleParams,
|
|
|
|
ScrollbarParams,
|
|
|
|
bool
|
|
|
|
> mVariant;
|
|
|
|
|
|
|
|
enum Widget mWidget;
|
|
|
|
};
|
|
|
|
|
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;
|
2017-11-14 23:34:56 +03:00
|
|
|
bool CreateWebRenderCommandsForWidget(mozilla::wr::DisplayListBuilder& aBuilder,
|
|
|
|
mozilla::wr::IpcResourceUpdateQueue& aResources,
|
|
|
|
const mozilla::layers::StackingContextHelper& aSc,
|
|
|
|
mozilla::layers::WebRenderLayerManager* aManager,
|
|
|
|
nsIFrame* aFrame,
|
|
|
|
uint8_t aWidgetType,
|
|
|
|
const nsRect& aRect) override;
|
2018-06-02 20:10:48 +03:00
|
|
|
MOZ_MUST_USE LayoutDeviceIntMargin GetWidgetBorder(nsDeviceContext* aContext,
|
|
|
|
nsIFrame* aFrame,
|
|
|
|
uint8_t aWidgetType) override;
|
2006-08-31 02:06:44 +04:00
|
|
|
|
2018-05-17 18:30:35 +03:00
|
|
|
bool GetWidgetPadding(nsDeviceContext* aContext,
|
|
|
|
nsIFrame* aFrame,
|
|
|
|
uint8_t aWidgetType,
|
2018-06-02 20:10:48 +03:00
|
|
|
LayoutDeviceIntMargin* 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;
|
2018-04-15 06:31:11 +03:00
|
|
|
mozilla::Maybe<WidgetInfo> ComputeWidgetInfo(nsIFrame* aFrame,
|
|
|
|
uint8_t aWidgetType,
|
|
|
|
const nsRect& aRect);
|
2013-04-17 10:51:52 +04:00
|
|
|
void DrawProgress(CGContextRef context, const HIRect& inBoxRect,
|
2018-04-15 05:43:04 +03:00
|
|
|
const ProgressParams& aParams);
|
2013-04-17 10:51:52 +04:00
|
|
|
|
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
|
|
|
|
2018-06-02 20:10:48 +03:00
|
|
|
LayoutDeviceIntMargin
|
|
|
|
DirectionAwareMargin(const LayoutDeviceIntMargin& aMargin,
|
2018-05-17 18:30:35 +03:00
|
|
|
nsIFrame* aFrame);
|
2011-08-08 18:42:45 +04:00
|
|
|
nsIFrame* SeparatorResponsibility(nsIFrame* aBefore, nsIFrame* aAfter);
|
2015-05-26 20:55:08 +03:00
|
|
|
bool IsWindowSheet(nsIFrame* aFrame);
|
2018-04-15 04:13:10 +03:00
|
|
|
ControlParams ComputeControlParams(nsIFrame* aFrame,
|
|
|
|
mozilla::EventStates aEventState);
|
2018-04-15 04:56:23 +03:00
|
|
|
MenuBackgroundParams ComputeMenuBackgroundParams(nsIFrame* aFrame,
|
|
|
|
mozilla::EventStates aEventState);
|
2018-04-15 05:00:18 +03:00
|
|
|
MenuIconParams ComputeMenuIconParams(nsIFrame* aParams,
|
|
|
|
mozilla::EventStates aEventState,
|
|
|
|
MenuIcon aIcon);
|
|
|
|
MenuItemParams ComputeMenuItemParams(nsIFrame* aFrame,
|
|
|
|
mozilla::EventStates aEventState,
|
|
|
|
bool aIsChecked);
|
2018-04-15 05:26:24 +03:00
|
|
|
SegmentParams ComputeSegmentParams(nsIFrame* aFrame,
|
|
|
|
mozilla::EventStates aEventState,
|
|
|
|
SegmentType aSegmentType);
|
2017-12-01 02:51:24 +03:00
|
|
|
SearchFieldParams ComputeSearchFieldParams(nsIFrame* aFrame,
|
|
|
|
mozilla::EventStates aEventState);
|
2018-04-15 05:43:04 +03:00
|
|
|
ProgressParams ComputeProgressParams(nsIFrame* aFrame,
|
|
|
|
mozilla::EventStates aEventState,
|
|
|
|
bool aIsHorizontal);
|
2017-12-01 02:59:27 +03:00
|
|
|
MeterParams ComputeMeterParams(nsIFrame* aFrame);
|
2018-04-15 04:22:08 +03:00
|
|
|
TreeHeaderCellParams ComputeTreeHeaderCellParams(nsIFrame* aFrame,
|
|
|
|
mozilla::EventStates aEventState);
|
2018-04-15 06:06:29 +03:00
|
|
|
ScaleParams ComputeXULScaleParams(nsIFrame* aFrame,
|
|
|
|
mozilla::EventStates aEventState,
|
|
|
|
bool aIsHorizontal);
|
|
|
|
mozilla::Maybe<ScaleParams> ComputeHTMLScaleParams(nsIFrame* aFrame,
|
|
|
|
mozilla::EventStates aEventState);
|
|
|
|
ScrollbarParams ComputeScrollbarParams(nsIFrame* aFrame, bool aIsHorizontal);
|
2006-08-31 02:06:44 +04:00
|
|
|
|
|
|
|
// HITheme drawing routines
|
2018-04-15 05:29:57 +03:00
|
|
|
void DrawTextBox(CGContextRef context, const HIRect& inBoxRect,
|
|
|
|
TextBoxParams aParams);
|
2012-06-06 11:56:28 +04:00
|
|
|
void DrawMeter(CGContextRef context, const HIRect& inBoxRect,
|
2017-12-01 02:59:27 +03:00
|
|
|
const MeterParams& aParams);
|
2011-08-08 18:42:45 +04:00
|
|
|
void DrawSegment(CGContextRef cgContext, const HIRect& inBoxRect,
|
2018-04-15 05:26:24 +03:00
|
|
|
const SegmentParams& aParams);
|
2017-12-02 02:03:12 +03:00
|
|
|
void DrawTabPanel(CGContextRef context, const HIRect& inBoxRect,
|
|
|
|
bool aIsInsideActiveWindow);
|
2008-09-22 12:57:42 +04:00
|
|
|
void DrawScale(CGContextRef context, const HIRect& inBoxRect,
|
2018-04-15 06:06:29 +03:00
|
|
|
const ScaleParams& aParams);
|
2011-09-29 10:19:26 +04:00
|
|
|
void DrawCheckboxOrRadio(CGContextRef cgContext, bool inCheckbox,
|
2017-12-01 01:50:33 +03:00
|
|
|
const HIRect& inBoxRect,
|
|
|
|
const CheckboxOrRadioParams& aParams);
|
2010-09-20 05:16:49 +04:00
|
|
|
void DrawSearchField(CGContextRef cgContext, const HIRect& inBoxRect,
|
2017-12-01 02:51:24 +03:00
|
|
|
const SearchFieldParams& aParams);
|
2018-04-15 04:13:10 +03:00
|
|
|
void DrawRoundedBezelPushButton(CGContextRef cgContext,
|
|
|
|
const HIRect& inBoxRect,
|
|
|
|
ControlParams aControlParams);
|
|
|
|
void DrawSquareBezelPushButton(CGContextRef cgContext,
|
|
|
|
const HIRect& inBoxRect,
|
|
|
|
ControlParams aControlParams);
|
|
|
|
void DrawHelpButton(CGContextRef cgContext, const HIRect& inBoxRect,
|
|
|
|
ControlParams aControlParams);
|
|
|
|
void DrawDisclosureButton(CGContextRef cgContext, const HIRect& inBoxRect,
|
|
|
|
ControlParams aControlParams, NSCellStateValue aState);
|
2018-04-15 04:56:23 +03:00
|
|
|
void DrawMenuBackground(CGContextRef cgContext, const CGRect& inBoxRect,
|
|
|
|
const MenuBackgroundParams& aParams);
|
2018-04-15 05:00:18 +03:00
|
|
|
NSString* GetMenuIconName(const MenuIconParams& aParams);
|
|
|
|
NSSize GetMenuIconSize(MenuIcon aIcon);
|
2014-07-04 22:02:44 +04:00
|
|
|
void DrawMenuIcon(CGContextRef cgContext, const CGRect& aRect,
|
2018-04-15 05:00:18 +03:00
|
|
|
const MenuIconParams& aParams);
|
|
|
|
void DrawMenuItem(CGContextRef cgContext, const CGRect& inBoxRect,
|
|
|
|
const MenuItemParams& aParams);
|
2017-12-02 01:58:02 +03:00
|
|
|
void DrawMenuSeparator(CGContextRef cgContext, const CGRect& inBoxRect,
|
|
|
|
const MenuItemParams& aParams);
|
2018-04-15 04:48:09 +03:00
|
|
|
void DrawHIThemeButton(CGContextRef cgContext, const HIRect& aRect,
|
|
|
|
ThemeButtonKind aKind, ThemeButtonValue aValue,
|
|
|
|
ThemeDrawState aState, ThemeButtonAdornment aAdornment,
|
|
|
|
const ControlParams& aParams);
|
|
|
|
void DrawButton(CGContextRef context, const HIRect& inBoxRect,
|
|
|
|
const ButtonParams& aParams);
|
2018-04-15 04:22:08 +03:00
|
|
|
void DrawTreeHeaderCell(CGContextRef context, const HIRect& inBoxRect,
|
|
|
|
const TreeHeaderCellParams& aParams);
|
2017-12-02 02:07:24 +03:00
|
|
|
void DrawFocusOutline(CGContextRef cgContext, const HIRect& inBoxRect);
|
2010-10-20 15:26:32 +04:00
|
|
|
void DrawDropdown(CGContextRef context, const HIRect& inBoxRect,
|
2018-04-15 05:07:23 +03:00
|
|
|
const DropdownParams& aParams);
|
2018-04-15 05:14:19 +03:00
|
|
|
HIThemeButtonDrawInfo SpinButtonDrawInfo(ThemeButtonKind aKind,
|
|
|
|
const SpinButtonParams& aParams);
|
|
|
|
void DrawSpinButtons(CGContextRef context, const HIRect& inBoxRect,
|
|
|
|
const SpinButtonParams& aParams);
|
|
|
|
void DrawSpinButton(CGContextRef context,
|
|
|
|
const HIRect& inBoxRect, SpinButton aDrawnButton,
|
|
|
|
const SpinButtonParams& aParams);
|
2017-12-02 01:55:02 +03:00
|
|
|
void DrawToolbar(CGContextRef cgContext, const CGRect& inBoxRect,
|
|
|
|
bool aIsMain);
|
2008-09-16 12:21:06 +04:00
|
|
|
void DrawUnifiedToolbar(CGContextRef cgContext, const HIRect& inBoxRect,
|
2017-12-01 02:46:37 +03:00
|
|
|
const UnifiedToolbarParams& aParams);
|
2017-12-02 03:54:29 +03:00
|
|
|
void DrawNativeTitlebar(CGContextRef aContext, CGRect aTitlebarRect,
|
|
|
|
const UnifiedToolbarParams& aParams);
|
2009-01-06 18:46:59 +03:00
|
|
|
void DrawStatusBar(CGContextRef cgContext, const HIRect& inBoxRect,
|
2017-12-02 02:08:35 +03:00
|
|
|
bool aIsMain);
|
2017-12-02 02:31:18 +03:00
|
|
|
void DrawResizer(CGContextRef cgContext, const HIRect& aRect, bool aIsRTL);
|
2018-04-15 06:06:29 +03:00
|
|
|
void DrawScrollbarThumb(CGContextRef cgContext, const CGRect& inBoxRect,
|
|
|
|
ScrollbarParams aParams);
|
|
|
|
void DrawScrollbarTrack(CGContextRef cgContext, const CGRect& inBoxRect,
|
|
|
|
ScrollbarParams aParams);
|
2018-06-25 02:56:38 +03:00
|
|
|
void DrawScrollCorner(CGContextRef cgContext, const CGRect& inBoxRect,
|
|
|
|
ScrollbarParams aParams);
|
2017-12-02 02:35:45 +03:00
|
|
|
void DrawMultilineTextField(CGContextRef cgContext, const CGRect& inBoxRect,
|
|
|
|
bool aIsFocused);
|
2017-12-02 02:01:16 +03:00
|
|
|
void DrawSourceList(CGContextRef cgContext, const CGRect& inBoxRect,
|
|
|
|
bool aIsActive);
|
2008-09-16 12:21:06 +04:00
|
|
|
|
2007-04-11 04:25:11 +04:00
|
|
|
// Scrollbars
|
|
|
|
nsIFrame* GetParentScrollbarFrame(nsIFrame *aFrame);
|
2014-05-28 17:22:16 +04:00
|
|
|
bool IsParentScrollbarRolledOver(nsIFrame* aFrame);
|
2007-12-23 22:22:47 +03:00
|
|
|
|
2017-11-19 02:53:54 +03:00
|
|
|
void RenderWidget(const WidgetInfo& aWidgetInfo,
|
|
|
|
mozilla::gfx::DrawTarget& aDrawTarget,
|
|
|
|
const mozilla::gfx::Rect& aWidgetRect,
|
|
|
|
const mozilla::gfx::Rect& aDirtyRect,
|
|
|
|
float aScale);
|
|
|
|
|
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;
|
2018-04-14 01:19:32 +03:00
|
|
|
NSSearchFieldCell* mSearchFieldCell;
|
|
|
|
NSSearchFieldCell* mToolbarSearchFieldCell;
|
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_
|