0
|
1 |
/****************************************************************************
|
|
2 |
**
|
4
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
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_H
|
|
43 |
#define QAPPLICATION_H
|
|
44 |
|
|
45 |
#include <QtCore/qcoreapplication.h>
|
|
46 |
#include <QtGui/qwindowdefs.h>
|
|
47 |
#include <QtCore/qpoint.h>
|
|
48 |
#include <QtCore/qsize.h>
|
|
49 |
#include <QtGui/qcursor.h>
|
|
50 |
#ifdef QT_INCLUDE_COMPAT
|
|
51 |
# include <QtGui/qdesktopwidget.h>
|
|
52 |
#endif
|
|
53 |
#ifdef QT3_SUPPORT
|
|
54 |
# include <QtGui/qwidget.h>
|
|
55 |
# include <QtGui/qpalette.h>
|
|
56 |
#endif
|
|
57 |
#ifdef Q_WS_QWS
|
|
58 |
# include <QtGui/qrgb.h>
|
|
59 |
# include <QtGui/qtransportauth_qws.h>
|
|
60 |
#endif
|
|
61 |
|
|
62 |
QT_BEGIN_HEADER
|
|
63 |
|
|
64 |
#if defined(Q_WS_S60)
|
|
65 |
class CApaApplication;
|
|
66 |
#endif
|
|
67 |
|
|
68 |
QT_BEGIN_NAMESPACE
|
|
69 |
|
|
70 |
QT_MODULE(Gui)
|
|
71 |
|
|
72 |
class QSessionManager;
|
|
73 |
class QDesktopWidget;
|
|
74 |
class QStyle;
|
|
75 |
class QEventLoop;
|
|
76 |
class QIcon;
|
|
77 |
class QInputContext;
|
|
78 |
template <typename T> class QList;
|
|
79 |
class QLocale;
|
|
80 |
#if defined(Q_WS_QWS)
|
|
81 |
class QDecoration;
|
|
82 |
#endif
|
|
83 |
#if defined(Q_OS_SYMBIAN)
|
|
84 |
class QSymbianEvent;
|
|
85 |
#endif
|
|
86 |
|
|
87 |
class QApplication;
|
|
88 |
class QApplicationPrivate;
|
|
89 |
#if defined(qApp)
|
|
90 |
#undef qApp
|
|
91 |
#endif
|
|
92 |
#define qApp (static_cast<QApplication *>(QCoreApplication::instance()))
|
|
93 |
|
|
94 |
|
|
95 |
class Q_GUI_EXPORT QApplication : public QCoreApplication
|
|
96 |
{
|
|
97 |
Q_OBJECT
|
|
98 |
Q_PROPERTY(Qt::LayoutDirection layoutDirection READ layoutDirection WRITE setLayoutDirection)
|
|
99 |
Q_PROPERTY(QIcon windowIcon READ windowIcon WRITE setWindowIcon)
|
|
100 |
Q_PROPERTY(int cursorFlashTime READ cursorFlashTime WRITE setCursorFlashTime)
|
|
101 |
Q_PROPERTY(int doubleClickInterval READ doubleClickInterval WRITE setDoubleClickInterval)
|
|
102 |
Q_PROPERTY(int keyboardInputInterval READ keyboardInputInterval WRITE setKeyboardInputInterval)
|
|
103 |
#ifndef QT_NO_WHEELEVENT
|
|
104 |
Q_PROPERTY(int wheelScrollLines READ wheelScrollLines WRITE setWheelScrollLines)
|
|
105 |
#endif
|
|
106 |
Q_PROPERTY(QSize globalStrut READ globalStrut WRITE setGlobalStrut)
|
|
107 |
Q_PROPERTY(int startDragTime READ startDragTime WRITE setStartDragTime)
|
|
108 |
Q_PROPERTY(int startDragDistance READ startDragDistance WRITE setStartDragDistance)
|
|
109 |
Q_PROPERTY(bool quitOnLastWindowClosed READ quitOnLastWindowClosed WRITE setQuitOnLastWindowClosed)
|
|
110 |
#ifndef QT_NO_STYLE_STYLESHEET
|
|
111 |
Q_PROPERTY(QString styleSheet READ styleSheet WRITE setStyleSheet)
|
|
112 |
#endif
|
|
113 |
#ifdef Q_WS_WINCE
|
|
114 |
Q_PROPERTY(int autoMaximizeThreshold READ autoMaximizeThreshold WRITE setAutoMaximizeThreshold)
|
|
115 |
#endif
|
|
116 |
Q_PROPERTY(bool autoSipEnabled READ autoSipEnabled WRITE setAutoSipEnabled)
|
|
117 |
|
|
118 |
public:
|
|
119 |
enum Type { Tty, GuiClient, GuiServer };
|
|
120 |
|
|
121 |
#ifdef Q_WS_S60
|
|
122 |
typedef CApaApplication * (*QS60MainApplicationFactory)();
|
|
123 |
#endif
|
|
124 |
|
|
125 |
#ifndef qdoc
|
|
126 |
QApplication(int &argc, char **argv, int = QT_VERSION);
|
|
127 |
QApplication(int &argc, char **argv, bool GUIenabled, int = QT_VERSION);
|
|
128 |
QApplication(int &argc, char **argv, Type, int = QT_VERSION);
|
|
129 |
#if defined(Q_WS_X11)
|
|
130 |
QApplication(Display* dpy, Qt::HANDLE visual = 0, Qt::HANDLE cmap = 0, int = QT_VERSION);
|
|
131 |
QApplication(Display *dpy, int &argc, char **argv, Qt::HANDLE visual = 0, Qt::HANDLE cmap= 0, int = QT_VERSION);
|
|
132 |
#endif
|
|
133 |
#if defined(Q_WS_S60)
|
|
134 |
QApplication(QApplication::QS60MainApplicationFactory factory, int &argc, char **argv, int = QT_VERSION);
|
|
135 |
#endif
|
|
136 |
#endif
|
|
137 |
virtual ~QApplication();
|
|
138 |
|
|
139 |
static Type type();
|
|
140 |
|
|
141 |
static QStyle *style();
|
|
142 |
static void setStyle(QStyle*);
|
|
143 |
static QStyle *setStyle(const QString&);
|
|
144 |
enum ColorSpec { NormalColor=0, CustomColor=1, ManyColor=2 };
|
|
145 |
static int colorSpec();
|
|
146 |
static void setColorSpec(int);
|
|
147 |
static void setGraphicsSystem(const QString &);
|
|
148 |
|
|
149 |
#ifndef QT_NO_CURSOR
|
|
150 |
static QCursor *overrideCursor();
|
|
151 |
static void setOverrideCursor(const QCursor &);
|
|
152 |
static void changeOverrideCursor(const QCursor &);
|
|
153 |
static void restoreOverrideCursor();
|
|
154 |
#endif
|
|
155 |
static QPalette palette();
|
|
156 |
static QPalette palette(const QWidget *);
|
|
157 |
static QPalette palette(const char *className);
|
|
158 |
static void setPalette(const QPalette &, const char* className = 0);
|
|
159 |
static QFont font();
|
|
160 |
static QFont font(const QWidget*);
|
|
161 |
static QFont font(const char *className);
|
|
162 |
static void setFont(const QFont &, const char* className = 0);
|
|
163 |
static QFontMetrics fontMetrics();
|
|
164 |
|
|
165 |
static void setWindowIcon(const QIcon &icon);
|
|
166 |
static QIcon windowIcon();
|
|
167 |
|
|
168 |
|
|
169 |
#ifdef QT3_SUPPORT
|
|
170 |
static QT3_SUPPORT QWidget *mainWidget();
|
|
171 |
static QT3_SUPPORT void setMainWidget(QWidget *);
|
|
172 |
#endif
|
|
173 |
|
|
174 |
static QWidgetList allWidgets();
|
|
175 |
static QWidgetList topLevelWidgets();
|
|
176 |
|
|
177 |
static QDesktopWidget *desktop();
|
|
178 |
|
|
179 |
static QWidget *activePopupWidget();
|
|
180 |
static QWidget *activeModalWidget();
|
|
181 |
#ifndef QT_NO_CLIPBOARD
|
|
182 |
static QClipboard *clipboard();
|
|
183 |
#endif
|
|
184 |
static QWidget *focusWidget();
|
|
185 |
|
|
186 |
static QWidget *activeWindow();
|
|
187 |
static void setActiveWindow(QWidget* act);
|
|
188 |
|
|
189 |
static QWidget *widgetAt(const QPoint &p);
|
|
190 |
static inline QWidget *widgetAt(int x, int y) { return widgetAt(QPoint(x, y)); }
|
|
191 |
static QWidget *topLevelAt(const QPoint &p);
|
|
192 |
static inline QWidget *topLevelAt(int x, int y) { return topLevelAt(QPoint(x, y)); }
|
|
193 |
|
|
194 |
static void syncX();
|
|
195 |
static void beep();
|
|
196 |
static void alert(QWidget *widget, int duration = 0);
|
|
197 |
|
|
198 |
static Qt::KeyboardModifiers keyboardModifiers();
|
|
199 |
static Qt::MouseButtons mouseButtons();
|
|
200 |
|
|
201 |
static void setDesktopSettingsAware(bool);
|
|
202 |
static bool desktopSettingsAware();
|
|
203 |
|
|
204 |
static void setCursorFlashTime(int);
|
|
205 |
static int cursorFlashTime();
|
|
206 |
|
|
207 |
static void setDoubleClickInterval(int);
|
|
208 |
static int doubleClickInterval();
|
|
209 |
|
|
210 |
static void setKeyboardInputInterval(int);
|
|
211 |
static int keyboardInputInterval();
|
|
212 |
|
|
213 |
#ifndef QT_NO_WHEELEVENT
|
|
214 |
static void setWheelScrollLines(int);
|
|
215 |
static int wheelScrollLines();
|
|
216 |
#endif
|
|
217 |
static void setGlobalStrut(const QSize &);
|
|
218 |
static QSize globalStrut();
|
|
219 |
|
|
220 |
static void setStartDragTime(int ms);
|
|
221 |
static int startDragTime();
|
|
222 |
static void setStartDragDistance(int l);
|
|
223 |
static int startDragDistance();
|
|
224 |
|
|
225 |
static void setLayoutDirection(Qt::LayoutDirection direction);
|
|
226 |
static Qt::LayoutDirection layoutDirection();
|
|
227 |
|
|
228 |
static inline bool isRightToLeft() { return layoutDirection() == Qt::RightToLeft; }
|
|
229 |
static inline bool isLeftToRight() { return layoutDirection() == Qt::LeftToRight; }
|
|
230 |
|
|
231 |
static bool isEffectEnabled(Qt::UIEffect);
|
|
232 |
static void setEffectEnabled(Qt::UIEffect, bool enable = true);
|
|
233 |
|
|
234 |
#if defined(Q_WS_MAC)
|
|
235 |
virtual bool macEventFilter(EventHandlerCallRef, EventRef);
|
|
236 |
#endif
|
|
237 |
#if defined(Q_WS_X11)
|
|
238 |
virtual bool x11EventFilter(XEvent *);
|
|
239 |
virtual int x11ClientMessage(QWidget*, XEvent*, bool passive_only);
|
|
240 |
int x11ProcessEvent(XEvent*);
|
|
241 |
#endif
|
|
242 |
#if defined(Q_OS_SYMBIAN)
|
|
243 |
int symbianProcessEvent(const QSymbianEvent *event);
|
|
244 |
virtual bool symbianEventFilter(const QSymbianEvent *event);
|
|
245 |
#endif
|
|
246 |
#if defined(Q_WS_QWS)
|
|
247 |
virtual bool qwsEventFilter(QWSEvent *);
|
|
248 |
int qwsProcessEvent(QWSEvent*);
|
|
249 |
void qwsSetCustomColors(QRgb *colortable, int start, int numColors);
|
|
250 |
#ifndef QT_NO_QWS_MANAGER
|
|
251 |
static QDecoration &qwsDecoration();
|
|
252 |
static void qwsSetDecoration(QDecoration *);
|
|
253 |
static QDecoration *qwsSetDecoration(const QString &decoration);
|
|
254 |
#endif
|
|
255 |
#endif
|
|
256 |
|
|
257 |
|
|
258 |
#if defined(Q_WS_WIN)
|
|
259 |
void winFocus(QWidget *, bool);
|
|
260 |
static void winMouseButtonUp();
|
|
261 |
#endif
|
|
262 |
#ifndef QT_NO_SESSIONMANAGER
|
|
263 |
// session management
|
|
264 |
bool isSessionRestored() const;
|
|
265 |
QString sessionId() const;
|
|
266 |
QString sessionKey() const;
|
|
267 |
virtual void commitData(QSessionManager& sm);
|
|
268 |
virtual void saveState(QSessionManager& sm);
|
|
269 |
#endif
|
|
270 |
void setInputContext(QInputContext *);
|
|
271 |
QInputContext *inputContext() const;
|
|
272 |
|
|
273 |
static QLocale keyboardInputLocale();
|
|
274 |
static Qt::LayoutDirection keyboardInputDirection();
|
|
275 |
|
|
276 |
static int exec();
|
|
277 |
bool notify(QObject *, QEvent *);
|
|
278 |
|
|
279 |
|
|
280 |
static void setQuitOnLastWindowClosed(bool quit);
|
|
281 |
static bool quitOnLastWindowClosed();
|
|
282 |
|
|
283 |
#ifdef QT_KEYPAD_NAVIGATION
|
|
284 |
static Q_DECL_DEPRECATED void setKeypadNavigationEnabled(bool);
|
|
285 |
static bool keypadNavigationEnabled();
|
|
286 |
static void setNavigationMode(Qt::NavigationMode mode);
|
|
287 |
static Qt::NavigationMode navigationMode();
|
|
288 |
#endif
|
|
289 |
|
|
290 |
Q_SIGNALS:
|
|
291 |
void lastWindowClosed();
|
|
292 |
void focusChanged(QWidget *old, QWidget *now);
|
|
293 |
void fontDatabaseChanged();
|
|
294 |
#ifndef QT_NO_SESSIONMANAGER
|
|
295 |
void commitDataRequest(QSessionManager &sessionManager);
|
|
296 |
void saveStateRequest(QSessionManager &sessionManager);
|
|
297 |
#endif
|
|
298 |
|
|
299 |
public:
|
|
300 |
QString styleSheet() const;
|
|
301 |
public Q_SLOTS:
|
|
302 |
#ifndef QT_NO_STYLE_STYLESHEET
|
|
303 |
void setStyleSheet(const QString& sheet);
|
|
304 |
#endif
|
|
305 |
#ifdef Q_WS_WINCE
|
|
306 |
void setAutoMaximizeThreshold(const int threshold);
|
|
307 |
int autoMaximizeThreshold() const;
|
|
308 |
#endif
|
|
309 |
void setAutoSipEnabled(const bool enabled);
|
|
310 |
bool autoSipEnabled() const;
|
|
311 |
static void closeAllWindows();
|
|
312 |
static void aboutQt();
|
|
313 |
|
|
314 |
protected:
|
|
315 |
#if defined(Q_WS_QWS)
|
|
316 |
void setArgs(int, char **);
|
|
317 |
#endif
|
|
318 |
bool event(QEvent *);
|
|
319 |
bool compressEvent(QEvent *, QObject *receiver, QPostEventList *);
|
|
320 |
|
|
321 |
#ifdef QT3_SUPPORT
|
|
322 |
public:
|
|
323 |
static inline QT3_SUPPORT void setReverseLayout(bool b) { setLayoutDirection(b?Qt::RightToLeft:Qt::LeftToRight); }
|
|
324 |
static inline bool QT3_SUPPORT reverseLayout() { return layoutDirection() == Qt::RightToLeft; }
|
|
325 |
static QT3_SUPPORT Qt::Alignment horizontalAlignment(Qt::Alignment align);
|
|
326 |
typedef int ColorMode;
|
|
327 |
enum { NormalColors = NormalColor, CustomColors = CustomColor };
|
|
328 |
static inline QT3_SUPPORT ColorMode colorMode() { return static_cast<ColorMode>(colorSpec()); }
|
|
329 |
static inline QT3_SUPPORT void setColorMode(ColorMode mode) { setColorSpec(int(mode)); }
|
|
330 |
#if defined(Q_OS_WIN32) || defined(Q_OS_CYGWIN)
|
|
331 |
static QT3_SUPPORT Qt::WindowsVersion winVersion() { return (Qt::WindowsVersion)QSysInfo::WindowsVersion; }
|
|
332 |
#endif
|
|
333 |
#if defined(Q_OS_MAC)
|
|
334 |
static QT3_SUPPORT Qt::MacintoshVersion macVersion() { return (Qt::MacintoshVersion)QSysInfo::MacintoshVersion; }
|
|
335 |
#endif
|
|
336 |
# ifndef QT_NO_CURSOR
|
|
337 |
inline static QT3_SUPPORT void setOverrideCursor(const QCursor &cursor, bool replace)
|
|
338 |
{ if (replace) changeOverrideCursor(cursor); else setOverrideCursor(cursor); }
|
|
339 |
# endif
|
|
340 |
inline static QT3_SUPPORT bool hasGlobalMouseTracking() {return true;}
|
|
341 |
inline static QT3_SUPPORT void setGlobalMouseTracking(bool) {}
|
|
342 |
inline static QT3_SUPPORT void flushX() { flush(); }
|
|
343 |
static inline QT3_SUPPORT void setWinStyleHighlightColor(const QColor &c) {
|
|
344 |
QPalette p(palette());
|
|
345 |
p.setColor(QPalette::Highlight, c);
|
|
346 |
setPalette(p);
|
|
347 |
}
|
|
348 |
static inline QT3_SUPPORT const QColor &winStyleHighlightColor()
|
|
349 |
{ return palette().color(QPalette::Active, QPalette::Highlight); }
|
|
350 |
static inline QT3_SUPPORT void setPalette(const QPalette &pal, bool, const char* className = 0)
|
|
351 |
{ setPalette(pal, className); }
|
|
352 |
static inline QT3_SUPPORT void setFont(const QFont &font, bool, const char* className = 0)
|
|
353 |
{ setFont(font, className); }
|
|
354 |
|
|
355 |
static inline QT3_SUPPORT QWidget *widgetAt(int x, int y, bool child)
|
|
356 |
{ QWidget *w = widgetAt(x, y); return child ? w : (w ? w->window() : 0); }
|
|
357 |
static inline QT3_SUPPORT QWidget *widgetAt(const QPoint &p, bool child)
|
|
358 |
{ QWidget *w = widgetAt(p); return child ? w : (w ? w->window() : 0); }
|
|
359 |
#endif // QT3_SUPPORT
|
|
360 |
|
|
361 |
#if defined(Q_INTERNAL_QAPP_SRC) || defined(qdoc)
|
|
362 |
QApplication(int &argc, char **argv);
|
|
363 |
QApplication(int &argc, char **argv, bool GUIenabled);
|
|
364 |
QApplication(int &argc, char **argv, Type);
|
|
365 |
#if defined(Q_WS_X11)
|
|
366 |
QApplication(Display* dpy, Qt::HANDLE visual = 0, Qt::HANDLE cmap = 0);
|
|
367 |
QApplication(Display *dpy, int &argc, char **argv, Qt::HANDLE visual = 0, Qt::HANDLE cmap= 0);
|
|
368 |
#endif
|
|
369 |
#if defined(Q_WS_S60) || defined(qdoc)
|
|
370 |
QApplication(QApplication::QS60MainApplicationFactory factory, int &argc, char **argv);
|
|
371 |
#endif
|
|
372 |
#endif
|
|
373 |
|
|
374 |
private:
|
|
375 |
Q_DISABLE_COPY(QApplication)
|
|
376 |
Q_DECLARE_PRIVATE(QApplication)
|
|
377 |
|
|
378 |
friend class QGraphicsWidget;
|
|
379 |
friend class QGraphicsScene;
|
|
380 |
friend class QGraphicsScenePrivate;
|
|
381 |
friend class QWidget;
|
|
382 |
friend class QWidgetPrivate;
|
|
383 |
friend class QETWidget;
|
|
384 |
friend class Q3AccelManager;
|
|
385 |
friend class QTranslator;
|
|
386 |
friend class QWidgetAnimator;
|
|
387 |
#ifndef QT_NO_SHORTCUT
|
|
388 |
friend class QShortcut;
|
|
389 |
friend class QLineEdit;
|
|
390 |
friend class QTextControl;
|
|
391 |
#endif
|
|
392 |
friend class QAction;
|
|
393 |
friend class QFontDatabasePrivate;
|
|
394 |
|
|
395 |
#if defined(Q_WS_QWS)
|
|
396 |
friend class QInputContext;
|
|
397 |
friend class QWSDirectPainterSurface;
|
|
398 |
friend class QDirectPainter;
|
|
399 |
friend class QDirectPainterPrivate;
|
|
400 |
#endif
|
|
401 |
friend class QGestureManager;
|
|
402 |
|
|
403 |
#if defined(Q_WS_MAC) || defined(Q_WS_X11)
|
|
404 |
Q_PRIVATE_SLOT(d_func(), void _q_alertTimeOut())
|
|
405 |
#endif
|
|
406 |
#if defined(QT_RX71_MULTITOUCH)
|
|
407 |
Q_PRIVATE_SLOT(d_func(), void _q_readRX71MultiTouchEvents())
|
|
408 |
#endif
|
|
409 |
};
|
|
410 |
|
|
411 |
QT_END_NAMESPACE
|
|
412 |
|
|
413 |
QT_END_HEADER
|
|
414 |
|
|
415 |
#endif // QAPPLICATION_H
|