source: trunk/src/gui/kernel/qapplication.h@ 251

Last change on this file since 251 was 138, checked in by Dmitry A. Kuminov, 16 years ago

gui: Implemented focus notifications.

File size: 13.5 KB
Line 
1/****************************************************************************
2**
3** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
4** Contact: Qt Software Information ([email protected])
5**
6** This file is part of the QtGui module of the Qt Toolkit.
7**
8** $QT_BEGIN_LICENSE:LGPL$
9** Commercial Usage
10** Licensees holding valid Qt Commercial licenses may use this file in
11** accordance with the Qt Commercial License Agreement provided with the
12** Software or, alternatively, in accordance with the terms contained in
13** a written agreement between you and Nokia.
14**
15** GNU Lesser General Public License Usage
16** Alternatively, this file may be used under the terms of the GNU Lesser
17** General Public License version 2.1 as published by the Free Software
18** Foundation and appearing in the file LICENSE.LGPL included in the
19** packaging of this file. Please review the following information to
20** ensure the GNU Lesser General Public License version 2.1 requirements
21** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
22**
23** In addition, as a special exception, Nokia gives you certain
24** additional rights. These rights are described in the Nokia Qt LGPL
25** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
26** 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 are unsure which license is appropriate for your use, please
37** contact the sales department at [email protected].
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
62QT_BEGIN_HEADER
63
64QT_BEGIN_NAMESPACE
65
66QT_MODULE(Gui)
67
68class QSessionManager;
69class QDesktopWidget;
70class QStyle;
71class QEventLoop;
72class QIcon;
73class QInputContext;
74template <typename T> class QList;
75class QLocale;
76#if defined(Q_WS_QWS)
77class QDecoration;
78#endif
79
80class QApplication;
81class QApplicationPrivate;
82#if defined(qApp)
83#undef qApp
84#endif
85#define qApp (static_cast<QApplication *>(QCoreApplication::instance()))
86
87class Q_GUI_EXPORT QApplication : public QCoreApplication
88{
89 Q_OBJECT
90 Q_PROPERTY(Qt::LayoutDirection layoutDirection READ layoutDirection WRITE setLayoutDirection)
91 Q_PROPERTY(QIcon windowIcon READ windowIcon WRITE setWindowIcon)
92 Q_PROPERTY(int cursorFlashTime READ cursorFlashTime WRITE setCursorFlashTime)
93 Q_PROPERTY(int doubleClickInterval READ doubleClickInterval WRITE setDoubleClickInterval)
94 Q_PROPERTY(int keyboardInputInterval READ keyboardInputInterval WRITE setKeyboardInputInterval)
95#ifndef QT_NO_WHEELEVENT
96 Q_PROPERTY(int wheelScrollLines READ wheelScrollLines WRITE setWheelScrollLines)
97#endif
98 Q_PROPERTY(QSize globalStrut READ globalStrut WRITE setGlobalStrut)
99 Q_PROPERTY(int startDragTime READ startDragTime WRITE setStartDragTime)
100 Q_PROPERTY(int startDragDistance READ startDragDistance WRITE setStartDragDistance)
101 Q_PROPERTY(bool quitOnLastWindowClosed READ quitOnLastWindowClosed WRITE setQuitOnLastWindowClosed)
102#ifndef QT_NO_STYLE_STYLESHEET
103 Q_PROPERTY(QString styleSheet READ styleSheet WRITE setStyleSheet)
104#endif
105#ifdef Q_OS_WINCE
106 Q_PROPERTY(int autoMaximizeThreshold READ autoMaximizeThreshold WRITE setAutoMaximizeThreshold)
107 Q_PROPERTY(bool autoSipEnabled READ autoSipEnabled WRITE setAutoSipEnabled)
108#endif
109
110public:
111 enum Type { Tty, GuiClient, GuiServer };
112#ifndef qdoc
113 QApplication(int &argc, char **argv, int = QT_VERSION);
114 QApplication(int &argc, char **argv, bool GUIenabled, int = QT_VERSION);
115 QApplication(int &argc, char **argv, Type, int = QT_VERSION);
116#if defined(Q_WS_X11)
117 QApplication(Display* dpy, Qt::HANDLE visual = 0, Qt::HANDLE cmap = 0, int = QT_VERSION);
118 QApplication(Display *dpy, int &argc, char **argv, Qt::HANDLE visual = 0, Qt::HANDLE cmap= 0, int = QT_VERSION);
119#endif
120#endif
121 virtual ~QApplication();
122
123 static Type type();
124
125 static QStyle *style();
126 static void setStyle(QStyle*);
127 static QStyle *setStyle(const QString&);
128 enum ColorSpec { NormalColor=0, CustomColor=1, ManyColor=2 };
129 static int colorSpec();
130 static void setColorSpec(int);
131 static void setGraphicsSystem(const QString &);
132
133#ifndef QT_NO_CURSOR
134 static QCursor *overrideCursor();
135 static void setOverrideCursor(const QCursor &);
136 static void changeOverrideCursor(const QCursor &);
137 static void restoreOverrideCursor();
138#endif
139 static QPalette palette();
140 static QPalette palette(const QWidget *);
141 static QPalette palette(const char *className);
142 static void setPalette(const QPalette &, const char* className = 0);
143 static QFont font();
144 static QFont font(const QWidget*);
145 static QFont font(const char *className);
146 static void setFont(const QFont &, const char* className = 0);
147 static QFontMetrics fontMetrics();
148
149 static void setWindowIcon(const QIcon &icon);
150 static QIcon windowIcon();
151
152
153#ifdef QT3_SUPPORT
154 static QT3_SUPPORT QWidget *mainWidget();
155 static QT3_SUPPORT void setMainWidget(QWidget *);
156#endif
157
158 static QWidgetList allWidgets();
159 static QWidgetList topLevelWidgets();
160
161 static QDesktopWidget *desktop();