widget/qt/nsScreenQt.cpp

branch
TOR_BUG_9701
changeset 10
ac0c01689b40
equal deleted inserted replaced
-1:000000000000 0:83bb0b1962c7
1 /* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
4
5 #include <QColor>
6 #include <QRect>
7 #include <QGuiApplication>
8 #include <QTransform>
9 #include <QScreen>
10
11 #include "nsScreenQt.h"
12 #include "nsXULAppAPI.h"
13
14 nsScreenQt::nsScreenQt(int aScreen)
15 : mScreen(aScreen)
16 {
17 // nothing else to do. I guess we could cache a bunch of information
18 // here, but we want to ask the device at runtime in case anything
19 // has changed.
20 }
21
22 nsScreenQt::~nsScreenQt()
23 {
24 }
25
26 NS_IMETHODIMP
27 nsScreenQt::GetRect(int32_t *outLeft,int32_t *outTop,
28 int32_t *outWidth,int32_t *outHeight)
29 {
30 QRect r = QGuiApplication::screens()[mScreen]->geometry();
31
32 *outTop = r.x();
33 *outLeft = r.y();
34 *outWidth = r.width();
35 *outHeight = r.height();
36
37 return NS_OK;
38 }
39
40 NS_IMETHODIMP
41 nsScreenQt::GetAvailRect(int32_t *outLeft,int32_t *outTop,
42 int32_t *outWidth,int32_t *outHeight)
43 {
44 QRect r = QGuiApplication::screens()[mScreen]->geometry();
45
46 *outTop = r.x();
47 *outLeft = r.y();
48 *outWidth = r.width();
49 *outHeight = r.height();
50
51 return NS_OK;
52 }
53
54 NS_IMETHODIMP
55 nsScreenQt::GetPixelDepth(int32_t *aPixelDepth)
56 {
57 // #############
58 *aPixelDepth = QGuiApplication::primaryScreen()->depth();
59 return NS_OK;
60 }
61
62 NS_IMETHODIMP
63 nsScreenQt::GetColorDepth(int32_t *aColorDepth)
64 {
65 // ###############
66 return GetPixelDepth(aColorDepth);
67 }

mercurial