mirror of
https://github.com/mappu/miqt.git
synced 2024-12-23 01:18:37 +00:00
79 lines
1.9 KiB
Go
79 lines
1.9 KiB
Go
|
package qt6
|
||
|
|
||
|
/*
|
||
|
|
||
|
#include "gen_qfileiconprovider.h"
|
||
|
#include <stdlib.h>
|
||
|
|
||
|
*/
|
||
|
import "C"
|
||
|
|
||
|
import (
|
||
|
"runtime"
|
||
|
"unsafe"
|
||
|
)
|
||
|
|
||
|
type QFileIconProvider struct {
|
||
|
h *C.QFileIconProvider
|
||
|
*QAbstractFileIconProvider
|
||
|
}
|
||
|
|
||
|
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)
|
||
|
}
|
||
|
|
||
|
func newQFileIconProvider(h *C.QFileIconProvider) *QFileIconProvider {
|
||
|
if h == nil {
|
||
|
return nil
|
||
|
}
|
||
|
return &QFileIconProvider{h: h, QAbstractFileIconProvider: UnsafeNewQAbstractFileIconProvider(unsafe.Pointer(h))}
|
||
|
}
|
||
|
|
||
|
func UnsafeNewQFileIconProvider(h unsafe.Pointer) *QFileIconProvider {
|
||
|
return newQFileIconProvider((*C.QFileIconProvider)(h))
|
||
|
}
|
||
|
|
||
|
// NewQFileIconProvider constructs a new QFileIconProvider object.
|
||
|
func NewQFileIconProvider() *QFileIconProvider {
|
||
|
ret := C.QFileIconProvider_new()
|
||
|
return newQFileIconProvider(ret)
|
||
|
}
|
||
|
|
||
|
func (this *QFileIconProvider) Icon(typeVal QAbstractFileIconProvider__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
|
||
|
}
|
||
|
|
||
|
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
|
||
|
}
|
||
|
|
||
|
// Delete this object from C++ memory.
|
||
|
func (this *QFileIconProvider) Delete() {
|
||
|
C.QFileIconProvider_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 *QFileIconProvider) GoGC() {
|
||
|
runtime.SetFinalizer(this, func(this *QFileIconProvider) {
|
||
|
this.Delete()
|
||
|
runtime.KeepAlive(this.h)
|
||
|
})
|
||
|
}
|