2015-10-24 18:18:24 +03:00
|
|
|
package qml
|
|
|
|
|
2015-12-06 02:56:16 +03:00
|
|
|
//#include "qml.h"
|
2015-10-24 18:18:24 +03:00
|
|
|
import "C"
|
|
|
|
import (
|
|
|
|
"github.com/therecipe/qt"
|
|
|
|
"github.com/therecipe/qt/core"
|
|
|
|
"unsafe"
|
|
|
|
)
|
|
|
|
|
|
|
|
type QQmlComponent struct {
|
|
|
|
core.QObject
|
|
|
|
}
|
|
|
|
|
2015-11-09 20:23:42 +03:00
|
|
|
type QQmlComponent_ITF interface {
|
|
|
|
core.QObject_ITF
|
|
|
|
QQmlComponent_PTR() *QQmlComponent
|
2015-10-24 18:18:24 +03:00
|
|
|
}
|
|
|
|
|
2015-11-09 20:23:42 +03:00
|
|
|
func PointerFromQQmlComponent(ptr QQmlComponent_ITF) unsafe.Pointer {
|
2015-10-24 18:18:24 +03:00
|
|
|
if ptr != nil {
|
2015-11-09 20:23:42 +03:00
|
|
|
return ptr.QQmlComponent_PTR().Pointer()
|
2015-10-24 18:18:24 +03:00
|
|
|
}
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
2015-11-09 20:23:42 +03:00
|
|
|
func NewQQmlComponentFromPointer(ptr unsafe.Pointer) *QQmlComponent {
|
2015-10-24 18:18:24 +03:00
|
|
|
var n = new(QQmlComponent)
|
|
|
|
n.SetPointer(ptr)
|
2015-12-06 02:56:16 +03:00
|
|
|
for len(n.ObjectName()) < len("QQmlComponent_") {
|
2015-12-15 04:01:51 +03:00
|
|
|
n.SetObjectName("QQmlComponent_" + qt.Identifier())
|
2015-10-24 18:18:24 +03:00
|
|
|
}
|
|
|
|
return n
|
|
|
|
}
|
|
|
|
|
2015-11-09 20:23:42 +03:00
|
|
|
func (ptr *QQmlComponent) QQmlComponent_PTR() *QQmlComponent {
|
2015-10-24 18:18:24 +03:00
|
|
|
return ptr
|
|
|
|
}
|
|
|
|
|
|
|
|
//QQmlComponent::CompilationMode
|
2015-11-09 20:23:42 +03:00
|
|
|
type QQmlComponent__CompilationMode int64
|
2015-10-24 18:18:24 +03:00
|
|
|
|
2015-11-09 20:23:42 +03:00
|
|
|
const (
|
2015-10-24 18:18:24 +03:00
|
|
|
QQmlComponent__PreferSynchronous = QQmlComponent__CompilationMode(0)
|
|
|
|
QQmlComponent__Asynchronous = QQmlComponent__CompilationMode(1)
|
|
|
|
)
|
|
|
|
|
|
|
|
//QQmlComponent::Status
|
2015-11-09 20:23:42 +03:00
|
|
|
type QQmlComponent__Status int64
|
2015-10-24 18:18:24 +03:00
|
|
|
|
2015-11-09 20:23:42 +03:00
|
|
|
const (
|
2015-10-24 18:18:24 +03:00
|
|
|
QQmlComponent__Null = QQmlComponent__Status(0)
|
|
|
|
QQmlComponent__Ready = QQmlComponent__Status(1)
|
|
|
|
QQmlComponent__Loading = QQmlComponent__Status(2)
|
|
|
|
QQmlComponent__Error = QQmlComponent__Status(3)
|
|
|
|
)
|
|
|
|
|
2015-11-09 20:23:42 +03:00
|
|
|
func (ptr *QQmlComponent) Progress() float64 {
|
2015-12-15 04:01:51 +03:00
|
|
|
defer qt.Recovering("QQmlComponent::progress")
|
2015-12-06 02:56:16 +03:00
|
|
|
|
2015-10-24 18:18:24 +03:00
|
|
|
if ptr.Pointer() != nil {
|
2015-11-09 20:23:42 +03:00
|
|
|
return float64(C.QQmlComponent_Progress(ptr.Pointer()))
|
2015-10-24 18:18:24 +03:00
|
|
|
}
|
|
|
|
return 0
|
|
|
|
}
|
|
|
|
|
2015-11-09 20:23:42 +03:00
|
|
|
func (ptr *QQmlComponent) Status() QQmlComponent__Status {
|
2015-12-15 04:01:51 +03:00
|
|
|
defer qt.Recovering("QQmlComponent::status")
|
2015-12-06 02:56:16 +03:00
|
|
|
|
2015-10-24 18:18:24 +03:00
|
|
|
if ptr.Pointer() != nil {
|
2015-11-09 20:23:42 +03:00
|
|
|
return QQmlComponent__Status(C.QQmlComponent_Status(ptr.Pointer()))
|
2015-10-24 18:18:24 +03:00
|
|
|
}
|
2015-11-09 20:23:42 +03:00
|
|
|
return 0
|
2015-10-24 18:18:24 +03:00
|
|
|
}
|
|
|
|
|
2015-11-09 20:23:42 +03:00
|
|
|
func NewQQmlComponent(engine QQmlEngine_ITF, parent core.QObject_ITF) *QQmlComponent {
|
2015-12-15 04:01:51 +03:00
|
|
|
defer qt.Recovering("QQmlComponent::QQmlComponent")
|
2015-12-06 02:56:16 +03:00
|
|
|
|
2015-11-09 20:23:42 +03:00
|
|
|
return NewQQmlComponentFromPointer(C.QQmlComponent_NewQQmlComponent(PointerFromQQmlEngine(engine), core.PointerFromQObject(parent)))
|
2015-10-24 18:18:24 +03:00
|
|
|
}
|
|
|
|
|
2015-11-09 20:23:42 +03:00
|
|
|
func NewQQmlComponent4(engine QQmlEngine_ITF, fileName string, mode QQmlComponent__CompilationMode, parent core.QObject_ITF) *QQmlComponent {
|
2015-12-15 04:01:51 +03:00
|
|
|
defer qt.Recovering("QQmlComponent::QQmlComponent")
|
2015-12-06 02:56:16 +03:00
|
|
|
|
2015-11-09 20:23:42 +03:00
|
|
|
return NewQQmlComponentFromPointer(C.QQmlComponent_NewQQmlComponent4(PointerFromQQmlEngine(engine), C.CString(fileName), C.int(mode), core.PointerFromQObject(parent)))
|
2015-10-24 18:18:24 +03:00
|
|
|
}
|
|
|
|
|
2015-11-09 20:23:42 +03:00
|
|
|
func NewQQmlComponent3(engine QQmlEngine_ITF, fileName string, parent core.QObject_ITF) *QQmlComponent {
|
2015-12-15 04:01:51 +03:00
|
|
|
defer qt.Recovering("QQmlComponent::QQmlComponent")
|
2015-12-06 02:56:16 +03:00
|
|
|
|
2015-11-09 20:23:42 +03:00
|
|
|
return NewQQmlComponentFromPointer(C.QQmlComponent_NewQQmlComponent3(PointerFromQQmlEngine(engine), C.CString(fileName), core.PointerFromQObject(parent)))
|
2015-10-24 18:18:24 +03:00
|
|
|
}
|
|
|
|
|
2015-11-09 20:23:42 +03:00
|
|
|
func NewQQmlComponent6(engine QQmlEngine_ITF, url core.QUrl_ITF, mode QQmlComponent__CompilationMode, parent core.QObject_ITF) *QQmlComponent {
|
2015-12-15 04:01:51 +03:00
|
|
|
defer qt.Recovering("QQmlComponent::QQmlComponent")
|
2015-12-06 02:56:16 +03:00
|
|
|
|
2015-11-09 20:23:42 +03:00
|
|
|
return NewQQmlComponentFromPointer(C.QQmlComponent_NewQQmlComponent6(PointerFromQQmlEngine(engine), core.PointerFromQUrl(url), C.int(mode), core.PointerFromQObject(parent)))
|
2015-10-24 18:18:24 +03:00
|
|
|
}
|
|
|
|
|
2015-11-09 20:23:42 +03:00
|
|
|
func NewQQmlComponent5(engine QQmlEngine_ITF, url core.QUrl_ITF, parent core.QObject_ITF) *QQmlComponent {
|
2015-12-15 04:01:51 +03:00
|
|
|
defer qt.Recovering("QQmlComponent::QQmlComponent")
|
2015-12-06 02:56:16 +03:00
|
|
|
|
2015-11-09 20:23:42 +03:00
|
|
|
return NewQQmlComponentFromPointer(C.QQmlComponent_NewQQmlComponent5(PointerFromQQmlEngine(engine), core.PointerFromQUrl(url), core.PointerFromQObject(parent)))
|
2015-10-24 18:18:24 +03:00
|
|
|
}
|
|
|
|
|
2015-11-09 20:23:42 +03:00
|
|
|
func (ptr *QQmlComponent) BeginCreate(publicContext QQmlContext_ITF) *core.QObject {
|
2015-12-15 04:01:51 +03:00
|
|
|
defer qt.Recovering("QQmlComponent::beginCreate")
|
2015-12-06 02:56:16 +03:00
|
|
|
|
2015-10-24 18:18:24 +03:00
|
|
|
if ptr.Pointer() != nil {
|
2015-11-09 20:23:42 +03:00
|
|
|
return core.NewQObjectFromPointer(C.QQmlComponent_BeginCreate(ptr.Pointer(), PointerFromQQmlContext(publicContext)))
|
2015-10-24 18:18:24 +03:00
|
|
|
}
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
2015-12-15 04:01:51 +03:00
|
|
|
func (ptr *QQmlComponent) ConnectCompleteCreate(f func()) {
|
|
|
|
defer qt.Recovering("connect QQmlComponent::completeCreate")
|
2015-12-06 02:56:16 +03:00
|
|
|
|
2015-10-24 18:18:24 +03:00
|
|
|
if ptr.Pointer() != nil {
|
2015-12-15 04:01:51 +03:00
|
|
|
|
|
|
|
qt.ConnectSignal(ptr.ObjectName(), "completeCreate", f)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func (ptr *QQmlComponent) DisconnectCompleteCreate() {
|
|
|
|
defer qt.Recovering("disconnect QQmlComponent::completeCreate")
|
|
|
|
|
|
|
|
if ptr.Pointer() != nil {
|
|
|
|
|
|
|
|
qt.DisconnectSignal(ptr.ObjectName(), "completeCreate")
|
2015-10-24 18:18:24 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-12-15 04:01:51 +03:00
|
|
|
//export callbackQQmlComponentCompleteCreate
|
|
|
|
func callbackQQmlComponentCompleteCreate(ptrName *C.char) bool {
|
|
|
|
defer qt.Recovering("callback QQmlComponent::completeCreate")
|
|
|
|
|
|
|
|
var signal = qt.GetSignal(C.GoString(ptrName), "completeCreate")
|
|
|
|
if signal != nil {
|
|
|
|
defer signal.(func())()
|
|
|
|
return true
|
|
|
|
}
|
|
|
|
return false
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2015-11-09 20:23:42 +03:00
|
|
|
func (ptr *QQmlComponent) Create(context QQmlContext_ITF) *core.QObject {
|
2015-12-15 04:01:51 +03:00
|
|
|
defer qt.Recovering("QQmlComponent::create")
|
2015-12-06 02:56:16 +03:00
|
|
|
|
2015-10-24 18:18:24 +03:00
|
|
|
if ptr.Pointer() != nil {
|
2015-11-09 20:23:42 +03:00
|
|
|
return core.NewQObjectFromPointer(C.QQmlComponent_Create(ptr.Pointer(), PointerFromQQmlContext(context)))
|
2015-10-24 18:18:24 +03:00
|
|
|
}
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
2015-11-09 20:23:42 +03:00
|
|
|
func (ptr *QQmlComponent) Create2(incubator QQmlIncubator_ITF, context QQmlContext_ITF, forContext QQmlContext_ITF) {
|
2015-12-15 04:01:51 +03:00
|
|
|
defer qt.Recovering("QQmlComponent::create")
|
2015-12-06 02:56:16 +03:00
|
|
|
|
2015-10-24 18:18:24 +03:00
|
|
|
if ptr.Pointer() != nil {
|
2015-11-09 20:23:42 +03:00
|
|
|
C.QQmlComponent_Create2(ptr.Pointer(), PointerFromQQmlIncubator(incubator), PointerFromQQmlContext(context), PointerFromQQmlContext(forContext))
|
2015-10-24 18:18:24 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func (ptr *QQmlComponent) CreationContext() *QQmlContext {
|
2015-12-15 04:01:51 +03:00
|
|
|
defer qt.Recovering("QQmlComponent::creationContext")
|
2015-12-06 02:56:16 +03:00
|
|
|
|
2015-10-24 18:18:24 +03:00
|
|
|
if ptr.Pointer() != nil {
|
2015-11-09 20:23:42 +03:00
|
|
|
return NewQQmlContextFromPointer(C.QQmlComponent_CreationContext(ptr.Pointer()))
|
2015-10-24 18:18:24 +03:00
|
|
|
}
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
func (ptr *QQmlComponent) IsError() bool {
|
2015-12-15 04:01:51 +03:00
|
|
|
defer qt.Recovering("QQmlComponent::isError")
|
2015-12-06 02:56:16 +03:00
|
|
|
|
2015-10-24 18:18:24 +03:00
|
|
|
if ptr.Pointer() != nil {
|
2015-11-09 20:23:42 +03:00
|
|
|
return C.QQmlComponent_IsError(ptr.Pointer()) != 0
|
2015-10-24 18:18:24 +03:00
|
|
|
}
|
|
|
|
return false
|
|
|
|
}
|
|
|
|
|
|
|
|
func (ptr *QQmlComponent) IsLoading() bool {
|
2015-12-15 04:01:51 +03:00
|
|
|
defer qt.Recovering("QQmlComponent::isLoading")
|
2015-12-06 02:56:16 +03:00
|
|
|
|
2015-10-24 18:18:24 +03:00
|
|
|
if ptr.Pointer() != nil {
|
2015-11-09 20:23:42 +03:00
|
|
|
return C.QQmlComponent_IsLoading(ptr.Pointer()) != 0
|
2015-10-24 18:18:24 +03:00
|
|
|
}
|
|
|
|
return false
|
|
|
|
}
|
|
|
|
|
|
|
|
func (ptr *QQmlComponent) IsNull() bool {
|
2015-12-15 04:01:51 +03:00
|
|
|
defer qt.Recovering("QQmlComponent::isNull")
|
2015-12-06 02:56:16 +03:00
|
|
|
|
2015-10-24 18:18:24 +03:00
|
|
|
if ptr.Pointer() != nil {
|
2015-11-09 20:23:42 +03:00
|
|
|
return C.QQmlComponent_IsNull(ptr.Pointer()) != 0
|
2015-10-24 18:18:24 +03:00
|
|
|
}
|
|
|
|
return false
|
|
|
|
}
|
|
|
|
|
|
|
|
func (ptr *QQmlComponent) IsReady() bool {
|
2015-12-15 04:01:51 +03:00
|
|
|
defer qt.Recovering("QQmlComponent::isReady")
|
2015-12-06 02:56:16 +03:00
|
|
|
|
2015-10-24 18:18:24 +03:00
|
|
|
if ptr.Pointer() != nil {
|
2015-11-09 20:23:42 +03:00
|
|
|
return C.QQmlComponent_IsReady(ptr.Pointer()) != 0
|
2015-10-24 18:18:24 +03:00
|
|
|
}
|
|
|
|
return false
|
|
|
|
}
|
|
|
|
|
2015-11-09 20:23:42 +03:00
|
|
|
func (ptr *QQmlComponent) LoadUrl(url core.QUrl_ITF) {
|
2015-12-15 04:01:51 +03:00
|
|
|
defer qt.Recovering("QQmlComponent::loadUrl")
|
2015-12-06 02:56:16 +03:00
|
|
|
|
2015-10-24 18:18:24 +03:00
|
|
|
if ptr.Pointer() != nil {
|
2015-11-09 20:23:42 +03:00
|
|
|
C.QQmlComponent_LoadUrl(ptr.Pointer(), core.PointerFromQUrl(url))
|
2015-10-24 18:18:24 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-11-09 20:23:42 +03:00
|
|
|
func (ptr *QQmlComponent) LoadUrl2(url core.QUrl_ITF, mode QQmlComponent__CompilationMode) {
|
2015-12-15 04:01:51 +03:00
|
|
|
defer qt.Recovering("QQmlComponent::loadUrl")
|
2015-12-06 02:56:16 +03:00
|
|
|
|
2015-10-24 18:18:24 +03:00
|
|
|
if ptr.Pointer() != nil {
|
2015-11-09 20:23:42 +03:00
|
|
|
C.QQmlComponent_LoadUrl2(ptr.Pointer(), core.PointerFromQUrl(url), C.int(mode))
|
2015-10-24 18:18:24 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-11-09 20:23:42 +03:00
|
|
|
func (ptr *QQmlComponent) SetData(data core.QByteArray_ITF, url core.QUrl_ITF) {
|
2015-12-15 04:01:51 +03:00
|
|
|
defer qt.Recovering("QQmlComponent::setData")
|
2015-12-06 02:56:16 +03:00
|
|
|
|
2015-10-24 18:18:24 +03:00
|
|
|
if ptr.Pointer() != nil {
|
2015-11-09 20:23:42 +03:00
|
|
|
C.QQmlComponent_SetData(ptr.Pointer(), core.PointerFromQByteArray(data), core.PointerFromQUrl(url))
|
2015-10-24 18:18:24 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func (ptr *QQmlComponent) ConnectStatusChanged(f func(status QQmlComponent__Status)) {
|
2015-12-15 04:01:51 +03:00
|
|
|
defer qt.Recovering("connect QQmlComponent::statusChanged")
|
2015-12-06 02:56:16 +03:00
|
|
|
|
2015-10-24 18:18:24 +03:00
|
|
|
if ptr.Pointer() != nil {
|
2015-11-09 20:23:42 +03:00
|
|
|
C.QQmlComponent_ConnectStatusChanged(ptr.Pointer())
|
2015-10-24 18:18:24 +03:00
|
|
|
qt.ConnectSignal(ptr.ObjectName(), "statusChanged", f)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func (ptr *QQmlComponent) DisconnectStatusChanged() {
|
2015-12-15 04:01:51 +03:00
|
|
|
defer qt.Recovering("disconnect QQmlComponent::statusChanged")
|
2015-12-06 02:56:16 +03:00
|
|
|
|
2015-10-24 18:18:24 +03:00
|
|
|
if ptr.Pointer() != nil {
|
2015-11-09 20:23:42 +03:00
|
|
|
C.QQmlComponent_DisconnectStatusChanged(ptr.Pointer())
|
2015-10-24 18:18:24 +03:00
|
|
|
qt.DisconnectSignal(ptr.ObjectName(), "statusChanged")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//export callbackQQmlComponentStatusChanged
|
|
|
|
func callbackQQmlComponentStatusChanged(ptrName *C.char, status C.int) {
|
2015-12-15 04:01:51 +03:00
|
|
|
defer qt.Recovering("callback QQmlComponent::statusChanged")
|
|
|
|
|
|
|
|
var signal = qt.GetSignal(C.GoString(ptrName), "statusChanged")
|
|
|
|
if signal != nil {
|
|
|
|
signal.(func(QQmlComponent__Status))(QQmlComponent__Status(status))
|
|
|
|
}
|
2015-12-06 02:56:16 +03:00
|
|
|
|
2015-10-24 18:18:24 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
func (ptr *QQmlComponent) DestroyQQmlComponent() {
|
2015-12-15 04:01:51 +03:00
|
|
|
defer qt.Recovering("QQmlComponent::~QQmlComponent")
|
2015-12-06 02:56:16 +03:00
|
|
|
|
2015-10-24 18:18:24 +03:00
|
|
|
if ptr.Pointer() != nil {
|
2015-11-09 20:23:42 +03:00
|
|
|
C.QQmlComponent_DestroyQQmlComponent(ptr.Pointer())
|
2015-10-24 18:18:24 +03:00
|
|
|
ptr.SetPointer(nil)
|
|
|
|
}
|
|
|
|
}
|