diff options
Diffstat (limited to 'src/plugins/styles/mac/qmacstyle_mac_p_p.h')
-rw-r--r-- | src/plugins/styles/mac/qmacstyle_mac_p_p.h | 72 |
1 files changed, 35 insertions, 37 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..078509d551 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)) @@ -199,14 +177,32 @@ typedef void (^QCocoaDrawRectBlock)(CGContextRef, const CGRect &); return sizes[controlSize]; \ } while (false) -#if QT_CONFIG(pushbutton) -bool qt_mac_buttonIsRenderedFlat(const QPushButton *pushButton, const QStyleOptionButton *option); -#endif - 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(); @@ -235,6 +231,7 @@ public: // Utility functions void drawColorlessButton(const CGRect &macRect, HIThemeButtonDrawInfo *bdi, + const CocoaControl &cw, QPainter *p, const QStyleOption *opt) const; QSize pushButtonSizeFromContents(const QStyleOptionButton *btn) const; @@ -243,15 +240,14 @@ public: const HIThemeButtonDrawInfo *bdi) const; void initComboboxBdi(const QStyleOptionComboBox *combo, HIThemeButtonDrawInfo *bdi, + CocoaControl *cw, const QWidget *widget, const ThemeDrawState &tds) const; - static CGRect comboboxInnerBounds(const CGRect &outerBounds, int buttonKind); + static CGRect comboboxInnerBounds(const CGRect &outerBounds, const CocoaControl &cocoaWidget); static QRect comboboxEditBounds(const QRect &outerBounds, const HIThemeButtonDrawInfo &bdi); - static void drawCombobox(const CGRect &outerBounds, const HIThemeButtonDrawInfo &bdi, QPainter *p); - static void drawTableHeader(const CGRect &outerBounds, bool drawTopBorder, bool drawLeftBorder, - const HIThemeButtonDrawInfo &bdi, QPainter *p); + static void drawCombobox(const CGRect &outerBounds, const HIThemeButtonDrawInfo &bdi, const CocoaControl &cw, QPainter *p); bool contentFitsInPushButton(const QStyleOptionButton *btn, HIThemeButtonDrawInfo *bdi, ThemeButtonKind buttonKindToCheck) const; void initHIThemePushButton(const QStyleOptionButton *btn, const QWidget *widget, @@ -260,16 +256,18 @@ 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 resolveCurrentNSView(QWindow *window); + void drawNSViewInRect(CocoaControl widget, NSView *view, const QRect &rect, QPainter *p, bool isQWidget = true, DrawRectBlock drawRectBlock = nil) const; + void resolveCurrentNSView(QWindow *window) const; void drawFocusRing(QPainter *p, const QRect &targetRect, int hMargin, int vMargin, qreal radius = 0) const; @@ -283,9 +281,9 @@ public: mutable QPointer<QFocusFrame> focusWidget; QT_MANGLE_NAMESPACE(NotificationReceiver) *receiver; - NSView *backingStoreNSView; - mutable QHash<QCocoaWidget, NSView *> cocoaControls; - mutable QHash<QCocoaWidget, NSCell *> cocoaCells; + mutable NSView *backingStoreNSView; + mutable QHash<CocoaControl, NSView *> cocoaControls; + mutable QHash<CocoaControl, NSCell *> cocoaCells; QFont smallSystemFont; QFont miniSystemFont; |