summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/cocoa/qcocoawindow.h
diff options
context:
space:
mode:
authorGabriel de Dietrich <gabriel.dedietrich@digia.com>2014-01-13 15:13:46 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-01-31 14:43:54 +0100
commit79fb39a87ce5ffbda22f297977b510e89ebf5485 (patch)
tree180994cd6c90ce5f88295207d845516be04fd3a4 /src/plugins/platforms/cocoa/qcocoawindow.h
parent2d576f79f748ca4c9bb54634f0fd44fa207a2248 (diff)
Cocoa: Merge QNSWindow and QNSPanel, inherit NSPanel
Since we will later have frameless NSWindow child QWindows, it makes sense to be able to keep and reuse the instantiated NSWindows in cases like QDockWidgets. If we keep these 2 different classes, it becomes impossible to morph one into the other. Task-number: QTBUG-33082 Change-Id: I351c628b887101b1cfd67689afbf689f119554de Reviewed-by: Morten Johan Sørvig <morten.sorvig@digia.com>
Diffstat (limited to 'src/plugins/platforms/cocoa/qcocoawindow.h')
-rw-r--r--src/plugins/platforms/cocoa/qcocoawindow.h47
1 files changed, 24 insertions, 23 deletions
diff --git a/src/plugins/platforms/cocoa/qcocoawindow.h b/src/plugins/platforms/cocoa/qcocoawindow.h
index c20773601d..18d512ce30 100644
--- a/src/plugins/platforms/cocoa/qcocoawindow.h
+++ b/src/plugins/platforms/cocoa/qcocoawindow.h
@@ -52,34 +52,32 @@
QT_FORWARD_DECLARE_CLASS(QCocoaWindow)
-@interface QNSWindow : NSWindow {
- @public QCocoaWindow *m_cocoaPlatformWindow;
-}
-
-- (void)clearPlatformWindow;
-- (BOOL)canBecomeKeyWindow;
-@end
+@class QNSWindowDelegate;
-@interface QNSPanel : NSPanel {
- @public QCocoaWindow *m_cocoaPlatformWindow;
+@interface QNSWindow : NSPanel {
+@public
+ QCocoaWindow *m_cocoaPlatformWindow;
}
+
- (void)clearPlatformWindow;
-- (BOOL)canBecomeKeyWindow;
@end
-@class QNSWindowDelegate;
-
QT_BEGIN_NAMESPACE
+
// QCocoaWindow
//
-// QCocoaWindow is an NSView (not an NSWindow!) in the sense
-// that it relies on a NSView for all event handling and
-// graphics output and does not require a NSWindow, except for
-// for the window-related functions like setWindowTitle.
+// A QCocoaWindow is backed by a NSView and optionally a NSWindow.
//
-// As a consequence of this it is possible to embed the QCocoaWindow
-// in an NSView hierarchy by getting a pointer to the "backing"
-// NSView and not calling QCocoaWindow::show():
+// The NSView is used for most event handling and graphics output.
+//
+// Top-level QWindows are always backed by a NSWindow in addition to
+// the NSView. Child QWindows can also be backed by NSWindows, which
+// enables proper stacking of GL Widgets and threaded GL rendering
+// to multiple contexts.
+//
+// It is possible to embed the QCocoaWindow in an NSView hierarchy
+// by getting a pointer to the backing NSView and not calling
+// QCocoaWindow::show():
//
// QWindow *qtWindow = new MyWindow();
// qtWindow->create();
@@ -135,6 +133,7 @@ public:
void windowDidResize();
bool windowShouldClose();
bool windowIsPopupType(Qt::WindowType type = Qt::Widget) const;
+ bool windowShouldBehaveAsPanel() const;
void setSynchedWindowStateFromWindow();
@@ -170,9 +169,9 @@ 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);
+ QNSWindow *createNSWindow();
+ void setNSWindow(QNSWindow *window);
+ void clearNSWindow(QNSWindow *window);
QRect windowGeometry() const;
QCocoaWindow *parentCocoaWindow() const;
@@ -185,12 +184,14 @@ public: // for QNSView
NSView *m_contentView;
QNSView *m_qtView;
- NSWindow *m_nsWindow;
+ QNSWindow *m_nsWindow;
// 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
+ QCocoaWindow *m_parentCocoaWindow;
+
QNSWindowDelegate *m_nsWindowDelegate;
Qt::WindowFlags m_windowFlags;
Qt::WindowState m_synchedWindowState;