mirror of
https://github.com/mappu/miqt.git
synced 2024-12-23 09:28:36 +00:00
220 lines
6.1 KiB
Go
220 lines
6.1 KiB
Go
package qt
|
|
|
|
/*
|
|
|
|
#include "gen_qglyphrun.h"
|
|
#include <stdlib.h>
|
|
|
|
*/
|
|
import "C"
|
|
|
|
import (
|
|
"runtime"
|
|
"unsafe"
|
|
)
|
|
|
|
type QGlyphRun__GlyphRunFlag int
|
|
|
|
const (
|
|
QGlyphRun__GlyphRunFlag__Overline QGlyphRun__GlyphRunFlag = 1
|
|
QGlyphRun__GlyphRunFlag__Underline QGlyphRun__GlyphRunFlag = 2
|
|
QGlyphRun__GlyphRunFlag__StrikeOut QGlyphRun__GlyphRunFlag = 4
|
|
QGlyphRun__GlyphRunFlag__RightToLeft QGlyphRun__GlyphRunFlag = 8
|
|
QGlyphRun__GlyphRunFlag__SplitLigature QGlyphRun__GlyphRunFlag = 16
|
|
)
|
|
|
|
type QGlyphRun struct {
|
|
h *C.QGlyphRun
|
|
}
|
|
|
|
func (this *QGlyphRun) cPointer() *C.QGlyphRun {
|
|
if this == nil {
|
|
return nil
|
|
}
|
|
return this.h
|
|
}
|
|
|
|
func newQGlyphRun(h *C.QGlyphRun) *QGlyphRun {
|
|
if h == nil {
|
|
return nil
|
|
}
|
|
return &QGlyphRun{h: h}
|
|
}
|
|
|
|
func newQGlyphRun_U(h unsafe.Pointer) *QGlyphRun {
|
|
return newQGlyphRun((*C.QGlyphRun)(h))
|
|
}
|
|
|
|
// NewQGlyphRun constructs a new QGlyphRun object.
|
|
func NewQGlyphRun() *QGlyphRun {
|
|
ret := C.QGlyphRun_new()
|
|
return newQGlyphRun(ret)
|
|
}
|
|
|
|
// NewQGlyphRun2 constructs a new QGlyphRun object.
|
|
func NewQGlyphRun2(other *QGlyphRun) *QGlyphRun {
|
|
ret := C.QGlyphRun_new2(other.cPointer())
|
|
return newQGlyphRun(ret)
|
|
}
|
|
|
|
func (this *QGlyphRun) OperatorAssign(other *QGlyphRun) {
|
|
C.QGlyphRun_OperatorAssign(this.h, other.cPointer())
|
|
}
|
|
|
|
func (this *QGlyphRun) Swap(other *QGlyphRun) {
|
|
C.QGlyphRun_Swap(this.h, other.cPointer())
|
|
}
|
|
|
|
func (this *QGlyphRun) RawFont() *QRawFont {
|
|
_ret := C.QGlyphRun_RawFont(this.h)
|
|
_goptr := newQRawFont(_ret)
|
|
_goptr.GoGC() // Qt uses pass-by-value semantics for this type. Mimic with finalizer
|
|
return _goptr
|
|
}
|
|
|
|
func (this *QGlyphRun) SetRawFont(rawFont *QRawFont) {
|
|
C.QGlyphRun_SetRawFont(this.h, rawFont.cPointer())
|
|
}
|
|
|
|
func (this *QGlyphRun) SetRawData(glyphIndexArray *uint, glyphPositionArray *QPointF, size int) {
|
|
C.QGlyphRun_SetRawData(this.h, (*C.uint)(unsafe.Pointer(glyphIndexArray)), glyphPositionArray.cPointer(), (C.int)(size))
|
|
}
|
|
|
|
func (this *QGlyphRun) GlyphIndexes() []uint {
|
|
var _ma *C.struct_miqt_array = C.QGlyphRun_GlyphIndexes(this.h)
|
|
_ret := make([]uint, int(_ma.len))
|
|
_outCast := (*[0xffff]C.uint)(unsafe.Pointer(_ma.data)) // hey ya
|
|
for i := 0; i < int(_ma.len); i++ {
|
|
_ret[i] = (uint)(_outCast[i])
|
|
}
|
|
C.free(unsafe.Pointer(_ma))
|
|
return _ret
|
|
}
|
|
|
|
func (this *QGlyphRun) SetGlyphIndexes(glyphIndexes []uint) {
|
|
// For the C ABI, malloc a C array of raw pointers
|
|
glyphIndexes_CArray := (*[0xffff]C.uint)(C.malloc(C.size_t(8 * len(glyphIndexes))))
|
|
defer C.free(unsafe.Pointer(glyphIndexes_CArray))
|
|
for i := range glyphIndexes {
|
|
glyphIndexes_CArray[i] = (C.uint)(glyphIndexes[i])
|
|
}
|
|
glyphIndexes_ma := &C.struct_miqt_array{len: C.size_t(len(glyphIndexes)), data: unsafe.Pointer(glyphIndexes_CArray)}
|
|
defer runtime.KeepAlive(unsafe.Pointer(glyphIndexes_ma))
|
|
C.QGlyphRun_SetGlyphIndexes(this.h, glyphIndexes_ma)
|
|
}
|
|
|
|
func (this *QGlyphRun) Positions() []QPointF {
|
|
var _ma *C.struct_miqt_array = C.QGlyphRun_Positions(this.h)
|
|
_ret := make([]QPointF, int(_ma.len))
|
|
_outCast := (*[0xffff]*C.QPointF)(unsafe.Pointer(_ma.data)) // hey ya
|
|
for i := 0; i < int(_ma.len); i++ {
|
|
_vv_ret := _outCast[i]
|
|
_vv_goptr := newQPointF(_vv_ret)
|
|
_vv_goptr.GoGC() // Qt uses pass-by-value semantics for this type. Mimic with finalizer
|
|
_ret[i] = *_vv_goptr
|
|
}
|
|
C.free(unsafe.Pointer(_ma))
|
|
return _ret
|
|
}
|
|
|
|
func (this *QGlyphRun) SetPositions(positions []QPointF) {
|
|
// For the C ABI, malloc a C array of raw pointers
|
|
positions_CArray := (*[0xffff]*C.QPointF)(C.malloc(C.size_t(8 * len(positions))))
|
|
defer C.free(unsafe.Pointer(positions_CArray))
|
|
for i := range positions {
|
|
positions_CArray[i] = positions[i].cPointer()
|
|
}
|
|
positions_ma := &C.struct_miqt_array{len: C.size_t(len(positions)), data: unsafe.Pointer(positions_CArray)}
|
|
defer runtime.KeepAlive(unsafe.Pointer(positions_ma))
|
|
C.QGlyphRun_SetPositions(this.h, positions_ma)
|
|
}
|
|
|
|
func (this *QGlyphRun) Clear() {
|
|
C.QGlyphRun_Clear(this.h)
|
|
}
|
|
|
|
func (this *QGlyphRun) OperatorEqual(other *QGlyphRun) bool {
|
|
return (bool)(C.QGlyphRun_OperatorEqual(this.h, other.cPointer()))
|
|
}
|
|
|
|
func (this *QGlyphRun) OperatorNotEqual(other *QGlyphRun) bool {
|
|
return (bool)(C.QGlyphRun_OperatorNotEqual(this.h, other.cPointer()))
|
|
}
|
|
|
|
func (this *QGlyphRun) SetOverline(overline bool) {
|
|
C.QGlyphRun_SetOverline(this.h, (C.bool)(overline))
|
|
}
|
|
|
|
func (this *QGlyphRun) Overline() bool {
|
|
return (bool)(C.QGlyphRun_Overline(this.h))
|
|
}
|
|
|
|
func (this *QGlyphRun) SetUnderline(underline bool) {
|
|
C.QGlyphRun_SetUnderline(this.h, (C.bool)(underline))
|
|
}
|
|
|
|
func (this *QGlyphRun) Underline() bool {
|
|
return (bool)(C.QGlyphRun_Underline(this.h))
|
|
}
|
|
|
|
func (this *QGlyphRun) SetStrikeOut(strikeOut bool) {
|
|
C.QGlyphRun_SetStrikeOut(this.h, (C.bool)(strikeOut))
|
|
}
|
|
|
|
func (this *QGlyphRun) StrikeOut() bool {
|
|
return (bool)(C.QGlyphRun_StrikeOut(this.h))
|
|
}
|
|
|
|
func (this *QGlyphRun) SetRightToLeft(on bool) {
|
|
C.QGlyphRun_SetRightToLeft(this.h, (C.bool)(on))
|
|
}
|
|
|
|
func (this *QGlyphRun) IsRightToLeft() bool {
|
|
return (bool)(C.QGlyphRun_IsRightToLeft(this.h))
|
|
}
|
|
|
|
func (this *QGlyphRun) SetFlag(flag QGlyphRun__GlyphRunFlag) {
|
|
C.QGlyphRun_SetFlag(this.h, (C.uintptr_t)(flag))
|
|
}
|
|
|
|
func (this *QGlyphRun) SetFlags(flags int) {
|
|
C.QGlyphRun_SetFlags(this.h, (C.int)(flags))
|
|
}
|
|
|
|
func (this *QGlyphRun) Flags() int {
|
|
return (int)(C.QGlyphRun_Flags(this.h))
|
|
}
|
|
|
|
func (this *QGlyphRun) SetBoundingRect(boundingRect *QRectF) {
|
|
C.QGlyphRun_SetBoundingRect(this.h, boundingRect.cPointer())
|
|
}
|
|
|
|
func (this *QGlyphRun) BoundingRect() *QRectF {
|
|
_ret := C.QGlyphRun_BoundingRect(this.h)
|
|
_goptr := newQRectF(_ret)
|
|
_goptr.GoGC() // Qt uses pass-by-value semantics for this type. Mimic with finalizer
|
|
return _goptr
|
|
}
|
|
|
|
func (this *QGlyphRun) IsEmpty() bool {
|
|
return (bool)(C.QGlyphRun_IsEmpty(this.h))
|
|
}
|
|
|
|
func (this *QGlyphRun) SetFlag2(flag QGlyphRun__GlyphRunFlag, enabled bool) {
|
|
C.QGlyphRun_SetFlag2(this.h, (C.uintptr_t)(flag), (C.bool)(enabled))
|
|
}
|
|
|
|
// Delete this object from C++ memory.
|
|
func (this *QGlyphRun) Delete() {
|
|
C.QGlyphRun_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 *QGlyphRun) GoGC() {
|
|
runtime.SetFinalizer(this, func(this *QGlyphRun) {
|
|
this.Delete()
|
|
runtime.KeepAlive(this.h)
|
|
})
|
|
}
|