~ubuntu-branches/ubuntu/wily/qtbase-opensource-src/wily

« back to all changes in this revision

Viewing changes to src/gui/kernel/qguiapplication.h

  • Committer: Package Import Robot
  • Author(s): Timo Jyrinki
  • Date: 2013-02-05 12:46:17 UTC
  • Revision ID: package-import@ubuntu.com-20130205124617-c8jouts182j002fx
Tags: upstream-5.0.1+dfsg
ImportĀ upstreamĀ versionĀ 5.0.1+dfsg

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/****************************************************************************
 
2
**
 
3
** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
 
4
** Contact: http://www.qt-project.org/legal
 
5
**
 
6
** This file is part of the QtGui module of the Qt Toolkit.
 
7
**
 
8
** $QT_BEGIN_LICENSE:LGPL$
 
9
** Commercial License Usage
 
10
** Licensees holding valid commercial Qt licenses may use this file in
 
11
** accordance with the commercial license agreement provided with the
 
12
** Software or, alternatively, in accordance with the terms contained in
 
13
** a written agreement between you and Digia.  For licensing terms and
 
14
** conditions see http://qt.digia.com/licensing.  For further information
 
15
** use the contact form at http://qt.digia.com/contact-us.
 
16
**
 
17
** GNU Lesser General Public License Usage
 
18
** Alternatively, this file may be used under the terms of the GNU Lesser
 
19
** General Public License version 2.1 as published by the Free Software
 
20
** Foundation and appearing in the file LICENSE.LGPL included in the
 
21
** packaging of this file.  Please review the following information to
 
22
** ensure the GNU Lesser General Public License version 2.1 requirements
 
23
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
 
24
**
 
25
** In addition, as a special exception, Digia gives you certain additional
 
26
** rights.  These rights are described in the Digia Qt LGPL Exception
 
27
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
 
28
**
 
29
** GNU General Public License Usage
 
30
** Alternatively, this file may be used under the terms of the GNU
 
31
** General Public License version 3.0 as published by the Free Software
 
32
** Foundation and appearing in the file LICENSE.GPL included in the
 
33
** packaging of this file.  Please review the following information to
 
34
** ensure the GNU General Public License version 3.0 requirements will be
 
35
** met: http://www.gnu.org/copyleft/gpl.html.
 
36
**
 
37
**
 
38
** $QT_END_LICENSE$
 
39
**
 
40
****************************************************************************/
 
41
 
 
42
#ifndef QGUIAPPLICATION_H
 
43
#define QGUIAPPLICATION_H
 
44
 
 
45
#include <QtCore/qcoreapplication.h>
 
46
#include <QtGui/qwindowdefs.h>
 
47
#include <QtGui/qinputmethod.h>
 
48
#include <QtCore/qlocale.h>
 
49
#include <QtCore/qpoint.h>
 
50
#include <QtCore/qsize.h>
 
51
 
 
52
QT_BEGIN_HEADER
 
53
 
 
54
QT_BEGIN_NAMESPACE
 
55
 
 
56
 
 
57
class QSessionManager;
 
58
class QGuiApplicationPrivate;
 
59
class QPlatformNativeInterface;
 
60
class QPlatformIntegration;
 
61
class QPalette;
 
62
class QScreen;
 
63
class QStyleHints;
 
64
 
 
65
#if defined(qApp)
 
66
#undef qApp
 
67
#endif
 
68
#define qApp (static_cast<QGuiApplication *>(QCoreApplication::instance()))
 
69
 
 
70
#if defined(qGuiApp)
 
71
#undef qGuiApp
 
72
#endif
 
73
#define qGuiApp (static_cast<QGuiApplication *>(QCoreApplication::instance()))
 
74
 
 
75
class Q_GUI_EXPORT QGuiApplication : public QCoreApplication
 
76
{
 
77
    Q_OBJECT
 
78
    Q_PROPERTY(QString applicationDisplayName READ applicationDisplayName WRITE setApplicationDisplayName)
 
79
    Q_PROPERTY(Qt::LayoutDirection layoutDirection READ layoutDirection WRITE setLayoutDirection)
 
80
    Q_PROPERTY(QString platformName READ platformName STORED false)
 
81
    Q_PROPERTY(bool quitOnLastWindowClosed  READ quitOnLastWindowClosed WRITE setQuitOnLastWindowClosed)
 
82
 
 
83
public:
 
84
#ifdef Q_QDOC
 
85
    QGuiApplication(int &argc, char **argv);
 
86
#else
 
87
    QGuiApplication(int &argc, char **argv, int = ApplicationFlags);
 
88
#endif
 
89
    virtual ~QGuiApplication();
 
90
 
 
91
    static void setApplicationDisplayName(const QString &name);
 
92
    static QString applicationDisplayName();
 
93
 
 
94
    static QWindowList allWindows();
 
95
    static QWindowList topLevelWindows();
 
96
    static QWindow *topLevelAt(const QPoint &pos);
 
97
 
 
98
    static QString platformName();
 
99
 
 
100
    static QWindow *modalWindow();
 
101
 
 
102
    static QWindow *focusWindow();
 
103
    static QObject *focusObject();
 
104
 
 
105
    static QScreen *primaryScreen();
 
106
    static QList<QScreen *> screens();
 
107
    qreal devicePixelRatio() const;
 
108
 
 
109
#ifndef QT_NO_CURSOR
 
110
    static QCursor *overrideCursor();
 
111
    static void setOverrideCursor(const QCursor &);
 
112
    static void changeOverrideCursor(const QCursor &);
 
113
    static void restoreOverrideCursor();
 
114
#endif
 
115
 
 
116
    static QFont font();
 
117
    static void setFont(const QFont &);
 
118
 
 
119
#ifndef QT_NO_CLIPBOARD
 
120
    static QClipboard *clipboard();
 
121
#endif
 
122
 
 
123
    static QPalette palette();
 
124
    static void setPalette(const QPalette &pal);
 
125
 
 
126
    static Qt::KeyboardModifiers keyboardModifiers();
 
127
    static Qt::KeyboardModifiers queryKeyboardModifiers();
 
128
    static Qt::MouseButtons mouseButtons();
 
129
 
 
130
    static void setLayoutDirection(Qt::LayoutDirection direction);
 
131
    static Qt::LayoutDirection layoutDirection();
 
132
 
 
133
    static inline bool isRightToLeft() { return layoutDirection() == Qt::RightToLeft; }
 
134
    static inline bool isLeftToRight() { return layoutDirection() == Qt::LeftToRight; }
 
135
 
 
136
    static QStyleHints *styleHints();
 
137
    static void setDesktopSettingsAware(bool on);
 
138
    static bool desktopSettingsAware();
 
139
 
 
140
    static QInputMethod *inputMethod();
 
141
 
 
142
    static QPlatformNativeInterface *platformNativeInterface();
 
143
 
 
144
    static void setQuitOnLastWindowClosed(bool quit);
 
145
    static bool quitOnLastWindowClosed();
 
146
 
 
147
    static int exec();
 
148
    bool notify(QObject *, QEvent *);
 
149
 
 
150
#ifndef QT_NO_SESSIONMANAGER
 
151
    // session management
 
152
    bool isSessionRestored() const;
 
153
    QString sessionId() const;
 
154
    QString sessionKey() const;
 
155
    bool isSavingSession() const;
 
156
#endif
 
157
 
 
158
Q_SIGNALS:
 
159
    void fontDatabaseChanged();
 
160
    void screenAdded(QScreen *screen);
 
161
    void lastWindowClosed();
 
162
    void focusObjectChanged(QObject *focusObject);
 
163
    void focusWindowChanged(QWindow *focusWindow);
 
164
#ifndef QT_NO_SESSIONMANAGER
 
165
    void commitDataRequest(QSessionManager &sessionManager);
 
166
    void saveStateRequest(QSessionManager &sessionManager);
 
167
#endif
 
168
 
 
169
protected:
 
170
    bool event(QEvent *);
 
171
    bool compressEvent(QEvent *, QObject *receiver, QPostEventList *);
 
172
 
 
173
    QGuiApplication(QGuiApplicationPrivate &p);
 
174
 
 
175
private:
 
176
    Q_DISABLE_COPY(QGuiApplication)
 
177
    Q_DECLARE_PRIVATE(QGuiApplication)
 
178
 
 
179
    Q_PRIVATE_SLOT(d_func(), void _q_updateFocusObject(QObject *object))
 
180
 
 
181
#ifndef QT_NO_GESTURES
 
182
    friend class QGestureManager;
 
183
#endif
 
184
    friend class QFontDatabasePrivate;
 
185
    friend class QPlatformIntegration;
 
186
};
 
187
 
 
188
QT_END_NAMESPACE
 
189
 
 
190
QT_END_HEADER
 
191
 
 
192
#endif // QGUIAPPLICATION_H