miqt/qt/gen_qrunnable.go

81 lines
1.5 KiB
Go
Raw Normal View History

package qt
/*
#include "gen_qrunnable.h"
#include <stdlib.h>
*/
import "C"
import (
"runtime"
"unsafe"
)
type QRunnable struct {
2024-11-19 06:29:06 +00:00
h *C.QRunnable
isSubclass bool
}
func (this *QRunnable) cPointer() *C.QRunnable {
if this == nil {
return nil
}
return this.h
}
func (this *QRunnable) UnsafePointer() unsafe.Pointer {
if this == nil {
return nil
}
return unsafe.Pointer(this.h)
}
2024-11-19 06:29:06 +00:00
// newQRunnable constructs the type using only CGO pointers.
func newQRunnable(h *C.QRunnable) *QRunnable {
2024-09-01 02:23:55 +00:00
if h == nil {
return nil
}
return &QRunnable{h: h}
}
2024-11-19 06:29:06 +00:00
// UnsafeNewQRunnable constructs the type using only unsafe pointers.
func UnsafeNewQRunnable(h unsafe.Pointer) *QRunnable {
2024-11-19 06:29:06 +00:00
if h == nil {
return nil
}
return &QRunnable{h: (*C.QRunnable)(h)}
}
func (this *QRunnable) Run() {
C.QRunnable_Run(this.h)
}
func (this *QRunnable) AutoDelete() bool {
return (bool)(C.QRunnable_AutoDelete(this.h))
}
func (this *QRunnable) SetAutoDelete(_autoDelete bool) {
C.QRunnable_SetAutoDelete(this.h, (C.bool)(_autoDelete))
}
func (this *QRunnable) OperatorAssign(param1 *QRunnable) {
C.QRunnable_OperatorAssign(this.h, param1.cPointer())
}
// Delete this object from C++ memory.
func (this *QRunnable) Delete() {
2024-11-19 06:29:06 +00:00
C.QRunnable_Delete(this.h, C.bool(this.isSubclass))
}
// 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 *QRunnable) GoGC() {
runtime.SetFinalizer(this, func(this *QRunnable) {
this.Delete()
runtime.KeepAlive(this.h)
})
}