1 /* 2 * DQt - D bindings for the Qt Toolkit 3 * 4 * GNU Lesser General Public License Usage 5 * This file may be used under the terms of the GNU Lesser 6 * General Public License version 3 as published by the Free Software 7 * Foundation and appearing in the file LICENSE.LGPL3 included in the 8 * packaging of this file. Please review the following information to 9 * ensure the GNU Lesser General Public License version 3 requirements 10 * will be met: https://www.gnu.org/licenses/lgpl-3.0.html. 11 */ 12 module qt.core.eventloop; 13 extern(C++): 14 15 import qt.config; 16 import qt.core.coreevent; 17 import qt.core.flags; 18 import qt.core.object; 19 import qt.core.thread; 20 import qt.helpers; 21 22 extern(C++, class) struct QEventLoopPrivate; 23 24 /// Binding for C++ class [QEventLoop](https://doc.qt.io/qt-6/qeventloop.html). 25 class /+ Q_CORE_EXPORT +/ QEventLoop : QObject 26 { 27 mixin(Q_OBJECT); 28 /+ Q_DECLARE_PRIVATE(QEventLoop) +/ 29 30 public: 31 /+ explicit +/this(QObject parent = null); 32 ~this(); 33 34 enum ProcessEventsFlag { 35 AllEvents = 0x00, 36 ExcludeUserInputEvents = 0x01, 37 ExcludeSocketNotifiers = 0x02, 38 WaitForMoreEvents = 0x04, 39 X11ExcludeTimers = 0x08, 40 EventLoopExec = 0x20, 41 DialogExec = 0x40 42 } 43 /+ Q_DECLARE_FLAGS(ProcessEventsFlags, ProcessEventsFlag) +/ 44 alias ProcessEventsFlags = QFlags!(ProcessEventsFlag); 45 final bool processEvents(ProcessEventsFlags flags = ProcessEventsFlag.AllEvents); 46 final void processEvents(ProcessEventsFlags flags, int maximumTime); 47 48 final int exec(ProcessEventsFlags flags = ProcessEventsFlag.AllEvents); 49 final bool isRunning() const; 50 51 final void wakeUp(); 52 53 override bool event(QEvent event); 54 55 public /+ Q_SLOTS +/: 56 @QSlot final void exit(int returnCode = 0); 57 @QSlot final void quit(); 58 mixin(CREATE_CONVENIENCE_WRAPPERS); 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) 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;}+/ 63 /+pragma(inline, true) QFlags!(QEventLoop.ProcessEventsFlags.enum_type) operator &(QEventLoop.ProcessEventsFlags.enum_type f1, QFlags!(QEventLoop.ProcessEventsFlags.enum_type) f2)/+noexcept+/{return f2&f1;}+/ 64 /+pragma(inline, true) void operator +(QEventLoop.ProcessEventsFlags.enum_type f1, QEventLoop.ProcessEventsFlags.enum_type f2)/+noexcept+/;+/ 65 /+pragma(inline, true) void operator +(QEventLoop.ProcessEventsFlags.enum_type f1, QFlags!(QEventLoop.ProcessEventsFlags.enum_type) f2)/+noexcept+/;+/ 66 /+pragma(inline, true) void operator +(int f1, QFlags!(QEventLoop.ProcessEventsFlags.enum_type) f2)/+noexcept+/;+/ 67 /+pragma(inline, true) void operator -(QEventLoop.ProcessEventsFlags.enum_type f1, QEventLoop.ProcessEventsFlags.enum_type f2)/+noexcept+/;+/ 68 /+pragma(inline, true) void operator -(QEventLoop.ProcessEventsFlags.enum_type f1, QFlags!(QEventLoop.ProcessEventsFlags.enum_type) f2)/+noexcept+/;+/ 69 /+pragma(inline, true) void operator -(int f1, QFlags!(QEventLoop.ProcessEventsFlags.enum_type) f2)/+noexcept+/;+/ 70 /+pragma(inline, true) QIncompatibleFlag operator |(QEventLoop.ProcessEventsFlags.enum_type f1, int f2)/+noexcept+/{return QIncompatibleFlag(int(f1)|f2);}+/ 71 /+pragma(inline, true) void operator +(int f1, QEventLoop.ProcessEventsFlags.enum_type f2)/+noexcept+/;+/ 72 /+pragma(inline, true) void operator +(QEventLoop.ProcessEventsFlags.enum_type f1, int f2)/+noexcept+/;+/ 73 /+pragma(inline, true) void operator -(int f1, QEventLoop.ProcessEventsFlags.enum_type f2)/+noexcept+/;+/ 74 /+pragma(inline, true) void operator -(QEventLoop.ProcessEventsFlags.enum_type f1, int f2)/+noexcept+/;+/ 75 76 /+ Q_DECLARE_OPERATORS_FOR_FLAGS(QEventLoop::ProcessEventsFlags) +/ 77 extern(C++, class) struct QEventLoopLockerPrivate; 78 79 /// Binding for C++ class [QEventLoopLocker](https://doc.qt.io/qt-6/qeventlooplocker.html). 80 extern(C++, class) struct /+ Q_CORE_EXPORT +/ QEventLoopLocker 81 { 82 public: 83 @disable this(); 84 pragma(mangle, defaultConstructorMangling(__traits(identifier, typeof(this)))) 85 ref typeof(this) rawConstructor(); 86 static typeof(this) create() 87 { 88 typeof(this) r = typeof(this).init; 89 r.rawConstructor(); 90 return r; 91 } 92 93 /+ explicit +/this(QEventLoop loop); 94 /+ explicit +/this(QThread thread); 95 ~this(); 96 97 private: 98 /+ Q_DISABLE_COPY(QEventLoopLocker) +/ 99 @disable this(this); 100 /+this(ref const(QEventLoopLocker));+//+ref QEventLoopLocker operator =(ref const(QEventLoopLocker));+/ QEventLoopLockerPrivate* d_ptr; 101 mixin(CREATE_CONVENIENCE_WRAPPERS); 102 } 103