diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/gui/kernel/kernel.pri | 24 | ||||
-rw-r--r-- | src/gui/kernel/qplatformintegration_qpa.h | 7 | ||||
-rw-r--r-- | src/gui/kernel/qwindow_qpa.cpp | 305 | ||||
-rw-r--r-- | src/gui/kernel/qwindow_qpa.h | 136 | ||||
-rw-r--r-- | src/gui/kernel/qwindowformat_qpa.cpp (renamed from src/gui/kernel/qplatformwindowformat_qpa.cpp) | 0 | ||||
-rw-r--r-- | src/gui/kernel/qwindowformat_qpa.h (renamed from src/gui/kernel/qplatformwindowformat_qpa.h) | 80 |
6 files changed, 458 insertions, 94 deletions
diff --git a/src/gui/kernel/kernel.pri b/src/gui/kernel/kernel.pri index 3c57368bab..03313aa434 100644 --- a/src/gui/kernel/kernel.pri +++ b/src/gui/kernel/kernel.pri @@ -210,7 +210,7 @@ embedded { qpa { HEADERS += \ - kernel/qgenericpluginfactory_qpa.h \ + kernel/qgenericpluginfactory_qpa.h \ kernel/qgenericplugin_qpa.h \ kernel/qeventdispatcher_qpa_p.h \ kernel/qwindowsysteminterface_qpa.h \ @@ -226,17 +226,18 @@ qpa { kernel/qplatformeventloopintegration_qpa.h \ kernel/qplatformcursor_qpa.h \ kernel/qplatformclipboard_qpa.h \ - kernel/qplatformnativeinterface_qpa.h + kernel/qplatformnativeinterface_qpa.h \ + kernel/qwindow_qpa.cpp SOURCES += \ - kernel/qapplication_qpa.cpp \ - kernel/qclipboard_qpa.cpp \ - kernel/qcursor_qpa.cpp \ - kernel/qdnd_qws.cpp \ - kernel/qdesktopwidget_qpa.cpp \ - kernel/qgenericpluginfactory_qpa.cpp \ - kernel/qgenericplugin_qpa.cpp \ - kernel/qkeymapper_qws.cpp \ + kernel/qapplication_qpa.cpp \ + kernel/qclipboard_qpa.cpp \ + kernel/qcursor_qpa.cpp \ + kernel/qdnd_qws.cpp \ + kernel/qdesktopwidget_qpa.cpp \ + kernel/qgenericpluginfactory_qpa.cpp \ + kernel/qgenericplugin_qpa.cpp \ + kernel/qkeymapper_qws.cpp \ kernel/qwidget_qpa.cpp \ kernel/qeventdispatcher_qpa.cpp \ kernel/qwindowsysteminterface_qpa.cpp \ @@ -251,7 +252,8 @@ qpa { kernel/qplatformcursor_qpa.cpp \ kernel/qplatformclipboard_qpa.cpp \ kernel/qplatformnativeinterface_qpa.cpp \ - kernel/qsessionmanager_qpa.cpp + kernel/qsessionmanager_qpa.cpp \ + kernel/qwindow_qpa.cpp contains(QT_CONFIG, glib) { SOURCES += \ diff --git a/src/gui/kernel/qplatformintegration_qpa.h b/src/gui/kernel/qplatformintegration_qpa.h index d06272ce01..1517fc4fce 100644 --- a/src/gui/kernel/qplatformintegration_qpa.h +++ b/src/gui/kernel/qplatformintegration_qpa.h @@ -54,7 +54,7 @@ QT_BEGIN_NAMESPACE QT_MODULE(Gui) class QPlatformWindow; -class QWindowSurface; +class QWindow; class QBlittable; class QWidget; class QPlatformEventLoopIntegration; @@ -62,6 +62,7 @@ class QPlatformFontDatabase; class QPlatformClipboard; class QPlatformNativeInterface; + class Q_GUI_EXPORT QPlatformIntegration { public: @@ -76,8 +77,8 @@ public: // GraphicsSystem functions virtual QPixmapData *createPixmapData(QPixmapData::PixelType type) const = 0; - virtual QPlatformWindow *createPlatformWindow(QWidget *widget, WId winId = 0) const = 0; - virtual QWindowSurface *createWindowSurface(QWidget *widget, WId winId) const = 0; + virtual QPlatformWindow *createPlatformWindow(QWindow *window, const QWindowFormat &format) const = 0; + virtual QWindowSurface *createWindowSurface(QWindow *window, WId winId) const = 0; // Window System functions virtual QList<QPlatformScreen *> screens() const = 0; diff --git a/src/gui/kernel/qwindow_qpa.cpp b/src/gui/kernel/qwindow_qpa.cpp new file mode 100644 index 0000000000..ad5f22aaf9 --- /dev/null +++ b/src/gui/kernel/qwindow_qpa.cpp @@ -0,0 +1,305 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qwindow_qpa.h" + +#include "qplatformwindow_qpa.h" +#include "qwindowformat_qpa.h" + +#include "qapplication_p.h" + +#include <QtCore/QDebug> + +QT_BEGIN_NAMESPACE + +class QWindowPrivate : public QObjectPrivate{ + QWindowPrivate(const QWindowFormat &requestedFormat) + : QObjectPrivate() + , platformWindow(0) + , requestedFormat(requestedFormat) + , glContext(0) + { + + } + + ~QWindowPrivate() + { + + } + +private: + QPlatformWindow *platformWindow; + QWindowFormat requestedFormat; + QString windowTitle; + QRect geometry; + QGLContext *glContext; +}; + +QWindow::QWindow(const QWindowFormat &format, QWindow *parent) + : QObject(*new QWindowPrivate(format), parent) +{ + +} + +void QWindow::setVisible(bool visible) +{ + Q_D(QWindow); + if (!d->platformWindow) { + create(); + } + d->platformWindow->setVisible(visible); +} + +void QWindow::create() +{ + Q_D(QWindow); + d->platformWindow = QApplicationPrivate::platformIntegration()->createPlatformWindow(this,d->requestedFormat); + Q_ASSERT(d->platformWindow); +} + +WId QWindow::winId() const +{ + Q_D(QWindow); + if(d->platformWindow) { + return d->platformWindow->winId(); + } + return 0; +} + +void QWindow::setParent(const QWindow *parent) +{ + Q_D(QWindow); + //How should we support lazy init when setting parent + if (!parent->d_func()->platformWindow) { + parent->create(); + } + + if(!d->platformWindow) { + create(); + } + d->platformWindow->setParent(parent->d_func()->platformWindow); +} + +void QWindow::setWindowTitle(const QString &title) +{ + Q_D(QWindow); + d->windowTitle = title; + if (d->platformWindow) { + d->platformWindow->setWindowTitle(title); + } +} + +QString QWindow::windowTitle() const +{ + Q_D(const QWindow); + return d->windowTitle; +} + +void QWindow::raise() +{ + Q_D(QWindow); + if (d->platformWindow) { + d->platformWindow->raise(); + } +} + +void QWindow::lower() +{ + Q_D(QWindow); + if (d->platformWindow) { + d->platformWindow->lower(); + } +} + +void QWindow::setOpacity(qreal level) +{ + Q_D(QWindow); + if (d->platformWindow) { + d->platformWindow->setOpacity(level); + } +} + +void QWindow::requestActivateWindow() +{ + Q_D(QWindow); + if (d->platformWindow) { + d->platformWindow->requestActivateWindow(); + } +} + +Qt::WindowStates QWindow::windowState() const +{ + qDebug() << "unimplemented:" << __FILE__ << __LINE__; +} + +void QWindow::setWindowState(Qt::WindowStates state) +{ + qDebug() << "unimplemented:" << __FILE__ << __LINE__; +} + +QSize QWindow::minimumSize() const +{ + qDebug() << "unimplemented:" << __FILE__ << __LINE__; +} + +QSize QWindow::maximumSize() const +{ + qDebug() << "unimplemented:" << __FILE__ << __LINE__; +} + +void QWindow::setMinimumSize(const QSize &size) const +{ + qDebug() << "unimplemented:" << __FILE__ << __LINE__; +} + +void QWindow::setMaximumSize(const QSize &size) const +{ + qDebug() << "unimplemented:" << __FILE__ << __LINE__; +} + +void QWindow::setGeometry(const QRect &rect) +{ + Q_D(QWindow); + d->geometry = rect; + if (d->platformWindow) { + d->platformWindow->setGeometry(rect); + } +} + +QRect QWindow::geometry() const +{ + Q_D(const QWindow); + return d->geometry; +} + +void QWindow::setWindowIcon(const QImage &icon) const +{ + qDebug() << "unimplemented:" << __FILE__ << __LINE__; +} + +QGLContext * QWindow::glContext() const +{ + Q_D(QWindow); + return d->glContext; +} + +void QWindow::showMinimized() +{ + qDebug() << "unimplemented:" << __FILE__ << __LINE__; +} + +void QWindow::showMaximized() +{ + qDebug() << "unimplemented:" << __FILE__ << __LINE__; +} + +void QWindow::showFullScreen() +{ + qDebug() << "unimplemented:" << __FILE__ << __LINE__; +} + +void QWindow::showNormal() +{ + qDebug() << "unimplemented:" << __FILE__ << __LINE__; +} + +bool QWindow::close() +{ + //should we have close? + qDebug() << "unimplemented:" << __FILE__ << __LINE__; +} + +void QWindow::resizeEvent(QResizeEvent *) +{ + qDebug() << "unimplemented:" << __FILE__ << __LINE__; +} + +void QWindow::showEvent(QShowEvent *) +{ + qDebug() << "unimplemented:" << __FILE__ << __LINE__; +} + +void QWindow::hideEvent(QHideEvent *) +{ + qDebug() << "unimplemented:" << __FILE__ << __LINE__; +} + +bool QWindow::event(QEvent *) +{ + qDebug() << "unimplemented:" << __FILE__ << __LINE__; +} + +void QWindow::keyPressEvent(QKeyEvent *) +{ + +} + +void QWindow::keyReleaseEvent(QKeyEvent *) +{ +} + +void QWindow::inputMethodEvent(QInputMethodEvent *) +{ +} + +void QWindow::mousePressEvent(QMouseEvent *) +{ +} + +void QWindow::mouseReleaseEvent(QMouseEvent *) +{ +} + +void QWindow::mouseDoubleClickEvent(QMouseEvent *) +{ +} + +void QWindow::mouseMoveEvent(QMouseEvent *) +{ +} + +#ifndef QT_NO_WHEELEVENT +void QWindow::wheelEvent(QWheelEvent *) +{ +} +#endif //QT_NO_WHEELEVENT + +QT_END_NAMESPACE diff --git a/src/gui/kernel/qwindow_qpa.h b/src/gui/kernel/qwindow_qpa.h new file mode 100644 index 0000000000..62d8825236 --- /dev/null +++ b/src/gui/kernel/qwindow_qpa.h @@ -0,0 +1,136 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QWINDOW_QPA_H +#define QWINDOW_QPA_H + +#include <QObject> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +class QWindowPrivate; +class QGLContext; + +class Q_GUI_EXPORT QWindow : public QObject +{ + Q_OBJECT + Q_DECLARE_PRIVATE(QWindow) + + Q_PROPERTY(QString windowTitle READ windowTitle WRITE setWindowTitle) + +public: + QWindow(const QWindowFormat &format, QWindow *parent); + void setVisible(bool visible); + void create(); + + WId winId() const; + void setParent(const QWindow *parent); + + QString windowTitle() const; + + void setOpacity(qreal level); + void requestActivateWindow(); + + Qt::WindowStates windowState() const; + void setWindowState(Qt::WindowStates state); + + QSize minimumSize() const; + QSize maximumSize() const; + + void setMinimumSize(const QSize &size) const; + void setMaximumSize(const QSize &size) const; + + void setGeometry(const QRect &rect); + QRect geometry() const; + + void setWindowIcon(const QImage &icon) const; + + QGLContext *glContext() const; + +public Q_SLOTS: + inline void show() { setVisible(true); } + inline void hide() { setVisible(false); } + + void showMinimized(); + void showMaximized(); + void showFullScreen(); + void showNormal(); + + bool close(); + void raise(); + void lower(); + + void setWindowTitle(const QString &); + +Q_SIGNALS: + void backBufferReady(); + +protected: + virtual void resizeEvent(QResizeEvent *); + + virtual void showEvent(QShowEvent *); + virtual void hideEvent(QHideEvent *); + + virtual bool event(QEvent *); + virtual void keyPressEvent(QKeyEvent *); + virtual void keyReleaseEvent(QKeyEvent *); + virtual void inputMethodEvent(QInputMethodEvent *); + virtual void mousePressEvent(QMouseEvent *); + virtual void mouseReleaseEvent(QMouseEvent *); + virtual void mouseDoubleClickEvent(QMouseEvent *); + virtual void mouseMoveEvent(QMouseEvent *); +#ifndef QT_NO_WHEELEVENT + virtual void wheelEvent(QWheelEvent *); +#endif + +private: + Q_DISABLE_COPY(QWindow) +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QWINDOW_QPA_H diff --git a/src/gui/kernel/qplatformwindowformat_qpa.cpp b/src/gui/kernel/qwindowformat_qpa.cpp index c165c8513a..c165c8513a 100644 --- a/src/gui/kernel/qplatformwindowformat_qpa.cpp +++ b/src/gui/kernel/qwindowformat_qpa.cpp diff --git a/src/gui/kernel/qplatformwindowformat_qpa.h b/src/gui/kernel/qwindowformat_qpa.h index 427318ea28..b0989d70e9 100644 --- a/src/gui/kernel/qplatformwindowformat_qpa.h +++ b/src/gui/kernel/qwindowformat_qpa.h @@ -51,86 +51,6 @@ QT_MODULE(Gui) class QWindowFormatPrivate; -class QWindowPrivate; - -class Q_GUI_EXPORT QWindow : public QObject -{ - Q_OBJECT - Q_DECLARE_PRIVATE(QWindow) - - Q_PROPERTY(QString windowTitle READ windowTitle WRITE setWindowTitle) - -public: - void setVisible(bool visible); - - WId winId() const; - void setParent(const QWindow *window); - - void setWindowTitle(const QString &title); - void raise(); - void lower(); - - void setOpacity(qreal level); - void requestActivateWindow(); - - Qt::WindowStates windowState() const; - void setWindowState(Qt::WindowStates state); - - QSize minimumSize() const; - QSize maximumSize() const; - - void setMinimumSize(const QSize &size) const; - void setMaximumSize(const QSize &size) const; - - void setGeometry(const QRect &rect); - QRect geometry() const; - - QString windowTitle() const; - - void setWindowIcon(const QImage &icon) const; - - QGLContext *glContext() const; - -public Q_SLOTS: - inline void show() { setVisible(true); } - inline void hide() { setVisible(false); } - - void showMinimized(); - void showMaximized(); - void showFullScreen(); - void showNormal(); - - bool close(); - void raise(); - void lower(); - - void setWindowTitle(const QString &); - -Q_SIGNALS: - void backBufferReady(); - -protected: - virtual void resizeEvent(QResizeEvent *); - - virtual void showEvent(QShowEvent *); - virtual void hideEvent(QHideEvent *); - - virtual bool event(QEvent *); - virtual void keyPressEvent(QKeyEvent *); - virtual void keyReleaseEvent(QKeyEvent *); - virtual void inputMethodEvent(QInputMethodEvent *); - virtual void mousePressEvent(QMouseEvent *); - virtual void mouseReleaseEvent(QMouseEvent *); - virtual void mouseDoubleClickEvent(QMouseEvent *); - virtual void mouseMoveEvent(QMouseEvent *); -#ifndef QT_NO_WHEELEVENT - virtual void wheelEvent(QWheelEvent *); -#endif - -private: - Q_DISABLE_COPY(QWindow) -}; - class Q_GUI_EXPORT QWindowFormat { public: |