miqt/qt/webchannel/gen_qqmlwebchannel.go

370 lines
13 KiB
Go

package webchannel
/*
#include "gen_qqmlwebchannel.h"
#include <stdlib.h>
*/
import "C"
import (
"github.com/mappu/miqt/qt"
"runtime"
"runtime/cgo"
"unsafe"
)
type QQmlWebChannel struct {
h *C.QQmlWebChannel
*QWebChannel
}
func (this *QQmlWebChannel) cPointer() *C.QQmlWebChannel {
if this == nil {
return nil
}
return this.h
}
func (this *QQmlWebChannel) UnsafePointer() unsafe.Pointer {
if this == nil {
return nil
}
return unsafe.Pointer(this.h)
}
// newQQmlWebChannel constructs the type using only CGO pointers.
func newQQmlWebChannel(h *C.QQmlWebChannel) *QQmlWebChannel {
if h == nil {
return nil
}
var outptr_QWebChannel *C.QWebChannel = nil
C.QQmlWebChannel_virtbase(h, &outptr_QWebChannel)
return &QQmlWebChannel{h: h,
QWebChannel: newQWebChannel(outptr_QWebChannel)}
}
// UnsafeNewQQmlWebChannel constructs the type using only unsafe pointers.
func UnsafeNewQQmlWebChannel(h unsafe.Pointer) *QQmlWebChannel {
return newQQmlWebChannel((*C.QQmlWebChannel)(h))
}
// NewQQmlWebChannel constructs a new QQmlWebChannel object.
func NewQQmlWebChannel() *QQmlWebChannel {
return newQQmlWebChannel(C.QQmlWebChannel_new())
}
// NewQQmlWebChannel2 constructs a new QQmlWebChannel object.
func NewQQmlWebChannel2(parent *qt.QObject) *QQmlWebChannel {
return newQQmlWebChannel(C.QQmlWebChannel_new2((*C.QObject)(parent.UnsafePointer())))
}
func (this *QQmlWebChannel) MetaObject() *qt.QMetaObject {
return qt.UnsafeNewQMetaObject(unsafe.Pointer(C.QQmlWebChannel_MetaObject(this.h)))
}
func (this *QQmlWebChannel) Metacast(param1 string) unsafe.Pointer {
param1_Cstring := C.CString(param1)
defer C.free(unsafe.Pointer(param1_Cstring))
return (unsafe.Pointer)(C.QQmlWebChannel_Metacast(this.h, param1_Cstring))
}
func QQmlWebChannel_Tr(s string) string {
s_Cstring := C.CString(s)
defer C.free(unsafe.Pointer(s_Cstring))
var _ms C.struct_miqt_string = C.QQmlWebChannel_Tr(s_Cstring)
_ret := C.GoStringN(_ms.data, C.int(int64(_ms.len)))
C.free(unsafe.Pointer(_ms.data))
return _ret
}
func QQmlWebChannel_TrUtf8(s string) string {
s_Cstring := C.CString(s)
defer C.free(unsafe.Pointer(s_Cstring))
var _ms C.struct_miqt_string = C.QQmlWebChannel_TrUtf8(s_Cstring)
_ret := C.GoStringN(_ms.data, C.int(int64(_ms.len)))
C.free(unsafe.Pointer(_ms.data))
return _ret
}
func (this *QQmlWebChannel) RegisterObjects(objects map[string]qt.QVariant) {
objects_Keys_CArray := (*[0xffff]C.struct_miqt_string)(C.malloc(C.size_t(int(unsafe.Sizeof(C.struct_miqt_string{})) * len(objects))))
defer C.free(unsafe.Pointer(objects_Keys_CArray))
objects_Values_CArray := (*[0xffff]*C.QVariant)(C.malloc(C.size_t(8 * len(objects))))
defer C.free(unsafe.Pointer(objects_Values_CArray))
objects_ctr := 0
for objects_k, objects_v := range objects {
objects_k_ms := C.struct_miqt_string{}
objects_k_ms.data = C.CString(objects_k)
objects_k_ms.len = C.size_t(len(objects_k))
defer C.free(unsafe.Pointer(objects_k_ms.data))
objects_Keys_CArray[objects_ctr] = objects_k_ms
objects_Values_CArray[objects_ctr] = (*C.QVariant)(objects_v.UnsafePointer())
objects_ctr++
}
objects_mm := C.struct_miqt_map{
len: C.size_t(len(objects)),
keys: unsafe.Pointer(objects_Keys_CArray),
values: unsafe.Pointer(objects_Values_CArray),
}
C.QQmlWebChannel_RegisterObjects(this.h, objects_mm)
}
func (this *QQmlWebChannel) ConnectTo(transport *qt.QObject) {
C.QQmlWebChannel_ConnectTo(this.h, (*C.QObject)(transport.UnsafePointer()))
}
func (this *QQmlWebChannel) DisconnectFrom(transport *qt.QObject) {
C.QQmlWebChannel_DisconnectFrom(this.h, (*C.QObject)(transport.UnsafePointer()))
}
func QQmlWebChannel_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))
var _ms C.struct_miqt_string = C.QQmlWebChannel_Tr2(s_Cstring, c_Cstring)
_ret := C.GoStringN(_ms.data, C.int(int64(_ms.len)))
C.free(unsafe.Pointer(_ms.data))
return _ret
}
func QQmlWebChannel_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))
var _ms C.struct_miqt_string = C.QQmlWebChannel_Tr3(s_Cstring, c_Cstring, (C.int)(n))
_ret := C.GoStringN(_ms.data, C.int(int64(_ms.len)))
C.free(unsafe.Pointer(_ms.data))
return _ret
}
func QQmlWebChannel_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))
var _ms C.struct_miqt_string = C.QQmlWebChannel_TrUtf82(s_Cstring, c_Cstring)
_ret := C.GoStringN(_ms.data, C.int(int64(_ms.len)))
C.free(unsafe.Pointer(_ms.data))
return _ret
}
func QQmlWebChannel_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))
var _ms C.struct_miqt_string = C.QQmlWebChannel_TrUtf83(s_Cstring, c_Cstring, (C.int)(n))
_ret := C.GoStringN(_ms.data, C.int(int64(_ms.len)))
C.free(unsafe.Pointer(_ms.data))
return _ret
}
func (this *QQmlWebChannel) callVirtualBase_Event(event *qt.QEvent) bool {
return (bool)(C.QQmlWebChannel_virtualbase_Event(unsafe.Pointer(this.h), (*C.QEvent)(event.UnsafePointer())))
}
func (this *QQmlWebChannel) OnEvent(slot func(super func(event *qt.QEvent) bool, event *qt.QEvent) bool) {
ok := C.QQmlWebChannel_override_virtual_Event(unsafe.Pointer(this.h), C.intptr_t(cgo.NewHandle(slot)))
if !ok {
panic("miqt: can only override virtual methods for directly constructed types")
}
}
//export miqt_exec_callback_QQmlWebChannel_Event
func miqt_exec_callback_QQmlWebChannel_Event(self *C.QQmlWebChannel, cb C.intptr_t, event *C.QEvent) C.bool {
gofunc, ok := cgo.Handle(cb).Value().(func(super func(event *qt.QEvent) bool, event *qt.QEvent) bool)
if !ok {
panic("miqt: callback of non-callback type (heap corruption?)")
}
// Convert all CABI parameters to Go parameters
slotval1 := qt.UnsafeNewQEvent(unsafe.Pointer(event))
virtualReturn := gofunc((&QQmlWebChannel{h: self}).callVirtualBase_Event, slotval1)
return (C.bool)(virtualReturn)
}
func (this *QQmlWebChannel) callVirtualBase_EventFilter(watched *qt.QObject, event *qt.QEvent) bool {
return (bool)(C.QQmlWebChannel_virtualbase_EventFilter(unsafe.Pointer(this.h), (*C.QObject)(watched.UnsafePointer()), (*C.QEvent)(event.UnsafePointer())))
}
func (this *QQmlWebChannel) OnEventFilter(slot func(super func(watched *qt.QObject, event *qt.QEvent) bool, watched *qt.QObject, event *qt.QEvent) bool) {
ok := C.QQmlWebChannel_override_virtual_EventFilter(unsafe.Pointer(this.h), C.intptr_t(cgo.NewHandle(slot)))
if !ok {
panic("miqt: can only override virtual methods for directly constructed types")
}
}
//export miqt_exec_callback_QQmlWebChannel_EventFilter
func miqt_exec_callback_QQmlWebChannel_EventFilter(self *C.QQmlWebChannel, cb C.intptr_t, watched *C.QObject, event *C.QEvent) C.bool {
gofunc, ok := cgo.Handle(cb).Value().(func(super func(watched *qt.QObject, event *qt.QEvent) bool, watched *qt.QObject, event *qt.QEvent) bool)
if !ok {
panic("miqt: callback of non-callback type (heap corruption?)")
}
// Convert all CABI parameters to Go parameters
slotval1 := qt.UnsafeNewQObject(unsafe.Pointer(watched))
slotval2 := qt.UnsafeNewQEvent(unsafe.Pointer(event))
virtualReturn := gofunc((&QQmlWebChannel{h: self}).callVirtualBase_EventFilter, slotval1, slotval2)
return (C.bool)(virtualReturn)
}
func (this *QQmlWebChannel) callVirtualBase_TimerEvent(event *qt.QTimerEvent) {
C.QQmlWebChannel_virtualbase_TimerEvent(unsafe.Pointer(this.h), (*C.QTimerEvent)(event.UnsafePointer()))
}
func (this *QQmlWebChannel) OnTimerEvent(slot func(super func(event *qt.QTimerEvent), event *qt.QTimerEvent)) {
ok := C.QQmlWebChannel_override_virtual_TimerEvent(unsafe.Pointer(this.h), C.intptr_t(cgo.NewHandle(slot)))
if !ok {
panic("miqt: can only override virtual methods for directly constructed types")
}
}
//export miqt_exec_callback_QQmlWebChannel_TimerEvent
func miqt_exec_callback_QQmlWebChannel_TimerEvent(self *C.QQmlWebChannel, cb C.intptr_t, event *C.QTimerEvent) {
gofunc, ok := cgo.Handle(cb).Value().(func(super func(event *qt.QTimerEvent), event *qt.QTimerEvent))
if !ok {
panic("miqt: callback of non-callback type (heap corruption?)")
}
// Convert all CABI parameters to Go parameters
slotval1 := qt.UnsafeNewQTimerEvent(unsafe.Pointer(event))
gofunc((&QQmlWebChannel{h: self}).callVirtualBase_TimerEvent, slotval1)
}
func (this *QQmlWebChannel) callVirtualBase_ChildEvent(event *qt.QChildEvent) {
C.QQmlWebChannel_virtualbase_ChildEvent(unsafe.Pointer(this.h), (*C.QChildEvent)(event.UnsafePointer()))
}
func (this *QQmlWebChannel) OnChildEvent(slot func(super func(event *qt.QChildEvent), event *qt.QChildEvent)) {
ok := C.QQmlWebChannel_override_virtual_ChildEvent(unsafe.Pointer(this.h), C.intptr_t(cgo.NewHandle(slot)))
if !ok {
panic("miqt: can only override virtual methods for directly constructed types")
}
}
//export miqt_exec_callback_QQmlWebChannel_ChildEvent
func miqt_exec_callback_QQmlWebChannel_ChildEvent(self *C.QQmlWebChannel, cb C.intptr_t, event *C.QChildEvent) {
gofunc, ok := cgo.Handle(cb).Value().(func(super func(event *qt.QChildEvent), event *qt.QChildEvent))
if !ok {
panic("miqt: callback of non-callback type (heap corruption?)")
}
// Convert all CABI parameters to Go parameters
slotval1 := qt.UnsafeNewQChildEvent(unsafe.Pointer(event))
gofunc((&QQmlWebChannel{h: self}).callVirtualBase_ChildEvent, slotval1)
}
func (this *QQmlWebChannel) callVirtualBase_CustomEvent(event *qt.QEvent) {
C.QQmlWebChannel_virtualbase_CustomEvent(unsafe.Pointer(this.h), (*C.QEvent)(event.UnsafePointer()))
}
func (this *QQmlWebChannel) OnCustomEvent(slot func(super func(event *qt.QEvent), event *qt.QEvent)) {
ok := C.QQmlWebChannel_override_virtual_CustomEvent(unsafe.Pointer(this.h), C.intptr_t(cgo.NewHandle(slot)))
if !ok {
panic("miqt: can only override virtual methods for directly constructed types")
}
}
//export miqt_exec_callback_QQmlWebChannel_CustomEvent
func miqt_exec_callback_QQmlWebChannel_CustomEvent(self *C.QQmlWebChannel, cb C.intptr_t, event *C.QEvent) {
gofunc, ok := cgo.Handle(cb).Value().(func(super func(event *qt.QEvent), event *qt.QEvent))
if !ok {
panic("miqt: callback of non-callback type (heap corruption?)")
}
// Convert all CABI parameters to Go parameters
slotval1 := qt.UnsafeNewQEvent(unsafe.Pointer(event))
gofunc((&QQmlWebChannel{h: self}).callVirtualBase_CustomEvent, slotval1)
}
func (this *QQmlWebChannel) callVirtualBase_ConnectNotify(signal *qt.QMetaMethod) {
C.QQmlWebChannel_virtualbase_ConnectNotify(unsafe.Pointer(this.h), (*C.QMetaMethod)(signal.UnsafePointer()))
}
func (this *QQmlWebChannel) OnConnectNotify(slot func(super func(signal *qt.QMetaMethod), signal *qt.QMetaMethod)) {
ok := C.QQmlWebChannel_override_virtual_ConnectNotify(unsafe.Pointer(this.h), C.intptr_t(cgo.NewHandle(slot)))
if !ok {
panic("miqt: can only override virtual methods for directly constructed types")
}
}
//export miqt_exec_callback_QQmlWebChannel_ConnectNotify
func miqt_exec_callback_QQmlWebChannel_ConnectNotify(self *C.QQmlWebChannel, cb C.intptr_t, signal *C.QMetaMethod) {
gofunc, ok := cgo.Handle(cb).Value().(func(super func(signal *qt.QMetaMethod), signal *qt.QMetaMethod))
if !ok {
panic("miqt: callback of non-callback type (heap corruption?)")
}
// Convert all CABI parameters to Go parameters
slotval1 := qt.UnsafeNewQMetaMethod(unsafe.Pointer(signal))
gofunc((&QQmlWebChannel{h: self}).callVirtualBase_ConnectNotify, slotval1)
}
func (this *QQmlWebChannel) callVirtualBase_DisconnectNotify(signal *qt.QMetaMethod) {
C.QQmlWebChannel_virtualbase_DisconnectNotify(unsafe.Pointer(this.h), (*C.QMetaMethod)(signal.UnsafePointer()))
}
func (this *QQmlWebChannel) OnDisconnectNotify(slot func(super func(signal *qt.QMetaMethod), signal *qt.QMetaMethod)) {
ok := C.QQmlWebChannel_override_virtual_DisconnectNotify(unsafe.Pointer(this.h), C.intptr_t(cgo.NewHandle(slot)))
if !ok {
panic("miqt: can only override virtual methods for directly constructed types")
}
}
//export miqt_exec_callback_QQmlWebChannel_DisconnectNotify
func miqt_exec_callback_QQmlWebChannel_DisconnectNotify(self *C.QQmlWebChannel, cb C.intptr_t, signal *C.QMetaMethod) {
gofunc, ok := cgo.Handle(cb).Value().(func(super func(signal *qt.QMetaMethod), signal *qt.QMetaMethod))
if !ok {
panic("miqt: callback of non-callback type (heap corruption?)")
}
// Convert all CABI parameters to Go parameters
slotval1 := qt.UnsafeNewQMetaMethod(unsafe.Pointer(signal))
gofunc((&QQmlWebChannel{h: self}).callVirtualBase_DisconnectNotify, slotval1)
}
// Delete this object from C++ memory.
func (this *QQmlWebChannel) Delete() {
C.QQmlWebChannel_Delete(this.h)
}
// 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 *QQmlWebChannel) GoGC() {
runtime.SetFinalizer(this, func(this *QQmlWebChannel) {
this.Delete()
runtime.KeepAlive(this.h)
})
}