2024-08-25 04:08:24 +00:00
|
|
|
package qt
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
|
|
|
#include "gen_qstate.h"
|
|
|
|
#include <stdlib.h>
|
|
|
|
|
|
|
|
*/
|
|
|
|
import "C"
|
|
|
|
|
|
|
|
import (
|
2024-09-14 22:29:05 +00:00
|
|
|
"runtime"
|
2024-11-19 06:29:06 +00:00
|
|
|
"runtime/cgo"
|
2024-08-25 04:08:24 +00:00
|
|
|
"unsafe"
|
|
|
|
)
|
|
|
|
|
2024-09-04 06:54:22 +00:00
|
|
|
type QState__ChildMode int
|
|
|
|
|
|
|
|
const (
|
2024-09-20 07:13:26 +00:00
|
|
|
QState__ExclusiveStates QState__ChildMode = 0
|
|
|
|
QState__ParallelStates QState__ChildMode = 1
|
2024-09-04 06:54:22 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
type QState__RestorePolicy int
|
|
|
|
|
|
|
|
const (
|
2024-09-20 07:13:26 +00:00
|
|
|
QState__DontRestoreProperties QState__RestorePolicy = 0
|
|
|
|
QState__RestoreProperties QState__RestorePolicy = 1
|
2024-09-04 06:54:22 +00:00
|
|
|
)
|
|
|
|
|
2024-08-25 04:08:24 +00:00
|
|
|
type QState struct {
|
2024-11-19 06:29:06 +00:00
|
|
|
h *C.QState
|
|
|
|
isSubclass bool
|
2024-08-25 04:08:24 +00:00
|
|
|
*QAbstractState
|
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QState) cPointer() *C.QState {
|
|
|
|
if this == nil {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
return this.h
|
|
|
|
}
|
|
|
|
|
2024-10-16 05:07:56 +00:00
|
|
|
func (this *QState) UnsafePointer() unsafe.Pointer {
|
|
|
|
if this == nil {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
return unsafe.Pointer(this.h)
|
|
|
|
}
|
|
|
|
|
2024-11-19 06:29:06 +00:00
|
|
|
// newQState constructs the type using only CGO pointers.
|
|
|
|
func newQState(h *C.QState, h_QAbstractState *C.QAbstractState, h_QObject *C.QObject) *QState {
|
2024-09-01 02:23:55 +00:00
|
|
|
if h == nil {
|
|
|
|
return nil
|
|
|
|
}
|
2024-11-19 06:29:06 +00:00
|
|
|
return &QState{h: h,
|
|
|
|
QAbstractState: newQAbstractState(h_QAbstractState, h_QObject)}
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-11-19 06:29:06 +00:00
|
|
|
// UnsafeNewQState constructs the type using only unsafe pointers.
|
|
|
|
func UnsafeNewQState(h unsafe.Pointer, h_QAbstractState unsafe.Pointer, h_QObject unsafe.Pointer) *QState {
|
|
|
|
if h == nil {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
return &QState{h: (*C.QState)(h),
|
|
|
|
QAbstractState: UnsafeNewQAbstractState(h_QAbstractState, h_QObject)}
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// NewQState constructs a new QState object.
|
|
|
|
func NewQState() *QState {
|
2024-11-19 06:29:06 +00:00
|
|
|
var outptr_QState *C.QState = nil
|
|
|
|
var outptr_QAbstractState *C.QAbstractState = nil
|
|
|
|
var outptr_QObject *C.QObject = nil
|
|
|
|
|
|
|
|
C.QState_new(&outptr_QState, &outptr_QAbstractState, &outptr_QObject)
|
|
|
|
ret := newQState(outptr_QState, outptr_QAbstractState, outptr_QObject)
|
|
|
|
ret.isSubclass = true
|
|
|
|
return ret
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// NewQState2 constructs a new QState object.
|
2024-09-04 06:54:22 +00:00
|
|
|
func NewQState2(childMode QState__ChildMode) *QState {
|
2024-11-19 06:29:06 +00:00
|
|
|
var outptr_QState *C.QState = nil
|
|
|
|
var outptr_QAbstractState *C.QAbstractState = nil
|
|
|
|
var outptr_QObject *C.QObject = nil
|
|
|
|
|
|
|
|
C.QState_new2((C.int)(childMode), &outptr_QState, &outptr_QAbstractState, &outptr_QObject)
|
|
|
|
ret := newQState(outptr_QState, outptr_QAbstractState, outptr_QObject)
|
|
|
|
ret.isSubclass = true
|
|
|
|
return ret
|
2024-08-29 07:01:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// NewQState3 constructs a new QState object.
|
|
|
|
func NewQState3(parent *QState) *QState {
|
2024-11-19 06:29:06 +00:00
|
|
|
var outptr_QState *C.QState = nil
|
|
|
|
var outptr_QAbstractState *C.QAbstractState = nil
|
|
|
|
var outptr_QObject *C.QObject = nil
|
|
|
|
|
|
|
|
C.QState_new3(parent.cPointer(), &outptr_QState, &outptr_QAbstractState, &outptr_QObject)
|
|
|
|
ret := newQState(outptr_QState, outptr_QAbstractState, outptr_QObject)
|
|
|
|
ret.isSubclass = true
|
|
|
|
return ret
|
2024-08-29 07:01:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// NewQState4 constructs a new QState object.
|
2024-09-04 06:54:22 +00:00
|
|
|
func NewQState4(childMode QState__ChildMode, parent *QState) *QState {
|
2024-11-19 06:29:06 +00:00
|
|
|
var outptr_QState *C.QState = nil
|
|
|
|
var outptr_QAbstractState *C.QAbstractState = nil
|
|
|
|
var outptr_QObject *C.QObject = nil
|
|
|
|
|
|
|
|
C.QState_new4((C.int)(childMode), parent.cPointer(), &outptr_QState, &outptr_QAbstractState, &outptr_QObject)
|
|
|
|
ret := newQState(outptr_QState, outptr_QAbstractState, outptr_QObject)
|
|
|
|
ret.isSubclass = true
|
|
|
|
return ret
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QState) MetaObject() *QMetaObject {
|
2024-10-16 05:07:56 +00:00
|
|
|
return UnsafeNewQMetaObject(unsafe.Pointer(C.QState_MetaObject(this.h)))
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-09-20 22:32:57 +00:00
|
|
|
func (this *QState) Metacast(param1 string) unsafe.Pointer {
|
|
|
|
param1_Cstring := C.CString(param1)
|
|
|
|
defer C.free(unsafe.Pointer(param1_Cstring))
|
2024-10-18 23:53:33 +00:00
|
|
|
return (unsafe.Pointer)(C.QState_Metacast(this.h, param1_Cstring))
|
2024-09-20 22:32:57 +00:00
|
|
|
}
|
|
|
|
|
2024-08-25 04:08:24 +00:00
|
|
|
func QState_Tr(s string) string {
|
|
|
|
s_Cstring := C.CString(s)
|
|
|
|
defer C.free(unsafe.Pointer(s_Cstring))
|
2024-10-18 23:53:33 +00:00
|
|
|
var _ms C.struct_miqt_string = C.QState_Tr(s_Cstring)
|
|
|
|
_ret := C.GoStringN(_ms.data, C.int(int64(_ms.len)))
|
|
|
|
C.free(unsafe.Pointer(_ms.data))
|
2024-09-14 22:29:05 +00:00
|
|
|
return _ret
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func QState_TrUtf8(s string) string {
|
|
|
|
s_Cstring := C.CString(s)
|
|
|
|
defer C.free(unsafe.Pointer(s_Cstring))
|
2024-10-18 23:53:33 +00:00
|
|
|
var _ms C.struct_miqt_string = C.QState_TrUtf8(s_Cstring)
|
|
|
|
_ret := C.GoStringN(_ms.data, C.int(int64(_ms.len)))
|
|
|
|
C.free(unsafe.Pointer(_ms.data))
|
2024-09-14 22:29:05 +00:00
|
|
|
return _ret
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QState) ErrorState() *QAbstractState {
|
2024-11-19 06:29:06 +00:00
|
|
|
return UnsafeNewQAbstractState(unsafe.Pointer(C.QState_ErrorState(this.h)), nil)
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QState) SetErrorState(state *QAbstractState) {
|
|
|
|
C.QState_SetErrorState(this.h, state.cPointer())
|
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QState) AddTransition(transition *QAbstractTransition) {
|
|
|
|
C.QState_AddTransition(this.h, transition.cPointer())
|
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QState) AddTransition2(sender *QObject, signal string, target *QAbstractState) *QSignalTransition {
|
|
|
|
signal_Cstring := C.CString(signal)
|
|
|
|
defer C.free(unsafe.Pointer(signal_Cstring))
|
2024-11-19 06:29:06 +00:00
|
|
|
return UnsafeNewQSignalTransition(unsafe.Pointer(C.QState_AddTransition2(this.h, sender.cPointer(), signal_Cstring, target.cPointer())), nil, nil)
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QState) AddTransitionWithTarget(target *QAbstractState) *QAbstractTransition {
|
2024-11-19 06:29:06 +00:00
|
|
|
return UnsafeNewQAbstractTransition(unsafe.Pointer(C.QState_AddTransitionWithTarget(this.h, target.cPointer())), nil)
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QState) RemoveTransition(transition *QAbstractTransition) {
|
|
|
|
C.QState_RemoveTransition(this.h, transition.cPointer())
|
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QState) Transitions() []*QAbstractTransition {
|
2024-11-04 07:18:27 +00:00
|
|
|
var _ma C.struct_miqt_array = C.QState_Transitions(this.h)
|
2024-09-14 22:29:05 +00:00
|
|
|
_ret := make([]*QAbstractTransition, int(_ma.len))
|
2024-09-17 07:30:27 +00:00
|
|
|
_outCast := (*[0xffff]*C.QAbstractTransition)(unsafe.Pointer(_ma.data)) // hey ya
|
2024-09-14 22:29:05 +00:00
|
|
|
for i := 0; i < int(_ma.len); i++ {
|
2024-11-19 06:29:06 +00:00
|
|
|
_ret[i] = UnsafeNewQAbstractTransition(unsafe.Pointer(_outCast[i]), nil)
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
2024-09-14 22:29:05 +00:00
|
|
|
return _ret
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QState) InitialState() *QAbstractState {
|
2024-11-19 06:29:06 +00:00
|
|
|
return UnsafeNewQAbstractState(unsafe.Pointer(C.QState_InitialState(this.h)), nil)
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QState) SetInitialState(state *QAbstractState) {
|
|
|
|
C.QState_SetInitialState(this.h, state.cPointer())
|
|
|
|
}
|
|
|
|
|
2024-09-04 06:54:22 +00:00
|
|
|
func (this *QState) ChildMode() QState__ChildMode {
|
2024-09-17 07:30:27 +00:00
|
|
|
return (QState__ChildMode)(C.QState_ChildMode(this.h))
|
2024-08-29 07:01:51 +00:00
|
|
|
}
|
|
|
|
|
2024-09-04 06:54:22 +00:00
|
|
|
func (this *QState) SetChildMode(mode QState__ChildMode) {
|
2024-09-18 00:12:02 +00:00
|
|
|
C.QState_SetChildMode(this.h, (C.int)(mode))
|
2024-08-29 07:01:51 +00:00
|
|
|
}
|
|
|
|
|
2024-08-25 04:08:24 +00:00
|
|
|
func (this *QState) AssignProperty(object *QObject, name string, value *QVariant) {
|
|
|
|
name_Cstring := C.CString(name)
|
|
|
|
defer C.free(unsafe.Pointer(name_Cstring))
|
|
|
|
C.QState_AssignProperty(this.h, object.cPointer(), name_Cstring, value.cPointer())
|
|
|
|
}
|
|
|
|
|
|
|
|
func QState_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))
|
2024-10-18 23:53:33 +00:00
|
|
|
var _ms C.struct_miqt_string = C.QState_Tr2(s_Cstring, c_Cstring)
|
|
|
|
_ret := C.GoStringN(_ms.data, C.int(int64(_ms.len)))
|
|
|
|
C.free(unsafe.Pointer(_ms.data))
|
2024-09-14 22:29:05 +00:00
|
|
|
return _ret
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func QState_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))
|
2024-10-18 23:53:33 +00:00
|
|
|
var _ms C.struct_miqt_string = C.QState_Tr3(s_Cstring, c_Cstring, (C.int)(n))
|
|
|
|
_ret := C.GoStringN(_ms.data, C.int(int64(_ms.len)))
|
|
|
|
C.free(unsafe.Pointer(_ms.data))
|
2024-09-14 22:29:05 +00:00
|
|
|
return _ret
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func QState_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))
|
2024-10-18 23:53:33 +00:00
|
|
|
var _ms C.struct_miqt_string = C.QState_TrUtf82(s_Cstring, c_Cstring)
|
|
|
|
_ret := C.GoStringN(_ms.data, C.int(int64(_ms.len)))
|
|
|
|
C.free(unsafe.Pointer(_ms.data))
|
2024-09-14 22:29:05 +00:00
|
|
|
return _ret
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func QState_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))
|
2024-10-18 23:53:33 +00:00
|
|
|
var _ms C.struct_miqt_string = C.QState_TrUtf83(s_Cstring, c_Cstring, (C.int)(n))
|
|
|
|
_ret := C.GoStringN(_ms.data, C.int(int64(_ms.len)))
|
|
|
|
C.free(unsafe.Pointer(_ms.data))
|
2024-09-14 22:29:05 +00:00
|
|
|
return _ret
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-11-19 06:29:06 +00:00
|
|
|
func (this *QState) callVirtualBase_OnEntry(event *QEvent) {
|
|
|
|
|
|
|
|
C.QState_virtualbase_OnEntry(unsafe.Pointer(this.h), event.cPointer())
|
|
|
|
|
|
|
|
}
|
|
|
|
func (this *QState) OnOnEntry(slot func(super func(event *QEvent), event *QEvent)) {
|
2024-12-07 01:43:28 +00:00
|
|
|
if !this.isSubclass {
|
|
|
|
panic("miqt: can only override virtual methods for directly constructed types")
|
|
|
|
}
|
2024-11-19 06:29:06 +00:00
|
|
|
C.QState_override_virtual_OnEntry(unsafe.Pointer(this.h), C.intptr_t(cgo.NewHandle(slot)))
|
|
|
|
}
|
|
|
|
|
|
|
|
//export miqt_exec_callback_QState_OnEntry
|
|
|
|
func miqt_exec_callback_QState_OnEntry(self *C.QState, cb C.intptr_t, event *C.QEvent) {
|
|
|
|
gofunc, ok := cgo.Handle(cb).Value().(func(super func(event *QEvent), event *QEvent))
|
|
|
|
if !ok {
|
|
|
|
panic("miqt: callback of non-callback type (heap corruption?)")
|
|
|
|
}
|
|
|
|
|
|
|
|
// Convert all CABI parameters to Go parameters
|
|
|
|
slotval1 := UnsafeNewQEvent(unsafe.Pointer(event))
|
|
|
|
|
|
|
|
gofunc((&QState{h: self}).callVirtualBase_OnEntry, slotval1)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QState) callVirtualBase_OnExit(event *QEvent) {
|
|
|
|
|
|
|
|
C.QState_virtualbase_OnExit(unsafe.Pointer(this.h), event.cPointer())
|
|
|
|
|
|
|
|
}
|
|
|
|
func (this *QState) OnOnExit(slot func(super func(event *QEvent), event *QEvent)) {
|
2024-12-07 01:43:28 +00:00
|
|
|
if !this.isSubclass {
|
|
|
|
panic("miqt: can only override virtual methods for directly constructed types")
|
|
|
|
}
|
2024-11-19 06:29:06 +00:00
|
|
|
C.QState_override_virtual_OnExit(unsafe.Pointer(this.h), C.intptr_t(cgo.NewHandle(slot)))
|
|
|
|
}
|
|
|
|
|
|
|
|
//export miqt_exec_callback_QState_OnExit
|
|
|
|
func miqt_exec_callback_QState_OnExit(self *C.QState, cb C.intptr_t, event *C.QEvent) {
|
|
|
|
gofunc, ok := cgo.Handle(cb).Value().(func(super func(event *QEvent), event *QEvent))
|
|
|
|
if !ok {
|
|
|
|
panic("miqt: callback of non-callback type (heap corruption?)")
|
|
|
|
}
|
|
|
|
|
|
|
|
// Convert all CABI parameters to Go parameters
|
|
|
|
slotval1 := UnsafeNewQEvent(unsafe.Pointer(event))
|
|
|
|
|
|
|
|
gofunc((&QState{h: self}).callVirtualBase_OnExit, slotval1)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QState) callVirtualBase_Event(e *QEvent) bool {
|
|
|
|
|
|
|
|
return (bool)(C.QState_virtualbase_Event(unsafe.Pointer(this.h), e.cPointer()))
|
|
|
|
|
|
|
|
}
|
|
|
|
func (this *QState) OnEvent(slot func(super func(e *QEvent) bool, e *QEvent) 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-19 06:29:06 +00:00
|
|
|
C.QState_override_virtual_Event(unsafe.Pointer(this.h), C.intptr_t(cgo.NewHandle(slot)))
|
|
|
|
}
|
|
|
|
|
|
|
|
//export miqt_exec_callback_QState_Event
|
|
|
|
func miqt_exec_callback_QState_Event(self *C.QState, cb C.intptr_t, e *C.QEvent) C.bool {
|
|
|
|
gofunc, ok := cgo.Handle(cb).Value().(func(super func(e *QEvent) bool, e *QEvent) bool)
|
|
|
|
if !ok {
|
|
|
|
panic("miqt: callback of non-callback type (heap corruption?)")
|
|
|
|
}
|
|
|
|
|
|
|
|
// Convert all CABI parameters to Go parameters
|
|
|
|
slotval1 := UnsafeNewQEvent(unsafe.Pointer(e))
|
|
|
|
|
|
|
|
virtualReturn := gofunc((&QState{h: self}).callVirtualBase_Event, slotval1)
|
|
|
|
|
|
|
|
return (C.bool)(virtualReturn)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2024-09-14 22:29:05 +00:00
|
|
|
// Delete this object from C++ memory.
|
2024-08-25 04:08:24 +00:00
|
|
|
func (this *QState) Delete() {
|
2024-11-19 06:29:06 +00:00
|
|
|
C.QState_Delete(this.h, C.bool(this.isSubclass))
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
2024-09-14 22:29:05 +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 *QState) GoGC() {
|
|
|
|
runtime.SetFinalizer(this, func(this *QState) {
|
|
|
|
this.Delete()
|
|
|
|
runtime.KeepAlive(this.h)
|
|
|
|
})
|
|
|
|
}
|