2024-08-25 04:08:24 +00:00
|
|
|
package qt
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
|
|
|
#include "gen_qdrag.h"
|
|
|
|
#include <stdlib.h>
|
|
|
|
|
|
|
|
*/
|
|
|
|
import "C"
|
|
|
|
|
|
|
|
import (
|
|
|
|
"runtime"
|
|
|
|
"runtime/cgo"
|
|
|
|
"unsafe"
|
|
|
|
)
|
|
|
|
|
|
|
|
type QDrag struct {
|
|
|
|
h *C.QDrag
|
|
|
|
*QObject
|
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QDrag) cPointer() *C.QDrag {
|
|
|
|
if this == nil {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
return this.h
|
|
|
|
}
|
|
|
|
|
|
|
|
func newQDrag(h *C.QDrag) *QDrag {
|
2024-09-01 02:23:55 +00:00
|
|
|
if h == nil {
|
|
|
|
return nil
|
|
|
|
}
|
2024-08-25 04:08:24 +00:00
|
|
|
return &QDrag{h: h, QObject: newQObject_U(unsafe.Pointer(h))}
|
|
|
|
}
|
|
|
|
|
|
|
|
func newQDrag_U(h unsafe.Pointer) *QDrag {
|
|
|
|
return newQDrag((*C.QDrag)(h))
|
|
|
|
}
|
|
|
|
|
|
|
|
// NewQDrag constructs a new QDrag object.
|
|
|
|
func NewQDrag(dragSource *QObject) *QDrag {
|
|
|
|
ret := C.QDrag_new(dragSource.cPointer())
|
|
|
|
return newQDrag(ret)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QDrag) MetaObject() *QMetaObject {
|
2024-09-14 22:29:05 +00:00
|
|
|
_ret := C.QDrag_MetaObject(this.h)
|
|
|
|
return newQMetaObject_U(unsafe.Pointer(_ret))
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func QDrag_Tr(s string) string {
|
|
|
|
s_Cstring := C.CString(s)
|
|
|
|
defer C.free(unsafe.Pointer(s_Cstring))
|
2024-09-14 22:29:05 +00:00
|
|
|
var _ms *C.struct_miqt_string = C.QDrag_Tr(s_Cstring)
|
|
|
|
_ret := C.GoStringN(&_ms.data, C.int(int64(_ms.len)))
|
|
|
|
C.free(unsafe.Pointer(_ms))
|
|
|
|
return _ret
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func QDrag_TrUtf8(s string) string {
|
|
|
|
s_Cstring := C.CString(s)
|
|
|
|
defer C.free(unsafe.Pointer(s_Cstring))
|
2024-09-14 22:29:05 +00:00
|
|
|
var _ms *C.struct_miqt_string = C.QDrag_TrUtf8(s_Cstring)
|
|
|
|
_ret := C.GoStringN(&_ms.data, C.int(int64(_ms.len)))
|
|
|
|
C.free(unsafe.Pointer(_ms))
|
|
|
|
return _ret
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QDrag) SetMimeData(data *QMimeData) {
|
|
|
|
C.QDrag_SetMimeData(this.h, data.cPointer())
|
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QDrag) MimeData() *QMimeData {
|
2024-09-14 22:29:05 +00:00
|
|
|
_ret := C.QDrag_MimeData(this.h)
|
|
|
|
return newQMimeData_U(unsafe.Pointer(_ret))
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QDrag) SetPixmap(pixmap *QPixmap) {
|
|
|
|
C.QDrag_SetPixmap(this.h, pixmap.cPointer())
|
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QDrag) Pixmap() *QPixmap {
|
2024-09-14 22:29:05 +00:00
|
|
|
_ret := C.QDrag_Pixmap(this.h)
|
|
|
|
_goptr := newQPixmap(_ret)
|
|
|
|
_goptr.GoGC() // Qt uses pass-by-value semantics for this type. Mimic with finalizer
|
|
|
|
return _goptr
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QDrag) SetHotSpot(hotspot *QPoint) {
|
|
|
|
C.QDrag_SetHotSpot(this.h, hotspot.cPointer())
|
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QDrag) HotSpot() *QPoint {
|
2024-09-14 22:29:05 +00:00
|
|
|
_ret := C.QDrag_HotSpot(this.h)
|
|
|
|
_goptr := newQPoint(_ret)
|
|
|
|
_goptr.GoGC() // Qt uses pass-by-value semantics for this type. Mimic with finalizer
|
|
|
|
return _goptr
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QDrag) Source() *QObject {
|
2024-09-14 22:29:05 +00:00
|
|
|
_ret := C.QDrag_Source(this.h)
|
|
|
|
return newQObject_U(unsafe.Pointer(_ret))
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QDrag) Target() *QObject {
|
2024-09-14 22:29:05 +00:00
|
|
|
_ret := C.QDrag_Target(this.h)
|
|
|
|
return newQObject_U(unsafe.Pointer(_ret))
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-09-04 06:54:22 +00:00
|
|
|
func (this *QDrag) Start() DropAction {
|
2024-09-14 22:29:05 +00:00
|
|
|
_ret := C.QDrag_Start(this.h)
|
|
|
|
return (DropAction)(_ret)
|
2024-08-29 07:01:51 +00:00
|
|
|
}
|
|
|
|
|
2024-09-04 06:54:22 +00:00
|
|
|
func (this *QDrag) Exec() DropAction {
|
2024-09-14 22:29:05 +00:00
|
|
|
_ret := C.QDrag_Exec(this.h)
|
|
|
|
return (DropAction)(_ret)
|
2024-08-29 07:01:51 +00:00
|
|
|
}
|
|
|
|
|
2024-09-04 06:54:22 +00:00
|
|
|
func (this *QDrag) Exec2(supportedActions int, defaultAction DropAction) DropAction {
|
2024-09-14 22:29:05 +00:00
|
|
|
_ret := C.QDrag_Exec2(this.h, (C.int)(supportedActions), (C.uintptr_t)(defaultAction))
|
|
|
|
return (DropAction)(_ret)
|
2024-08-29 07:01:51 +00:00
|
|
|
}
|
|
|
|
|
2024-09-04 06:54:22 +00:00
|
|
|
func (this *QDrag) SetDragCursor(cursor *QPixmap, action DropAction) {
|
2024-08-29 07:01:51 +00:00
|
|
|
C.QDrag_SetDragCursor(this.h, cursor.cPointer(), (C.uintptr_t)(action))
|
|
|
|
}
|
|
|
|
|
2024-09-04 06:54:22 +00:00
|
|
|
func (this *QDrag) DragCursor(action DropAction) *QPixmap {
|
2024-09-14 22:29:05 +00:00
|
|
|
_ret := C.QDrag_DragCursor(this.h, (C.uintptr_t)(action))
|
|
|
|
_goptr := newQPixmap(_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 *QDrag) SupportedActions() int {
|
2024-09-14 22:29:05 +00:00
|
|
|
_ret := C.QDrag_SupportedActions(this.h)
|
|
|
|
return (int)(_ret)
|
2024-08-29 07:01:51 +00:00
|
|
|
}
|
|
|
|
|
2024-09-04 06:54:22 +00:00
|
|
|
func (this *QDrag) DefaultAction() DropAction {
|
2024-09-14 22:29:05 +00:00
|
|
|
_ret := C.QDrag_DefaultAction(this.h)
|
|
|
|
return (DropAction)(_ret)
|
2024-08-29 07:01:51 +00:00
|
|
|
}
|
|
|
|
|
2024-08-25 04:08:24 +00:00
|
|
|
func QDrag_Cancel() {
|
|
|
|
C.QDrag_Cancel()
|
|
|
|
}
|
|
|
|
|
2024-09-04 06:54:22 +00:00
|
|
|
func (this *QDrag) ActionChanged(action DropAction) {
|
2024-08-29 07:01:51 +00:00
|
|
|
C.QDrag_ActionChanged(this.h, (C.uintptr_t)(action))
|
|
|
|
}
|
2024-09-14 22:29:05 +00:00
|
|
|
func (this *QDrag) OnActionChanged(slot func(action DropAction)) {
|
|
|
|
C.QDrag_connect_ActionChanged(this.h, unsafe.Pointer(uintptr(cgo.NewHandle(slot))))
|
|
|
|
}
|
2024-08-29 07:01:51 +00:00
|
|
|
|
2024-09-14 22:29:05 +00:00
|
|
|
//export miqt_exec_callback_QDrag_ActionChanged
|
|
|
|
func miqt_exec_callback_QDrag_ActionChanged(cb *C.void, action C.uintptr_t) {
|
|
|
|
gofunc, ok := (cgo.Handle(uintptr(unsafe.Pointer(cb))).Value()).(func(action DropAction))
|
|
|
|
if !ok {
|
|
|
|
panic("miqt: callback of non-callback type (heap corruption?)")
|
2024-08-29 07:01:51 +00:00
|
|
|
}
|
|
|
|
|
2024-09-14 22:29:05 +00:00
|
|
|
// Convert all CABI parameters to Go parameters
|
|
|
|
action_ret := action
|
|
|
|
slotval1 := (DropAction)(action_ret)
|
|
|
|
|
|
|
|
gofunc(slotval1)
|
2024-08-29 07:01:51 +00:00
|
|
|
}
|
|
|
|
|
2024-08-25 04:08:24 +00:00
|
|
|
func (this *QDrag) TargetChanged(newTarget *QObject) {
|
|
|
|
C.QDrag_TargetChanged(this.h, newTarget.cPointer())
|
|
|
|
}
|
2024-09-14 22:29:05 +00:00
|
|
|
func (this *QDrag) OnTargetChanged(slot func(newTarget *QObject)) {
|
|
|
|
C.QDrag_connect_TargetChanged(this.h, unsafe.Pointer(uintptr(cgo.NewHandle(slot))))
|
|
|
|
}
|
2024-08-25 04:08:24 +00:00
|
|
|
|
2024-09-14 22:29:05 +00:00
|
|
|
//export miqt_exec_callback_QDrag_TargetChanged
|
|
|
|
func miqt_exec_callback_QDrag_TargetChanged(cb *C.void, newTarget *C.QObject) {
|
|
|
|
gofunc, ok := (cgo.Handle(uintptr(unsafe.Pointer(cb))).Value()).(func(newTarget *QObject))
|
|
|
|
if !ok {
|
|
|
|
panic("miqt: callback of non-callback type (heap corruption?)")
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-09-14 22:29:05 +00:00
|
|
|
// Convert all CABI parameters to Go parameters
|
|
|
|
newTarget_ret := newTarget
|
|
|
|
slotval1 := newQObject_U(unsafe.Pointer(newTarget_ret))
|
|
|
|
|
|
|
|
gofunc(slotval1)
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func QDrag_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-09-14 22:29:05 +00:00
|
|
|
var _ms *C.struct_miqt_string = C.QDrag_Tr2(s_Cstring, c_Cstring)
|
|
|
|
_ret := C.GoStringN(&_ms.data, C.int(int64(_ms.len)))
|
|
|
|
C.free(unsafe.Pointer(_ms))
|
|
|
|
return _ret
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func QDrag_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-09-14 22:29:05 +00:00
|
|
|
var _ms *C.struct_miqt_string = C.QDrag_Tr3(s_Cstring, c_Cstring, (C.int)(n))
|
|
|
|
_ret := C.GoStringN(&_ms.data, C.int(int64(_ms.len)))
|
|
|
|
C.free(unsafe.Pointer(_ms))
|
|
|
|
return _ret
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func QDrag_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-09-14 22:29:05 +00:00
|
|
|
var _ms *C.struct_miqt_string = C.QDrag_TrUtf82(s_Cstring, c_Cstring)
|
|
|
|
_ret := C.GoStringN(&_ms.data, C.int(int64(_ms.len)))
|
|
|
|
C.free(unsafe.Pointer(_ms))
|
|
|
|
return _ret
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func QDrag_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-09-14 22:29:05 +00:00
|
|
|
var _ms *C.struct_miqt_string = C.QDrag_TrUtf83(s_Cstring, c_Cstring, (C.int)(n))
|
|
|
|
_ret := C.GoStringN(&_ms.data, C.int(int64(_ms.len)))
|
|
|
|
C.free(unsafe.Pointer(_ms))
|
|
|
|
return _ret
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-09-04 06:54:22 +00:00
|
|
|
func (this *QDrag) Start1(supportedActions int) DropAction {
|
2024-09-14 22:29:05 +00:00
|
|
|
_ret := C.QDrag_Start1(this.h, (C.int)(supportedActions))
|
|
|
|
return (DropAction)(_ret)
|
2024-08-29 07:01:51 +00:00
|
|
|
}
|
|
|
|
|
2024-09-04 06:54:22 +00:00
|
|
|
func (this *QDrag) Exec1(supportedActions int) DropAction {
|
2024-09-14 22:29:05 +00:00
|
|
|
_ret := C.QDrag_Exec1(this.h, (C.int)(supportedActions))
|
|
|
|
return (DropAction)(_ret)
|
2024-08-29 07:01:51 +00:00
|
|
|
}
|
|
|
|
|
2024-09-14 22:29:05 +00:00
|
|
|
// Delete this object from C++ memory.
|
2024-08-25 04:08:24 +00:00
|
|
|
func (this *QDrag) Delete() {
|
|
|
|
C.QDrag_Delete(this.h)
|
|
|
|
}
|
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 *QDrag) GoGC() {
|
|
|
|
runtime.SetFinalizer(this, func(this *QDrag) {
|
|
|
|
this.Delete()
|
|
|
|
runtime.KeepAlive(this.h)
|
|
|
|
})
|
|
|
|
}
|