cutego/gui/qintvalidator.go

124 lines
2.8 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"
"unsafe"
)
type QIntValidator struct {
QValidator
}
2015-11-09 20:23:42 +03:00
type QIntValidator_ITF interface {
QValidator_ITF
QIntValidator_PTR() *QIntValidator
2015-10-24 18:18:24 +03:00
}
2015-11-09 20:23:42 +03:00
func PointerFromQIntValidator(ptr QIntValidator_ITF) unsafe.Pointer {
2015-10-24 18:18:24 +03:00
if ptr != nil {
2015-11-09 20:23:42 +03:00
return ptr.QIntValidator_PTR().Pointer()
2015-10-24 18:18:24 +03:00
}
return nil
}
2015-11-09 20:23:42 +03:00
func NewQIntValidatorFromPointer(ptr unsafe.Pointer) *QIntValidator {
2015-10-24 18:18:24 +03:00
var n = new(QIntValidator)
n.SetPointer(ptr)
for len(n.ObjectName()) < len("QIntValidator_") {
n.SetObjectName("QIntValidator_" + qt.Identifier())
2015-10-24 18:18:24 +03:00
}
return n
}
2015-11-09 20:23:42 +03:00
func (ptr *QIntValidator) QIntValidator_PTR() *QIntValidator {
2015-10-24 18:18:24 +03:00
return ptr
}
func (ptr *QIntValidator) SetBottom(v int) {
defer qt.Recovering("QIntValidator::setBottom")
2015-10-24 18:18:24 +03:00
if ptr.Pointer() != nil {
2015-11-09 20:23:42 +03:00
C.QIntValidator_SetBottom(ptr.Pointer(), C.int(v))
2015-10-24 18:18:24 +03:00
}
}
func (ptr *QIntValidator) SetTop(v int) {
defer qt.Recovering("QIntValidator::setTop")
2015-10-24 18:18:24 +03:00
if ptr.Pointer() != nil {
2015-11-09 20:23:42 +03:00
C.QIntValidator_SetTop(ptr.Pointer(), C.int(v))
2015-10-24 18:18:24 +03:00
}
}
2015-11-09 20:23:42 +03:00
func NewQIntValidator(parent core.QObject_ITF) *QIntValidator {
defer qt.Recovering("QIntValidator::QIntValidator")
2015-11-09 20:23:42 +03:00
return NewQIntValidatorFromPointer(C.QIntValidator_NewQIntValidator(core.PointerFromQObject(parent)))
2015-10-24 18:18:24 +03:00
}
2015-11-09 20:23:42 +03:00
func NewQIntValidator2(minimum int, maximum int, parent core.QObject_ITF) *QIntValidator {
defer qt.Recovering("QIntValidator::QIntValidator")
2015-11-09 20:23:42 +03:00
return NewQIntValidatorFromPointer(C.QIntValidator_NewQIntValidator2(C.int(minimum), C.int(maximum), core.PointerFromQObject(parent)))
2015-10-24 18:18:24 +03:00
}
func (ptr *QIntValidator) Bottom() int {
defer qt.Recovering("QIntValidator::bottom")
2015-10-24 18:18:24 +03:00
if ptr.Pointer() != nil {
2015-11-09 20:23:42 +03:00
return int(C.QIntValidator_Bottom(ptr.Pointer()))
2015-10-24 18:18:24 +03:00
}
return 0
}
func (ptr *QIntValidator) ConnectSetRange(f func(bottom int, top int)) {
defer qt.Recovering("connect QIntValidator::setRange")
2015-10-24 18:18:24 +03:00
if ptr.Pointer() != nil {
qt.ConnectSignal(ptr.ObjectName(), "setRange", f)
}
}
func (ptr *QIntValidator) DisconnectSetRange() {
defer qt.Recovering("disconnect QIntValidator::setRange")
if ptr.Pointer() != nil {
qt.DisconnectSignal(ptr.ObjectName(), "setRange")
}
}
//export callbackQIntValidatorSetRange
func callbackQIntValidatorSetRange(ptrName *C.char, bottom C.int, top C.int) bool {
defer qt.Recovering("callback QIntValidator::setRange")
2015-12-22 18:59:41 +03:00
if signal := qt.GetSignal(C.GoString(ptrName), "setRange"); signal != nil {
signal.(func(int, int))(int(bottom), int(top))
return true
2015-10-24 18:18:24 +03:00
}
return false
2015-10-24 18:18:24 +03:00
}
func (ptr *QIntValidator) Top() int {
defer qt.Recovering("QIntValidator::top")
2015-10-24 18:18:24 +03:00
if ptr.Pointer() != nil {
2015-11-09 20:23:42 +03:00
return int(C.QIntValidator_Top(ptr.Pointer()))
2015-10-24 18:18:24 +03:00
}
return 0
}
func (ptr *QIntValidator) DestroyQIntValidator() {
defer qt.Recovering("QIntValidator::~QIntValidator")
2015-10-24 18:18:24 +03:00
if ptr.Pointer() != nil {
2015-11-09 20:23:42 +03:00
C.QIntValidator_DestroyQIntValidator(ptr.Pointer())
2015-10-24 18:18:24 +03:00
ptr.SetPointer(nil)
}
}