1 /****************************************************************************
2 **
3 ** DQt - D bindings for the Qt Toolkit
4 **
5 ** GNU Lesser General Public License Usage
6 ** This file may be used under the terms of the GNU Lesser
7 ** General Public License version 3 as published by the Free Software
8 ** Foundation and appearing in the file LICENSE.LGPL3 included in the
9 ** packaging of this file. Please review the following information to
10 ** ensure the GNU Lesser General Public License version 3 requirements
11 ** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
12 **
13 ****************************************************************************/
14 module qt.gui.guiapplication;
15 extern(C++):
16 
17 import qt.config;
18 import qt.core.bytearray;
19 import qt.core.coreapplication;
20 import qt.core.coreevent;
21 import qt.core.global;
22 import qt.core.list;
23 import qt.core.namespace;
24 import qt.core.object;
25 import qt.core.point;
26 import qt.core.string;
27 import qt.gui.font;
28 import qt.gui.icon;
29 import qt.gui.inputmethod;
30 import qt.gui.palette;
31 import qt.gui.screen;
32 import qt.gui.stylehints;
33 import qt.gui.windowdefs;
34 import qt.helpers;
35 version(QT_NO_CLIPBOARD){}else
36     import qt.gui.clipboard;
37 version(QT_NO_CURSOR){}else
38     import qt.gui.cursor;
39 
40 extern(C++, class) struct QSessionManager;
41 extern(C++, class) struct QGuiApplicationPrivate;
42 extern(C++, class) struct QPlatformNativeInterface;
43 extern(C++, class) struct QPlatformIntegration;
44 /+ class QPalette;
45 class QScreen;
46 class QStyleHints;
47 
48 #if defined(qApp)
49 #undef qApp
50 #endif
51 #define qApp (static_cast<QGuiApplication *>(QCoreApplication::instance()))
52 
53 #if defined(qGuiApp)
54 #undef qGuiApp
55 #endif
56 #define qGuiApp (static_cast<QGuiApplication *>(QCoreApplication::instance())) +/
57 
58 class /+ Q_GUI_EXPORT +/ QGuiApplication : QCoreApplication
59 {
60     mixin(Q_OBJECT);
61     /+ Q_PROPERTY(QIcon windowIcon READ windowIcon WRITE setWindowIcon)
62     Q_PROPERTY(QString applicationDisplayName READ applicationDisplayName WRITE setApplicationDisplayName NOTIFY applicationDisplayNameChanged)
63     Q_PROPERTY(QString desktopFileName READ desktopFileName WRITE setDesktopFileName)
64     Q_PROPERTY(Qt::LayoutDirection layoutDirection READ layoutDirection WRITE setLayoutDirection NOTIFY layoutDirectionChanged)
65     Q_PROPERTY(QString platformName READ platformName STORED false)
66     Q_PROPERTY(bool quitOnLastWindowClosed  READ quitOnLastWindowClosed WRITE setQuitOnLastWindowClosed)
67     Q_PROPERTY(QScreen *primaryScreen READ primaryScreen NOTIFY primaryScreenChanged STORED false) +/
68 
69 public:
70 /+ #ifdef Q_QDOC
71     QGuiApplication(int &argc, char **argv);
72 #else +/
73     this(ref int argc, char** argv, int = ApplicationFlags);
74 /+ #endif +/
75     ~this();
76 
77     static void setApplicationDisplayName(ref const(QString) name);
78     static QString applicationDisplayName();
79 
80     static void setDesktopFileName(ref const(QString) name);
81     static QString desktopFileName();
82 
83     static QWindowList allWindows();
84     static QWindowList topLevelWindows();
85     static QWindow* topLevelAt(ref const(QPoint) pos);
86 
87     static void setWindowIcon(ref const(QIcon) icon);
88     static QIcon windowIcon();
89 
90     static QString platformName();
91 
92     static QWindow* modalWindow();
93 
94     static QWindow* focusWindow();
95     static QObject focusObject();
96 
97     static QScreen primaryScreen();
98     static QList!(QScreen) screens();
99     static QScreen screenAt(ref const(QPoint) point);
100 
101     final qreal devicePixelRatio() const;
102 
103     version(QT_NO_CURSOR){}else
104     {
105         static QCursor* overrideCursor();
106         static void setOverrideCursor(ref const(QCursor) );
107         static void changeOverrideCursor(ref const(QCursor) );
108         static void restoreOverrideCursor();
109     }
110 
111     static QFont font();
112     static void setFont(ref const(QFont) );
113 
114     version(QT_NO_CLIPBOARD){}else
115     {
116         static QClipboard clipboard();
117     }
118 
119     static QPalette palette();
120     static void setPalette(ref const(QPalette) pal);
121 
122     static /+ Qt:: +/qt.core.namespace.KeyboardModifiers keyboardModifiers();
123     static /+ Qt:: +/qt.core.namespace.KeyboardModifiers queryKeyboardModifiers();
124     static /+ Qt:: +/qt.core.namespace.MouseButtons mouseButtons();
125 
126     static void setLayoutDirection(/+ Qt:: +/qt.core.namespace.LayoutDirection direction);
127     static /+ Qt:: +/qt.core.namespace.LayoutDirection layoutDirection();
128 
129     pragma(inline, true) static bool isRightToLeft() { return layoutDirection() == /+ Qt:: +/qt.core.namespace.LayoutDirection.RightToLeft; }
130     pragma(inline, true) static bool isLeftToRight() { return layoutDirection() == /+ Qt:: +/qt.core.namespace.LayoutDirection.LeftToRight; }
131 
132     static QStyleHints styleHints();
133     static void setDesktopSettingsAware(bool on);
134     static bool desktopSettingsAware();
135 
136     static QInputMethod inputMethod();
137 
138     static QPlatformNativeInterface* platformNativeInterface();
139 
140     static QFunctionPointer platformFunction(ref const(QByteArray) function_);
141 
142     static void setQuitOnLastWindowClosed(bool quit);
143     static bool quitOnLastWindowClosed();
144 
145     static /+ Qt:: +/qt.core.namespace.ApplicationState applicationState();
146 
147     static void setHighDpiScaleFactorRoundingPolicy(/+ Qt:: +/qt.core.namespace.HighDpiScaleFactorRoundingPolicy policy);
148     static /+ Qt:: +/qt.core.namespace.HighDpiScaleFactorRoundingPolicy highDpiScaleFactorRoundingPolicy();
149 
150     static int exec();
151     override bool notify(QObject , QEvent );
152 
153     version(QT_NO_SESSIONMANAGER){}else
154     {
155         // session management
156         final bool isSessionRestored() const;
157         final QString sessionId() const;
158         final QString sessionKey() const;
159         final bool isSavingSession() const;
160 
161         static bool isFallbackSessionManagementEnabled();
162         static void setFallbackSessionManagementEnabled(bool);
163     }
164 
165     static void sync();
166 /+ Q_SIGNALS +/public:
167     @QSignal final void fontDatabaseChanged();
168     @QSignal final void screenAdded(QScreen screen);
169     @QSignal final void screenRemoved(QScreen screen);
170     @QSignal final void primaryScreenChanged(QScreen screen);
171     @QSignal final void lastWindowClosed();
172     @QSignal final void focusObjectChanged(QObject focusObject);
173     @QSignal final void focusWindowChanged(QWindow* focusWindow);
174     @QSignal final void applicationStateChanged(/+ Qt:: +/qt.core.namespace.ApplicationState state);
175     @QSignal final void layoutDirectionChanged(/+ Qt:: +/qt.core.namespace.LayoutDirection direction);
176     version(QT_NO_SESSIONMANAGER){}else
177     {
178         @QSignal final void commitDataRequest(ref QSessionManager sessionManager);
179         @QSignal final void saveStateRequest(ref QSessionManager sessionManager);
180     }
181     @QSignal final void paletteChanged(ref const(QPalette) pal);
182     @QSignal final void applicationDisplayNameChanged();
183     @QSignal final void fontChanged(ref const(QFont) font);
184 
185 protected:
186     override bool event(QEvent );
187     override bool compressEvent(QEvent , QObject receiver, QPostEventList* );
188 
189     this(ref QGuiApplicationPrivate p);
190 
191 private:
192     /+ Q_DISABLE_COPY(QGuiApplication) +/
193     /+ Q_DECLARE_PRIVATE(QGuiApplication) +/
194 
195     /+ Q_PRIVATE_SLOT(d_func(), void _q_updateFocusObject(QObject *object)) +/
196 
197     version(QT_NO_GESTURES){}else
198     {
199         /+ friend class QGestureManager; +/
200     }
201     /+ friend class QFontDatabasePrivate; +/
202     /+ friend class QPlatformIntegration; +/
203     version(QT_NO_SESSIONMANAGER){}else
204     {
205         /+ friend class QPlatformSessionManager; +/
206     }
207 }
208