Qt 4.8
qbbscreen.h
Go to the documentation of this file.
1 /****************************************************************************
2 **
3 ** Copyright (C) 2011 - 2012 Research In Motion <blackberry-qt@qnx.com>
4 ** Contact: http://www.qt-project.org/legal
5 **
6 ** This file is part of the QtCore module of the Qt Toolkit.
7 **
8 ** $QT_BEGIN_LICENSE:LGPL$
9 ** Commercial License Usage
10 ** Licensees holding valid commercial Qt licenses may use this file in
11 ** accordance with the commercial license agreement provided with the
12 ** Software or, alternatively, in accordance with the terms contained in
13 ** a written agreement between you and Digia. For licensing terms and
14 ** conditions see http://qt.digia.com/licensing. For further information
15 ** use the contact form at http://qt.digia.com/contact-us.
16 **
17 ** GNU Lesser General Public License Usage
18 ** Alternatively, this file may be used under the terms of the GNU Lesser
19 ** General Public License version 2.1 as published by the Free Software
20 ** Foundation and appearing in the file LICENSE.LGPL included in the
21 ** packaging of this file. Please review the following information to
22 ** ensure the GNU Lesser General Public License version 2.1 requirements
23 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
24 **
25 ** In addition, as a special exception, Digia gives you certain additional
26 ** rights. These rights are described in the Digia Qt LGPL Exception
27 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
28 **
29 ** GNU General Public License Usage
30 ** Alternatively, this file may be used under the terms of the GNU
31 ** General Public License version 3.0 as published by the Free Software
32 ** Foundation and appearing in the file LICENSE.GPL included in the
33 ** packaging of this file. Please review the following information to
34 ** ensure the GNU General Public License version 3.0 requirements will be
35 ** met: http://www.gnu.org/copyleft/gpl.html.
36 **
37 **
38 ** $QT_END_LICENSE$
39 **
40 ****************************************************************************/
41 
42 #ifndef QBBSCREEN_H
43 #define QBBSCREEN_H
44 
45 #include <QtGui/QPlatformScreen>
46 
47 #include "qbbrootwindow.h"
48 
49 #include <screen/screen.h>
50 
52 
53 class QBBWindow;
54 class QPlatformCursor;
55 
56 class QBBScreen : public QPlatformScreen
57 {
58  Q_OBJECT
59 public:
60  QBBScreen(screen_context_t context, screen_display_t display, int screenIndex);
61  virtual ~QBBScreen();
62 
63  virtual QRect geometry() const { return mCurrentGeometry; }
64  virtual QRect availableGeometry() const;
65  virtual int depth() const;
66  virtual QImage::Format format() const { return (depth() == 32) ? QImage::Format_RGB32 : QImage::Format_RGB16; }
67  virtual QSize physicalSize() const { return mCurrentPhysicalSize; }
68 
69  int rotation() const { return mCurrentRotation; }
70 
71  int nativeFormat() const { return (depth() == 32) ? SCREEN_FORMAT_RGBA8888 : SCREEN_FORMAT_RGB565; }
72  screen_display_t nativeDisplay() const { return mDisplay; }
73  screen_context_t nativeContext() const { return mContext; }
74  const char *windowGroupName() const { return mRootWindow->groupName().constData(); }
75 
76  QBBWindow *findWindow(screen_window_t windowHandle);
77 
78  /* Window hierarchy management */
79  void addWindow(QBBWindow* child);
80  void removeWindow(QBBWindow* child);
82  void lowerWindow(QBBWindow* window);
83  void updateHierarchy();
84 
85  void onWindowPost(QBBWindow* window);
86  void adjustOrientation();
87  void ensureDisplayCreated();
88 
90 
91  QPlatformCursor *cursor() const;
92 
93 public Q_SLOTS:
94  void setRotation(int rotation);
95  void newWindowCreated(screen_window_t window);
96  void windowClosed(screen_window_t window);
97  void windowGroupStateChanged(const QByteArray &id, Qt::WindowState state);
98  void activateWindowGroup(const QByteArray &id);
99  void deactivateWindowGroup(const QByteArray &id);
100 
101 private Q_SLOTS:
102  void keyboardHeightChanged(int height);
103 
104 private:
105  void resizeNativeWidgetWindow(QBBWindow *w, const QRect &previousScreenGeometry) const;
106  void resizeTopLevelWindow(QBBWindow *w, const QRect &previousScreenGeometry) const;
107  void resizeWindows(const QRect &previousScreenGeometry);
108  void addOverlayWindow(screen_window_t window);
109  void removeOverlayWindow(screen_window_t window);
110 
111  QWidget *topMostChildWindow() const;
112 
113  screen_context_t mContext;
114  screen_display_t mDisplay;
116  bool mPosted;
119 
127 
131 
133 
135 };
136 
138 
139 #endif // QBBSCREEN_H
QWidget * topMostChildWindow() const
Definition: qbbscreen.cpp:582
int nativeFormat() const
Definition: qbbscreen.h:71
QSharedPointer< QBBRootWindow > mRootWindow
Definition: qbbscreen.h:115
QPlatformCursor * cursor() const
Definition: qbbscreen.cpp:508
QSize mStartPhysicalSize
Definition: qbbscreen.h:123
void newWindowCreated(screen_window_t window)
Definition: qbbscreen.cpp:184
Format
The following image formats are available in Qt.
Definition: qimage.h:91
int mStartRotation
Definition: qbbscreen.h:120
#define QT_END_NAMESPACE
This macro expands to.
Definition: qglobal.h:90
void onWindowPost(QBBWindow *window)
Definition: qbbscreen.cpp:483
QSharedPointer< QBBRootWindow > rootWindow() const
Definition: qbbscreen.h:89
The QPlatformScreen class provides an abstraction for visual displays.
bool isPrimaryDisplay()
Definition: qbbscreen.h:134
screen_context_t nativeContext() const
Definition: qbbscreen.h:73
bool mPosted
Definition: qbbscreen.h:116
screen_context_t mContext
Definition: qbbscreen.h:113
void addOverlayWindow(screen_window_t window)
Definition: qbbscreen.cpp:523
The QByteArray class provides an array of bytes.
Definition: qbytearray.h:135
The QPlatformCursor class provides information about pointer device events (movement, buttons), and requests to change the currently displayed cursor.
void setRotation(int rotation)
Definition: qbbscreen.cpp:229
The QWidget class is the base class of all user interface objects.
Definition: qwidget.h:150
void resizeWindows(const QRect &previousScreenGeometry)
Adjust windows to the new screen geometry.
Definition: qbbscreen.cpp:372
void ensureDisplayCreated()
Definition: qbbscreen.cpp:178
int mScreenIndex
Definition: qbbscreen.h:130
bool mPrimaryDisplay
Definition: qbbscreen.h:118
void lowerWindow(QBBWindow *window)
Definition: qbbscreen.cpp:445
#define Q_SLOTS
Definition: qobjectdefs.h:71
int mCurrentRotation
Definition: qbbscreen.h:121
bool mUsingOpenGL
Definition: qbbscreen.h:117
NSWindow * window
void addWindow(QBBWindow *child)
Definition: qbbscreen.cpp:400
#define QT_BEGIN_NAMESPACE
This macro expands to.
Definition: qglobal.h:89
Q_GUI_EXPORT EGLDisplay display()
Definition: qegl.cpp:589
void raiseWindow(QBBWindow *window)
Definition: qbbscreen.cpp:434
const char * windowGroupName() const
Definition: qbbscreen.h:74
QRect mCurrentGeometry
Definition: qbbscreen.h:126
int rotation() const
Definition: qbbscreen.h:69
virtual int depth() const
Reimplement in subclass to return current depth of the screen.
Definition: qbbscreen.cpp:216
void removeOverlayWindow(screen_window_t window)
Definition: qbbscreen.cpp:529
void updateHierarchy()
Definition: qbbscreen.cpp:456
virtual QRect availableGeometry() const
Reimplement in subclass to return the pixel geometry of the available space This normally is the desk...
Definition: qbbscreen.cpp:209
virtual QRect geometry() const
Reimplement in subclass to return the pixel geometry of the screen.
Definition: qbbscreen.h:63
screen_display_t mDisplay
Definition: qbbscreen.h:114
QRect mStartGeometry
Definition: qbbscreen.h:125
#define Q_OBJECT
Definition: qobjectdefs.h:157
QByteArray groupName() const
Definition: qbbrootwindow.h:69
const char * constData() const
Returns a pointer to the data stored in the byte array.
Definition: qbytearray.h:433
screen_display_t nativeDisplay() const
Definition: qbbscreen.h:72
int mKeyboardHeight
Definition: qbbscreen.h:122
virtual QSize physicalSize() const
Reimplement this function in subclass to return the physical size of the screen.
Definition: qbbscreen.h:67
QSize mCurrentPhysicalSize
Definition: qbbscreen.h:124
void keyboardHeightChanged(int height)
Definition: qbbscreen.cpp:513
void adjustOrientation()
Definition: qbbscreen.cpp:496
QList< QBBWindow * > mChildren
Definition: qbbscreen.h:128
virtual QImage::Format format() const
Reimplement in subclass to return the image format which corresponds to the screen format...
Definition: qbbscreen.h:66
void removeWindow(QBBWindow *child)
Definition: qbbscreen.cpp:423
QPlatformCursor * mCursor
Definition: qbbscreen.h:132
The QRect class defines a rectangle in the plane using integer precision.
Definition: qrect.h:58
void resizeNativeWidgetWindow(QBBWindow *w, const QRect &previousScreenGeometry) const
Definition: qbbscreen.cpp:288
void activateWindowGroup(const QByteArray &id)
Definition: qbbscreen.cpp:553
void deactivateWindowGroup(const QByteArray &id)
Definition: qbbscreen.cpp:570
void windowGroupStateChanged(const QByteArray &id, Qt::WindowState state)
Definition: qbbscreen.cpp:536
QBBScreen(screen_context_t context, screen_display_t display, int screenIndex)
Definition: qbbscreen.cpp:108
The QSize class defines the size of a two-dimensional object using integer point precision.
Definition: qsize.h:53
void resizeTopLevelWindow(QBBWindow *w, const QRect &previousScreenGeometry) const
Resize the given window to fit the screen geometry.
Definition: qbbscreen.cpp:304
QBBWindow * findWindow(screen_window_t windowHandle)
Definition: qbbscreen.cpp:389
virtual ~QBBScreen()
Definition: qbbscreen.cpp:157
WindowState
Definition: qnamespace.h:366
void windowClosed(screen_window_t window)
Definition: qbbscreen.cpp:203
The QList class is a template class that provides lists.
Definition: qdatastream.h:62
QList< screen_window_t > mOverlays
Definition: qbbscreen.h:129