author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Mon, 04 Oct 2010 01:19:32 +0300 | |
changeset 37 | 758a864f9613 |
parent 18 | 2f34d5167611 |
permissions | -rw-r--r-- |
0 | 1 |
/**************************************************************************** |
2 |
** |
|
18
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3 |
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). |
0 | 4 |
** All rights reserved. |
5 |
** Contact: Nokia Corporation (qt-info@nokia.com) |
|
6 |
** |
|
7 |
** This file is part of the QtGui module of the Qt Toolkit. |
|
8 |
** |
|
9 |
** $QT_BEGIN_LICENSE:LGPL$ |
|
10 |
** No Commercial Usage |
|
11 |
** This file contains pre-release code and may not be distributed. |
|
12 |
** You may use this file in accordance with the terms and conditions |
|
13 |
** contained in the Technology Preview License Agreement accompanying |
|
14 |
** this package. |
|
15 |
** |
|
16 |
** GNU Lesser General Public License Usage |
|
17 |
** Alternatively, this file may be used under the terms of the GNU Lesser |
|
18 |
** General Public License version 2.1 as published by the Free Software |
|
19 |
** Foundation and appearing in the file LICENSE.LGPL included in the |
|
20 |
** packaging of this file. Please review the following information to |
|
21 |
** ensure the GNU Lesser General Public License version 2.1 requirements |
|
22 |
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. |
|
23 |
** |
|
24 |
** In addition, as a special exception, Nokia gives you certain additional |
|
25 |
** rights. These rights are described in the Nokia Qt LGPL Exception |
|
26 |
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. |
|
27 |
** |
|
28 |
** If you have questions regarding the use of this file, please contact |
|
29 |
** Nokia at qt-info@nokia.com. |
|
30 |
** |
|
31 |
** |
|
32 |
** |
|
33 |
** |
|
34 |
** |
|
35 |
** |
|
36 |
** |
|
37 |
** |
|
38 |
** $QT_END_LICENSE$ |
|
39 |
** |
|
40 |
****************************************************************************/ |
|
41 |
||
42 |
#include "qpaintdevice.h" |
|
43 |
#include "qpainter.h" |
|
44 |
#include "qwidget.h" |
|
45 |
#include "qbitmap.h" |
|
46 |
#include "qapplication.h" |
|
47 |
#include <private/qt_x11_p.h> |
|
48 |
#include "qx11info_x11.h" |
|
49 |
||
50 |
QT_BEGIN_NAMESPACE |
|
51 |
||
52 |
/*! \internal |
|
53 |
||
54 |
Returns the X11 Drawable of the paint device. 0 is returned if it |
|
55 |
can't be obtained. |
|
56 |
*/ |
|
57 |
||
58 |
Drawable Q_GUI_EXPORT qt_x11Handle(const QPaintDevice *pd) |
|
59 |
{ |
|
60 |
if (!pd) return 0; |
|
61 |
if (pd->devType() == QInternal::Widget) |
|
62 |
return static_cast<const QWidget *>(pd)->handle(); |
|
63 |
else if (pd->devType() == QInternal::Pixmap) |
|
64 |
return static_cast<const QPixmap *>(pd)->handle(); |
|
65 |
return 0; |
|
66 |
} |
|
67 |
||
68 |
/*! |
|
69 |
\relates QPaintDevice |
|
70 |
||
71 |
Returns the QX11Info structure for the \a pd paint device. 0 is |
|
72 |
returned if it can't be obtained. |
|
73 |
*/ |
|
74 |
const Q_GUI_EXPORT QX11Info *qt_x11Info(const QPaintDevice *pd) |
|
75 |
{ |
|
76 |
if (!pd) return 0; |
|
77 |
if (pd->devType() == QInternal::Widget) |
|
78 |
return &static_cast<const QWidget *>(pd)->x11Info(); |
|
79 |
else if (pd->devType() == QInternal::Pixmap) |
|
80 |
return &static_cast<const QPixmap *>(pd)->x11Info(); |
|
81 |
return 0; |
|
82 |
} |
|
83 |
||
84 |
||
85 |
||
86 |
#ifdef QT3_SUPPORT |
|
87 |
||
88 |
Display *QPaintDevice::x11Display() const |
|
89 |
{ |
|
90 |
return X11->display; |
|
91 |
} |
|
92 |
||
93 |
int QPaintDevice::x11Screen() const |
|
94 |
{ |
|
95 |
const QX11Info *info = qt_x11Info(this); |
|
96 |
if (info) |
|
97 |
return info->screen(); |
|
98 |
return QX11Info::appScreen(); |
|
99 |
} |
|
100 |
||
101 |
void *QPaintDevice::x11Visual() const |
|
102 |
{ |
|
103 |
const QX11Info *info = qt_x11Info(this); |
|
104 |
if (info) |
|
105 |
return info->visual(); |
|
106 |
return QX11Info::appVisual(); |
|
107 |
} |
|
108 |
||
109 |
int QPaintDevice::x11Depth() const |
|
110 |
{ |
|
111 |
const QX11Info *info = qt_x11Info(this); |
|
112 |
if (info) |
|
113 |
return info->depth(); |
|
114 |
return QX11Info::appDepth(); |
|
115 |
} |
|
116 |
||
117 |
int QPaintDevice::x11Cells() const |
|
118 |
{ |
|
119 |
const QX11Info *info = qt_x11Info(this); |
|
120 |
if (info) |
|
121 |
return info->cells(); |
|
122 |
return QX11Info::appCells(); |
|
123 |
} |
|
124 |
||
125 |
Qt::HANDLE QPaintDevice::x11Colormap() const |
|
126 |
{ |
|
127 |
const QX11Info *info = qt_x11Info(this); |
|
128 |
if (info) |
|
129 |
return info->colormap(); |
|
130 |
return QX11Info::appColormap(); |
|
131 |
} |
|
132 |
||
133 |
bool QPaintDevice::x11DefaultColormap() const |
|
134 |
{ |
|
135 |
const QX11Info *info = qt_x11Info(this); |
|
136 |
if (info) |
|
137 |
return info->defaultColormap(); |
|
138 |
return QX11Info::appDefaultColormap(); |
|
139 |
} |
|
140 |
||
141 |
bool QPaintDevice::x11DefaultVisual() const |
|
142 |
{ |
|
143 |
const QX11Info *info = qt_x11Info(this); |
|
144 |
if (info) |
|
145 |
return info->defaultVisual(); |
|
146 |
return QX11Info::appDefaultVisual(); |
|
147 |
} |
|
148 |
||
149 |
void *QPaintDevice::x11AppVisual(int screen) |
|
150 |
{ return QX11Info::appVisual(screen); } |
|
151 |
||
152 |
Qt::HANDLE QPaintDevice::x11AppColormap(int screen) |
|
153 |
{ return QX11Info::appColormap(screen); } |
|
154 |
||
155 |
Display *QPaintDevice::x11AppDisplay() |
|
156 |
{ return QX11Info::display(); } |
|
157 |
||
158 |
int QPaintDevice::x11AppScreen() |
|
159 |
{ return QX11Info::appScreen(); } |
|
160 |
||
161 |
int QPaintDevice::x11AppDepth(int screen) |
|
162 |
{ return QX11Info::appDepth(screen); } |
|
163 |
||
164 |
int QPaintDevice::x11AppCells(int screen) |
|
165 |
{ return QX11Info::appCells(screen); } |
|
166 |
||
167 |
Qt::HANDLE QPaintDevice::x11AppRootWindow(int screen) |
|
168 |
{ return QX11Info::appRootWindow(screen); } |
|
169 |
||
170 |
bool QPaintDevice::x11AppDefaultColormap(int screen) |
|
171 |
{ return QX11Info::appDefaultColormap(screen); } |
|
172 |
||
173 |
bool QPaintDevice::x11AppDefaultVisual(int screen) |
|
174 |
{ return QX11Info::appDefaultVisual(screen); } |
|
175 |
||
176 |
void QPaintDevice::x11SetAppDpiX(int dpi, int screen) |
|
177 |
{ |
|
178 |
QX11Info::setAppDpiX(dpi, screen); |
|
179 |
} |
|
180 |
||
181 |
void QPaintDevice::x11SetAppDpiY(int dpi, int screen) |
|
182 |
{ |
|
183 |
QX11Info::setAppDpiY(dpi, screen); |
|
184 |
} |
|
185 |
||
186 |
int QPaintDevice::x11AppDpiX(int screen) |
|
187 |
{ |
|
188 |
return QX11Info::appDpiX(screen); |
|
189 |
} |
|
190 |
||
191 |
int QPaintDevice::x11AppDpiY(int screen) |
|
192 |
{ |
|
193 |
return QX11Info::appDpiY(screen); |
|
194 |
} |
|
195 |
#endif |
|
196 |
||
197 |
||
198 |
QT_END_NAMESPACE |