2024-08-25 04:08:24 +00:00
|
|
|
package qt
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
|
|
|
#include "gen_qeventloop.h"
|
|
|
|
#include <stdlib.h>
|
|
|
|
|
|
|
|
*/
|
|
|
|
import "C"
|
|
|
|
|
|
|
|
import (
|
2024-09-14 22:29:05 +00:00
|
|
|
"runtime"
|
2024-08-25 04:08:24 +00:00
|
|
|
"unsafe"
|
|
|
|
)
|
|
|
|
|
2024-09-04 06:54:22 +00:00
|
|
|
type QEventLoop__ProcessEventsFlag int
|
|
|
|
|
|
|
|
const (
|
2024-09-20 07:13:26 +00:00
|
|
|
QEventLoop__AllEvents QEventLoop__ProcessEventsFlag = 0
|
|
|
|
QEventLoop__ExcludeUserInputEvents QEventLoop__ProcessEventsFlag = 1
|
|
|
|
QEventLoop__ExcludeSocketNotifiers QEventLoop__ProcessEventsFlag = 2
|
|
|
|
QEventLoop__WaitForMoreEvents QEventLoop__ProcessEventsFlag = 4
|
|
|
|
QEventLoop__X11ExcludeTimers QEventLoop__ProcessEventsFlag = 8
|
|
|
|
QEventLoop__EventLoopExec QEventLoop__ProcessEventsFlag = 32
|
|
|
|
QEventLoop__DialogExec QEventLoop__ProcessEventsFlag = 64
|
2024-09-04 06:54:22 +00:00
|
|
|
)
|
|
|
|
|
2024-08-25 04:08:24 +00:00
|
|
|
type QEventLoop struct {
|
|
|
|
h *C.QEventLoop
|
|
|
|
*QObject
|
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QEventLoop) cPointer() *C.QEventLoop {
|
|
|
|
if this == nil {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
return this.h
|
|
|
|
}
|
|
|
|
|
2024-10-16 05:07:56 +00:00
|
|
|
func (this *QEventLoop) UnsafePointer() unsafe.Pointer {
|
|
|
|
if this == nil {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
return unsafe.Pointer(this.h)
|
|
|
|
}
|
|
|
|
|
2024-08-25 04:08:24 +00:00
|
|
|
func newQEventLoop(h *C.QEventLoop) *QEventLoop {
|
2024-09-01 02:23:55 +00:00
|
|
|
if h == nil {
|
|
|
|
return nil
|
|
|
|
}
|
2024-10-16 05:07:56 +00:00
|
|
|
return &QEventLoop{h: h, QObject: UnsafeNewQObject(unsafe.Pointer(h))}
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-10-16 05:07:56 +00:00
|
|
|
func UnsafeNewQEventLoop(h unsafe.Pointer) *QEventLoop {
|
2024-08-25 04:08:24 +00:00
|
|
|
return newQEventLoop((*C.QEventLoop)(h))
|
|
|
|
}
|
|
|
|
|
|
|
|
// NewQEventLoop constructs a new QEventLoop object.
|
|
|
|
func NewQEventLoop() *QEventLoop {
|
|
|
|
ret := C.QEventLoop_new()
|
|
|
|
return newQEventLoop(ret)
|
|
|
|
}
|
|
|
|
|
|
|
|
// NewQEventLoop2 constructs a new QEventLoop object.
|
|
|
|
func NewQEventLoop2(parent *QObject) *QEventLoop {
|
|
|
|
ret := C.QEventLoop_new2(parent.cPointer())
|
|
|
|
return newQEventLoop(ret)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QEventLoop) MetaObject() *QMetaObject {
|
2024-10-16 05:07:56 +00:00
|
|
|
return UnsafeNewQMetaObject(unsafe.Pointer(C.QEventLoop_MetaObject(this.h)))
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-09-20 22:32:57 +00:00
|
|
|
func (this *QEventLoop) Metacast(param1 string) unsafe.Pointer {
|
|
|
|
param1_Cstring := C.CString(param1)
|
|
|
|
defer C.free(unsafe.Pointer(param1_Cstring))
|
2024-10-18 23:53:33 +00:00
|
|
|
return (unsafe.Pointer)(C.QEventLoop_Metacast(this.h, param1_Cstring))
|
2024-09-20 22:32:57 +00:00
|
|
|
}
|
|
|
|
|
2024-08-25 04:08:24 +00:00
|
|
|
func QEventLoop_Tr(s string) string {
|
|
|
|
s_Cstring := C.CString(s)
|
|
|
|
defer C.free(unsafe.Pointer(s_Cstring))
|
2024-10-18 23:53:33 +00:00
|
|
|
var _ms C.struct_miqt_string = C.QEventLoop_Tr(s_Cstring)
|
|
|
|
_ret := C.GoStringN(_ms.data, C.int(int64(_ms.len)))
|
|
|
|
C.free(unsafe.Pointer(_ms.data))
|
2024-09-14 22:29:05 +00:00
|
|
|
return _ret
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func QEventLoop_TrUtf8(s string) string {
|
|
|
|
s_Cstring := C.CString(s)
|
|
|
|
defer C.free(unsafe.Pointer(s_Cstring))
|
2024-10-18 23:53:33 +00:00
|
|
|
var _ms C.struct_miqt_string = C.QEventLoop_TrUtf8(s_Cstring)
|
|
|
|
_ret := C.GoStringN(_ms.data, C.int(int64(_ms.len)))
|
|
|
|
C.free(unsafe.Pointer(_ms.data))
|
2024-09-14 22:29:05 +00:00
|
|
|
return _ret
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-08-29 07:01:51 +00:00
|
|
|
func (this *QEventLoop) ProcessEvents() bool {
|
2024-09-17 07:30:27 +00:00
|
|
|
return (bool)(C.QEventLoop_ProcessEvents(this.h))
|
2024-08-29 07:01:51 +00:00
|
|
|
}
|
|
|
|
|
2024-09-20 06:40:03 +00:00
|
|
|
func (this *QEventLoop) ProcessEvents2(flags QEventLoop__ProcessEventsFlag, maximumTime int) {
|
2024-09-18 01:33:50 +00:00
|
|
|
C.QEventLoop_ProcessEvents2(this.h, (C.int)(flags), (C.int)(maximumTime))
|
2024-08-29 07:01:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QEventLoop) Exec() int {
|
2024-09-17 07:30:27 +00:00
|
|
|
return (int)(C.QEventLoop_Exec(this.h))
|
2024-08-29 07:01:51 +00:00
|
|
|
}
|
|
|
|
|
2024-08-25 04:08:24 +00:00
|
|
|
func (this *QEventLoop) Exit() {
|
|
|
|
C.QEventLoop_Exit(this.h)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QEventLoop) IsRunning() bool {
|
2024-09-17 07:30:27 +00:00
|
|
|
return (bool)(C.QEventLoop_IsRunning(this.h))
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QEventLoop) WakeUp() {
|
|
|
|
C.QEventLoop_WakeUp(this.h)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QEventLoop) Event(event *QEvent) bool {
|
2024-09-17 07:30:27 +00:00
|
|
|
return (bool)(C.QEventLoop_Event(this.h, event.cPointer()))
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QEventLoop) Quit() {
|
|
|
|
C.QEventLoop_Quit(this.h)
|
|
|
|
}
|
|
|
|
|
|
|
|
func QEventLoop_Tr2(s string, c string) string {
|
|
|
|
s_Cstring := C.CString(s)
|
|
|
|
defer C.free(unsafe.Pointer(s_Cstring))
|
|
|
|
c_Cstring := C.CString(c)
|
|
|
|
defer C.free(unsafe.Pointer(c_Cstring))
|
2024-10-18 23:53:33 +00:00
|
|
|
var _ms C.struct_miqt_string = C.QEventLoop_Tr2(s_Cstring, c_Cstring)
|
|
|
|
_ret := C.GoStringN(_ms.data, C.int(int64(_ms.len)))
|
|
|
|
C.free(unsafe.Pointer(_ms.data))
|
2024-09-14 22:29:05 +00:00
|
|
|
return _ret
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func QEventLoop_Tr3(s string, c string, n int) string {
|
|
|
|
s_Cstring := C.CString(s)
|
|
|
|
defer C.free(unsafe.Pointer(s_Cstring))
|
|
|
|
c_Cstring := C.CString(c)
|
|
|
|
defer C.free(unsafe.Pointer(c_Cstring))
|
2024-10-18 23:53:33 +00:00
|
|
|
var _ms C.struct_miqt_string = C.QEventLoop_Tr3(s_Cstring, c_Cstring, (C.int)(n))
|
|
|
|
_ret := C.GoStringN(_ms.data, C.int(int64(_ms.len)))
|
|
|
|
C.free(unsafe.Pointer(_ms.data))
|
2024-09-14 22:29:05 +00:00
|
|
|
return _ret
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func QEventLoop_TrUtf82(s string, c string) string {
|
|
|
|
s_Cstring := C.CString(s)
|
|
|
|
defer C.free(unsafe.Pointer(s_Cstring))
|
|
|
|
c_Cstring := C.CString(c)
|
|
|
|
defer C.free(unsafe.Pointer(c_Cstring))
|
2024-10-18 23:53:33 +00:00
|
|
|
var _ms C.struct_miqt_string = C.QEventLoop_TrUtf82(s_Cstring, c_Cstring)
|
|
|
|
_ret := C.GoStringN(_ms.data, C.int(int64(_ms.len)))
|
|
|
|
C.free(unsafe.Pointer(_ms.data))
|
2024-09-14 22:29:05 +00:00
|
|
|
return _ret
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func QEventLoop_TrUtf83(s string, c string, n int) string {
|
|
|
|
s_Cstring := C.CString(s)
|
|
|
|
defer C.free(unsafe.Pointer(s_Cstring))
|
|
|
|
c_Cstring := C.CString(c)
|
|
|
|
defer C.free(unsafe.Pointer(c_Cstring))
|
2024-10-18 23:53:33 +00:00
|
|
|
var _ms C.struct_miqt_string = C.QEventLoop_TrUtf83(s_Cstring, c_Cstring, (C.int)(n))
|
|
|
|
_ret := C.GoStringN(_ms.data, C.int(int64(_ms.len)))
|
|
|
|
C.free(unsafe.Pointer(_ms.data))
|
2024-09-14 22:29:05 +00:00
|
|
|
return _ret
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-09-20 06:40:03 +00:00
|
|
|
func (this *QEventLoop) ProcessEvents1(flags QEventLoop__ProcessEventsFlag) bool {
|
2024-09-18 01:33:50 +00:00
|
|
|
return (bool)(C.QEventLoop_ProcessEvents1(this.h, (C.int)(flags)))
|
2024-08-29 07:01:51 +00:00
|
|
|
}
|
|
|
|
|
2024-09-20 06:40:03 +00:00
|
|
|
func (this *QEventLoop) Exec1(flags QEventLoop__ProcessEventsFlag) int {
|
2024-09-18 01:33:50 +00:00
|
|
|
return (int)(C.QEventLoop_Exec1(this.h, (C.int)(flags)))
|
2024-08-29 07:01:51 +00:00
|
|
|
}
|
|
|
|
|
2024-08-25 04:08:24 +00:00
|
|
|
func (this *QEventLoop) Exit1(returnCode int) {
|
|
|
|
C.QEventLoop_Exit1(this.h, (C.int)(returnCode))
|
|
|
|
}
|
|
|
|
|
2024-09-14 22:29:05 +00:00
|
|
|
// Delete this object from C++ memory.
|
2024-08-25 04:08:24 +00:00
|
|
|
func (this *QEventLoop) Delete() {
|
|
|
|
C.QEventLoop_Delete(this.h)
|
|
|
|
}
|
|
|
|
|
2024-09-14 22:29:05 +00:00
|
|
|
// GoGC adds a Go Finalizer to this pointer, so that it will be deleted
|
|
|
|
// from C++ memory once it is unreachable from Go memory.
|
|
|
|
func (this *QEventLoop) GoGC() {
|
|
|
|
runtime.SetFinalizer(this, func(this *QEventLoop) {
|
|
|
|
this.Delete()
|
|
|
|
runtime.KeepAlive(this.h)
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
2024-08-25 04:08:24 +00:00
|
|
|
type QEventLoopLocker struct {
|
|
|
|
h *C.QEventLoopLocker
|
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QEventLoopLocker) cPointer() *C.QEventLoopLocker {
|
|
|
|
if this == nil {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
return this.h
|
|
|
|
}
|
|
|
|
|
2024-10-16 05:07:56 +00:00
|
|
|
func (this *QEventLoopLocker) UnsafePointer() unsafe.Pointer {
|
|
|
|
if this == nil {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
return unsafe.Pointer(this.h)
|
|
|
|
}
|
|
|
|
|
2024-08-25 04:08:24 +00:00
|
|
|
func newQEventLoopLocker(h *C.QEventLoopLocker) *QEventLoopLocker {
|
2024-09-01 02:23:55 +00:00
|
|
|
if h == nil {
|
|
|
|
return nil
|
|
|
|
}
|
2024-08-25 04:08:24 +00:00
|
|
|
return &QEventLoopLocker{h: h}
|
|
|
|
}
|
|
|
|
|
2024-10-16 05:07:56 +00:00
|
|
|
func UnsafeNewQEventLoopLocker(h unsafe.Pointer) *QEventLoopLocker {
|
2024-08-25 04:08:24 +00:00
|
|
|
return newQEventLoopLocker((*C.QEventLoopLocker)(h))
|
|
|
|
}
|
|
|
|
|
|
|
|
// NewQEventLoopLocker constructs a new QEventLoopLocker object.
|
|
|
|
func NewQEventLoopLocker() *QEventLoopLocker {
|
|
|
|
ret := C.QEventLoopLocker_new()
|
|
|
|
return newQEventLoopLocker(ret)
|
|
|
|
}
|
|
|
|
|
|
|
|
// NewQEventLoopLocker2 constructs a new QEventLoopLocker object.
|
|
|
|
func NewQEventLoopLocker2(loop *QEventLoop) *QEventLoopLocker {
|
|
|
|
ret := C.QEventLoopLocker_new2(loop.cPointer())
|
|
|
|
return newQEventLoopLocker(ret)
|
|
|
|
}
|
|
|
|
|
|
|
|
// NewQEventLoopLocker3 constructs a new QEventLoopLocker object.
|
|
|
|
func NewQEventLoopLocker3(thread *QThread) *QEventLoopLocker {
|
|
|
|
ret := C.QEventLoopLocker_new3(thread.cPointer())
|
|
|
|
return newQEventLoopLocker(ret)
|
|
|
|
}
|
|
|
|
|
2024-09-14 22:29:05 +00:00
|
|
|
// Delete this object from C++ memory.
|
2024-08-25 04:08:24 +00:00
|
|
|
func (this *QEventLoopLocker) Delete() {
|
|
|
|
C.QEventLoopLocker_Delete(this.h)
|
|
|
|
}
|
2024-09-14 22:29:05 +00:00
|
|
|
|
|
|
|
// GoGC adds a Go Finalizer to this pointer, so that it will be deleted
|
|
|
|
// from C++ memory once it is unreachable from Go memory.
|
|
|
|
func (this *QEventLoopLocker) GoGC() {
|
|
|
|
runtime.SetFinalizer(this, func(this *QEventLoopLocker) {
|
|
|
|
this.Delete()
|
|
|
|
runtime.KeepAlive(this.h)
|
|
|
|
})
|
|
|
|
}
|