miqt/qt/gen_qgesturerecognizer.go

188 lines
6.1 KiB
Go
Raw Permalink Normal View History

package qt
/*
#include "gen_qgesturerecognizer.h"
#include <stdlib.h>
*/
import "C"
import (
"runtime"
"runtime/cgo"
"unsafe"
)
2024-09-04 06:54:22 +00:00
type QGestureRecognizer__ResultFlag int
const (
2024-09-20 07:13:26 +00:00
QGestureRecognizer__Ignore QGestureRecognizer__ResultFlag = 1
QGestureRecognizer__MayBeGesture QGestureRecognizer__ResultFlag = 2
QGestureRecognizer__TriggerGesture QGestureRecognizer__ResultFlag = 4
QGestureRecognizer__FinishGesture QGestureRecognizer__ResultFlag = 8
QGestureRecognizer__CancelGesture QGestureRecognizer__ResultFlag = 16
QGestureRecognizer__ResultState_Mask QGestureRecognizer__ResultFlag = 255
QGestureRecognizer__ConsumeEventHint QGestureRecognizer__ResultFlag = 256
QGestureRecognizer__ResultHint_Mask QGestureRecognizer__ResultFlag = 65280
2024-09-04 06:54:22 +00:00
)
type QGestureRecognizer struct {
2024-11-19 06:29:06 +00:00
h *C.QGestureRecognizer
isSubclass bool
}
func (this *QGestureRecognizer) cPointer() *C.QGestureRecognizer {
if this == nil {
return nil
}
return this.h
}
func (this *QGestureRecognizer) UnsafePointer() unsafe.Pointer {
if this == nil {
return nil
}
return unsafe.Pointer(this.h)
}
2024-11-19 06:29:06 +00:00
// newQGestureRecognizer constructs the type using only CGO pointers.
func newQGestureRecognizer(h *C.QGestureRecognizer) *QGestureRecognizer {
2024-09-01 02:23:55 +00:00
if h == nil {
return nil
}
2024-12-07 04:15:57 +00:00
return &QGestureRecognizer{h: h}
}
2024-11-19 06:29:06 +00:00
// UnsafeNewQGestureRecognizer constructs the type using only unsafe pointers.
func UnsafeNewQGestureRecognizer(h unsafe.Pointer) *QGestureRecognizer {
2024-12-07 04:15:57 +00:00
return newQGestureRecognizer((*C.QGestureRecognizer)(h))
}
// NewQGestureRecognizer constructs a new QGestureRecognizer object.
func NewQGestureRecognizer() *QGestureRecognizer {
2024-12-07 04:15:57 +00:00
ret := newQGestureRecognizer(C.QGestureRecognizer_new())
ret.isSubclass = true
return ret
}
func (this *QGestureRecognizer) Create(target *QObject) *QGesture {
2024-12-07 04:15:57 +00:00
return newQGesture(C.QGestureRecognizer_Create(this.h, target.cPointer()))
}
func (this *QGestureRecognizer) Recognize(state *QGesture, watched *QObject, event *QEvent) QGestureRecognizer__ResultFlag {
return (QGestureRecognizer__ResultFlag)(C.QGestureRecognizer_Recognize(this.h, state.cPointer(), watched.cPointer(), event.cPointer()))
2024-08-29 07:01:51 +00:00
}
func (this *QGestureRecognizer) Reset(state *QGesture) {
C.QGestureRecognizer_Reset(this.h, state.cPointer())
}
2024-09-04 06:54:22 +00:00
func QGestureRecognizer_RegisterRecognizer(recognizer *QGestureRecognizer) GestureType {
return (GestureType)(C.QGestureRecognizer_RegisterRecognizer(recognizer.cPointer()))
2024-08-29 07:01:51 +00:00
}
2024-09-04 06:54:22 +00:00
func QGestureRecognizer_UnregisterRecognizer(typeVal GestureType) {
C.QGestureRecognizer_UnregisterRecognizer((C.int)(typeVal))
2024-08-29 07:01:51 +00:00
}
func (this *QGestureRecognizer) OperatorAssign(param1 *QGestureRecognizer) {
C.QGestureRecognizer_OperatorAssign(this.h, param1.cPointer())
}
func (this *QGestureRecognizer) callVirtualBase_Create(target *QObject) *QGesture {
2024-12-07 04:15:57 +00:00
return newQGesture(C.QGestureRecognizer_virtualbase_Create(unsafe.Pointer(this.h), target.cPointer()))
}
func (this *QGestureRecognizer) OnCreate(slot func(super func(target *QObject) *QGesture, target *QObject) *QGesture) {
if !this.isSubclass {
panic("miqt: can only override virtual methods for directly constructed types")
}
C.QGestureRecognizer_override_virtual_Create(unsafe.Pointer(this.h), C.intptr_t(cgo.NewHandle(slot)))
}
//export miqt_exec_callback_QGestureRecognizer_Create
func miqt_exec_callback_QGestureRecognizer_Create(self *C.QGestureRecognizer, cb C.intptr_t, target *C.QObject) *C.QGesture {
gofunc, ok := cgo.Handle(cb).Value().(func(super func(target *QObject) *QGesture, target *QObject) *QGesture)
if !ok {
panic("miqt: callback of non-callback type (heap corruption?)")
}
// Convert all CABI parameters to Go parameters
slotval1 := newQObject(target)
virtualReturn := gofunc((&QGestureRecognizer{h: self}).callVirtualBase_Create, slotval1)
return virtualReturn.cPointer()
}
func (this *QGestureRecognizer) OnRecognize(slot func(state *QGesture, watched *QObject, event *QEvent) QGestureRecognizer__ResultFlag) {
if !this.isSubclass {
panic("miqt: can only override virtual methods for directly constructed types")
}
C.QGestureRecognizer_override_virtual_Recognize(unsafe.Pointer(this.h), C.intptr_t(cgo.NewHandle(slot)))
}
//export miqt_exec_callback_QGestureRecognizer_Recognize
func miqt_exec_callback_QGestureRecognizer_Recognize(self *C.QGestureRecognizer, cb C.intptr_t, state *C.QGesture, watched *C.QObject, event *C.QEvent) C.int {
gofunc, ok := cgo.Handle(cb).Value().(func(state *QGesture, watched *QObject, event *QEvent) QGestureRecognizer__ResultFlag)
if !ok {
panic("miqt: callback of non-callback type (heap corruption?)")
}
// Convert all CABI parameters to Go parameters
2024-12-07 04:15:57 +00:00
slotval1 := newQGesture(state)
slotval2 := newQObject(watched)
slotval3 := newQEvent(event)
virtualReturn := gofunc(slotval1, slotval2, slotval3)
return (C.int)(virtualReturn)
}
func (this *QGestureRecognizer) callVirtualBase_Reset(state *QGesture) {
C.QGestureRecognizer_virtualbase_Reset(unsafe.Pointer(this.h), state.cPointer())
}
func (this *QGestureRecognizer) OnReset(slot func(super func(state *QGesture), state *QGesture)) {
if !this.isSubclass {
panic("miqt: can only override virtual methods for directly constructed types")
}
C.QGestureRecognizer_override_virtual_Reset(unsafe.Pointer(this.h), C.intptr_t(cgo.NewHandle(slot)))
}
//export miqt_exec_callback_QGestureRecognizer_Reset
func miqt_exec_callback_QGestureRecognizer_Reset(self *C.QGestureRecognizer, cb C.intptr_t, state *C.QGesture) {
gofunc, ok := cgo.Handle(cb).Value().(func(super func(state *QGesture), state *QGesture))
if !ok {
panic("miqt: callback of non-callback type (heap corruption?)")
}
// Convert all CABI parameters to Go parameters
2024-12-07 04:15:57 +00:00
slotval1 := newQGesture(state)
gofunc((&QGestureRecognizer{h: self}).callVirtualBase_Reset, slotval1)
}
// Delete this object from C++ memory.
func (this *QGestureRecognizer) Delete() {
2024-11-19 06:29:06 +00:00
C.QGestureRecognizer_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 *QGestureRecognizer) GoGC() {
runtime.SetFinalizer(this, func(this *QGestureRecognizer) {
this.Delete()
runtime.KeepAlive(this.h)
})
}