summaryrefslogtreecommitdiffstats
path: root/src/plugins/styles/mac/qmacstyle_mac_p_p.h
diff options
context:
space:
mode:
authorGabriel de Dietrich <gabriel.dedietrich@qt.io>2017-11-07 11:35:46 +0700
committerGabriel de Dietrich <gabriel.dedietrich@qt.io>2017-11-15 19:04:46 +0000
commitd7dce54ba0c018c4db92a291d322167dcf308d75 (patch)
treeba662ff9c046eef535d756915781a6524cb94f80 /src/plugins/styles/mac/qmacstyle_mac_p_p.h
parent26986276531b7f0a3f950d4b3960d5302010d204 (diff)
QMacStyle: Rename Cocoa controls enum names
For easier sorting and grouping by actual Cocoa NSControl class. We also shorten the names and move the types inside QMacStylePrivate. Change-Id: Iac093fd359da66abd263aca841b870ea84337f50 Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
Diffstat (limited to 'src/plugins/styles/mac/qmacstyle_mac_p_p.h')
-rw-r--r--src/plugins/styles/mac/qmacstyle_mac_p_p.h56
1 files changed, 29 insertions, 27 deletions
diff --git a/src/plugins/styles/mac/qmacstyle_mac_p_p.h b/src/plugins/styles/mac/qmacstyle_mac_p_p.h
index 528edfcda1..9c38831c0a 100644
--- a/src/plugins/styles/mac/qmacstyle_mac_p_p.h
+++ b/src/plugins/styles/mac/qmacstyle_mac_p_p.h
@@ -167,28 +167,6 @@ QT_BEGIN_NAMESPACE
#define CT1(c) CT2(c, c)
#define CT2(c1, c2) ((uint(c1) << 16) | uint(c2))
-enum QCocoaWidgetKind {
- QCocoaBox, // QGroupBox
- QCocoaCheckBox,
- QCocoaComboBox, // Editable QComboBox
- QCocoaDisclosureButton, // Disclosure triangle, like in QTreeView
- QCocoaPopupButton, // Non-editable QComboBox
- QCocoaProgressIndicator,
- QCocoaIndeterminateProgressIndicator,
- QCocoaPullDownButton, // QPushButton with menu
- QCocoaPushButton,
- QCocoaRadioButton,
- QCocoaHorizontalScroller,
- QCocoaVerticalScroller,
- QCocoaHorizontalSlider,
- QCocoaVerticalSlider,
- QCocoaStepper // QSpinBox buttons
-};
-
-typedef QPair<QCocoaWidgetKind, QStyleHelper::WidgetSizePolicy> QCocoaWidget;
-
-typedef void (^QCocoaDrawRectBlock)(CGContextRef, const CGRect &);
-
#define SIZE(large, small, mini) \
(controlSize == QStyleHelper::SizeLarge ? (large) : controlSize == QStyleHelper::SizeSmall ? (small) : (mini))
@@ -207,6 +185,28 @@ class QMacStylePrivate : public QCommonStylePrivate
{
Q_DECLARE_PUBLIC(QMacStyle)
public:
+ enum CocoaControlType {
+ Box, // QGroupBox
+ Button_CheckBox,
+ Button_Disclosure, // Disclosure triangle, like in QTreeView
+ Button_PopupButton, // Non-editable QComboBox
+ Button_PullDown, // QPushButton with menu
+ Button_PushButton,
+ Button_RadioButton,
+ ComboBox, // Editable QComboBox
+ ProgressIndicator_Determinate,
+ ProgressIndicator_Indeterminate,
+ Scroller_Horizontal,
+ Scroller_Vertical,
+ Slider_Horizontal,
+ Slider_Vertical,
+ Stepper // QSpinBox buttons
+ };
+
+ typedef QPair<CocoaControlType, QStyleHelper::WidgetSizePolicy> CocoaControl;
+
+ typedef void (^DrawRectBlock)(CGContextRef, const CGRect &);
+
QMacStylePrivate();
~QMacStylePrivate();
@@ -260,15 +260,17 @@ public:
void setAutoDefaultButton(QObject *button) const;
- NSView *cocoaControl(QCocoaWidget widget) const;
- NSCell *cocoaCell(QCocoaWidget widget) const;
+ NSView *cocoaControl(CocoaControl widget) const;
+ NSCell *cocoaCell(CocoaControl widget) const;
+
+ static CocoaControl cocoaControlFromHIThemeButtonKind(ThemeButtonKind kind);
void setupNSGraphicsContext(CGContextRef cg, bool flipped) const;
void restoreNSGraphicsContext(CGContextRef cg) const;
void setupVerticalInvertedXform(CGContextRef cg, bool reverse, bool vertical, const CGRect &rect) const;
- void drawNSViewInRect(QCocoaWidget widget, NSView *view, const QRect &rect, QPainter *p, bool isQWidget = true, QCocoaDrawRectBlock drawRectBlock = nil) const;
+ void drawNSViewInRect(CocoaControl widget, NSView *view, const QRect &rect, QPainter *p, bool isQWidget = true, DrawRectBlock drawRectBlock = nil) const;
void resolveCurrentNSView(QWindow *window);
void drawFocusRing(QPainter *p, const QRect &targetRect, int hMargin, int vMargin, qreal radius = 0) const;
@@ -284,8 +286,8 @@ public:
mutable QPointer<QFocusFrame> focusWidget;
QT_MANGLE_NAMESPACE(NotificationReceiver) *receiver;
NSView *backingStoreNSView;
- mutable QHash<QCocoaWidget, NSView *> cocoaControls;
- mutable QHash<QCocoaWidget, NSCell *> cocoaCells;
+ mutable QHash<CocoaControl, NSView *> cocoaControls;
+ mutable QHash<CocoaControl, NSCell *> cocoaCells;
QFont smallSystemFont;
QFont miniSystemFont;