2024-10-20 05:21:03 +00:00
|
|
|
package qt6
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
|
|
|
#include "gen_qabstractnativeeventfilter.h"
|
|
|
|
#include <stdlib.h>
|
|
|
|
|
|
|
|
*/
|
|
|
|
import "C"
|
|
|
|
|
|
|
|
import (
|
|
|
|
"runtime"
|
2024-11-23 06:34:52 +00:00
|
|
|
"runtime/cgo"
|
2024-10-20 05:21:03 +00:00
|
|
|
"unsafe"
|
|
|
|
)
|
|
|
|
|
|
|
|
type QAbstractNativeEventFilter struct {
|
2024-11-19 06:29:06 +00:00
|
|
|
h *C.QAbstractNativeEventFilter
|
|
|
|
isSubclass bool
|
2024-10-20 05:21:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QAbstractNativeEventFilter) cPointer() *C.QAbstractNativeEventFilter {
|
|
|
|
if this == nil {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
return this.h
|
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QAbstractNativeEventFilter) UnsafePointer() unsafe.Pointer {
|
|
|
|
if this == nil {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
return unsafe.Pointer(this.h)
|
|
|
|
}
|
|
|
|
|
2024-11-19 06:29:06 +00:00
|
|
|
// newQAbstractNativeEventFilter constructs the type using only CGO pointers.
|
2024-10-20 05:21:03 +00:00
|
|
|
func newQAbstractNativeEventFilter(h *C.QAbstractNativeEventFilter) *QAbstractNativeEventFilter {
|
|
|
|
if h == nil {
|
|
|
|
return nil
|
|
|
|
}
|
2024-12-07 04:15:57 +00:00
|
|
|
|
2024-10-20 05:21:03 +00:00
|
|
|
return &QAbstractNativeEventFilter{h: h}
|
|
|
|
}
|
|
|
|
|
2024-11-19 06:29:06 +00:00
|
|
|
// UnsafeNewQAbstractNativeEventFilter constructs the type using only unsafe pointers.
|
2024-10-20 05:21:03 +00:00
|
|
|
func UnsafeNewQAbstractNativeEventFilter(h unsafe.Pointer) *QAbstractNativeEventFilter {
|
2024-12-07 04:15:57 +00:00
|
|
|
return newQAbstractNativeEventFilter((*C.QAbstractNativeEventFilter)(h))
|
2024-10-20 05:21:03 +00:00
|
|
|
}
|
|
|
|
|
2024-11-23 06:34:52 +00:00
|
|
|
// NewQAbstractNativeEventFilter constructs a new QAbstractNativeEventFilter object.
|
|
|
|
func NewQAbstractNativeEventFilter() *QAbstractNativeEventFilter {
|
|
|
|
|
2024-12-07 04:15:57 +00:00
|
|
|
ret := newQAbstractNativeEventFilter(C.QAbstractNativeEventFilter_new())
|
2024-11-23 06:34:52 +00:00
|
|
|
ret.isSubclass = true
|
|
|
|
return ret
|
|
|
|
}
|
|
|
|
|
2024-10-20 05:21:03 +00:00
|
|
|
func (this *QAbstractNativeEventFilter) NativeEventFilter(eventType []byte, message unsafe.Pointer, result *uintptr) bool {
|
|
|
|
eventType_alias := C.struct_miqt_string{}
|
|
|
|
eventType_alias.data = (*C.char)(unsafe.Pointer(&eventType[0]))
|
|
|
|
eventType_alias.len = C.size_t(len(eventType))
|
|
|
|
return (bool)(C.QAbstractNativeEventFilter_NativeEventFilter(this.h, eventType_alias, message, (*C.intptr_t)(unsafe.Pointer(result))))
|
|
|
|
}
|
2024-11-23 06:34:52 +00:00
|
|
|
func (this *QAbstractNativeEventFilter) OnNativeEventFilter(slot func(eventType []byte, message unsafe.Pointer, result *uintptr) bool) {
|
2024-12-07 01:43:28 +00:00
|
|
|
if !this.isSubclass {
|
|
|
|
panic("miqt: can only override virtual methods for directly constructed types")
|
|
|
|
}
|
2024-11-23 06:34:52 +00:00
|
|
|
C.QAbstractNativeEventFilter_override_virtual_NativeEventFilter(unsafe.Pointer(this.h), C.intptr_t(cgo.NewHandle(slot)))
|
|
|
|
}
|
|
|
|
|
|
|
|
//export miqt_exec_callback_QAbstractNativeEventFilter_NativeEventFilter
|
|
|
|
func miqt_exec_callback_QAbstractNativeEventFilter_NativeEventFilter(self *C.QAbstractNativeEventFilter, cb C.intptr_t, eventType C.struct_miqt_string, message unsafe.Pointer, result *C.intptr_t) C.bool {
|
|
|
|
gofunc, ok := cgo.Handle(cb).Value().(func(eventType []byte, message unsafe.Pointer, result *uintptr) bool)
|
|
|
|
if !ok {
|
|
|
|
panic("miqt: callback of non-callback type (heap corruption?)")
|
|
|
|
}
|
|
|
|
|
|
|
|
// Convert all CABI parameters to Go parameters
|
|
|
|
var eventType_bytearray C.struct_miqt_string = eventType
|
|
|
|
eventType_ret := C.GoBytes(unsafe.Pointer(eventType_bytearray.data), C.int(int64(eventType_bytearray.len)))
|
|
|
|
C.free(unsafe.Pointer(eventType_bytearray.data))
|
|
|
|
slotval1 := eventType_ret
|
|
|
|
slotval2 := (unsafe.Pointer)(message)
|
|
|
|
|
|
|
|
slotval3 := (*uintptr)(unsafe.Pointer(result))
|
|
|
|
|
|
|
|
virtualReturn := gofunc(slotval1, slotval2, slotval3)
|
|
|
|
|
|
|
|
return (C.bool)(virtualReturn)
|
|
|
|
|
|
|
|
}
|
2024-10-20 05:21:03 +00:00
|
|
|
|
|
|
|
// Delete this object from C++ memory.
|
|
|
|
func (this *QAbstractNativeEventFilter) Delete() {
|
2024-11-19 06:29:06 +00:00
|
|
|
C.QAbstractNativeEventFilter_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 *QAbstractNativeEventFilter) GoGC() {
|
|
|
|
runtime.SetFinalizer(this, func(this *QAbstractNativeEventFilter) {
|
|
|
|
this.Delete()
|
|
|
|
runtime.KeepAlive(this.h)
|
|
|
|
})
|
|
|
|
}
|