miqt/qt-restricted-extras/qscintilla6/gen_qscistyledtext.go

118 lines
2.9 KiB
Go
Raw Normal View History

2024-11-06 05:30:07 +00:00
package qscintilla6
/*
#include "gen_qscistyledtext.h"
#include <stdlib.h>
*/
import "C"
import (
"runtime"
"unsafe"
)
type QsciStyledText struct {
2024-11-19 06:29:06 +00:00
h *C.QsciStyledText
isSubclass bool
2024-11-06 05:30:07 +00:00
}
func (this *QsciStyledText) cPointer() *C.QsciStyledText {
if this == nil {
return nil
}
return this.h
}
func (this *QsciStyledText) UnsafePointer() unsafe.Pointer {
if this == nil {
return nil
}
return unsafe.Pointer(this.h)
}
2024-11-19 06:29:06 +00:00
// newQsciStyledText constructs the type using only CGO pointers.
2024-11-06 05:30:07 +00:00
func newQsciStyledText(h *C.QsciStyledText) *QsciStyledText {
if h == nil {
return nil
}
return &QsciStyledText{h: h}
}
2024-11-19 06:29:06 +00:00
// UnsafeNewQsciStyledText constructs the type using only unsafe pointers.
2024-11-06 05:30:07 +00:00
func UnsafeNewQsciStyledText(h unsafe.Pointer) *QsciStyledText {
2024-11-19 06:29:06 +00:00
if h == nil {
return nil
}
return &QsciStyledText{h: (*C.QsciStyledText)(h)}
2024-11-06 05:30:07 +00:00
}
// NewQsciStyledText constructs a new QsciStyledText object.
func NewQsciStyledText(text string, style int) *QsciStyledText {
text_ms := C.struct_miqt_string{}
text_ms.data = C.CString(text)
text_ms.len = C.size_t(len(text))
defer C.free(unsafe.Pointer(text_ms.data))
2024-11-19 06:29:06 +00:00
var outptr_QsciStyledText *C.QsciStyledText = nil
C.QsciStyledText_new(text_ms, (C.int)(style), &outptr_QsciStyledText)
ret := newQsciStyledText(outptr_QsciStyledText)
ret.isSubclass = true
return ret
2024-11-06 05:30:07 +00:00
}
// NewQsciStyledText2 constructs a new QsciStyledText object.
func NewQsciStyledText2(text string, style *QsciStyle) *QsciStyledText {
text_ms := C.struct_miqt_string{}
text_ms.data = C.CString(text)
text_ms.len = C.size_t(len(text))
defer C.free(unsafe.Pointer(text_ms.data))
2024-11-19 06:29:06 +00:00
var outptr_QsciStyledText *C.QsciStyledText = nil
C.QsciStyledText_new2(text_ms, style.cPointer(), &outptr_QsciStyledText)
ret := newQsciStyledText(outptr_QsciStyledText)
ret.isSubclass = true
return ret
2024-11-06 05:30:07 +00:00
}
// NewQsciStyledText3 constructs a new QsciStyledText object.
func NewQsciStyledText3(param1 *QsciStyledText) *QsciStyledText {
2024-11-19 06:29:06 +00:00
var outptr_QsciStyledText *C.QsciStyledText = nil
C.QsciStyledText_new3(param1.cPointer(), &outptr_QsciStyledText)
ret := newQsciStyledText(outptr_QsciStyledText)
ret.isSubclass = true
return ret
2024-11-06 05:30:07 +00:00
}
func (this *QsciStyledText) Apply(sci *QsciScintillaBase) {
C.QsciStyledText_Apply(this.h, sci.cPointer())
}
func (this *QsciStyledText) Text() string {
var _ms C.struct_miqt_string = C.QsciStyledText_Text(this.h)
_ret := C.GoStringN(_ms.data, C.int(int64(_ms.len)))
C.free(unsafe.Pointer(_ms.data))
return _ret
}
func (this *QsciStyledText) Style() int {
return (int)(C.QsciStyledText_Style(this.h))
}
// Delete this object from C++ memory.
func (this *QsciStyledText) Delete() {
2024-11-19 06:29:06 +00:00
C.QsciStyledText_Delete(this.h, C.bool(this.isSubclass))
2024-11-06 05:30:07 +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 *QsciStyledText) GoGC() {
runtime.SetFinalizer(this, func(this *QsciStyledText) {
this.Delete()
runtime.KeepAlive(this.h)
})
}