package qt /* #cgo CFLAGS: -fPIC #cgo pkg-config: Qt5Widgets #include "gen_qfileselector.h" #include */ import "C" import ( "runtime" "unsafe" ) type QFileSelector struct { h *C.QFileSelector *QObject } func (this *QFileSelector) cPointer() *C.QFileSelector { if this == nil { return nil } return this.h } func newQFileSelector(h *C.QFileSelector) *QFileSelector { return &QFileSelector{h: h, QObject: newQObject_U(unsafe.Pointer(h))} } func newQFileSelector_U(h unsafe.Pointer) *QFileSelector { return newQFileSelector((*C.QFileSelector)(h)) } // NewQFileSelector constructs a new QFileSelector object. func NewQFileSelector() *QFileSelector { ret := C.QFileSelector_new() return newQFileSelector(ret) } // NewQFileSelector2 constructs a new QFileSelector object. func NewQFileSelector2(parent *QObject) *QFileSelector { ret := C.QFileSelector_new2(parent.cPointer()) return newQFileSelector(ret) } func (this *QFileSelector) MetaObject() *QMetaObject { ret := C.QFileSelector_MetaObject(this.h) return newQMetaObject_U(unsafe.Pointer(ret)) } func QFileSelector_Tr(s string) string { s_Cstring := C.CString(s) defer C.free(unsafe.Pointer(s_Cstring)) var _out *C.char = nil var _out_Strlen C.int = 0 C.QFileSelector_Tr(s_Cstring, &_out, &_out_Strlen) ret := C.GoStringN(_out, _out_Strlen) C.free(unsafe.Pointer(_out)) return ret } func QFileSelector_TrUtf8(s string) string { s_Cstring := C.CString(s) defer C.free(unsafe.Pointer(s_Cstring)) var _out *C.char = nil var _out_Strlen C.int = 0 C.QFileSelector_TrUtf8(s_Cstring, &_out, &_out_Strlen) ret := C.GoStringN(_out, _out_Strlen) C.free(unsafe.Pointer(_out)) return ret } func (this *QFileSelector) Select(filePath string) string { filePath_Cstring := C.CString(filePath) defer C.free(unsafe.Pointer(filePath_Cstring)) var _out *C.char = nil var _out_Strlen C.int = 0 C.QFileSelector_Select(this.h, filePath_Cstring, C.ulong(len(filePath)), &_out, &_out_Strlen) ret := C.GoStringN(_out, _out_Strlen) C.free(unsafe.Pointer(_out)) return ret } func (this *QFileSelector) SelectWithFilePath(filePath *QUrl) *QUrl { ret := C.QFileSelector_SelectWithFilePath(this.h, filePath.cPointer()) // Qt uses pass-by-value semantics for this type. Mimic with finalizer ret1 := newQUrl(ret) runtime.SetFinalizer(ret1, func(ret2 *QUrl) { ret2.Delete() runtime.KeepAlive(ret2.h) }) return ret1 } func (this *QFileSelector) ExtraSelectors() []string { var _out **C.char = nil var _out_Lengths *C.int = nil var _out_len C.size_t = 0 C.QFileSelector_ExtraSelectors(this.h, &_out, &_out_Lengths, &_out_len) ret := make([]string, int(_out_len)) _outCast := (*[0xffff]*C.char)(unsafe.Pointer(_out)) // hey ya _out_LengthsCast := (*[0xffff]C.int)(unsafe.Pointer(_out_Lengths)) for i := 0; i < int(_out_len); i++ { ret[i] = C.GoStringN(_outCast[i], _out_LengthsCast[i]) } C.free(unsafe.Pointer(_out)) return ret } func (this *QFileSelector) SetExtraSelectors(list []string) { // For the C ABI, malloc two C arrays; raw char* pointers and their lengths list_CArray := (*[0xffff]*C.char)(C.malloc(C.ulong(8 * len(list)))) list_Lengths := (*[0xffff]C.size_t)(C.malloc(C.ulong(8 * len(list)))) defer C.free(unsafe.Pointer(list_CArray)) defer C.free(unsafe.Pointer(list_Lengths)) for i := range list { single_cstring := C.CString(list[i]) defer C.free(unsafe.Pointer(single_cstring)) list_CArray[i] = single_cstring list_Lengths[i] = (C.size_t)(len(list[i])) } C.QFileSelector_SetExtraSelectors(this.h, &list_CArray[0], &list_Lengths[0], C.ulong(len(list))) } func (this *QFileSelector) AllSelectors() []string { var _out **C.char = nil var _out_Lengths *C.int = nil var _out_len C.size_t = 0 C.QFileSelector_AllSelectors(this.h, &_out, &_out_Lengths, &_out_len) ret := make([]string, int(_out_len)) _outCast := (*[0xffff]*C.char)(unsafe.Pointer(_out)) // hey ya _out_LengthsCast := (*[0xffff]C.int)(unsafe.Pointer(_out_Lengths)) for i := 0; i < int(_out_len); i++ { ret[i] = C.GoStringN(_outCast[i], _out_LengthsCast[i]) } C.free(unsafe.Pointer(_out)) return ret } func QFileSelector_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 _out *C.char = nil var _out_Strlen C.int = 0 C.QFileSelector_Tr2(s_Cstring, c_Cstring, &_out, &_out_Strlen) ret := C.GoStringN(_out, _out_Strlen) C.free(unsafe.Pointer(_out)) return ret } func QFileSelector_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 _out *C.char = nil var _out_Strlen C.int = 0 C.QFileSelector_Tr3(s_Cstring, c_Cstring, (C.int)(n), &_out, &_out_Strlen) ret := C.GoStringN(_out, _out_Strlen) C.free(unsafe.Pointer(_out)) return ret } func QFileSelector_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 _out *C.char = nil var _out_Strlen C.int = 0 C.QFileSelector_TrUtf82(s_Cstring, c_Cstring, &_out, &_out_Strlen) ret := C.GoStringN(_out, _out_Strlen) C.free(unsafe.Pointer(_out)) return ret } func QFileSelector_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 _out *C.char = nil var _out_Strlen C.int = 0 C.QFileSelector_TrUtf83(s_Cstring, c_Cstring, (C.int)(n), &_out, &_out_Strlen) ret := C.GoStringN(_out, _out_Strlen) C.free(unsafe.Pointer(_out)) return ret } func (this *QFileSelector) Delete() { C.QFileSelector_Delete(this.h) }