diff options
Diffstat (limited to 'src/plugins/platforms/cocoa/qcocoahelpers.h')
-rw-r--r-- | src/plugins/platforms/cocoa/qcocoahelpers.h | 59 |
1 files changed, 27 insertions, 32 deletions
diff --git a/src/plugins/platforms/cocoa/qcocoahelpers.h b/src/plugins/platforms/cocoa/qcocoahelpers.h index ec2f7f8cf1..a2e0876073 100644 --- a/src/plugins/platforms/cocoa/qcocoahelpers.h +++ b/src/plugins/platforms/cocoa/qcocoahelpers.h @@ -55,6 +55,8 @@ #include <QtGui/qpalette.h> #include <QtGui/qscreen.h> +Q_FORWARD_DECLARE_OBJC_CLASS(QT_MANGLE_NAMESPACE(QNSView)); + QT_BEGIN_NAMESPACE Q_DECLARE_LOGGING_CATEGORY(lcQpaCocoaWindow) @@ -69,39 +71,15 @@ void *qt_mac_QStringListToNSMutableArrayVoid(const QStringList &list); inline NSMutableArray *qt_mac_QStringListToNSMutableArray(const QStringList &qstrlist) { return reinterpret_cast<NSMutableArray *>(qt_mac_QStringListToNSMutableArrayVoid(qstrlist)); } -NSImage *qt_mac_cgimage_to_nsimage(CGImageRef iamge); -NSImage *qt_mac_create_nsimage(const QPixmap &pm); -NSImage *qt_mac_create_nsimage(const QIcon &icon); -CGImageRef qt_mac_toCGImage(const QImage &qImage); -CGImageRef qt_mac_toCGImageMask(const QImage &qImage); -QImage qt_mac_toQImage(CGImageRef image); -QPixmap qt_mac_toQPixmap(const NSImage *image, const QSizeF &size); - -NSSize qt_mac_toNSSize(const QSize &qtSize); -NSRect qt_mac_toNSRect(const QRect &rect); -QRect qt_mac_toQRect(const NSRect &rect); - -QColor qt_mac_toQColor(const NSColor *color); -QColor qt_mac_toQColor(CGColorRef color); - -QBrush qt_mac_toQBrush(CGColorRef color); -QBrush qt_mac_toQBrush(const NSColor *color, QPalette::ColorGroup colorGroup = QPalette::Normal); - -// Creates a mutable shape, it's the caller's responsibility to release. -HIMutableShapeRef qt_mac_QRegionToHIMutableShape(const QRegion ®ion); - -OSStatus qt_mac_drawCGImage(CGContextRef inContext, const CGRect *inBounds, CGImageRef inImage); - NSDragOperation qt_mac_mapDropAction(Qt::DropAction action); NSDragOperation qt_mac_mapDropActions(Qt::DropActions actions); Qt::DropAction qt_mac_mapNSDragOperation(NSDragOperation nsActions); Qt::DropActions qt_mac_mapNSDragOperations(NSDragOperation nsActions); +QT_MANGLE_NAMESPACE(QNSView) *qnsview_cast(NSView *view); + // Misc void qt_mac_transformProccessToForegroundApplication(); -CGColorSpaceRef qt_mac_genericColorSpace(); -CGColorSpaceRef qt_mac_displayColorSpace(const QWidget *widget); -CGColorSpaceRef qt_mac_colorSpaceForDeviceType(const QPaintDevice *paintDevice); QString qt_mac_applicationName(); int qt_mac_flipYCoordinate(int y); @@ -114,10 +92,6 @@ NSRect qt_mac_flipRect(const QRect &rect); Qt::MouseButton cocoaButton2QtButton(NSInteger buttonNum); -bool qt_mac_execute_apple_script(const char *script, long script_len, AEDesc *ret); -bool qt_mac_execute_apple_script(const char *script, AEDesc *ret); -bool qt_mac_execute_apple_script(const QString &script, AEDesc *ret); - // strip out '&' characters, and convert "&&" to a single '&', in menu // text - since menu text is sometimes decorated with these for Windows // accelerators. @@ -151,8 +125,6 @@ public: } }; -CGContextRef qt_mac_cg_context(QPaintDevice *pdev); - template<typename T> T qt_mac_resolveOption(const T &fallback, const QByteArray &environment) { @@ -186,7 +158,30 @@ T qt_mac_resolveOption(const T &fallback, QWindow *window, const QByteArray &pro // return default value. return fallback; } + QT_END_NAMESPACE +@protocol QT_MANGLE_NAMESPACE(QNSPanelDelegate) +@required +- (void)onOkClicked; +- (void)onCancelClicked; +@end + +@interface QT_MANGLE_NAMESPACE(QNSPanelContentsWrapper) : NSView + +@property (nonatomic, readonly) NSButton *okButton; +@property (nonatomic, readonly) NSButton *cancelButton; +@property (nonatomic, readonly) NSView *panelContents; // ARC: unretained, make it weak +@property (nonatomic, assign) NSEdgeInsets panelContentsMargins; + +- (instancetype)initWithPanelDelegate:(id<QT_MANGLE_NAMESPACE(QNSPanelDelegate)>)panelDelegate; +- (void)dealloc; + +- (NSButton *)createButtonWithTitle:(const char *)title; +- (void)layout; +@end + +QT_NAMESPACE_ALIAS_OBJC_CLASS(QNSPanelContentsWrapper); + #endif //QCOCOAHELPERS_H |