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.core.eventloop; 15 extern(C++): 16 17 import qt.config; 18 import qt.core.coreevent; 19 import qt.core.flags; 20 import qt.core.object; 21 import qt.core.thread; 22 import qt.helpers; 23 24 extern(C++, class) struct QEventLoopPrivate; 25 26 class /+ Q_CORE_EXPORT +/ QEventLoop : QObject 27 { 28 mixin(Q_OBJECT); 29 /+ Q_DECLARE_PRIVATE(QEventLoop) +/ 30 31 public: 32 /+ explicit +/this(QObject parent = null); 33 ~this(); 34 35 enum ProcessEventsFlag { 36 AllEvents = 0x00, 37 ExcludeUserInputEvents = 0x01, 38 ExcludeSocketNotifiers = 0x02, 39 WaitForMoreEvents = 0x04, 40 X11ExcludeTimers = 0x08, 41 EventLoopExec = 0x20, 42 DialogExec = 0x40 43 } 44 /+ Q_DECLARE_FLAGS(ProcessEventsFlags, ProcessEventsFlag) +/ 45 alias ProcessEventsFlags = QFlags!(ProcessEventsFlag); 46 final bool processEvents(ProcessEventsFlags flags = ProcessEventsFlag.AllEvents); 47 final void processEvents(ProcessEventsFlags flags, int maximumTime); 48 49 final int exec(ProcessEventsFlags flags = ProcessEventsFlag.AllEvents); 50 final void exit(int returnCode = 0); 51 final bool isRunning() const; 52 53 final void wakeUp(); 54 55 override bool event(QEvent event); 56 57 public /+ Q_SLOTS +/: 58 @QSlot final void quit(); 59 } 60 /+pragma(inline, true) QFlags!(QEventLoop.ProcessEventsFlags.enum_type) operator |(QEventLoop.ProcessEventsFlags.enum_type f1, QEventLoop.ProcessEventsFlags.enum_type f2)/+noexcept+/{return QFlags!(QEventLoop.ProcessEventsFlags.enum_type)(f1)|f2;}+/ 61 /+pragma(inline, true) QFlags!(QEventLoop.ProcessEventsFlags.enum_type) operator |(QEventLoop.ProcessEventsFlags.enum_type f1, QFlags!(QEventLoop.ProcessEventsFlags.enum_type) f2)/+noexcept+/{return f2|f1;}+/ 62 /+pragma(inline, true) QIncompatibleFlag operator |(QEventLoop.ProcessEventsFlags.enum_type f1, int f2)/+noexcept+/{return QIncompatibleFlag(int(f1)|f2);}+/ 63 64 /+ Q_DECLARE_OPERATORS_FOR_FLAGS(QEventLoop::ProcessEventsFlags) +/ 65 66 extern(C++, class) struct QEventLoopLockerPrivate; 67 68 extern(C++, class) struct /+ Q_CORE_EXPORT +/ QEventLoopLocker 69 { 70 public: 71 @disable this(); 72 pragma(mangle, defaultConstructorMangling(__traits(identifier, typeof(this)))) 73 ref typeof(this) rawConstructor(); 74 static typeof(this) create() 75 { 76 typeof(this) r = typeof(this).init; 77 r.rawConstructor(); 78 return r; 79 } 80 81 /+ explicit +/this(QEventLoop loop); 82 /+ explicit +/this(QThread thread); 83 ~this(); 84 85 private: 86 /+ Q_DISABLE_COPY(QEventLoopLocker) +/ 87 @disable this(this); 88 /+this(ref const(QEventLoopLocker));+//+ref QEventLoopLocker operator =(ref const(QEventLoopLocker));+/ QEventLoopLockerPrivate* d_ptr; 89 } 90