diff options
Diffstat (limited to 'src/plugins/platforms/cocoa/qcocoawindow.h')
-rw-r--r-- | src/plugins/platforms/cocoa/qcocoawindow.h | 93 |
1 files changed, 78 insertions, 15 deletions
diff --git a/src/plugins/platforms/cocoa/qcocoawindow.h b/src/plugins/platforms/cocoa/qcocoawindow.h index 452be90108..fe82edd618 100644 --- a/src/plugins/platforms/cocoa/qcocoawindow.h +++ b/src/plugins/platforms/cocoa/qcocoawindow.h @@ -52,19 +52,62 @@ QT_FORWARD_DECLARE_CLASS(QCocoaWindow) -@interface QNSWindow : NSWindow { - @public QCocoaWindow *m_cocoaPlatformWindow; +@class QNSWindowHelper; + +@protocol QNSWindowProtocol + +@property (nonatomic, readonly) QNSWindowHelper *helper; + +- (void)superSendEvent:(NSEvent *)theEvent; +- (void)closeAndRelease; + +@end + +typedef NSWindow<QNSWindowProtocol> QCocoaNSWindow; + +@interface QNSWindowHelper : NSObject +{ + QCocoaNSWindow *_window; + QCocoaWindow *_platformWindow; + BOOL _grabbingMouse; + BOOL _releaseOnMouseUp; +} + +@property (nonatomic, readonly) QCocoaNSWindow *window; +@property (nonatomic, readonly) QCocoaWindow *platformWindow; +@property (nonatomic) BOOL grabbingMouse; +@property (nonatomic) BOOL releaseOnMouseUp; + +- (id)initWithNSWindow:(QCocoaNSWindow *)window platformWindow:(QCocoaWindow *)platformWindow; +- (void)handleWindowEvent:(NSEvent *)theEvent; +- (void) clearWindow; + +@end + +@interface QNSWindow : NSWindow<QNSWindowProtocol> +{ + QNSWindowHelper *_helper; } -- (void)clearPlatformWindow; -- (BOOL)canBecomeKeyWindow; +@property (nonatomic, readonly) QNSWindowHelper *helper; + +- (id)initWithContentRect:(NSRect)contentRect + styleMask:(NSUInteger)windowStyle + qPlatformWindow:(QCocoaWindow *)qpw; + @end -@interface QNSPanel : NSPanel { - @public QCocoaWindow *m_cocoaPlatformWindow; +@interface QNSPanel : NSPanel<QNSWindowProtocol> +{ + QNSWindowHelper *_helper; } -- (void)clearPlatformWindow; -- (BOOL)canBecomeKeyWindow; + +@property (nonatomic, readonly) QNSWindowHelper *helper; + +- (id)initWithContentRect:(NSRect)contentRect + styleMask:(NSUInteger)windowStyle + qPlatformWindow:(QCocoaWindow *)qpw; + @end @class QNSWindowDelegate; @@ -100,6 +143,10 @@ public: void setGeometry(const QRect &rect); void setCocoaGeometry(const QRect &rect); + void clipChildWindows(); + void clipWindow(const NSRect &clipRect); + void show(bool becauseOfAncestor = false); + void hide(bool becauseOfAncestor = false); void setVisible(bool visible); void setWindowFlags(Qt::WindowFlags flags); void setWindowState(Qt::WindowState state); @@ -127,6 +174,8 @@ public: NSView *contentView() const; void setContentView(NSView *contentView); + QNSView *qtView() const; + NSWindow *nativeWindow() const; void setEmbeddedInForeignView(bool subwindow); @@ -141,6 +190,7 @@ public: NSInteger windowLevel(Qt::WindowFlags flags); NSUInteger windowStyleMask(Qt::WindowFlags flags); void setWindowShadow(Qt::WindowFlags flags); + void setWindowZoomButton(Qt::WindowFlags flags); void setCurrentContext(QCocoaGLContext *context); QCocoaGLContext *currentContext() const; @@ -159,6 +209,7 @@ public: void registerTouch(bool enable); void setContentBorderThickness(int topThickness, int bottomThickness); void applyContentBorderThickness(NSWindow *window); + void updateNSToolbar(); qreal devicePixelRatio() const; bool isWindowExposable(); @@ -167,16 +218,17 @@ public: void updateExposedGeometry(); QWindow *childWindowAt(QPoint windowPoint); protected: - // NSWindow handling. The QCocoaWindow/QNSView can either be displayed - // in an existing NSWindow or in one created by Qt. void recreateWindow(const QPlatformWindow *parentWindow); - NSWindow *createNSWindow(); - void setNSWindow(NSWindow *window); - void clearNSWindow(NSWindow *window); + QCocoaNSWindow *createNSWindow(); + void setNSWindow(QCocoaNSWindow *window); + + bool shouldUseNSPanel(); QRect windowGeometry() const; QCocoaWindow *parentCocoaWindow() const; void syncWindowState(Qt::WindowState newState); + void reinsertChildWindow(QCocoaWindow *child); + void removeChildWindow(QCocoaWindow *child); // private: public: // for QNSView @@ -185,13 +237,17 @@ public: // for QNSView NSView *m_contentView; QNSView *m_qtView; - NSWindow *m_nsWindow; + QCocoaNSWindow *m_nsWindow; + QCocoaWindow *m_forwardWindow; // TODO merge to one variable if possible bool m_contentViewIsEmbedded; // true if the m_contentView is actually embedded in a "foreign" NSView hiearchy bool m_contentViewIsToBeEmbedded; // true if the m_contentView is intended to be embedded in a "foreign" NSView hiearchy - QNSWindowDelegate *m_nsWindowDelegate; + QCocoaWindow *m_parentCocoaWindow; + bool m_isNSWindowChild; // this window is a non-top level QWindow with a NSWindow. + QList<QCocoaWindow *> m_childWindows; + Qt::WindowFlags m_windowFlags; Qt::WindowState m_synchedWindowState; Qt::WindowModality m_windowModality; @@ -211,6 +267,8 @@ public: // for QNSView QRect m_exposedGeometry; int m_registerTouchCount; bool m_resizableTransientParent; + bool m_hiddenByClipping; + bool m_hiddenByAncestor; static const int NoAlertRequest; NSInteger m_alertRequest; @@ -219,6 +277,11 @@ public: // for QNSView bool m_drawContentBorderGradient; int m_topContentBorderThickness; int m_bottomContentBorderThickness; + + // used by showFullScreen in fake mode + QRect m_normalGeometry; + Qt::WindowFlags m_oldWindowFlags; + NSApplicationPresentationOptions m_presentationOptions; }; QT_END_NAMESPACE |