source: trunk/src/gui/painting/qpaintdevice_x11.cpp@ 564

Last change on this file since 564 was 561, checked in by Dmitry A. Kuminov, 15 years ago

trunk: Merged in qt 4.6.1 sources.

File size: 5.3 KB
Line 
1/****************************************************************************
2**
3** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
4** All rights reserved.
5** Contact: Nokia Corporation ([email protected])
6**
7** This file is part of the QtGui module of the Qt Toolkit.
8**
9** $QT_BEGIN_LICENSE:LGPL$
10** Commercial Usage
11** Licensees holding valid Qt Commercial licenses may use this file in
12** accordance with the Qt Commercial License Agreement provided with the
13** Software or, alternatively, in accordance with the terms contained in
14** a written agreement between you and Nokia.
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** GNU General Public License Usage
29** Alternatively, this file may be used under the terms of the GNU
30** General Public License version 3.0 as published by the Free Software
31** Foundation and appearing in the file LICENSE.GPL included in the
32** packaging of this file. Please review the following information to
33** ensure the GNU General Public License version 3.0 requirements will be
34** met: http://www.gnu.org/copyleft/gpl.html.
35**
36** If you have questions regarding the use of this file, please contact
37** Nokia at [email protected].
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
50QT_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
58Drawable 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*/
74const 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
88Display *QPaintDevice::x11Display() const
89{
90 return X11->display;
91}
92
93int QPaintDevice::x11Screen() const
94{
95 const QX11Info *info = qt_x11Info(this);
96 if (info)
97 return info->screen();
98 return QX11Info::appScreen();
99}
100
101void *QPaintDevice::x11Visual() const
102{
103 const QX11Info *info = qt_x11Info(this);
104 if (info)
105 return info->visual();
106 return QX11Info::appVisual();
107}
108
109int QPaintDevice::x11Depth() const
110{
111 const QX11Info *info = qt_x11Info(this);
112 if (info)
113 return info->depth();
114 return QX11Info::appDepth();
115}
116
117int QPaintDevice::x11Cells() const
118{
119 const QX11Info *info = qt_x11Info(this);
120 if (info)
121 return info->cells();
122 return QX11Info::appCells();
123}
124
125Qt::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
133bool QPaintDevice::x11DefaultColormap() const
134{
135 const QX11Info *info = qt_x11Info(this);
136 if (info)
137 return info->defaultColormap();
138 return QX11Info::appDefaultColormap();
139}
140
141bool QPaintDevice::x11DefaultVisual() const
142{
143 const QX11Info *info = qt_x11Info(this);
144 if (info)
145 return info->defaultVisual();
146 return QX11Info::appDefaultVisual();
147}
148
149void *QPaintDevice::x11AppVisual(int screen)
150{ return QX11Info::appVisual(screen); }
151
152Qt::HANDLE QPaintDevice::x11AppColormap(int screen)
153{ return QX11Info::appColormap(screen); }
154
155Display *QPaintDevice::x11AppDisplay()
156{ return QX11Info::display(); }
157
158int QPaintDevice::x11AppScreen()
159{ return QX11Info::appScreen(); }
160
161int QPaintDevice::x11AppDepth(int screen)
162{ return QX11Info::appDepth(screen); }
163
164int QPaintDevice::x11AppCells(int screen)
165{ return QX11Info::appCells(screen); }
166
167Qt::HANDLE QPaintDevice::x11AppRootWindow(int screen)
168{ return QX11Info::appRootWindow(screen); }
169
170bool QPaintDevice::x11AppDefaultColormap(int screen)
171{ return QX11Info::appDefaultColormap(screen); }
172
173bool QPaintDevice::x11AppDefaultVisual(int screen)
174{ return QX11Info::appDefaultVisual(screen); }
175
176void QPaintDevice::x11SetAppDpiX(int dpi, int screen)
177{
178 QX11Info::setAppDpiX(dpi, screen);
179}
180
181void QPaintDevice::x11SetAppDpiY(int dpi, int screen)
182{
183 QX11Info::setAppDpiY(dpi, screen);
184}
185
186int QPaintDevice::x11AppDpiX(int screen)
187{
188 return QX11Info::appDpiX(screen);
189}
190
191int QPaintDevice::x11AppDpiY(int screen)
192{
193 return QX11Info::appDpiY(screen);
194}
195#endif
196
197
198QT_END_NAMESPACE
Note: See TracBrowser for help on using the repository browser.