miqt/qt/gen_qfileiconprovider.go

219 lines
7.1 KiB
Go
Raw Normal View History

package qt
/*
#include "gen_qfileiconprovider.h"
#include <stdlib.h>
*/
import "C"
import (
"runtime"
2024-11-19 06:29:06 +00:00
"runtime/cgo"
"unsafe"
)
2024-09-04 06:54:22 +00:00
type QFileIconProvider__IconType int
const (
2024-09-20 07:13:26 +00:00
QFileIconProvider__Computer QFileIconProvider__IconType = 0
QFileIconProvider__Desktop QFileIconProvider__IconType = 1
QFileIconProvider__Trashcan QFileIconProvider__IconType = 2
QFileIconProvider__Network QFileIconProvider__IconType = 3
QFileIconProvider__Drive QFileIconProvider__IconType = 4
QFileIconProvider__Folder QFileIconProvider__IconType = 5
QFileIconProvider__File QFileIconProvider__IconType = 6
2024-09-04 06:54:22 +00:00
)
type QFileIconProvider__Option int
const (
2024-09-20 07:13:26 +00:00
QFileIconProvider__DontUseCustomDirectoryIcons QFileIconProvider__Option = 1
2024-09-04 06:54:22 +00:00
)
type QFileIconProvider struct {
2024-11-19 06:29:06 +00:00
h *C.QFileIconProvider
isSubclass bool
}
func (this *QFileIconProvider) cPointer() *C.QFileIconProvider {
if this == nil {
return nil
}
return this.h
}
func (this *QFileIconProvider) UnsafePointer() unsafe.Pointer {
if this == nil {
return nil
}
return unsafe.Pointer(this.h)
}
2024-11-19 06:29:06 +00:00
// newQFileIconProvider constructs the type using only CGO pointers.
func newQFileIconProvider(h *C.QFileIconProvider) *QFileIconProvider {
2024-09-01 02:23:55 +00:00
if h == nil {
return nil
}
return &QFileIconProvider{h: h}
}
2024-11-19 06:29:06 +00:00
// UnsafeNewQFileIconProvider constructs the type using only unsafe pointers.
func UnsafeNewQFileIconProvider(h unsafe.Pointer) *QFileIconProvider {
2024-11-19 06:29:06 +00:00
if h == nil {
return nil
}
return &QFileIconProvider{h: (*C.QFileIconProvider)(h)}
}
// NewQFileIconProvider constructs a new QFileIconProvider object.
func NewQFileIconProvider() *QFileIconProvider {
2024-11-19 06:29:06 +00:00
var outptr_QFileIconProvider *C.QFileIconProvider = nil
C.QFileIconProvider_new(&outptr_QFileIconProvider)
ret := newQFileIconProvider(outptr_QFileIconProvider)
ret.isSubclass = true
return ret
}
2024-09-04 06:54:22 +00:00
func (this *QFileIconProvider) Icon(typeVal QFileIconProvider__IconType) *QIcon {
_ret := C.QFileIconProvider_Icon(this.h, (C.int)(typeVal))
_goptr := newQIcon(_ret)
_goptr.GoGC() // Qt uses pass-by-value semantics for this type. Mimic with finalizer
return _goptr
2024-08-29 07:01:51 +00:00
}
func (this *QFileIconProvider) IconWithInfo(info *QFileInfo) *QIcon {
_ret := C.QFileIconProvider_IconWithInfo(this.h, info.cPointer())
_goptr := newQIcon(_ret)
_goptr.GoGC() // Qt uses pass-by-value semantics for this type. Mimic with finalizer
return _goptr
}
func (this *QFileIconProvider) Type(info *QFileInfo) string {
var _ms C.struct_miqt_string = C.QFileIconProvider_Type(this.h, info.cPointer())
_ret := C.GoStringN(_ms.data, C.int(int64(_ms.len)))
C.free(unsafe.Pointer(_ms.data))
return _ret
}
func (this *QFileIconProvider) SetOptions(options QFileIconProvider__Option) {
C.QFileIconProvider_SetOptions(this.h, (C.int)(options))
2024-08-29 07:01:51 +00:00
}
func (this *QFileIconProvider) Options() QFileIconProvider__Option {
return (QFileIconProvider__Option)(C.QFileIconProvider_Options(this.h))
2024-08-29 07:01:51 +00:00
}
2024-11-19 06:29:06 +00:00
func (this *QFileIconProvider) callVirtualBase_Icon(typeVal QFileIconProvider__IconType) *QIcon {
_ret := C.QFileIconProvider_virtualbase_Icon(unsafe.Pointer(this.h), (C.int)(typeVal))
_goptr := newQIcon(_ret)
_goptr.GoGC() // Qt uses pass-by-value semantics for this type. Mimic with finalizer
return _goptr
}
func (this *QFileIconProvider) OnIcon(slot func(super func(typeVal QFileIconProvider__IconType) *QIcon, typeVal QFileIconProvider__IconType) *QIcon) {
if !this.isSubclass {
panic("miqt: can only override virtual methods for directly constructed types")
}
2024-11-19 06:29:06 +00:00
C.QFileIconProvider_override_virtual_Icon(unsafe.Pointer(this.h), C.intptr_t(cgo.NewHandle(slot)))
}
//export miqt_exec_callback_QFileIconProvider_Icon
func miqt_exec_callback_QFileIconProvider_Icon(self *C.QFileIconProvider, cb C.intptr_t, typeVal C.int) *C.QIcon {
gofunc, ok := cgo.Handle(cb).Value().(func(super func(typeVal QFileIconProvider__IconType) *QIcon, typeVal QFileIconProvider__IconType) *QIcon)
if !ok {
panic("miqt: callback of non-callback type (heap corruption?)")
}
// Convert all CABI parameters to Go parameters
slotval1 := (QFileIconProvider__IconType)(typeVal)
virtualReturn := gofunc((&QFileIconProvider{h: self}).callVirtualBase_Icon, slotval1)
return virtualReturn.cPointer()
}
func (this *QFileIconProvider) callVirtualBase_IconWithInfo(info *QFileInfo) *QIcon {
_ret := C.QFileIconProvider_virtualbase_IconWithInfo(unsafe.Pointer(this.h), info.cPointer())
_goptr := newQIcon(_ret)
_goptr.GoGC() // Qt uses pass-by-value semantics for this type. Mimic with finalizer
return _goptr
}
func (this *QFileIconProvider) OnIconWithInfo(slot func(super func(info *QFileInfo) *QIcon, info *QFileInfo) *QIcon) {
if !this.isSubclass {
panic("miqt: can only override virtual methods for directly constructed types")
}
2024-11-19 06:29:06 +00:00
C.QFileIconProvider_override_virtual_IconWithInfo(unsafe.Pointer(this.h), C.intptr_t(cgo.NewHandle(slot)))
}
//export miqt_exec_callback_QFileIconProvider_IconWithInfo
func miqt_exec_callback_QFileIconProvider_IconWithInfo(self *C.QFileIconProvider, cb C.intptr_t, info *C.QFileInfo) *C.QIcon {
gofunc, ok := cgo.Handle(cb).Value().(func(super func(info *QFileInfo) *QIcon, info *QFileInfo) *QIcon)
if !ok {
panic("miqt: callback of non-callback type (heap corruption?)")
}
// Convert all CABI parameters to Go parameters
slotval1 := UnsafeNewQFileInfo(unsafe.Pointer(info))
virtualReturn := gofunc((&QFileIconProvider{h: self}).callVirtualBase_IconWithInfo, slotval1)
return virtualReturn.cPointer()
}
func (this *QFileIconProvider) callVirtualBase_Type(info *QFileInfo) string {
var _ms C.struct_miqt_string = C.QFileIconProvider_virtualbase_Type(unsafe.Pointer(this.h), info.cPointer())
_ret := C.GoStringN(_ms.data, C.int(int64(_ms.len)))
C.free(unsafe.Pointer(_ms.data))
return _ret
}
func (this *QFileIconProvider) OnType(slot func(super func(info *QFileInfo) string, info *QFileInfo) string) {
if !this.isSubclass {
panic("miqt: can only override virtual methods for directly constructed types")
}
2024-11-19 06:29:06 +00:00
C.QFileIconProvider_override_virtual_Type(unsafe.Pointer(this.h), C.intptr_t(cgo.NewHandle(slot)))
}
//export miqt_exec_callback_QFileIconProvider_Type
func miqt_exec_callback_QFileIconProvider_Type(self *C.QFileIconProvider, cb C.intptr_t, info *C.QFileInfo) C.struct_miqt_string {
gofunc, ok := cgo.Handle(cb).Value().(func(super func(info *QFileInfo) string, info *QFileInfo) string)
if !ok {
panic("miqt: callback of non-callback type (heap corruption?)")
}
// Convert all CABI parameters to Go parameters
slotval1 := UnsafeNewQFileInfo(unsafe.Pointer(info))
virtualReturn := gofunc((&QFileIconProvider{h: self}).callVirtualBase_Type, slotval1)
virtualReturn_ms := C.struct_miqt_string{}
virtualReturn_ms.data = C.CString(virtualReturn)
virtualReturn_ms.len = C.size_t(len(virtualReturn))
defer C.free(unsafe.Pointer(virtualReturn_ms.data))
return virtualReturn_ms
}
// Delete this object from C++ memory.
func (this *QFileIconProvider) Delete() {
2024-11-19 06:29:06 +00:00
C.QFileIconProvider_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 *QFileIconProvider) GoGC() {
runtime.SetFinalizer(this, func(this *QFileIconProvider) {
this.Delete()
runtime.KeepAlive(this.h)
})
}