summaryrefslogtreecommitdiffstats
path: root/src/widgets/styles/qmacstyle_mac_p_p.h
diff options
context:
space:
mode:
authorGabriel de Dietrich <gabriel.dedietrich@digia.com>2014-09-24 18:04:02 +0200
committerGabriel de Dietrich <gabriel.dedietrich@digia.com>2014-09-29 13:39:06 +0200
commitee6e9cbf36a189a4f59851ea3b069560e823b4ef (patch)
treef7061d09d50c970f4b5a9c6f9d07ee5694c74f24 /src/widgets/styles/qmacstyle_mac_p_p.h
parent996054f5e65bc676aaea0743c2eacec51918e4aa (diff)
QMacStyle: Generalize Cocoa control rendering
So far, we were restricted by the values of ThemeButtonKind, which consist mostly of buttons. We want to generalize to other kind of controls when the time arrives. Already, QPushButton with pull- down menu is not possible to get from that enum, while its easy to get from NSPopupButton. Task-number: QTBUG-40833 Change-Id: I244c42c42ab595f4790050eb15ade70443e155b2 Reviewed-by: Morten Johan Sørvig <morten.sorvig@digia.com>
Diffstat (limited to 'src/widgets/styles/qmacstyle_mac_p_p.h')
-rw-r--r--src/widgets/styles/qmacstyle_mac_p_p.h16
1 files changed, 14 insertions, 2 deletions
diff --git a/src/widgets/styles/qmacstyle_mac_p_p.h b/src/widgets/styles/qmacstyle_mac_p_p.h
index e4aad113d0..8fdeab9163 100644
--- a/src/widgets/styles/qmacstyle_mac_p_p.h
+++ b/src/widgets/styles/qmacstyle_mac_p_p.h
@@ -93,6 +93,7 @@
#include <qlibrary.h>
#include <qdatetimeedit.h>
#include <qmath.h>
+#include <qpair.h>
#include <qset.h>
#include <QtWidgets/qgraphicsproxywidget.h>
#include <QtWidgets/qgraphicsview.h>
@@ -128,6 +129,17 @@ QT_BEGIN_NAMESPACE
enum QAquaWidgetSize { QAquaSizeLarge = 0, QAquaSizeSmall = 1, QAquaSizeMini = 2,
QAquaSizeUnknown = -1 };
+enum QCocoaWidgetKind {
+ QCocoaArrowButton, // Disclosure triangle, like in QTreeView
+ QCocoaCheckBox,
+ QCocoaComboBox, // Editable QComboBox
+ QCocoaPopupButton, // Non-editable QComboBox
+ QCocoaPushButton,
+ QCocoaRadioButton
+};
+
+typedef QPair<QCocoaWidgetKind, QAquaWidgetSize> QCocoaWidget;
+
#define SIZE(large, small, mini) \
(controlSize == QAquaSizeLarge ? (large) : controlSize == QAquaSizeSmall ? (small) : (mini))
@@ -195,7 +207,7 @@ public:
void setAutoDefaultButton(QObject *button) const;
- NSView *buttonOfKind(ThemeButtonKind kind, QPoint *offset) const;
+ NSView *cocoaControl(QCocoaWidget widget, QPoint *offset) const;
void drawNSViewInRect(NSView *view, const QRect &rect, QPainter *p) const;
void resolveCurrentNSView(QWindow *window);
@@ -219,7 +231,7 @@ public:
#endif
void *indicatorBranchButtonCell;
NSView *backingStoreNSView;
- QHash<ThemeButtonKind , NSView *> buttons;
+ QHash<QCocoaWidget, NSView *> cocoaControls;
};
QT_END_NAMESPACE