author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Mon, 04 Oct 2010 01:19:32 +0300 | |
changeset 37 | 758a864f9613 |
parent 33 | 3e2da88830cd |
permissions | -rw-r--r-- |
0 | 1 |
/**************************************************************************** |
2 |
** |
|
18
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
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 |
#ifndef QAPPLICATION_P_H |
|
43 |
#define QAPPLICATION_P_H |
|
44 |
||
45 |
// |
|
46 |
// W A R N I N G |
|
47 |
// ------------- |
|
48 |
// |
|
49 |
// This file is not part of the Qt API. It exists for the convenience |
|
50 |
// of qapplication_*.cpp, qwidget*.cpp, qcolor_x11.cpp, qfiledialog.cpp |
|
51 |
// and many other. This header file may change from version to version |
|
52 |
// without notice, or even be removed. |
|
53 |
// |
|
54 |
// We mean it. |
|
55 |
// |
|
56 |
||
57 |
#include "QtGui/qapplication.h" |
|
58 |
#include "QtGui/qevent.h" |
|
59 |
#include "QtGui/qfont.h" |
|
60 |
#include "QtGui/qcursor.h" |
|
61 |
#include "QtGui/qregion.h" |
|
62 |
#include "QtCore/qmutex.h" |
|
63 |
#include "QtCore/qtranslator.h" |
|
64 |
#include "QtCore/qbasictimer.h" |
|
65 |
#include "QtCore/qhash.h" |
|
66 |
#include "QtCore/qpointer.h" |
|
67 |
#include "private/qcoreapplication_p.h" |
|
68 |
#include "private/qshortcutmap_p.h" |
|
69 |
#include <private/qthread_p.h> |
|
70 |
#ifdef Q_WS_QWS |
|
71 |
#include "QtGui/qscreen_qws.h" |
|
72 |
#include <private/qgraphicssystem_qws_p.h> |
|
73 |
#endif |
|
74 |
#ifdef Q_OS_SYMBIAN |
|
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
75 |
#include <w32std.h> |
0 | 76 |
#endif |
77 |
||
78 |
QT_BEGIN_NAMESPACE |
|
79 |
||
80 |
class QClipboard; |
|
81 |
class QGraphicsScene; |
|
82 |
class QGraphicsSystem; |
|
83 |
class QInputContext; |
|
84 |
class QObject; |
|
85 |
class QWidget; |
|
86 |
class QSocketNotifier; |
|
33
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
87 |
#ifndef QT_NO_GESTURES |
18
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
88 |
class QGestureManager; |
33
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
89 |
#endif |
0 | 90 |
|
91 |
extern bool qt_is_gui_used; |
|
92 |
#ifndef QT_NO_CLIPBOARD |
|
93 |
extern QClipboard *qt_clipboard; |
|
94 |
#endif |
|
95 |
||
96 |
#if defined (Q_OS_WIN32) || defined (Q_OS_CYGWIN) || defined(Q_OS_WINCE) |
|
97 |
extern QSysInfo::WinVersion qt_winver; |
|
98 |
enum { QT_TABLET_NPACKETQSIZE = 128 }; |
|
99 |
# ifdef Q_OS_WINCE |
|
100 |
extern DWORD qt_cever; |
|
101 |
# endif |
|
102 |
#elif defined (Q_OS_MAC) |
|
103 |
extern QSysInfo::MacVersion qt_macver; |
|
104 |
#endif |
|
105 |
#if defined(Q_WS_QWS) |
|
106 |
class QWSManager; |
|
107 |
class QDirectPainter; |
|
108 |
struct QWSServerCleaner { ~QWSServerCleaner(); }; |
|
109 |
#endif |
|
110 |
||
111 |
#ifndef QT_NO_TABLET |
|
112 |
struct QTabletDeviceData |
|
113 |
{ |
|
114 |
#ifndef Q_WS_MAC |
|
115 |
int minPressure; |
|
116 |
int maxPressure; |
|
117 |
int minTanPressure; |
|
118 |
int maxTanPressure; |
|
119 |
int minX, maxX, minY, maxY, minZ, maxZ; |
|
120 |
inline QPointF scaleCoord(int coordX, int coordY, int outOriginX, int outExtentX, |
|
121 |
int outOriginY, int outExtentY) const; |
|
122 |
#endif |
|
123 |
||
124 |
#if defined(Q_WS_X11) || (defined(Q_WS_MAC) && !defined(QT_MAC_USE_COCOA)) |
|
125 |
QPointer<QWidget> widgetToGetPress; |
|
126 |
#endif |
|
127 |
||
128 |
#ifdef Q_WS_X11 |
|
129 |
int deviceType; |
|
130 |
enum { |
|
131 |
TOTAL_XINPUT_EVENTS = 64 |
|
132 |
}; |
|
133 |
void *device; |
|
134 |
int eventCount; |
|
135 |
long unsigned int eventList[TOTAL_XINPUT_EVENTS]; // XEventClass is in fact a long unsigned int |
|
136 |
||
137 |
int xinput_motion; |
|
138 |
int xinput_key_press; |
|
139 |
int xinput_key_release; |
|
140 |
int xinput_button_press; |
|
141 |
int xinput_button_release; |
|
142 |
int xinput_proximity_in; |
|
143 |
int xinput_proximity_out; |
|
144 |
#elif defined(Q_WS_WIN) |
|
145 |
qint64 llId; |
|
146 |
int currentDevice; |
|
147 |
int currentPointerType; |
|
148 |
#elif defined(Q_WS_MAC) |
|
149 |
quint64 tabletUniqueID; |
|
150 |
int tabletDeviceType; |
|
151 |
int tabletPointerType; |
|
152 |
int capabilityMask; |
|
153 |
#endif |
|
154 |
}; |
|
155 |
||
156 |
static inline int sign(int x) |
|
157 |
{ |
|
158 |
return x >= 0 ? 1 : -1; |
|
159 |
} |
|
160 |
||
161 |
#ifndef Q_WS_MAC |
|
162 |
inline QPointF QTabletDeviceData::scaleCoord(int coordX, int coordY, |
|
163 |
int outOriginX, int outExtentX, |
|
164 |
int outOriginY, int outExtentY) const |
|
165 |
{ |
|
166 |
QPointF ret; |
|
167 |
||
168 |
if (sign(outExtentX) == sign(maxX)) |
|
169 |
ret.setX(((coordX - minX) * qAbs(outExtentX) / qAbs(qreal(maxX - minX))) + outOriginX); |
|
170 |
else |
|
171 |
ret.setX(((qAbs(maxX) - (coordX - minX)) * qAbs(outExtentX) / qAbs(qreal(maxX - minX))) |
|
172 |
+ outOriginX); |
|
173 |
||
174 |
if (sign(outExtentY) == sign(maxY)) |
|
175 |
ret.setY(((coordY - minY) * qAbs(outExtentY) / qAbs(qreal(maxY - minY))) + outOriginY); |
|
176 |
else |
|
177 |
ret.setY(((qAbs(maxY) - (coordY - minY)) * qAbs(outExtentY) / qAbs(qreal(maxY - minY))) |
|
178 |
+ outOriginY); |
|
179 |
||
180 |
return ret; |
|
181 |
} |
|
182 |
#endif |
|
183 |
||
184 |
typedef QList<QTabletDeviceData> QTabletDeviceDataList; |
|
185 |
QTabletDeviceDataList *qt_tablet_devices(); |
|
186 |
# if defined(Q_WS_MAC) |
|
187 |
typedef QHash<int, QTabletDeviceData> QMacTabletHash; |
|
188 |
QMacTabletHash *qt_mac_tablet_hash(); |
|
189 |
# endif |
|
190 |
#endif |
|
191 |
||
192 |
#ifdef QT3_SUPPORT |
|
193 |
extern "C" { |
|
194 |
typedef bool (*Ptrqt_tryAccelEvent)(QWidget *w, QKeyEvent *e); |
|
195 |
typedef bool (*Ptrqt_tryComposeUnicode)(QWidget *w, QKeyEvent *e); |
|
196 |
typedef bool (*Ptrqt_dispatchAccelEvent)(QWidget *w, QKeyEvent *e); |
|
197 |
} |
|
198 |
#endif |
|
199 |
||
200 |
#if defined(Q_WS_WIN) |
|
201 |
typedef BOOL (WINAPI *PtrRegisterTouchWindow)(HWND, ULONG); |
|
202 |
typedef BOOL (WINAPI *PtrGetTouchInputInfo)(HANDLE, UINT, PVOID, int); |
|
203 |
typedef BOOL (WINAPI *PtrCloseTouchInputHandle)(HANDLE); |
|
204 |
||
33
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
205 |
#ifndef QT_NO_GESTURES |
0 | 206 |
typedef BOOL (WINAPI *PtrGetGestureInfo)(HANDLE, PVOID); |
207 |
typedef BOOL (WINAPI *PtrGetGestureExtraArgs)(HANDLE, UINT, PBYTE); |
|
208 |
typedef BOOL (WINAPI *PtrCloseGestureInfoHandle)(HANDLE); |
|
209 |
typedef BOOL (WINAPI *PtrSetGestureConfig)(HWND, DWORD, UINT, PVOID, UINT); |
|
210 |
typedef BOOL (WINAPI *PtrGetGestureConfig)(HWND, DWORD, DWORD, PUINT, PVOID, UINT); |
|
211 |
||
212 |
typedef BOOL (WINAPI *PtrBeginPanningFeedback)(HWND); |
|
213 |
typedef BOOL (WINAPI *PtrUpdatePanningFeedback)(HWND, LONG, LONG, BOOL); |
|
214 |
typedef BOOL (WINAPI *PtrEndPanningFeedback)(HWND, BOOL); |
|
215 |
||
216 |
#ifndef WM_GESTURE |
|
217 |
# define WM_GESTURE 0x0119 |
|
218 |
||
219 |
# define GID_BEGIN 1 |
|
220 |
# define GID_END 2 |
|
221 |
# define GID_ZOOM 3 |
|
222 |
# define GID_PAN 4 |
|
223 |
# define GID_ROTATE 5 |
|
224 |
# define GID_TWOFINGERTAP 6 |
|
225 |
# define GID_ROLLOVER 7 |
|
226 |
||
227 |
typedef struct tagGESTUREINFO |
|
228 |
{ |
|
229 |
UINT cbSize; |
|
230 |
DWORD dwFlags; |
|
231 |
DWORD dwID; |
|
232 |
HWND hwndTarget; |
|
233 |
POINTS ptsLocation; |
|
234 |
DWORD dwInstanceID; |
|
235 |
DWORD dwSequenceID; |
|
236 |
ULONGLONG ullArguments; |
|
237 |
UINT cbExtraArgs; |
|
238 |
} GESTUREINFO; |
|
239 |
||
240 |
# define GC_PAN 0x00000001 |
|
241 |
# define GC_PAN_WITH_SINGLE_FINGER_VERTICALLY 0x00000002 |
|
242 |
# define GC_PAN_WITH_SINGLE_FINGER_HORIZONTALLY 0x00000004 |
|
243 |
||
244 |
# define GC_ZOOM 0x00000001 |
|
245 |
# define GC_ROTATE 0x00000001 |
|
246 |
||
247 |
typedef struct tagGESTURECONFIG |
|
248 |
{ |
|
249 |
DWORD dwID; |
|
250 |
DWORD dwWant; |
|
251 |
DWORD dwBlock; |
|
252 |
} GESTURECONFIG; |
|
253 |
||
254 |
# define GID_ROTATE_ANGLE_FROM_ARGUMENT(arg) ((((double)(arg) / 65535.0) * 4.0 * 3.14159265) - 2.0*3.14159265) |
|
255 |
||
256 |
#endif // WM_GESTURE |
|
257 |
||
258 |
#if defined(Q_WS_WINCE_WM) && defined(QT_WINCE_GESTURES) |
|
259 |
#undef GID_ZOOM |
|
260 |
#define GID_ZOOM 0xf000 |
|
261 |
#undef GID_ROTATE |
|
262 |
#define GID_ROTATE 0xf001 |
|
263 |
#undef GID_TWOFINGERTAP |
|
264 |
#define GID_TWOFINGERTAP 0xf002 |
|
265 |
#undef GID_ROLLOVER |
|
266 |
#define GID_ROLLOVER 0xf003 |
|
267 |
#endif |
|
268 |
||
33
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
269 |
#endif // QT_NO_GESTURES |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
270 |
|
0 | 271 |
#endif // Q_WS_WIN |
272 |
||
273 |
class QScopedLoopLevelCounter |
|
274 |
{ |
|
275 |
QThreadData *threadData; |
|
276 |
public: |
|
277 |
QScopedLoopLevelCounter(QThreadData *threadData) |
|
278 |
: threadData(threadData) |
|
279 |
{ ++threadData->loopLevel; } |
|
280 |
~QScopedLoopLevelCounter() |
|
281 |
{ --threadData->loopLevel; } |
|
282 |
}; |
|
283 |
||
284 |
typedef QHash<QByteArray, QFont> FontHash; |
|
285 |
FontHash *qt_app_fonts_hash(); |
|
286 |
||
287 |
typedef QHash<QByteArray, QPalette> PaletteHash; |
|
288 |
PaletteHash *qt_app_palettes_hash(); |
|
289 |
||
290 |
class Q_GUI_EXPORT QApplicationPrivate : public QCoreApplicationPrivate |
|
291 |
{ |
|
292 |
Q_DECLARE_PUBLIC(QApplication) |
|
293 |
public: |
|
294 |
QApplicationPrivate(int &argc, char **argv, QApplication::Type type); |
|
295 |
~QApplicationPrivate(); |
|
296 |
||
297 |
#if defined(Q_WS_X11) |
|
298 |
#ifndef QT_NO_SETTINGS |
|
299 |
static bool x11_apply_settings(); |
|
300 |
#endif |
|
301 |
static void reset_instance_pointer(); |
|
302 |
#elif defined(Q_WS_QWS) |
|
303 |
static bool qws_apply_settings(); |
|
304 |
static QWidget *findWidget(const QObjectList&, const QPoint &, bool rec); |
|
305 |
#endif |
|
306 |
static bool quitOnLastWindowClosed; |
|
307 |
static void emitLastWindowClosed(); |
|
308 |
#ifdef Q_WS_WINCE |
|
309 |
static int autoMaximizeThreshold; |
|
310 |
#endif |
|
311 |
static bool autoSipEnabled; |
|
312 |
static QString desktopStyleKey(); |
|
313 |
||
314 |
static QGraphicsSystem *graphicsSystem() |
|
315 |
#if !defined(Q_WS_QWS) |
|
316 |
{ return graphics_system; } |
|
317 |
#else |
|
318 |
{ return QScreen::instance()->graphicsSystem(); } |
|
319 |
#endif |
|
320 |
||
321 |
void createEventDispatcher(); |
|
322 |
QString appName() const; |
|
323 |
static void dispatchEnterLeave(QWidget *enter, QWidget *leave); |
|
324 |
||
325 |
//modality |
|
326 |
static void enterModal(QWidget*); |
|
327 |
static void leaveModal(QWidget*); |
|
328 |
static void enterModal_sys(QWidget*); |
|
329 |
static void leaveModal_sys(QWidget*); |
|
330 |
static bool isBlockedByModal(QWidget *widget); |
|
331 |
static bool modalState(); |
|
332 |
static bool tryModalHelper(QWidget *widget, QWidget **rettop = 0); |
|
333 |
#ifdef Q_WS_MAC |
|
334 |
static QWidget *tryModalHelper_sys(QWidget *top); |
|
335 |
bool canQuit(); |
|
336 |
#endif |
|
337 |
||
338 |
bool notify_helper(QObject *receiver, QEvent * e); |
|
339 |
||
340 |
void construct( |
|
341 |
#ifdef Q_WS_X11 |
|
342 |
Display *dpy = 0, Qt::HANDLE visual = 0, Qt::HANDLE cmap = 0 |
|
343 |
#endif |
|
344 |
); |
|
345 |
void initialize(); |
|
346 |
void process_cmdline(); |
|
347 |
||
348 |
#if defined(Q_WS_X11) |
|
349 |
static void x11_initialize_style(); |
|
350 |
#endif |
|
351 |
||
352 |
enum KeyPlatform { |
|
353 |
KB_Win = 1, |
|
354 |
KB_Mac = 2, |
|
355 |
KB_X11 = 4, |
|
356 |
KB_KDE = 8, |
|
357 |
KB_Gnome = 16, |
|
358 |
KB_CDE = 32, |
|
359 |
KB_S60 = 64, |
|
360 |
KB_All = 0xffff |
|
361 |
}; |
|
362 |
||
363 |
static uint currentPlatform(); |
|
364 |
bool inPopupMode() const; |
|
365 |
void closePopup(QWidget *popup); |
|
366 |
void openPopup(QWidget *popup); |
|
367 |
static void setFocusWidget(QWidget *focus, Qt::FocusReason reason); |
|
368 |
static QWidget *focusNextPrevChild_helper(QWidget *toplevel, bool next); |
|
369 |
||
370 |
#ifndef QT_NO_SESSIONMANAGER |
|
371 |
QSessionManager *session_manager; |
|
372 |
QString session_id; |
|
373 |
QString session_key; |
|
374 |
bool is_session_restored; |
|
375 |
#endif |
|
376 |
||
377 |
#ifndef QT_NO_CURSOR |
|
378 |
QList<QCursor> cursor_list; |
|
379 |
#endif |
|
380 |
#ifndef QT_NO_GRAPHICSVIEW |
|
381 |
// Maintain a list of all scenes to ensure font and palette propagation to |
|
382 |
// all scenes. |
|
383 |
QList<QGraphicsScene *> scene_list; |
|
384 |
#endif |
|
385 |
||
386 |
QBasicTimer toolTipWakeUp, toolTipFallAsleep; |
|
387 |
QPoint toolTipPos, toolTipGlobalPos, hoverGlobalPos; |
|
388 |
QPointer<QWidget> toolTipWidget; |
|
389 |
#ifndef QT_NO_SHORTCUT |
|
390 |
QShortcutMap shortcutMap; |
|
391 |
#endif |
|
392 |
||
393 |
#ifdef QT3_SUPPORT |
|
394 |
bool qt_compat_used; |
|
395 |
bool qt_compat_resolved; |
|
396 |
Ptrqt_tryAccelEvent qt_tryAccelEvent; |
|
397 |
Ptrqt_tryComposeUnicode qt_tryComposeUnicode; |
|
398 |
Ptrqt_dispatchAccelEvent qt_dispatchAccelEvent; |
|
399 |
||
400 |
bool use_compat() { |
|
401 |
return qt_tryAccelEvent |
|
402 |
&& qt_tryComposeUnicode |
|
403 |
&& qt_dispatchAccelEvent; |
|
404 |
} |
|
405 |
#endif |
|
406 |
static QInputContext *inputContext; |
|
407 |
||
408 |
static Qt::MouseButtons mouse_buttons; |
|
409 |
static Qt::KeyboardModifiers modifier_buttons; |
|
410 |
||
411 |
static QSize app_strut; |
|
412 |
static QWidgetList *popupWidgets; |
|
413 |
static QStyle *app_style; |
|
414 |
static int app_cspec; |
|
415 |
static QPalette *app_pal; |
|
416 |
static QPalette *sys_pal; |
|
417 |
static QPalette *set_pal; |
|
418 |
static QGraphicsSystem *graphics_system; |
|
419 |
static QString graphics_system_name; |
|
33
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
420 |
static bool runtime_graphics_system; |
0 | 421 |
|
422 |
private: |
|
423 |
static QFont *app_font; // private for a reason! Always use QApplication::font() instead! |
|
424 |
public: |
|
425 |
static QFont *sys_font; |
|
426 |
static QFont *set_font; |
|
427 |
static QWidget *main_widget; |
|
428 |
static QWidget *focus_widget; |
|
429 |
static QWidget *hidden_focus_widget; |
|
430 |
static QWidget *active_window; |
|
431 |
static QIcon *app_icon; |
|
432 |
static bool obey_desktop_settings; |
|
433 |
static int cursor_flash_time; |
|
434 |
static int mouse_double_click_time; |
|
435 |
static int keyboard_input_time; |
|
18
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
436 |
#ifndef QT_NO_WHEELEVENT |
0 | 437 |
static int wheel_scroll_lines; |
18
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
438 |
#endif |
0 | 439 |
|
440 |
static bool animate_ui; |
|
441 |
static bool animate_menu; |
|
442 |
static bool animate_tooltip; |
|
443 |
static bool animate_combo; |
|
444 |
static bool fade_menu; |
|
445 |
static bool fade_tooltip; |
|
446 |
static bool animate_toolbox; |
|
447 |
static bool widgetCount; // Coupled with -widgetcount switch |
|
448 |
static bool load_testability; // Coupled with -testability switch |
|
449 |
#ifdef Q_WS_MAC |
|
450 |
static bool native_modal_dialog_active; |
|
451 |
#endif |
|
452 |
||
453 |
static void setSystemPalette(const QPalette &pal); |
|
454 |
static void setPalette_helper(const QPalette &palette, const char* className, bool clearWidgetPaletteHash); |
|
455 |
static void initializeWidgetPaletteHash(); |
|
456 |
static void setSystemFont(const QFont &font); |
|
457 |
||
458 |
#if defined(Q_WS_X11) |
|
459 |
static void applyX11SpecificCommandLineArguments(QWidget *main_widget); |
|
460 |
#elif defined(Q_WS_QWS) |
|
461 |
static void applyQWSSpecificCommandLineArguments(QWidget *main_widget); |
|
462 |
#endif |
|
463 |
||
464 |
#ifdef Q_WS_MAC |
|
465 |
static OSStatus globalEventProcessor(EventHandlerCallRef, EventRef, void *); |
|
466 |
static OSStatus globalAppleEventProcessor(const AppleEvent *, AppleEvent *, long); |
|
467 |
static OSStatus tabletProximityCallback(EventHandlerCallRef, EventRef, void *); |
|
30
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
468 |
#ifdef QT_MAC_USE_COCOA |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
469 |
static void qt_initAfterNSAppStarted(); |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
470 |
static void setupAppleEvents(); |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
471 |
static void updateOverrideCursor(); |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
472 |
static void disableUsageOfCursorRects(bool disable); |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
473 |
#endif |
0 | 474 |
static bool qt_mac_apply_settings(); |
475 |
#endif |
|
476 |
||
477 |
#ifdef Q_WS_QWS |
|
478 |
QPointer<QWSManager> last_manager; |
|
479 |
QWSServerCleaner qwsServerCleaner; |
|
480 |
# ifndef QT_NO_DIRECTPAINTER |
|
481 |
QMap<WId, QDirectPainter *> *directPainters; |
|
482 |
# endif |
|
483 |
QRect maxWindowRect(const QScreen *screen) const { return maxWindowRects[screen]; } |
|
484 |
void setMaxWindowRect(const QScreen *screen, int screenNo, const QRect &rect); |
|
485 |
void setScreenTransformation(QScreen *screen, int screenNo, int transformation); |
|
486 |
#endif |
|
487 |
||
488 |
static QApplicationPrivate *instance() { return self; } |
|
489 |
||
490 |
static QString styleOverride; |
|
491 |
||
492 |
static int app_compile_version; |
|
493 |
||
494 |
#ifdef QT_KEYPAD_NAVIGATION |
|
495 |
static QWidget *oldEditFocus; |
|
496 |
static Qt::NavigationMode navigationMode; |
|
497 |
#endif |
|
498 |
||
499 |
#if defined(Q_WS_MAC) || defined(Q_WS_X11) |
|
500 |
void _q_alertTimeOut(); |
|
501 |
QHash<QWidget *, QTimer *> alertTimerHash; |
|
502 |
#endif |
|
503 |
#ifndef QT_NO_STYLE_STYLESHEET |
|
504 |
static QString styleSheet; |
|
505 |
#endif |
|
506 |
static QPointer<QWidget> leaveAfterRelease; |
|
507 |
static QWidget *pickMouseReceiver(QWidget *candidate, const QPoint &globalPos, QPoint &pos, |
|
508 |
QEvent::Type type, Qt::MouseButtons buttons, |
|
509 |
QWidget *buttonDown, QWidget *alienWidget); |
|
510 |
static bool sendMouseEvent(QWidget *receiver, QMouseEvent *event, QWidget *alienWidget, |
|
511 |
QWidget *native, QWidget **buttonDown, QPointer<QWidget> &lastMouseReceiver, |
|
512 |
bool spontaneous = true); |
|
513 |
#ifdef Q_OS_SYMBIAN |
|
514 |
static void setNavigationMode(Qt::NavigationMode mode); |
|
515 |
static TUint resolveS60ScanCode(TInt scanCode, TUint keysym); |
|
516 |
QSet<WId> nativeWindows; |
|
517 |
||
18
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
518 |
int symbianProcessWsEvent(const QSymbianEvent *symbianEvent); |
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
519 |
int symbianHandleCommand(const QSymbianEvent *symbianEvent); |
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
520 |
int symbianResourceChange(const QSymbianEvent *symbianEvent); |
0 | 521 |
|
37
758a864f9613
Revision: 201037
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
522 |
void _q_aboutToQuit(); |
0 | 523 |
#endif |
30
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
524 |
#if defined(Q_WS_WIN) || defined(Q_WS_X11) || defined (Q_WS_QWS) || defined(Q_WS_MAC) |
0 | 525 |
void sendSyntheticEnterLeave(QWidget *widget); |
526 |
#endif |
|
527 |
||
33
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
528 |
#ifndef QT_NO_GESTURES |
18
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
529 |
QGestureManager *gestureManager; |
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
530 |
QWidget *gestureWidget; |
30
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
531 |
#if defined(Q_WS_X11) || defined(Q_WS_WIN) |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
532 |
QPixmap *move_cursor; |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
533 |
QPixmap *copy_cursor; |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
534 |
QPixmap *link_cursor; |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
535 |
#endif |
33
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
536 |
#endif |
30
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
537 |
#if defined(Q_WS_WIN) |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
538 |
QPixmap *ignore_cursor; |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
539 |
#endif |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
29
diff
changeset
|
540 |
QPixmap getPixmapCursor(Qt::CursorShape cshape); |
0 | 541 |
|
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
542 |
QMap<int, QWeakPointer<QWidget> > widgetForTouchPointId; |
0 | 543 |
QMap<int, QTouchEvent::TouchPoint> appCurrentTouchPoints; |
544 |
static void updateTouchPointsForWidget(QWidget *widget, QTouchEvent *touchEvent); |
|
545 |
void initializeMultitouch(); |
|
546 |
void initializeMultitouch_sys(); |
|
547 |
void cleanupMultitouch(); |
|
548 |
void cleanupMultitouch_sys(); |
|
549 |
int findClosestTouchPointId(const QPointF &screenPos); |
|
550 |
void appendTouchPoint(const QTouchEvent::TouchPoint &touchPoint); |
|
551 |
void removeTouchPoint(int touchPointId); |
|
552 |
static void translateRawTouchEvent(QWidget *widget, |
|
553 |
QTouchEvent::DeviceType deviceType, |
|
554 |
const QList<QTouchEvent::TouchPoint> &touchPoints); |
|
555 |
||
556 |
#if defined(Q_WS_WIN) |
|
19
fcece45ef507
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
557 |
static bool HasTouchSupport; |
0 | 558 |
static PtrRegisterTouchWindow RegisterTouchWindow; |
559 |
static PtrGetTouchInputInfo GetTouchInputInfo; |
|
560 |
static PtrCloseTouchInputHandle CloseTouchInputHandle; |
|
561 |
||
562 |
QHash<DWORD, int> touchInputIDToTouchPointID; |
|
563 |
bool translateTouchEvent(const MSG &msg); |
|
564 |
||
33
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
565 |
#ifndef QT_NO_GESTURES |
0 | 566 |
PtrGetGestureInfo GetGestureInfo; |
567 |
PtrGetGestureExtraArgs GetGestureExtraArgs; |
|
568 |
PtrCloseGestureInfoHandle CloseGestureInfoHandle; |
|
569 |
PtrSetGestureConfig SetGestureConfig; |
|
570 |
PtrGetGestureConfig GetGestureConfig; |
|
571 |
PtrBeginPanningFeedback BeginPanningFeedback; |
|
572 |
PtrUpdatePanningFeedback UpdatePanningFeedback; |
|
573 |
PtrEndPanningFeedback EndPanningFeedback; |
|
33
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
574 |
#endif // QT_NO_GESTURES |
0 | 575 |
#endif |
576 |
||
577 |
#ifdef QT_RX71_MULTITOUCH |
|
578 |
bool hasRX71MultiTouch; |
|
579 |
||
580 |
struct RX71TouchPointState { |
|
581 |
QSocketNotifier *socketNotifier; |
|
582 |
QTouchEvent::TouchPoint touchPoint; |
|
583 |
||
584 |
int minX, maxX, scaleX; |
|
585 |
int minY, maxY, scaleY; |
|
586 |
int minZ, maxZ; |
|
587 |
}; |
|
588 |
QList<RX71TouchPointState> allRX71TouchPoints; |
|
589 |
||
590 |
bool readRX71MultiTouchEvents(int deviceNumber); |
|
591 |
void fakeMouseEventFromRX71TouchEvent(); |
|
592 |
void _q_readRX71MultiTouchEvents(); |
|
593 |
#endif |
|
594 |
||
33
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
595 |
#if defined(Q_OS_SYMBIAN) |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
596 |
int pressureSupported; |
0 | 597 |
int maxTouchPressure; |
598 |
QList<QTouchEvent::TouchPoint> appAllTouchPoints; |
|
599 |
#endif |
|
600 |
||
601 |
private: |
|
602 |
#ifdef Q_WS_QWS |
|
603 |
QMap<const QScreen*, QRect> maxWindowRects; |
|
604 |
#endif |
|
605 |
||
606 |
#ifdef Q_OS_SYMBIAN |
|
37
758a864f9613
Revision: 201037
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
607 |
QHash<TInt, TUint> scanCodeCache; |
0 | 608 |
#endif |
609 |
||
610 |
static QApplicationPrivate *self; |
|
611 |
||
612 |
static void giveFocusAccordingToFocusPolicy(QWidget *w, |
|
613 |
Qt::FocusPolicy focusPolicy, |
|
614 |
Qt::FocusReason focusReason); |
|
615 |
static bool shouldSetFocus(QWidget *w, Qt::FocusPolicy policy); |
|
616 |
||
617 |
||
618 |
static bool isAlien(QWidget *); |
|
619 |
}; |
|
620 |
||
621 |
Q_GUI_EXPORT void qt_translateRawTouchEvent(QWidget *window, |
|
622 |
QTouchEvent::DeviceType deviceType, |
|
623 |
const QList<QTouchEvent::TouchPoint> &touchPoints); |
|
624 |
||
625 |
#if defined(Q_WS_WIN) |
|
626 |
extern void qt_win_set_cursor(QWidget *, bool); |
|
627 |
#elif defined(Q_WS_X11) |
|
628 |
extern void qt_x11_enforce_cursor(QWidget *, bool); |
|
629 |
extern void qt_x11_enforce_cursor(QWidget *); |
|
630 |
#elif defined(Q_OS_SYMBIAN) |
|
631 |
extern void qt_symbian_set_cursor(QWidget *, bool); |
|
632 |
#endif |
|
633 |
||
634 |
QT_END_NAMESPACE |
|
635 |
||
636 |
#endif // QAPPLICATION_P_H |