mirror of
https://github.com/mappu/miqt.git
synced 2024-12-22 00:48:38 +00:00
475 lines
15 KiB
Go
475 lines
15 KiB
Go
package qt6
|
|
|
|
/*
|
|
|
|
#include "gen_qtoolbox.h"
|
|
#include <stdlib.h>
|
|
|
|
*/
|
|
import "C"
|
|
|
|
import (
|
|
"runtime"
|
|
"runtime/cgo"
|
|
"unsafe"
|
|
)
|
|
|
|
type QToolBox struct {
|
|
h *C.QToolBox
|
|
isSubclass bool
|
|
*QFrame
|
|
}
|
|
|
|
func (this *QToolBox) cPointer() *C.QToolBox {
|
|
if this == nil {
|
|
return nil
|
|
}
|
|
return this.h
|
|
}
|
|
|
|
func (this *QToolBox) UnsafePointer() unsafe.Pointer {
|
|
if this == nil {
|
|
return nil
|
|
}
|
|
return unsafe.Pointer(this.h)
|
|
}
|
|
|
|
// newQToolBox constructs the type using only CGO pointers.
|
|
func newQToolBox(h *C.QToolBox) *QToolBox {
|
|
if h == nil {
|
|
return nil
|
|
}
|
|
var outptr_QFrame *C.QFrame = nil
|
|
C.QToolBox_virtbase(h, &outptr_QFrame)
|
|
|
|
return &QToolBox{h: h,
|
|
QFrame: newQFrame(outptr_QFrame)}
|
|
}
|
|
|
|
// UnsafeNewQToolBox constructs the type using only unsafe pointers.
|
|
func UnsafeNewQToolBox(h unsafe.Pointer) *QToolBox {
|
|
return newQToolBox((*C.QToolBox)(h))
|
|
}
|
|
|
|
// NewQToolBox constructs a new QToolBox object.
|
|
func NewQToolBox(parent *QWidget) *QToolBox {
|
|
|
|
ret := newQToolBox(C.QToolBox_new(parent.cPointer()))
|
|
ret.isSubclass = true
|
|
return ret
|
|
}
|
|
|
|
// NewQToolBox2 constructs a new QToolBox object.
|
|
func NewQToolBox2() *QToolBox {
|
|
|
|
ret := newQToolBox(C.QToolBox_new2())
|
|
ret.isSubclass = true
|
|
return ret
|
|
}
|
|
|
|
// NewQToolBox3 constructs a new QToolBox object.
|
|
func NewQToolBox3(parent *QWidget, f WindowType) *QToolBox {
|
|
|
|
ret := newQToolBox(C.QToolBox_new3(parent.cPointer(), (C.int)(f)))
|
|
ret.isSubclass = true
|
|
return ret
|
|
}
|
|
|
|
func (this *QToolBox) MetaObject() *QMetaObject {
|
|
return newQMetaObject(C.QToolBox_MetaObject(this.h))
|
|
}
|
|
|
|
func (this *QToolBox) Metacast(param1 string) unsafe.Pointer {
|
|
param1_Cstring := C.CString(param1)
|
|
defer C.free(unsafe.Pointer(param1_Cstring))
|
|
return (unsafe.Pointer)(C.QToolBox_Metacast(this.h, param1_Cstring))
|
|
}
|
|
|
|
func QToolBox_Tr(s string) string {
|
|
s_Cstring := C.CString(s)
|
|
defer C.free(unsafe.Pointer(s_Cstring))
|
|
var _ms C.struct_miqt_string = C.QToolBox_Tr(s_Cstring)
|
|
_ret := C.GoStringN(_ms.data, C.int(int64(_ms.len)))
|
|
C.free(unsafe.Pointer(_ms.data))
|
|
return _ret
|
|
}
|
|
|
|
func (this *QToolBox) AddItem(widget *QWidget, text string) int {
|
|
text_ms := C.struct_miqt_string{}
|
|
text_ms.data = C.CString(text)
|
|
text_ms.len = C.size_t(len(text))
|
|
defer C.free(unsafe.Pointer(text_ms.data))
|
|
return (int)(C.QToolBox_AddItem(this.h, widget.cPointer(), text_ms))
|
|
}
|
|
|
|
func (this *QToolBox) AddItem2(widget *QWidget, icon *QIcon, text string) int {
|
|
text_ms := C.struct_miqt_string{}
|
|
text_ms.data = C.CString(text)
|
|
text_ms.len = C.size_t(len(text))
|
|
defer C.free(unsafe.Pointer(text_ms.data))
|
|
return (int)(C.QToolBox_AddItem2(this.h, widget.cPointer(), icon.cPointer(), text_ms))
|
|
}
|
|
|
|
func (this *QToolBox) InsertItem(index int, widget *QWidget, text string) int {
|
|
text_ms := C.struct_miqt_string{}
|
|
text_ms.data = C.CString(text)
|
|
text_ms.len = C.size_t(len(text))
|
|
defer C.free(unsafe.Pointer(text_ms.data))
|
|
return (int)(C.QToolBox_InsertItem(this.h, (C.int)(index), widget.cPointer(), text_ms))
|
|
}
|
|
|
|
func (this *QToolBox) InsertItem2(index int, widget *QWidget, icon *QIcon, text string) int {
|
|
text_ms := C.struct_miqt_string{}
|
|
text_ms.data = C.CString(text)
|
|
text_ms.len = C.size_t(len(text))
|
|
defer C.free(unsafe.Pointer(text_ms.data))
|
|
return (int)(C.QToolBox_InsertItem2(this.h, (C.int)(index), widget.cPointer(), icon.cPointer(), text_ms))
|
|
}
|
|
|
|
func (this *QToolBox) RemoveItem(index int) {
|
|
C.QToolBox_RemoveItem(this.h, (C.int)(index))
|
|
}
|
|
|
|
func (this *QToolBox) SetItemEnabled(index int, enabled bool) {
|
|
C.QToolBox_SetItemEnabled(this.h, (C.int)(index), (C.bool)(enabled))
|
|
}
|
|
|
|
func (this *QToolBox) IsItemEnabled(index int) bool {
|
|
return (bool)(C.QToolBox_IsItemEnabled(this.h, (C.int)(index)))
|
|
}
|
|
|
|
func (this *QToolBox) SetItemText(index int, text string) {
|
|
text_ms := C.struct_miqt_string{}
|
|
text_ms.data = C.CString(text)
|
|
text_ms.len = C.size_t(len(text))
|
|
defer C.free(unsafe.Pointer(text_ms.data))
|
|
C.QToolBox_SetItemText(this.h, (C.int)(index), text_ms)
|
|
}
|
|
|
|
func (this *QToolBox) ItemText(index int) string {
|
|
var _ms C.struct_miqt_string = C.QToolBox_ItemText(this.h, (C.int)(index))
|
|
_ret := C.GoStringN(_ms.data, C.int(int64(_ms.len)))
|
|
C.free(unsafe.Pointer(_ms.data))
|
|
return _ret
|
|
}
|
|
|
|
func (this *QToolBox) SetItemIcon(index int, icon *QIcon) {
|
|
C.QToolBox_SetItemIcon(this.h, (C.int)(index), icon.cPointer())
|
|
}
|
|
|
|
func (this *QToolBox) ItemIcon(index int) *QIcon {
|
|
_goptr := newQIcon(C.QToolBox_ItemIcon(this.h, (C.int)(index)))
|
|
_goptr.GoGC() // Qt uses pass-by-value semantics for this type. Mimic with finalizer
|
|
return _goptr
|
|
}
|
|
|
|
func (this *QToolBox) SetItemToolTip(index int, toolTip string) {
|
|
toolTip_ms := C.struct_miqt_string{}
|
|
toolTip_ms.data = C.CString(toolTip)
|
|
toolTip_ms.len = C.size_t(len(toolTip))
|
|
defer C.free(unsafe.Pointer(toolTip_ms.data))
|
|
C.QToolBox_SetItemToolTip(this.h, (C.int)(index), toolTip_ms)
|
|
}
|
|
|
|
func (this *QToolBox) ItemToolTip(index int) string {
|
|
var _ms C.struct_miqt_string = C.QToolBox_ItemToolTip(this.h, (C.int)(index))
|
|
_ret := C.GoStringN(_ms.data, C.int(int64(_ms.len)))
|
|
C.free(unsafe.Pointer(_ms.data))
|
|
return _ret
|
|
}
|
|
|
|
func (this *QToolBox) CurrentIndex() int {
|
|
return (int)(C.QToolBox_CurrentIndex(this.h))
|
|
}
|
|
|
|
func (this *QToolBox) CurrentWidget() *QWidget {
|
|
return newQWidget(C.QToolBox_CurrentWidget(this.h))
|
|
}
|
|
|
|
func (this *QToolBox) Widget(index int) *QWidget {
|
|
return newQWidget(C.QToolBox_Widget(this.h, (C.int)(index)))
|
|
}
|
|
|
|
func (this *QToolBox) IndexOf(widget *QWidget) int {
|
|
return (int)(C.QToolBox_IndexOf(this.h, widget.cPointer()))
|
|
}
|
|
|
|
func (this *QToolBox) Count() int {
|
|
return (int)(C.QToolBox_Count(this.h))
|
|
}
|
|
|
|
func (this *QToolBox) SetCurrentIndex(index int) {
|
|
C.QToolBox_SetCurrentIndex(this.h, (C.int)(index))
|
|
}
|
|
|
|
func (this *QToolBox) SetCurrentWidget(widget *QWidget) {
|
|
C.QToolBox_SetCurrentWidget(this.h, widget.cPointer())
|
|
}
|
|
|
|
func (this *QToolBox) CurrentChanged(index int) {
|
|
C.QToolBox_CurrentChanged(this.h, (C.int)(index))
|
|
}
|
|
func (this *QToolBox) OnCurrentChanged(slot func(index int)) {
|
|
C.QToolBox_connect_CurrentChanged(this.h, C.intptr_t(cgo.NewHandle(slot)))
|
|
}
|
|
|
|
//export miqt_exec_callback_QToolBox_CurrentChanged
|
|
func miqt_exec_callback_QToolBox_CurrentChanged(cb C.intptr_t, index C.int) {
|
|
gofunc, ok := cgo.Handle(cb).Value().(func(index int))
|
|
if !ok {
|
|
panic("miqt: callback of non-callback type (heap corruption?)")
|
|
}
|
|
|
|
// Convert all CABI parameters to Go parameters
|
|
slotval1 := (int)(index)
|
|
|
|
gofunc(slotval1)
|
|
}
|
|
|
|
func QToolBox_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.QToolBox_Tr2(s_Cstring, c_Cstring)
|
|
_ret := C.GoStringN(_ms.data, C.int(int64(_ms.len)))
|
|
C.free(unsafe.Pointer(_ms.data))
|
|
return _ret
|
|
}
|
|
|
|
func QToolBox_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.QToolBox_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 (this *QToolBox) callVirtualBase_Event(e *QEvent) bool {
|
|
|
|
return (bool)(C.QToolBox_virtualbase_Event(unsafe.Pointer(this.h), e.cPointer()))
|
|
|
|
}
|
|
func (this *QToolBox) OnEvent(slot func(super func(e *QEvent) bool, e *QEvent) bool) {
|
|
if !this.isSubclass {
|
|
panic("miqt: can only override virtual methods for directly constructed types")
|
|
}
|
|
C.QToolBox_override_virtual_Event(unsafe.Pointer(this.h), C.intptr_t(cgo.NewHandle(slot)))
|
|
}
|
|
|
|
//export miqt_exec_callback_QToolBox_Event
|
|
func miqt_exec_callback_QToolBox_Event(self *C.QToolBox, 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 := newQEvent(e)
|
|
|
|
virtualReturn := gofunc((&QToolBox{h: self}).callVirtualBase_Event, slotval1)
|
|
|
|
return (C.bool)(virtualReturn)
|
|
|
|
}
|
|
|
|
func (this *QToolBox) callVirtualBase_ItemInserted(index int) {
|
|
|
|
C.QToolBox_virtualbase_ItemInserted(unsafe.Pointer(this.h), (C.int)(index))
|
|
|
|
}
|
|
func (this *QToolBox) OnItemInserted(slot func(super func(index int), index int)) {
|
|
if !this.isSubclass {
|
|
panic("miqt: can only override virtual methods for directly constructed types")
|
|
}
|
|
C.QToolBox_override_virtual_ItemInserted(unsafe.Pointer(this.h), C.intptr_t(cgo.NewHandle(slot)))
|
|
}
|
|
|
|
//export miqt_exec_callback_QToolBox_ItemInserted
|
|
func miqt_exec_callback_QToolBox_ItemInserted(self *C.QToolBox, cb C.intptr_t, index C.int) {
|
|
gofunc, ok := cgo.Handle(cb).Value().(func(super func(index int), index int))
|
|
if !ok {
|
|
panic("miqt: callback of non-callback type (heap corruption?)")
|
|
}
|
|
|
|
// Convert all CABI parameters to Go parameters
|
|
slotval1 := (int)(index)
|
|
|
|
gofunc((&QToolBox{h: self}).callVirtualBase_ItemInserted, slotval1)
|
|
|
|
}
|
|
|
|
func (this *QToolBox) callVirtualBase_ItemRemoved(index int) {
|
|
|
|
C.QToolBox_virtualbase_ItemRemoved(unsafe.Pointer(this.h), (C.int)(index))
|
|
|
|
}
|
|
func (this *QToolBox) OnItemRemoved(slot func(super func(index int), index int)) {
|
|
if !this.isSubclass {
|
|
panic("miqt: can only override virtual methods for directly constructed types")
|
|
}
|
|
C.QToolBox_override_virtual_ItemRemoved(unsafe.Pointer(this.h), C.intptr_t(cgo.NewHandle(slot)))
|
|
}
|
|
|
|
//export miqt_exec_callback_QToolBox_ItemRemoved
|
|
func miqt_exec_callback_QToolBox_ItemRemoved(self *C.QToolBox, cb C.intptr_t, index C.int) {
|
|
gofunc, ok := cgo.Handle(cb).Value().(func(super func(index int), index int))
|
|
if !ok {
|
|
panic("miqt: callback of non-callback type (heap corruption?)")
|
|
}
|
|
|
|
// Convert all CABI parameters to Go parameters
|
|
slotval1 := (int)(index)
|
|
|
|
gofunc((&QToolBox{h: self}).callVirtualBase_ItemRemoved, slotval1)
|
|
|
|
}
|
|
|
|
func (this *QToolBox) callVirtualBase_ShowEvent(e *QShowEvent) {
|
|
|
|
C.QToolBox_virtualbase_ShowEvent(unsafe.Pointer(this.h), e.cPointer())
|
|
|
|
}
|
|
func (this *QToolBox) OnShowEvent(slot func(super func(e *QShowEvent), e *QShowEvent)) {
|
|
if !this.isSubclass {
|
|
panic("miqt: can only override virtual methods for directly constructed types")
|
|
}
|
|
C.QToolBox_override_virtual_ShowEvent(unsafe.Pointer(this.h), C.intptr_t(cgo.NewHandle(slot)))
|
|
}
|
|
|
|
//export miqt_exec_callback_QToolBox_ShowEvent
|
|
func miqt_exec_callback_QToolBox_ShowEvent(self *C.QToolBox, cb C.intptr_t, e *C.QShowEvent) {
|
|
gofunc, ok := cgo.Handle(cb).Value().(func(super func(e *QShowEvent), e *QShowEvent))
|
|
if !ok {
|
|
panic("miqt: callback of non-callback type (heap corruption?)")
|
|
}
|
|
|
|
// Convert all CABI parameters to Go parameters
|
|
slotval1 := newQShowEvent(e)
|
|
|
|
gofunc((&QToolBox{h: self}).callVirtualBase_ShowEvent, slotval1)
|
|
|
|
}
|
|
|
|
func (this *QToolBox) callVirtualBase_ChangeEvent(param1 *QEvent) {
|
|
|
|
C.QToolBox_virtualbase_ChangeEvent(unsafe.Pointer(this.h), param1.cPointer())
|
|
|
|
}
|
|
func (this *QToolBox) OnChangeEvent(slot func(super func(param1 *QEvent), param1 *QEvent)) {
|
|
if !this.isSubclass {
|
|
panic("miqt: can only override virtual methods for directly constructed types")
|
|
}
|
|
C.QToolBox_override_virtual_ChangeEvent(unsafe.Pointer(this.h), C.intptr_t(cgo.NewHandle(slot)))
|
|
}
|
|
|
|
//export miqt_exec_callback_QToolBox_ChangeEvent
|
|
func miqt_exec_callback_QToolBox_ChangeEvent(self *C.QToolBox, cb C.intptr_t, param1 *C.QEvent) {
|
|
gofunc, ok := cgo.Handle(cb).Value().(func(super func(param1 *QEvent), param1 *QEvent))
|
|
if !ok {
|
|
panic("miqt: callback of non-callback type (heap corruption?)")
|
|
}
|
|
|
|
// Convert all CABI parameters to Go parameters
|
|
slotval1 := newQEvent(param1)
|
|
|
|
gofunc((&QToolBox{h: self}).callVirtualBase_ChangeEvent, slotval1)
|
|
|
|
}
|
|
|
|
func (this *QToolBox) callVirtualBase_SizeHint() *QSize {
|
|
|
|
_goptr := newQSize(C.QToolBox_virtualbase_SizeHint(unsafe.Pointer(this.h)))
|
|
_goptr.GoGC() // Qt uses pass-by-value semantics for this type. Mimic with finalizer
|
|
return _goptr
|
|
|
|
}
|
|
func (this *QToolBox) OnSizeHint(slot func(super func() *QSize) *QSize) {
|
|
if !this.isSubclass {
|
|
panic("miqt: can only override virtual methods for directly constructed types")
|
|
}
|
|
C.QToolBox_override_virtual_SizeHint(unsafe.Pointer(this.h), C.intptr_t(cgo.NewHandle(slot)))
|
|
}
|
|
|
|
//export miqt_exec_callback_QToolBox_SizeHint
|
|
func miqt_exec_callback_QToolBox_SizeHint(self *C.QToolBox, cb C.intptr_t) *C.QSize {
|
|
gofunc, ok := cgo.Handle(cb).Value().(func(super func() *QSize) *QSize)
|
|
if !ok {
|
|
panic("miqt: callback of non-callback type (heap corruption?)")
|
|
}
|
|
|
|
virtualReturn := gofunc((&QToolBox{h: self}).callVirtualBase_SizeHint)
|
|
|
|
return virtualReturn.cPointer()
|
|
|
|
}
|
|
|
|
func (this *QToolBox) callVirtualBase_PaintEvent(param1 *QPaintEvent) {
|
|
|
|
C.QToolBox_virtualbase_PaintEvent(unsafe.Pointer(this.h), param1.cPointer())
|
|
|
|
}
|
|
func (this *QToolBox) OnPaintEvent(slot func(super func(param1 *QPaintEvent), param1 *QPaintEvent)) {
|
|
if !this.isSubclass {
|
|
panic("miqt: can only override virtual methods for directly constructed types")
|
|
}
|
|
C.QToolBox_override_virtual_PaintEvent(unsafe.Pointer(this.h), C.intptr_t(cgo.NewHandle(slot)))
|
|
}
|
|
|
|
//export miqt_exec_callback_QToolBox_PaintEvent
|
|
func miqt_exec_callback_QToolBox_PaintEvent(self *C.QToolBox, cb C.intptr_t, param1 *C.QPaintEvent) {
|
|
gofunc, ok := cgo.Handle(cb).Value().(func(super func(param1 *QPaintEvent), param1 *QPaintEvent))
|
|
if !ok {
|
|
panic("miqt: callback of non-callback type (heap corruption?)")
|
|
}
|
|
|
|
// Convert all CABI parameters to Go parameters
|
|
slotval1 := newQPaintEvent(param1)
|
|
|
|
gofunc((&QToolBox{h: self}).callVirtualBase_PaintEvent, slotval1)
|
|
|
|
}
|
|
|
|
func (this *QToolBox) callVirtualBase_InitStyleOption(option *QStyleOptionFrame) {
|
|
|
|
C.QToolBox_virtualbase_InitStyleOption(unsafe.Pointer(this.h), option.cPointer())
|
|
|
|
}
|
|
func (this *QToolBox) OnInitStyleOption(slot func(super func(option *QStyleOptionFrame), option *QStyleOptionFrame)) {
|
|
if !this.isSubclass {
|
|
panic("miqt: can only override virtual methods for directly constructed types")
|
|
}
|
|
C.QToolBox_override_virtual_InitStyleOption(unsafe.Pointer(this.h), C.intptr_t(cgo.NewHandle(slot)))
|
|
}
|
|
|
|
//export miqt_exec_callback_QToolBox_InitStyleOption
|
|
func miqt_exec_callback_QToolBox_InitStyleOption(self *C.QToolBox, cb C.intptr_t, option *C.QStyleOptionFrame) {
|
|
gofunc, ok := cgo.Handle(cb).Value().(func(super func(option *QStyleOptionFrame), option *QStyleOptionFrame))
|
|
if !ok {
|
|
panic("miqt: callback of non-callback type (heap corruption?)")
|
|
}
|
|
|
|
// Convert all CABI parameters to Go parameters
|
|
slotval1 := newQStyleOptionFrame(option)
|
|
|
|
gofunc((&QToolBox{h: self}).callVirtualBase_InitStyleOption, slotval1)
|
|
|
|
}
|
|
|
|
// Delete this object from C++ memory.
|
|
func (this *QToolBox) Delete() {
|
|
C.QToolBox_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 *QToolBox) GoGC() {
|
|
runtime.SetFinalizer(this, func(this *QToolBox) {
|
|
this.Delete()
|
|
runtime.KeepAlive(this.h)
|
|
})
|
|
}
|