diff options
author | Morten Johan Sorvig <morten.sorvig@nokia.com> | 2011-12-16 13:12:39 +0100 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-03-14 23:02:12 +0100 |
commit | d6311a06515221e41edb69722b571080c08d11ce (patch) | |
tree | 68d67e7f76fe0a826a2b6237890dfe9e3117e228 /src/plugins/platforms/cocoa/qcocoawindow.h | |
parent | 439a78974576894b23bce0621e49ce4a593428a9 (diff) |
Cocoa: Improve basic window handling.
Refactor NSWindow creation into createNSWindow and
setNSWindow. This is necessary to support QMacNativeWidget
where we re-use an already created window.
Implement popup window handling. Make sure the window
is displayed correctly and closes when it should.
Take control over window activation in order to prevent
infinite loops involving the QtCreator "cmd-k" window.
Activation events are for now not sent to popup-type
windows.
There is now a different set of test failures: add
and remove some QEXPECT_FAILs.
Change-Id: I229761b59f90c9815b968eacc2cbc9c20cc5047e
Reviewed-by: Morten Johan Sørvig <morten.sorvig@nokia.com>
Diffstat (limited to 'src/plugins/platforms/cocoa/qcocoawindow.h')
-rw-r--r-- | src/plugins/platforms/cocoa/qcocoawindow.h | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/src/plugins/platforms/cocoa/qcocoawindow.h b/src/plugins/platforms/cocoa/qcocoawindow.h index ba56a8991d..8bdb5535d5 100644 --- a/src/plugins/platforms/cocoa/qcocoawindow.h +++ b/src/plugins/platforms/cocoa/qcocoawindow.h @@ -49,17 +49,17 @@ #include "qcocoaglcontext.h" #include "qnsview.h" +class QCocoaWindow; @interface QNSWindow : NSWindow { - + @public QCocoaWindow *m_cocoaPlatformWindow; } - (BOOL)canBecomeKeyWindow; - @end @interface QNSPanel : NSPanel { - + @public QCocoaWindow *m_cocoaPlatformWindow; } - (BOOL)canBecomeKeyWindow; @end @@ -93,6 +93,7 @@ public: void setGeometry(const QRect &rect); void setVisible(bool visible); + Qt::WindowFlags setWindowFlags(Qt::WindowFlags flags); void setWindowTitle(const QString &title); void raise(); void lower(); @@ -101,8 +102,11 @@ public: bool setMouseGrabEnabled(bool grab); WId winId() const; + void setParent(const QPlatformWindow *window); + NSView *contentView() const; + void windowWillMove(); void windowDidMove(); void windowDidResize(); void windowWillClose(); @@ -111,8 +115,12 @@ public: QCocoaGLContext *currentContext() const; protected: - void determineWindowClass(); - NSWindow *createWindow(); + // NSWindow handling. The QCocoaWindow/QNSView can either be displayed + // in an existing NSWindow or in one created by Qt. + NSWindow *createNSWindow(); + void setNSWindow(NSWindow *window); + void clearNSWindow(NSWindow *window); + QRect windowGeometry() const; QCocoaWindow *parentCocoaWindow() const; @@ -123,9 +131,9 @@ public: // for QNSView QNSView *m_contentView; QNSWindow *m_nsWindow; + Qt::WindowFlags m_windowFlags; + QPointer<QWindow> m_activePopupWindow; - quint32 m_windowAttributes; - quint32 m_windowClass; bool m_inConstructor; QCocoaGLContext *m_glContext; }; |