2024-08-25 04:08:24 +00:00
|
|
|
package qt
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
|
|
|
#include "gen_qpen.h"
|
|
|
|
#include <stdlib.h>
|
|
|
|
|
|
|
|
*/
|
|
|
|
import "C"
|
|
|
|
|
|
|
|
import (
|
|
|
|
"runtime"
|
|
|
|
"unsafe"
|
|
|
|
)
|
|
|
|
|
|
|
|
type QPen struct {
|
2024-11-19 06:29:06 +00:00
|
|
|
h *C.QPen
|
|
|
|
isSubclass bool
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QPen) cPointer() *C.QPen {
|
|
|
|
if this == nil {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
return this.h
|
|
|
|
}
|
|
|
|
|
2024-10-16 05:07:56 +00:00
|
|
|
func (this *QPen) UnsafePointer() unsafe.Pointer {
|
|
|
|
if this == nil {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
return unsafe.Pointer(this.h)
|
|
|
|
}
|
|
|
|
|
2024-11-19 06:29:06 +00:00
|
|
|
// newQPen constructs the type using only CGO pointers.
|
2024-08-25 04:08:24 +00:00
|
|
|
func newQPen(h *C.QPen) *QPen {
|
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 &QPen{h: h}
|
|
|
|
}
|
|
|
|
|
2024-11-19 06:29:06 +00:00
|
|
|
// UnsafeNewQPen constructs the type using only unsafe pointers.
|
2024-10-16 05:07:56 +00:00
|
|
|
func UnsafeNewQPen(h unsafe.Pointer) *QPen {
|
2024-12-07 04:15:57 +00:00
|
|
|
return newQPen((*C.QPen)(h))
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// NewQPen constructs a new QPen object.
|
|
|
|
func NewQPen() *QPen {
|
2024-11-19 06:29:06 +00:00
|
|
|
|
2024-12-07 04:15:57 +00:00
|
|
|
ret := newQPen(C.QPen_new())
|
2024-11-19 06:29:06 +00:00
|
|
|
ret.isSubclass = true
|
|
|
|
return ret
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// NewQPen2 constructs a new QPen object.
|
2024-09-04 06:54:22 +00:00
|
|
|
func NewQPen2(param1 PenStyle) *QPen {
|
2024-11-19 06:29:06 +00:00
|
|
|
|
2024-12-07 04:15:57 +00:00
|
|
|
ret := newQPen(C.QPen_new2((C.int)(param1)))
|
2024-11-19 06:29:06 +00:00
|
|
|
ret.isSubclass = true
|
|
|
|
return ret
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// NewQPen3 constructs a new QPen object.
|
2024-08-29 07:01:51 +00:00
|
|
|
func NewQPen3(color *QColor) *QPen {
|
2024-11-19 06:29:06 +00:00
|
|
|
|
2024-12-07 04:15:57 +00:00
|
|
|
ret := newQPen(C.QPen_new3(color.cPointer()))
|
2024-11-19 06:29:06 +00:00
|
|
|
ret.isSubclass = true
|
|
|
|
return ret
|
2024-08-29 07:01:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// NewQPen4 constructs a new QPen object.
|
|
|
|
func NewQPen4(brush *QBrush, width float64) *QPen {
|
2024-11-19 06:29:06 +00:00
|
|
|
|
2024-12-07 04:15:57 +00:00
|
|
|
ret := newQPen(C.QPen_new4(brush.cPointer(), (C.double)(width)))
|
2024-11-19 06:29:06 +00:00
|
|
|
ret.isSubclass = true
|
|
|
|
return ret
|
2024-08-29 07:01:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// NewQPen5 constructs a new QPen object.
|
|
|
|
func NewQPen5(pen *QPen) *QPen {
|
2024-11-19 06:29:06 +00:00
|
|
|
|
2024-12-07 04:15:57 +00:00
|
|
|
ret := newQPen(C.QPen_new5(pen.cPointer()))
|
2024-11-19 06:29:06 +00:00
|
|
|
ret.isSubclass = true
|
|
|
|
return ret
|
2024-08-29 07:01:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// NewQPen6 constructs a new QPen object.
|
2024-09-04 06:54:22 +00:00
|
|
|
func NewQPen6(brush *QBrush, width float64, s PenStyle) *QPen {
|
2024-11-19 06:29:06 +00:00
|
|
|
|
2024-12-07 04:15:57 +00:00
|
|
|
ret := newQPen(C.QPen_new6(brush.cPointer(), (C.double)(width), (C.int)(s)))
|
2024-11-19 06:29:06 +00:00
|
|
|
ret.isSubclass = true
|
|
|
|
return ret
|
2024-08-29 07:01:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// NewQPen7 constructs a new QPen object.
|
2024-09-04 06:54:22 +00:00
|
|
|
func NewQPen7(brush *QBrush, width float64, s PenStyle, c PenCapStyle) *QPen {
|
2024-11-19 06:29:06 +00:00
|
|
|
|
2024-12-07 04:15:57 +00:00
|
|
|
ret := newQPen(C.QPen_new7(brush.cPointer(), (C.double)(width), (C.int)(s), (C.int)(c)))
|
2024-11-19 06:29:06 +00:00
|
|
|
ret.isSubclass = true
|
|
|
|
return ret
|
2024-08-29 07:01:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// NewQPen8 constructs a new QPen object.
|
2024-09-04 06:54:22 +00:00
|
|
|
func NewQPen8(brush *QBrush, width float64, s PenStyle, c PenCapStyle, j PenJoinStyle) *QPen {
|
2024-11-19 06:29:06 +00:00
|
|
|
|
2024-12-07 04:15:57 +00:00
|
|
|
ret := newQPen(C.QPen_new8(brush.cPointer(), (C.double)(width), (C.int)(s), (C.int)(c), (C.int)(j)))
|
2024-11-19 06:29:06 +00:00
|
|
|
ret.isSubclass = true
|
|
|
|
return ret
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QPen) OperatorAssign(pen *QPen) {
|
|
|
|
C.QPen_OperatorAssign(this.h, pen.cPointer())
|
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QPen) Swap(other *QPen) {
|
|
|
|
C.QPen_Swap(this.h, other.cPointer())
|
|
|
|
}
|
|
|
|
|
2024-09-04 06:54:22 +00:00
|
|
|
func (this *QPen) Style() PenStyle {
|
2024-09-17 07:30:27 +00:00
|
|
|
return (PenStyle)(C.QPen_Style(this.h))
|
2024-08-29 07:01:51 +00:00
|
|
|
}
|
|
|
|
|
2024-09-04 06:54:22 +00:00
|
|
|
func (this *QPen) SetStyle(style PenStyle) {
|
2024-09-18 00:12:02 +00:00
|
|
|
C.QPen_SetStyle(this.h, (C.int)(style))
|
2024-08-29 07:01:51 +00:00
|
|
|
}
|
|
|
|
|
2024-08-25 04:08:24 +00:00
|
|
|
func (this *QPen) DashPattern() []float64 {
|
2024-11-04 07:18:27 +00:00
|
|
|
var _ma C.struct_miqt_array = C.QPen_DashPattern(this.h)
|
2024-09-14 22:29:05 +00:00
|
|
|
_ret := make([]float64, int(_ma.len))
|
2024-09-17 07:30:27 +00:00
|
|
|
_outCast := (*[0xffff]C.double)(unsafe.Pointer(_ma.data)) // hey ya
|
2024-09-14 22:29:05 +00:00
|
|
|
for i := 0; i < int(_ma.len); i++ {
|
|
|
|
_ret[i] = (float64)(_outCast[i])
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
2024-09-14 22:29:05 +00:00
|
|
|
return _ret
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QPen) SetDashPattern(pattern []float64) {
|
2024-09-01 05:51:28 +00:00
|
|
|
pattern_CArray := (*[0xffff]C.double)(C.malloc(C.size_t(8 * len(pattern))))
|
2024-08-25 04:08:24 +00:00
|
|
|
defer C.free(unsafe.Pointer(pattern_CArray))
|
|
|
|
for i := range pattern {
|
|
|
|
pattern_CArray[i] = (C.double)(pattern[i])
|
|
|
|
}
|
2024-11-04 07:18:27 +00:00
|
|
|
pattern_ma := C.struct_miqt_array{len: C.size_t(len(pattern)), data: unsafe.Pointer(pattern_CArray)}
|
2024-09-14 22:29:05 +00:00
|
|
|
C.QPen_SetDashPattern(this.h, pattern_ma)
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QPen) DashOffset() float64 {
|
2024-09-17 07:30:27 +00:00
|
|
|
return (float64)(C.QPen_DashOffset(this.h))
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QPen) SetDashOffset(doffset float64) {
|
|
|
|
C.QPen_SetDashOffset(this.h, (C.double)(doffset))
|
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QPen) MiterLimit() float64 {
|
2024-09-17 07:30:27 +00:00
|
|
|
return (float64)(C.QPen_MiterLimit(this.h))
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QPen) SetMiterLimit(limit float64) {
|
|
|
|
C.QPen_SetMiterLimit(this.h, (C.double)(limit))
|
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QPen) WidthF() float64 {
|
2024-09-17 07:30:27 +00:00
|
|
|
return (float64)(C.QPen_WidthF(this.h))
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QPen) SetWidthF(width float64) {
|
|
|
|
C.QPen_SetWidthF(this.h, (C.double)(width))
|
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QPen) Width() int {
|
2024-09-17 07:30:27 +00:00
|
|
|
return (int)(C.QPen_Width(this.h))
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QPen) SetWidth(width int) {
|
|
|
|
C.QPen_SetWidth(this.h, (C.int)(width))
|
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QPen) Color() *QColor {
|
2024-12-07 02:02:06 +00:00
|
|
|
_goptr := newQColor(C.QPen_Color(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 *QPen) SetColor(color *QColor) {
|
|
|
|
C.QPen_SetColor(this.h, color.cPointer())
|
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QPen) Brush() *QBrush {
|
2024-12-07 02:02:06 +00:00
|
|
|
_goptr := newQBrush(C.QPen_Brush(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 *QPen) SetBrush(brush *QBrush) {
|
|
|
|
C.QPen_SetBrush(this.h, brush.cPointer())
|
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QPen) IsSolid() bool {
|
2024-09-17 07:30:27 +00:00
|
|
|
return (bool)(C.QPen_IsSolid(this.h))
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-09-04 06:54:22 +00:00
|
|
|
func (this *QPen) CapStyle() PenCapStyle {
|
2024-09-17 07:30:27 +00:00
|
|
|
return (PenCapStyle)(C.QPen_CapStyle(this.h))
|
2024-08-29 07:01:51 +00:00
|
|
|
}
|
|
|
|
|
2024-09-04 06:54:22 +00:00
|
|
|
func (this *QPen) SetCapStyle(pcs PenCapStyle) {
|
2024-09-18 00:12:02 +00:00
|
|
|
C.QPen_SetCapStyle(this.h, (C.int)(pcs))
|
2024-08-29 07:01:51 +00:00
|
|
|
}
|
|
|
|
|
2024-09-04 06:54:22 +00:00
|
|
|
func (this *QPen) JoinStyle() PenJoinStyle {
|
2024-09-17 07:30:27 +00:00
|
|
|
return (PenJoinStyle)(C.QPen_JoinStyle(this.h))
|
2024-08-29 07:01:51 +00:00
|
|
|
}
|
|
|
|
|
2024-09-04 06:54:22 +00:00
|
|
|
func (this *QPen) SetJoinStyle(pcs PenJoinStyle) {
|
2024-09-18 00:12:02 +00:00
|
|
|
C.QPen_SetJoinStyle(this.h, (C.int)(pcs))
|
2024-08-29 07:01:51 +00:00
|
|
|
}
|
|
|
|
|
2024-08-25 04:08:24 +00:00
|
|
|
func (this *QPen) IsCosmetic() bool {
|
2024-09-17 07:30:27 +00:00
|
|
|
return (bool)(C.QPen_IsCosmetic(this.h))
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QPen) SetCosmetic(cosmetic bool) {
|
|
|
|
C.QPen_SetCosmetic(this.h, (C.bool)(cosmetic))
|
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QPen) OperatorEqual(p *QPen) bool {
|
2024-09-17 07:30:27 +00:00
|
|
|
return (bool)(C.QPen_OperatorEqual(this.h, p.cPointer()))
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QPen) OperatorNotEqual(p *QPen) bool {
|
2024-09-17 07:30:27 +00:00
|
|
|
return (bool)(C.QPen_OperatorNotEqual(this.h, p.cPointer()))
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QPen) IsDetached() bool {
|
2024-09-17 07:30:27 +00:00
|
|
|
return (bool)(C.QPen_IsDetached(this.h))
|
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 *QPen) Delete() {
|
2024-11-19 06:29:06 +00:00
|
|
|
C.QPen_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 *QPen) GoGC() {
|
|
|
|
runtime.SetFinalizer(this, func(this *QPen) {
|
|
|
|
this.Delete()
|
|
|
|
runtime.KeepAlive(this.h)
|
|
|
|
})
|
|
|
|
}
|