2024-08-25 04:08:24 +00:00
|
|
|
package qt
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
|
|
|
#include "gen_qpoint.h"
|
|
|
|
#include <stdlib.h>
|
|
|
|
|
|
|
|
*/
|
|
|
|
import "C"
|
|
|
|
|
|
|
|
import (
|
|
|
|
"runtime"
|
|
|
|
"unsafe"
|
|
|
|
)
|
|
|
|
|
|
|
|
type QPoint struct {
|
2024-11-19 06:29:06 +00:00
|
|
|
h *C.QPoint
|
|
|
|
isSubclass bool
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QPoint) cPointer() *C.QPoint {
|
|
|
|
if this == nil {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
return this.h
|
|
|
|
}
|
|
|
|
|
2024-10-16 05:07:56 +00:00
|
|
|
func (this *QPoint) UnsafePointer() unsafe.Pointer {
|
|
|
|
if this == nil {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
return unsafe.Pointer(this.h)
|
|
|
|
}
|
|
|
|
|
2024-11-19 06:29:06 +00:00
|
|
|
// newQPoint constructs the type using only CGO pointers.
|
2024-08-25 04:08:24 +00:00
|
|
|
func newQPoint(h *C.QPoint) *QPoint {
|
2024-09-01 02:23:55 +00:00
|
|
|
if h == nil {
|
|
|
|
return nil
|
|
|
|
}
|
2024-12-07 04:15:57 +00:00
|
|
|
|
2024-08-25 04:08:24 +00:00
|
|
|
return &QPoint{h: h}
|
|
|
|
}
|
|
|
|
|
2024-11-19 06:29:06 +00:00
|
|
|
// UnsafeNewQPoint constructs the type using only unsafe pointers.
|
2024-10-16 05:07:56 +00:00
|
|
|
func UnsafeNewQPoint(h unsafe.Pointer) *QPoint {
|
2024-12-07 04:15:57 +00:00
|
|
|
return newQPoint((*C.QPoint)(h))
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// NewQPoint constructs a new QPoint object.
|
|
|
|
func NewQPoint() *QPoint {
|
2024-11-19 06:29:06 +00:00
|
|
|
|
2024-12-07 04:15:57 +00:00
|
|
|
ret := newQPoint(C.QPoint_new())
|
2024-11-19 06:29:06 +00:00
|
|
|
ret.isSubclass = true
|
|
|
|
return ret
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// NewQPoint2 constructs a new QPoint object.
|
|
|
|
func NewQPoint2(xpos int, ypos int) *QPoint {
|
2024-11-19 06:29:06 +00:00
|
|
|
|
2024-12-07 04:15:57 +00:00
|
|
|
ret := newQPoint(C.QPoint_new2((C.int)(xpos), (C.int)(ypos)))
|
2024-11-19 06:29:06 +00:00
|
|
|
ret.isSubclass = true
|
|
|
|
return ret
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// NewQPoint3 constructs a new QPoint object.
|
|
|
|
func NewQPoint3(param1 *QPoint) *QPoint {
|
2024-11-19 06:29:06 +00:00
|
|
|
|
2024-12-07 04:15:57 +00:00
|
|
|
ret := newQPoint(C.QPoint_new3(param1.cPointer()))
|
2024-11-19 06:29:06 +00:00
|
|
|
ret.isSubclass = true
|
|
|
|
return ret
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QPoint) IsNull() bool {
|
2024-09-17 07:30:27 +00:00
|
|
|
return (bool)(C.QPoint_IsNull(this.h))
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QPoint) X() int {
|
2024-09-17 07:30:27 +00:00
|
|
|
return (int)(C.QPoint_X(this.h))
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QPoint) Y() int {
|
2024-09-17 07:30:27 +00:00
|
|
|
return (int)(C.QPoint_Y(this.h))
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QPoint) SetX(x int) {
|
|
|
|
C.QPoint_SetX(this.h, (C.int)(x))
|
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QPoint) SetY(y int) {
|
|
|
|
C.QPoint_SetY(this.h, (C.int)(y))
|
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QPoint) ManhattanLength() int {
|
2024-09-17 07:30:27 +00:00
|
|
|
return (int)(C.QPoint_ManhattanLength(this.h))
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QPoint) Transposed() *QPoint {
|
2024-12-07 02:02:06 +00:00
|
|
|
_goptr := newQPoint(C.QPoint_Transposed(this.h))
|
2024-09-14 22:29:05 +00:00
|
|
|
_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 *QPoint) OperatorPlusAssign(p *QPoint) *QPoint {
|
2024-12-07 02:02:06 +00:00
|
|
|
return newQPoint(C.QPoint_OperatorPlusAssign(this.h, p.cPointer()))
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QPoint) OperatorMinusAssign(p *QPoint) *QPoint {
|
2024-12-07 02:02:06 +00:00
|
|
|
return newQPoint(C.QPoint_OperatorMinusAssign(this.h, p.cPointer()))
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QPoint) OperatorMultiplyAssign(factor float32) *QPoint {
|
2024-12-07 02:02:06 +00:00
|
|
|
return newQPoint(C.QPoint_OperatorMultiplyAssign(this.h, (C.float)(factor)))
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QPoint) OperatorMultiplyAssignWithFactor(factor float64) *QPoint {
|
2024-12-07 02:02:06 +00:00
|
|
|
return newQPoint(C.QPoint_OperatorMultiplyAssignWithFactor(this.h, (C.double)(factor)))
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QPoint) OperatorMultiplyAssign2(factor int) *QPoint {
|
2024-12-07 02:02:06 +00:00
|
|
|
return newQPoint(C.QPoint_OperatorMultiplyAssign2(this.h, (C.int)(factor)))
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QPoint) OperatorDivideAssign(divisor float64) *QPoint {
|
2024-12-07 02:02:06 +00:00
|
|
|
return newQPoint(C.QPoint_OperatorDivideAssign(this.h, (C.double)(divisor)))
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func QPoint_DotProduct(p1 *QPoint, p2 *QPoint) int {
|
2024-09-17 07:30:27 +00:00
|
|
|
return (int)(C.QPoint_DotProduct(p1.cPointer(), p2.cPointer()))
|
2024-08-25 04:08:24 +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 *QPoint) Delete() {
|
2024-11-19 06:29:06 +00:00
|
|
|
C.QPoint_Delete(this.h, C.bool(this.isSubclass))
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
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 *QPoint) GoGC() {
|
|
|
|
runtime.SetFinalizer(this, func(this *QPoint) {
|
|
|
|
this.Delete()
|
|
|
|
runtime.KeepAlive(this.h)
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
2024-08-25 04:08:24 +00:00
|
|
|
type QPointF struct {
|
2024-11-19 06:29:06 +00:00
|
|
|
h *C.QPointF
|
|
|
|
isSubclass bool
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QPointF) cPointer() *C.QPointF {
|
|
|
|
if this == nil {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
return this.h
|
|
|
|
}
|
|
|
|
|
2024-10-16 05:07:56 +00:00
|
|
|
func (this *QPointF) UnsafePointer() unsafe.Pointer {
|
|
|
|
if this == nil {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
return unsafe.Pointer(this.h)
|
|
|
|
}
|
|
|
|
|
2024-11-19 06:29:06 +00:00
|
|
|
// newQPointF constructs the type using only CGO pointers.
|
2024-08-25 04:08:24 +00:00
|
|
|
func newQPointF(h *C.QPointF) *QPointF {
|
2024-09-01 02:23:55 +00:00
|
|
|
if h == nil {
|
|
|
|
return nil
|
|
|
|
}
|
2024-12-07 04:15:57 +00:00
|
|
|
|
2024-08-25 04:08:24 +00:00
|
|
|
return &QPointF{h: h}
|
|
|
|
}
|
|
|
|
|
2024-11-19 06:29:06 +00:00
|
|
|
// UnsafeNewQPointF constructs the type using only unsafe pointers.
|
2024-10-16 05:07:56 +00:00
|
|
|
func UnsafeNewQPointF(h unsafe.Pointer) *QPointF {
|
2024-12-07 04:15:57 +00:00
|
|
|
return newQPointF((*C.QPointF)(h))
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// NewQPointF constructs a new QPointF object.
|
|
|
|
func NewQPointF() *QPointF {
|
2024-11-19 06:29:06 +00:00
|
|
|
|
2024-12-07 04:15:57 +00:00
|
|
|
ret := newQPointF(C.QPointF_new())
|
2024-11-19 06:29:06 +00:00
|
|
|
ret.isSubclass = true
|
|
|
|
return ret
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// NewQPointF2 constructs a new QPointF object.
|
|
|
|
func NewQPointF2(p *QPoint) *QPointF {
|
2024-11-19 06:29:06 +00:00
|
|
|
|
2024-12-07 04:15:57 +00:00
|
|
|
ret := newQPointF(C.QPointF_new2(p.cPointer()))
|
2024-11-19 06:29:06 +00:00
|
|
|
ret.isSubclass = true
|
|
|
|
return ret
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// NewQPointF3 constructs a new QPointF object.
|
|
|
|
func NewQPointF3(xpos float64, ypos float64) *QPointF {
|
2024-11-19 06:29:06 +00:00
|
|
|
|
2024-12-07 04:15:57 +00:00
|
|
|
ret := newQPointF(C.QPointF_new3((C.double)(xpos), (C.double)(ypos)))
|
2024-11-19 06:29:06 +00:00
|
|
|
ret.isSubclass = true
|
|
|
|
return ret
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// NewQPointF4 constructs a new QPointF object.
|
|
|
|
func NewQPointF4(param1 *QPointF) *QPointF {
|
2024-11-19 06:29:06 +00:00
|
|
|
|
2024-12-07 04:15:57 +00:00
|
|
|
ret := newQPointF(C.QPointF_new4(param1.cPointer()))
|
2024-11-19 06:29:06 +00:00
|
|
|
ret.isSubclass = true
|
|
|
|
return ret
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QPointF) ManhattanLength() float64 {
|
2024-09-17 07:30:27 +00:00
|
|
|
return (float64)(C.QPointF_ManhattanLength(this.h))
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QPointF) IsNull() bool {
|
2024-09-17 07:30:27 +00:00
|
|
|
return (bool)(C.QPointF_IsNull(this.h))
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QPointF) X() float64 {
|
2024-09-17 07:30:27 +00:00
|
|
|
return (float64)(C.QPointF_X(this.h))
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QPointF) Y() float64 {
|
2024-09-17 07:30:27 +00:00
|
|
|
return (float64)(C.QPointF_Y(this.h))
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QPointF) SetX(x float64) {
|
|
|
|
C.QPointF_SetX(this.h, (C.double)(x))
|
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QPointF) SetY(y float64) {
|
|
|
|
C.QPointF_SetY(this.h, (C.double)(y))
|
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QPointF) Transposed() *QPointF {
|
2024-12-07 02:02:06 +00:00
|
|
|
_goptr := newQPointF(C.QPointF_Transposed(this.h))
|
2024-09-14 22:29:05 +00:00
|
|
|
_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 *QPointF) OperatorPlusAssign(p *QPointF) *QPointF {
|
2024-12-07 02:02:06 +00:00
|
|
|
return newQPointF(C.QPointF_OperatorPlusAssign(this.h, p.cPointer()))
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QPointF) OperatorMinusAssign(p *QPointF) *QPointF {
|
2024-12-07 02:02:06 +00:00
|
|
|
return newQPointF(C.QPointF_OperatorMinusAssign(this.h, p.cPointer()))
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QPointF) OperatorMultiplyAssign(c float64) *QPointF {
|
2024-12-07 02:02:06 +00:00
|
|
|
return newQPointF(C.QPointF_OperatorMultiplyAssign(this.h, (C.double)(c)))
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QPointF) OperatorDivideAssign(c float64) *QPointF {
|
2024-12-07 02:02:06 +00:00
|
|
|
return newQPointF(C.QPointF_OperatorDivideAssign(this.h, (C.double)(c)))
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func QPointF_DotProduct(p1 *QPointF, p2 *QPointF) float64 {
|
2024-09-17 07:30:27 +00:00
|
|
|
return (float64)(C.QPointF_DotProduct(p1.cPointer(), p2.cPointer()))
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QPointF) ToPoint() *QPoint {
|
2024-12-07 02:02:06 +00:00
|
|
|
_goptr := newQPoint(C.QPointF_ToPoint(this.h))
|
2024-09-14 22:29:05 +00:00
|
|
|
_goptr.GoGC() // Qt uses pass-by-value semantics for this type. Mimic with finalizer
|
|
|
|
return _goptr
|
2024-08-25 04:08:24 +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 *QPointF) Delete() {
|
2024-11-19 06:29:06 +00:00
|
|
|
C.QPointF_Delete(this.h, C.bool(this.isSubclass))
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
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 *QPointF) GoGC() {
|
|
|
|
runtime.SetFinalizer(this, func(this *QPointF) {
|
|
|
|
this.Delete()
|
|
|
|
runtime.KeepAlive(this.h)
|
|
|
|
})
|
|
|
|
}
|