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
|
|
|
|
2018-04-15 03:19:18 +00:00
|
|
|
#include "mozilla/Variant.h"
|
|
|
|
|
2006-08-30 22:06:44 +00:00
|
|
|
#include "nsITheme.h"
|
|
|
|
#include "nsCOMPtr.h"
|
2017-10-02 22:05:19 +00:00
|
|
|
#include "nsAtom.h"
|
2006-08-30 22:06:44 +00:00
|
|
|
#include "nsNativeTheme.h"
|
2020-10-27 15:16:49 +00:00
|
|
|
#include "ScrollbarDrawingMac.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-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;
|
2017-11-18 23:53:54 +00:00
|
|
|
namespace gfx {
|
|
|
|
class DrawTarget;
|
2018-11-30 10:46:48 +00:00
|
|
|
} // namespace gfx
|
|
|
|
} // namespace mozilla
|
2014-04-03 04:18:36 +00:00
|
|
|
|
2018-11-30 10:46:48 +00:00
|
|
|
class nsNativeThemeCocoa : private nsNativeTheme, public nsITheme {
|
|
|
|
public:
|
2015-02-04 22:25:18 +00:00
|
|
|
enum {
|
|
|
|
eThemeGeometryTypeTitlebar = eThemeGeometryTypeUnknown + 1,
|
|
|
|
eThemeGeometryTypeToolbar,
|
2015-03-06 19:43:46 +00:00
|
|
|
eThemeGeometryTypeToolbox,
|
2015-02-04 22:25:18 +00:00
|
|
|
eThemeGeometryTypeWindowButtons,
|
|
|
|
eThemeGeometryTypeFullscreenButton,
|
|
|
|
eThemeGeometryTypeMenu,
|
|
|
|
eThemeGeometryTypeHighlightedMenuItem,
|
|
|
|
eThemeGeometryTypeVibrancyLight,
|
|
|
|
eThemeGeometryTypeVibrancyDark,
|
2017-11-16 16:36:52 +00:00
|
|
|
eThemeGeometryTypeVibrantTitlebarLight,
|
|
|
|
eThemeGeometryTypeVibrantTitlebarDark,
|
2015-02-04 22:25:18 +00:00
|
|
|
eThemeGeometryTypeTooltip,
|
2020-02-13 14:26:51 +00:00
|
|
|
eThemeGeometryTypeSheet,
|
2016-05-17 05:37:05 +00:00
|
|
|
eThemeGeometryTypeSourceList,
|
2016-10-14 20:45:29 +00:00
|
|
|
eThemeGeometryTypeSourceListSelection,
|
|
|
|
eThemeGeometryTypeActiveSourceListSelection
|
2015-02-04 22:25:18 +00:00
|
|
|
};
|
|
|
|
|
2018-04-15 02:00:18 +00:00
|
|
|
enum class MenuIcon : uint8_t {
|
|
|
|
eCheckmark,
|
|
|
|
eMenuArrow,
|
|
|
|
eMenuDownScrollArrow,
|
|
|
|
eMenuUpScrollArrow
|
|
|
|
};
|
|
|
|
|
2018-11-30 10:46:48 +00:00
|
|
|
enum class CheckboxOrRadioState : uint8_t { eOff, eOn, eIndeterminate };
|
2017-11-30 22:50:33 +00:00
|
|
|
|
2018-04-15 01:48:09 +00:00
|
|
|
enum class ButtonType : uint8_t {
|
|
|
|
eRegularPushButton,
|
|
|
|
eDefaultPushButton,
|
|
|
|
eRegularBevelButton,
|
|
|
|
eDefaultBevelButton,
|
2017-11-30 21:47:59 +00:00
|
|
|
eRoundedBezelPushButton,
|
|
|
|
eSquareBezelPushButton,
|
2018-04-15 01:48:09 +00:00
|
|
|
eArrowButton,
|
2017-11-30 21:47:59 +00:00
|
|
|
eHelpButton,
|
2018-04-15 01:48:09 +00:00
|
|
|
eTreeTwistyPointingRight,
|
2017-11-30 21:47:59 +00:00
|
|
|
eTreeTwistyPointingDown,
|
|
|
|
eDisclosureButtonClosed,
|
|
|
|
eDisclosureButtonOpen
|
2018-04-15 01:48:09 +00:00
|
|
|
};
|
|
|
|
|
2018-11-30 10:46:48 +00:00
|
|
|
enum class SpinButton : uint8_t { eUp, eDown };
|
2018-04-15 02:14:19 +00:00
|
|
|
|
2018-11-30 10:46:48 +00:00
|
|
|
enum class SegmentType : uint8_t { eToolbarButton, eTab };
|
2018-04-15 02:26:24 +00:00
|
|
|
|
2018-11-30 10:46:48 +00:00
|
|
|
enum class OptimumState : uint8_t { eOptimum, eSubOptimum, eSubSubOptimum };
|
2017-11-30 23:59:27 +00:00
|
|
|
|
2018-04-15 01:13:10 +00:00
|
|
|
struct ControlParams {
|
|
|
|
ControlParams()
|
2018-11-30 10:46:48 +00:00
|
|
|
: disabled(false), insideActiveWindow(false), pressed(false), focused(false), rtl(false) {}
|
2018-04-15 01:13:10 +00:00
|
|
|
|
|
|
|
bool disabled : 1;
|
|
|
|
bool insideActiveWindow : 1;
|
|
|
|
bool pressed : 1;
|
|
|
|
bool focused : 1;
|
|
|
|
bool rtl : 1;
|
|
|
|
};
|
|
|
|
|
2018-04-15 02:00:18 +00:00
|
|
|
struct MenuIconParams {
|
|
|
|
MenuIcon icon = MenuIcon::eCheckmark;
|
|
|
|
bool disabled = false;
|
|
|
|
bool insideActiveMenuItem = false;
|
|
|
|
bool centerHorizontally = false;
|
|
|
|
bool rtl = false;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct MenuItemParams {
|
|
|
|
bool checked = false;
|
|
|
|
bool disabled = false;
|
|
|
|
bool selected = false;
|
|
|
|
bool rtl = false;
|
|
|
|
};
|
|
|
|
|
2017-11-30 22:50:33 +00:00
|
|
|
struct CheckboxOrRadioParams {
|
|
|
|
ControlParams controlParams;
|
|
|
|
CheckboxOrRadioState state = CheckboxOrRadioState::eOff;
|
|
|
|
float verticalAlignFactor = 0.5f;
|
|
|
|
};
|
|
|
|
|
2018-04-15 01:48:09 +00:00
|
|
|
struct ButtonParams {
|
|
|
|
ControlParams controlParams;
|
|
|
|
ButtonType button = ButtonType::eRegularPushButton;
|
|
|
|
};
|
|
|
|
|
2018-04-15 02:07:23 +00:00
|
|
|
struct DropdownParams {
|
|
|
|
ControlParams controlParams;
|
|
|
|
bool pullsDown = false;
|
|
|
|
bool editable = false;
|
|
|
|
};
|
|
|
|
|
2018-04-15 02:14:19 +00:00
|
|
|
struct SpinButtonParams {
|
|
|
|
mozilla::Maybe<SpinButton> pressedButton;
|
|
|
|
bool disabled = false;
|
|
|
|
bool insideActiveWindow = false;
|
|
|
|
};
|
|
|
|
|
2018-04-15 02:26:24 +00: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-11-30 23:46:37 +00:00
|
|
|
struct UnifiedToolbarParams {
|
|
|
|
float unifiedHeight = 0.0f;
|
|
|
|
bool isMain = false;
|
|
|
|
};
|
|
|
|
|
2018-04-15 02:29:57 +00:00
|
|
|
struct TextBoxParams {
|
|
|
|
bool disabled = false;
|
|
|
|
bool focused = false;
|
2018-10-19 17:12:15 +00:00
|
|
|
bool borderless = false;
|
2018-04-15 02:29:57 +00:00
|
|
|
};
|
|
|
|
|
2017-11-30 23:51:24 +00:00
|
|
|
struct SearchFieldParams {
|
|
|
|
float verticalAlignFactor = 0.5f;
|
|
|
|
bool insideToolbar = false;
|
|
|
|
bool disabled = false;
|
|
|
|
bool focused = false;
|
|
|
|
bool rtl = false;
|
|
|
|
};
|
|
|
|
|
2018-04-15 02:43:04 +00: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-11-30 23:59:27 +00: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 01:22:08 +00:00
|
|
|
struct TreeHeaderCellParams {
|
|
|
|
ControlParams controlParams;
|
|
|
|
TreeSortDirection sortDirection = eTreeSortDirection_Natural;
|
|
|
|
bool lastTreeHeaderCell = false;
|
|
|
|
};
|
|
|
|
|
2018-04-15 03:06:29 +00: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;
|
|
|
|
};
|
|
|
|
|
2020-10-27 15:16:49 +00:00
|
|
|
using ScrollbarParams = mozilla::widget::ScrollbarParams;
|
2018-04-15 03:06:29 +00:00
|
|
|
|
2018-04-15 03:19:18 +00:00
|
|
|
enum Widget : uint8_t {
|
2020-10-26 23:17:24 +00:00
|
|
|
eColorFill, // mozilla::gfx::sRGBColor
|
|
|
|
eMenuIcon, // MenuIconParams
|
|
|
|
eMenuItem, // MenuItemParams
|
|
|
|
eMenuSeparator, // MenuItemParams
|
2018-04-15 03:19:18 +00:00
|
|
|
eTooltip,
|
2018-11-30 10:46:48 +00:00
|
|
|
eCheckbox, // CheckboxOrRadioParams
|
|
|
|
eRadio, // CheckboxOrRadioParams
|
|
|
|
eButton, // ButtonParams
|
|
|
|
eDropdown, // DropdownParams
|
2018-04-15 03:19:18 +00:00
|
|
|
eFocusOutline,
|
2018-11-30 10:46:48 +00:00
|
|
|
eSpinButtons, // SpinButtonParams
|
|
|
|
eSpinButtonUp, // SpinButtonParams
|
|
|
|
eSpinButtonDown, // SpinButtonParams
|
|
|
|
eSegment, // SegmentParams
|
2018-04-15 03:19:18 +00:00
|
|
|
eSeparator,
|
2018-11-30 10:46:48 +00:00
|
|
|
eUnifiedToolbar, // UnifiedToolbarParams
|
|
|
|
eToolbar, // bool
|
|
|
|
eNativeTitlebar, // UnifiedToolbarParams
|
|
|
|
eStatusBar, // bool
|
2018-04-15 03:19:18 +00:00
|
|
|
eGroupBox,
|
2018-11-30 10:46:48 +00:00
|
|
|
eTextBox, // TextBoxParams
|
|
|
|
eSearchField, // SearchFieldParams
|
|
|
|
eProgressBar, // ProgressParams
|
|
|
|
eMeter, // MeterParams
|
|
|
|
eTreeHeaderCell, // TreeHeaderCellParams
|
|
|
|
eScale, // ScaleParams
|
|
|
|
eScrollbarThumb, // ScrollbarParams
|
|
|
|
eScrollbarTrack, // ScrollbarParams
|
|
|
|
eScrollCorner, // ScrollbarParams
|
|
|
|
eMultilineTextField, // bool
|
2018-04-15 03:19:18 +00:00
|
|
|
eListBox,
|
|
|
|
eSourceList, // bool
|
|
|
|
eActiveSourceListSelection, // bool
|
|
|
|
eInactiveSourceListSelection, // bool
|
|
|
|
eTabPanel,
|
|
|
|
eResizer
|
|
|
|
};
|
|
|
|
|
|
|
|
struct WidgetInfo {
|
2020-03-09 14:16:17 +00:00
|
|
|
static WidgetInfo ColorFill(const mozilla::gfx::sRGBColor& aParams) {
|
2018-11-30 10:46:48 +00:00
|
|
|
return WidgetInfo(Widget::eColorFill, 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);
|
|
|
|
}
|
2018-04-15 03:19:18 +00:00
|
|
|
static WidgetInfo Tooltip() { return WidgetInfo(Widget::eTooltip, false); }
|
2018-11-30 10:46:48 +00:00
|
|
|
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);
|
|
|
|
}
|
2018-04-15 03:19:18 +00:00
|
|
|
static WidgetInfo FocusOutline() { return WidgetInfo(Widget::eFocusOutline, false); }
|
2018-11-30 10:46:48 +00:00
|
|
|
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);
|
|
|
|
}
|
2018-04-15 03:19:18 +00:00
|
|
|
static WidgetInfo Separator() { return WidgetInfo(Widget::eSeparator, false); }
|
2018-11-30 10:46:48 +00:00
|
|
|
static WidgetInfo UnifiedToolbar(const UnifiedToolbarParams& aParams) {
|
|
|
|
return WidgetInfo(Widget::eUnifiedToolbar, aParams);
|
|
|
|
}
|
2018-04-15 03:19:18 +00:00
|
|
|
static WidgetInfo Toolbar(bool aParams) { return WidgetInfo(Widget::eToolbar, aParams); }
|
2018-11-30 10:46:48 +00:00
|
|
|
static WidgetInfo NativeTitlebar(const UnifiedToolbarParams& aParams) {
|
|
|
|
return WidgetInfo(Widget::eNativeTitlebar, aParams);
|
|
|
|
}
|
2018-04-15 03:19:18 +00:00
|
|
|
static WidgetInfo StatusBar(bool aParams) { return WidgetInfo(Widget::eStatusBar, aParams); }
|
|
|
|
static WidgetInfo GroupBox() { return WidgetInfo(Widget::eGroupBox, false); }
|
2018-11-30 10:46:48 +00:00
|
|
|
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);
|
|
|
|
}
|
|
|
|
static WidgetInfo ScrollCorner(const ScrollbarParams& aParams) {
|
|
|
|
return WidgetInfo(Widget::eScrollCorner, aParams);
|
|
|
|
}
|
|
|
|
static WidgetInfo MultilineTextField(bool aParams) {
|
|
|
|
return WidgetInfo(Widget::eMultilineTextField, aParams);
|
|
|
|
}
|
2018-04-15 03:19:18 +00:00
|
|
|
static WidgetInfo ListBox() { return WidgetInfo(Widget::eListBox, false); }
|
|
|
|
static WidgetInfo SourceList(bool aParams) { return WidgetInfo(Widget::eSourceList, aParams); }
|
2018-11-30 10:46:48 +00:00
|
|
|
static WidgetInfo ActiveSourceListSelection(bool aParams) {
|
|
|
|
return WidgetInfo(Widget::eActiveSourceListSelection, aParams);
|
|
|
|
}
|
|
|
|
static WidgetInfo InactiveSourceListSelection(bool aParams) {
|
|
|
|
return WidgetInfo(Widget::eInactiveSourceListSelection, aParams);
|
|
|
|
}
|
2018-04-15 03:19:18 +00:00
|
|
|
static WidgetInfo TabPanel(bool aParams) { return WidgetInfo(Widget::eTabPanel, aParams); }
|
|
|
|
static WidgetInfo Resizer(bool aParams) { return WidgetInfo(Widget::eResizer, aParams); }
|
|
|
|
|
2018-11-30 10:46:48 +00:00
|
|
|
template <typename T>
|
|
|
|
T Params() const {
|
2018-04-15 03:19:18 +00:00
|
|
|
MOZ_RELEASE_ASSERT(mVariant.is<T>());
|
|
|
|
return mVariant.as<T>();
|
|
|
|
}
|
|
|
|
|
|
|
|
enum Widget Widget() const { return mWidget; }
|
|
|
|
|
2018-11-30 10:46:48 +00:00
|
|
|
private:
|
|
|
|
template <typename T>
|
|
|
|
WidgetInfo(enum Widget aWidget, const T& aParams) : mVariant(aParams), mWidget(aWidget) {}
|
|
|
|
|
2020-10-26 23:17:24 +00:00
|
|
|
mozilla::Variant<mozilla::gfx::sRGBColor, MenuIconParams, MenuItemParams, CheckboxOrRadioParams,
|
|
|
|
ButtonParams, DropdownParams, SpinButtonParams, SegmentParams,
|
|
|
|
UnifiedToolbarParams, TextBoxParams, SearchFieldParams, ProgressParams,
|
|
|
|
MeterParams, TreeHeaderCellParams, ScaleParams, ScrollbarParams, bool>
|
2018-11-30 10:46:48 +00:00
|
|
|
mVariant;
|
2018-04-15 03:19:18 +00:00
|
|
|
|
|
|
|
enum Widget mWidget;
|
|
|
|
};
|
|
|
|
|
2020-10-27 15:16:49 +00:00
|
|
|
using ScrollbarDrawingMac = mozilla::widget::ScrollbarDrawingMac;
|
|
|
|
|
2006-08-30 22:06:44 +00:00
|
|
|
nsNativeThemeCocoa();
|
|
|
|
|
2010-11-13 08:19:38 +00:00
|
|
|
NS_DECL_ISUPPORTS_INHERITED
|
2006-08-30 22:06:44 +00:00
|
|
|
|
|
|
|
// The nsITheme interface.
|
2018-11-30 10:46:48 +00:00
|
|
|
NS_IMETHOD DrawWidgetBackground(gfxContext* aContext, nsIFrame* aFrame,
|
|
|
|
StyleAppearance aAppearance, const nsRect& aRect,
|
2015-03-21 16:28:04 +00:00
|
|
|
const nsRect& aDirtyRect) override;
|
2017-11-14 20:34:56 +00:00
|
|
|
bool CreateWebRenderCommandsForWidget(mozilla::wr::DisplayListBuilder& aBuilder,
|
|
|
|
mozilla::wr::IpcResourceUpdateQueue& aResources,
|
|
|
|
const mozilla::layers::StackingContextHelper& aSc,
|
2019-01-07 21:33:10 +00:00
|
|
|
mozilla::layers::RenderRootStateManager* aManager,
|
2018-11-30 10:46:48 +00:00
|
|
|
nsIFrame* aFrame, StyleAppearance aAppearance,
|
2017-11-14 20:34:56 +00:00
|
|
|
const nsRect& aRect) override;
|
2020-04-08 16:41:42 +00:00
|
|
|
[[nodiscard]] LayoutDeviceIntMargin GetWidgetBorder(nsDeviceContext* aContext, nsIFrame* aFrame,
|
|
|
|
StyleAppearance aAppearance) override;
|
2006-08-30 22:06:44 +00:00
|
|
|
|
2018-11-30 10:46:48 +00:00
|
|
|
bool GetWidgetPadding(nsDeviceContext* aContext, nsIFrame* aFrame, StyleAppearance aAppearance,
|
|
|
|
LayoutDeviceIntMargin* aResult) override;
|
2006-08-30 22:06:44 +00:00
|
|
|
|
2011-09-29 06:19:26 +00:00
|
|
|
virtual bool GetWidgetOverflow(nsDeviceContext* aContext, nsIFrame* aFrame,
|
2018-11-30 10:46:48 +00:00
|
|
|
StyleAppearance aAppearance, nsRect* aOverflowRect) override;
|
2007-02-17 02:48:58 +00:00
|
|
|
|
2014-06-27 09:19:00 +00:00
|
|
|
NS_IMETHOD GetMinimumWidgetSize(nsPresContext* aPresContext, nsIFrame* aFrame,
|
2018-10-24 15:24:57 +00:00
|
|
|
StyleAppearance aAppearance,
|
2018-11-30 10:46:48 +00:00
|
|
|
mozilla::LayoutDeviceIntSize* aResult,
|
|
|
|
bool* aIsOverridable) override;
|
|
|
|
NS_IMETHOD WidgetStateChanged(nsIFrame* aFrame, StyleAppearance aAppearance, nsAtom* aAttribute,
|
|
|
|
bool* aShouldRepaint, const nsAttrValue* aOldValue) override;
|
2015-03-21 16:28:04 +00:00
|
|
|
NS_IMETHOD ThemeChanged() override;
|
2018-11-30 10:46:48 +00:00
|
|
|
bool ThemeSupportsWidget(nsPresContext* aPresContext, nsIFrame* aFrame,
|
2018-10-24 15:24:57 +00:00
|
|
|
StyleAppearance aAppearance) override;
|
|
|
|
bool WidgetIsContainer(StyleAppearance aAppearance) override;
|
|
|
|
bool ThemeDrawsFocusForWidget(StyleAppearance aAppearance) override;
|
2015-03-21 16:28:04 +00:00
|
|
|
bool ThemeNeedsComboboxDropmarker() override;
|
2018-10-24 15:24:57 +00:00
|
|
|
virtual bool WidgetAppearanceDependsOnWindowFocus(StyleAppearance aAppearance) override;
|
2015-02-04 22:25:18 +00:00
|
|
|
virtual ThemeGeometryType ThemeGeometryTypeForWidget(nsIFrame* aFrame,
|
2018-10-24 15:24:57 +00:00
|
|
|
StyleAppearance aAppearance) override;
|
2018-10-24 11:47:20 +00:00
|
|
|
virtual Transparency GetWidgetTransparency(nsIFrame* aFrame,
|
2018-10-24 15:24:57 +00:00
|
|
|
StyleAppearance aAppearance) override;
|
2018-11-30 10:46:48 +00:00
|
|
|
mozilla::Maybe<WidgetInfo> ComputeWidgetInfo(nsIFrame* aFrame, StyleAppearance aAppearance,
|
2018-04-15 03:31:11 +00:00
|
|
|
const nsRect& aRect);
|
2018-11-30 10:46:48 +00:00
|
|
|
void DrawProgress(CGContextRef context, const HIRect& inBoxRect, const ProgressParams& aParams);
|
2013-04-17 06:51:52 +00:00
|
|
|
|
2014-08-28 00:15:27 +00:00
|
|
|
static void DrawNativeTitlebar(CGContextRef aContext, CGRect aTitlebarRect,
|
|
|
|
CGFloat aUnifiedHeight, BOOL aIsMain, BOOL aIsFlipped);
|
|
|
|
|
2018-11-30 10:46:48 +00:00
|
|
|
protected:
|
2014-07-08 21:23:18 +00:00
|
|
|
virtual ~nsNativeThemeCocoa();
|
2007-04-11 00:25:11 +00:00
|
|
|
|
2018-11-30 10:46:48 +00:00
|
|
|
LayoutDeviceIntMargin DirectionAwareMargin(const LayoutDeviceIntMargin& aMargin,
|
|
|
|
nsIFrame* aFrame);
|
2011-08-08 14:42:45 +00:00
|
|
|
nsIFrame* SeparatorResponsibility(nsIFrame* aBefore, nsIFrame* aAfter);
|
2020-02-13 14:26:51 +00:00
|
|
|
bool IsWindowSheet(nsIFrame* aFrame);
|
2018-11-30 10:46:48 +00:00
|
|
|
ControlParams ComputeControlParams(nsIFrame* aFrame, mozilla::EventStates aEventState);
|
|
|
|
MenuIconParams ComputeMenuIconParams(nsIFrame* aParams, mozilla::EventStates aEventState,
|
2018-04-15 02:00:18 +00:00
|
|
|
MenuIcon aIcon);
|
2018-11-30 10:46:48 +00:00
|
|
|
MenuItemParams ComputeMenuItemParams(nsIFrame* aFrame, mozilla::EventStates aEventState,
|
2018-04-15 02:00:18 +00:00
|
|
|
bool aIsChecked);
|
2018-11-30 10:46:48 +00:00
|
|
|
SegmentParams ComputeSegmentParams(nsIFrame* aFrame, mozilla::EventStates aEventState,
|
2018-04-15 02:26:24 +00:00
|
|
|
SegmentType aSegmentType);
|
2018-11-30 10:46:48 +00:00
|
|
|
SearchFieldParams ComputeSearchFieldParams(nsIFrame* aFrame, mozilla::EventStates aEventState);
|
|
|
|
ProgressParams ComputeProgressParams(nsIFrame* aFrame, mozilla::EventStates aEventState,
|
2018-04-15 02:43:04 +00:00
|
|
|
bool aIsHorizontal);
|
2017-11-30 23:59:27 +00:00
|
|
|
MeterParams ComputeMeterParams(nsIFrame* aFrame);
|
2018-04-15 01:22:08 +00:00
|
|
|
TreeHeaderCellParams ComputeTreeHeaderCellParams(nsIFrame* aFrame,
|
|
|
|
mozilla::EventStates aEventState);
|
2018-04-15 03:06:29 +00:00
|
|
|
mozilla::Maybe<ScaleParams> ComputeHTMLScaleParams(nsIFrame* aFrame,
|
|
|
|
mozilla::EventStates aEventState);
|
2006-08-30 22:06:44 +00:00
|
|
|
|
|
|
|
// HITheme drawing routines
|
2018-11-30 10:46:48 +00:00
|
|
|
void DrawTextBox(CGContextRef context, const HIRect& inBoxRect, TextBoxParams aParams);
|
|
|
|
void DrawMeter(CGContextRef context, const HIRect& inBoxRect, const MeterParams& aParams);
|
|
|
|
void DrawSegment(CGContextRef cgContext, const HIRect& inBoxRect, const SegmentParams& aParams);
|
2020-10-17 13:59:49 +00:00
|
|
|
void DrawSegmentBackground(CGContextRef cgContext, const HIRect& inBoxRect,
|
|
|
|
const SegmentParams& aParams);
|
2018-11-30 10:46:48 +00:00
|
|
|
void DrawTabPanel(CGContextRef context, const HIRect& inBoxRect, bool aIsInsideActiveWindow);
|
|
|
|
void DrawScale(CGContextRef context, const HIRect& inBoxRect, const ScaleParams& aParams);
|
|
|
|
void DrawCheckboxOrRadio(CGContextRef cgContext, bool inCheckbox, const HIRect& inBoxRect,
|
2017-11-30 22:50:33 +00:00
|
|
|
const CheckboxOrRadioParams& aParams);
|
2010-09-20 01:16:49 +00:00
|
|
|
void DrawSearchField(CGContextRef cgContext, const HIRect& inBoxRect,
|
2017-11-30 23:51:24 +00:00
|
|
|
const SearchFieldParams& aParams);
|
2018-11-30 10:46:48 +00:00
|
|
|
void DrawRoundedBezelPushButton(CGContextRef cgContext, const HIRect& inBoxRect,
|
2018-04-15 01:13:10 +00:00
|
|
|
ControlParams aControlParams);
|
2018-11-30 10:46:48 +00:00
|
|
|
void DrawSquareBezelPushButton(CGContextRef cgContext, const HIRect& inBoxRect,
|
2018-04-15 01:13:10 +00:00
|
|
|
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 02:00:18 +00:00
|
|
|
NSString* GetMenuIconName(const MenuIconParams& aParams);
|
|
|
|
NSSize GetMenuIconSize(MenuIcon aIcon);
|
2018-11-30 10:46:48 +00:00
|
|
|
void DrawMenuIcon(CGContextRef cgContext, const CGRect& aRect, const MenuIconParams& aParams);
|
|
|
|
void DrawMenuItem(CGContextRef cgContext, const CGRect& inBoxRect, const MenuItemParams& aParams);
|
2017-12-01 22:58:02 +00:00
|
|
|
void DrawMenuSeparator(CGContextRef cgContext, const CGRect& inBoxRect,
|
|
|
|
const MenuItemParams& aParams);
|
2018-11-30 10:46:48 +00: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 01:22:08 +00:00
|
|
|
void DrawTreeHeaderCell(CGContextRef context, const HIRect& inBoxRect,
|
|
|
|
const TreeHeaderCellParams& aParams);
|
2017-12-01 23:07:24 +00:00
|
|
|
void DrawFocusOutline(CGContextRef cgContext, const HIRect& inBoxRect);
|
2018-11-30 10:46:48 +00:00
|
|
|
void DrawDropdown(CGContextRef context, const HIRect& inBoxRect, const DropdownParams& aParams);
|
|
|
|
HIThemeButtonDrawInfo SpinButtonDrawInfo(ThemeButtonKind aKind, const SpinButtonParams& aParams);
|
2018-04-15 02:14:19 +00:00
|
|
|
void DrawSpinButtons(CGContextRef context, const HIRect& inBoxRect,
|
|
|
|
const SpinButtonParams& aParams);
|
2018-11-30 10:46:48 +00:00
|
|
|
void DrawSpinButton(CGContextRef context, const HIRect& inBoxRect, SpinButton aDrawnButton,
|
2018-04-15 02:14:19 +00:00
|
|
|
const SpinButtonParams& aParams);
|
2018-11-30 10:46:48 +00:00
|
|
|
void DrawToolbar(CGContextRef cgContext, const CGRect& inBoxRect, bool aIsMain);
|
2008-09-16 08:21:06 +00:00
|
|
|
void DrawUnifiedToolbar(CGContextRef cgContext, const HIRect& inBoxRect,
|
2017-11-30 23:46:37 +00:00
|
|
|
const UnifiedToolbarParams& aParams);
|
2017-12-02 00:54:29 +00:00
|
|
|
void DrawNativeTitlebar(CGContextRef aContext, CGRect aTitlebarRect,
|
|
|
|
const UnifiedToolbarParams& aParams);
|
2018-11-30 10:46:48 +00:00
|
|
|
void DrawStatusBar(CGContextRef cgContext, const HIRect& inBoxRect, bool aIsMain);
|
2017-12-01 23:31:18 +00:00
|
|
|
void DrawResizer(CGContextRef cgContext, const HIRect& aRect, bool aIsRTL);
|
2018-11-30 10:46:48 +00:00
|
|
|
void DrawMultilineTextField(CGContextRef cgContext, const CGRect& inBoxRect, bool aIsFocused);
|
|
|
|
void DrawSourceList(CGContextRef cgContext, const CGRect& inBoxRect, bool aIsActive);
|
2020-06-09 16:26:33 +00:00
|
|
|
void DrawSourceListSelection(CGContextRef aContext, const CGRect& aRect, bool aWindowIsActive,
|
|
|
|
bool aSelectionIsActive);
|
2008-09-16 08:21:06 +00:00
|
|
|
|
2018-11-30 10:46:48 +00:00
|
|
|
void RenderWidget(const WidgetInfo& aWidgetInfo, mozilla::gfx::DrawTarget& aDrawTarget,
|
|
|
|
const mozilla::gfx::Rect& aWidgetRect, const mozilla::gfx::Rect& aDirtyRect,
|
2017-11-18 23:53:54 +00:00
|
|
|
float aScale);
|
|
|
|
|
2018-11-30 10:46:48 +00:00
|
|
|
private:
|
2014-11-01 16:13:27 +00:00
|
|
|
NSButtonCell* mDisclosureButtonCell;
|
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;
|
2018-04-13 22:19:32 +00:00
|
|
|
NSSearchFieldCell* mSearchFieldCell;
|
|
|
|
NSSearchFieldCell* mToolbarSearchFieldCell;
|
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
|
|
|
|
2018-11-30 10:46:48 +00:00
|
|
|
#endif // nsNativeThemeCocoa_h_
|