cutego/gui/qvalidator.go

111 lines
2.2 KiB
Go
Raw Normal View History

2015-10-24 18:18:24 +03:00
package gui
//#include "gui.h"
2015-10-24 18:18:24 +03:00
import "C"
import (
"github.com/therecipe/qt"
"github.com/therecipe/qt/core"
"log"
2015-10-24 18:18:24 +03:00
"unsafe"
)
type QValidator struct {
core.QObject
}
2015-11-09 20:23:42 +03:00
type QValidator_ITF interface {
core.QObject_ITF
QValidator_PTR() *QValidator
2015-10-24 18:18:24 +03:00
}
2015-11-09 20:23:42 +03:00
func PointerFromQValidator(ptr QValidator_ITF) unsafe.Pointer {
2015-10-24 18:18:24 +03:00
if ptr != nil {
2015-11-09 20:23:42 +03:00
return ptr.QValidator_PTR().Pointer()
2015-10-24 18:18:24 +03:00
}
return nil
}
2015-11-09 20:23:42 +03:00
func NewQValidatorFromPointer(ptr unsafe.Pointer) *QValidator {
2015-10-24 18:18:24 +03:00
var n = new(QValidator)
n.SetPointer(ptr)
for len(n.ObjectName()) < len("QValidator_") {
2015-10-24 18:18:24 +03:00
n.SetObjectName("QValidator_" + qt.RandomIdentifier())
}
return n
}
2015-11-09 20:23:42 +03:00
func (ptr *QValidator) QValidator_PTR() *QValidator {
2015-10-24 18:18:24 +03:00
return ptr
}
//QValidator::State
2015-11-09 20:23:42 +03:00
type QValidator__State 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
QValidator__Invalid = QValidator__State(0)
QValidator__Intermediate = QValidator__State(1)
QValidator__Acceptable = QValidator__State(2)
)
func (ptr *QValidator) ConnectChanged(f func()) {
defer func() {
if recover() != nil {
log.Println("recovered in QValidator::changed")
}
}()
2015-10-24 18:18:24 +03:00
if ptr.Pointer() != nil {
2015-11-09 20:23:42 +03:00
C.QValidator_ConnectChanged(ptr.Pointer())
2015-10-24 18:18:24 +03:00
qt.ConnectSignal(ptr.ObjectName(), "changed", f)
}
}
func (ptr *QValidator) DisconnectChanged() {
defer func() {
if recover() != nil {
log.Println("recovered in QValidator::changed")
}
}()
2015-10-24 18:18:24 +03:00
if ptr.Pointer() != nil {
2015-11-09 20:23:42 +03:00
C.QValidator_DisconnectChanged(ptr.Pointer())
2015-10-24 18:18:24 +03:00
qt.DisconnectSignal(ptr.ObjectName(), "changed")
}
}
//export callbackQValidatorChanged
func callbackQValidatorChanged(ptrName *C.char) {
defer func() {
if recover() != nil {
log.Println("recovered in QValidator::changed")
}
}()
2015-10-24 18:18:24 +03:00
qt.GetSignal(C.GoString(ptrName), "changed").(func())()
}
2015-11-09 20:23:42 +03:00
func (ptr *QValidator) SetLocale(locale core.QLocale_ITF) {
defer func() {
if recover() != nil {
log.Println("recovered in QValidator::setLocale")
}
}()
2015-10-24 18:18:24 +03:00
if ptr.Pointer() != nil {
2015-11-09 20:23:42 +03:00
C.QValidator_SetLocale(ptr.Pointer(), core.PointerFromQLocale(locale))
2015-10-24 18:18:24 +03:00
}
}
func (ptr *QValidator) DestroyQValidator() {
defer func() {
if recover() != nil {
log.Println("recovered in QValidator::~QValidator")
}
}()
2015-10-24 18:18:24 +03:00
if ptr.Pointer() != nil {
2015-11-09 20:23:42 +03:00
C.QValidator_DestroyQValidator(ptr.Pointer())
2015-10-24 18:18:24 +03:00
ptr.SetPointer(nil)
}
}