2024-10-20 05:21:03 +00:00
|
|
|
package qt6
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
|
|
|
#include "gen_qbasictimer.h"
|
|
|
|
#include <stdlib.h>
|
|
|
|
|
|
|
|
*/
|
|
|
|
import "C"
|
|
|
|
|
|
|
|
import (
|
|
|
|
"runtime"
|
|
|
|
"unsafe"
|
|
|
|
)
|
|
|
|
|
|
|
|
type QBasicTimer struct {
|
2024-11-19 06:29:06 +00:00
|
|
|
h *C.QBasicTimer
|
|
|
|
isSubclass bool
|
2024-10-20 05:21:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QBasicTimer) cPointer() *C.QBasicTimer {
|
|
|
|
if this == nil {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
return this.h
|
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QBasicTimer) UnsafePointer() unsafe.Pointer {
|
|
|
|
if this == nil {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
return unsafe.Pointer(this.h)
|
|
|
|
}
|
|
|
|
|
2024-11-19 06:29:06 +00:00
|
|
|
// newQBasicTimer constructs the type using only CGO pointers.
|
2024-10-20 05:21:03 +00:00
|
|
|
func newQBasicTimer(h *C.QBasicTimer) *QBasicTimer {
|
|
|
|
if h == nil {
|
|
|
|
return nil
|
|
|
|
}
|
2024-12-07 04:15:57 +00:00
|
|
|
|
2024-10-20 05:21:03 +00:00
|
|
|
return &QBasicTimer{h: h}
|
|
|
|
}
|
|
|
|
|
2024-11-19 06:29:06 +00:00
|
|
|
// UnsafeNewQBasicTimer constructs the type using only unsafe pointers.
|
2024-10-20 05:21:03 +00:00
|
|
|
func UnsafeNewQBasicTimer(h unsafe.Pointer) *QBasicTimer {
|
2024-12-07 04:15:57 +00:00
|
|
|
return newQBasicTimer((*C.QBasicTimer)(h))
|
2024-10-20 05:21:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// NewQBasicTimer constructs a new QBasicTimer object.
|
|
|
|
func NewQBasicTimer() *QBasicTimer {
|
2024-11-19 06:29:06 +00:00
|
|
|
|
2024-12-07 04:15:57 +00:00
|
|
|
ret := newQBasicTimer(C.QBasicTimer_new())
|
2024-11-19 06:29:06 +00:00
|
|
|
ret.isSubclass = true
|
|
|
|
return ret
|
2024-10-20 05:21:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QBasicTimer) Swap(other *QBasicTimer) {
|
|
|
|
C.QBasicTimer_Swap(this.h, other.cPointer())
|
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QBasicTimer) IsActive() bool {
|
|
|
|
return (bool)(C.QBasicTimer_IsActive(this.h))
|
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QBasicTimer) TimerId() int {
|
|
|
|
return (int)(C.QBasicTimer_TimerId(this.h))
|
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QBasicTimer) Start(msec int, obj *QObject) {
|
|
|
|
C.QBasicTimer_Start(this.h, (C.int)(msec), obj.cPointer())
|
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QBasicTimer) Start2(msec int, timerType TimerType, obj *QObject) {
|
|
|
|
C.QBasicTimer_Start2(this.h, (C.int)(msec), (C.int)(timerType), obj.cPointer())
|
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QBasicTimer) Stop() {
|
|
|
|
C.QBasicTimer_Stop(this.h)
|
|
|
|
}
|
|
|
|
|
|
|
|
// Delete this object from C++ memory.
|
|
|
|
func (this *QBasicTimer) Delete() {
|
2024-11-19 06:29:06 +00:00
|
|
|
C.QBasicTimer_Delete(this.h, C.bool(this.isSubclass))
|
2024-10-20 05:21:03 +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 *QBasicTimer) GoGC() {
|
|
|
|
runtime.SetFinalizer(this, func(this *QBasicTimer) {
|
|
|
|
this.Delete()
|
|
|
|
runtime.KeepAlive(this.h)
|
|
|
|
})
|
|
|
|
}
|