2015-10-24 18:18:24 +03:00
|
|
|
package gui
|
|
|
|
|
2015-12-06 02:56:16 +03:00
|
|
|
//#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)
|
2015-12-06 02:56:16 +03:00
|
|
|
for len(n.ObjectName()) < len("QIntValidator_") {
|
2015-12-15 04:01:51 +03:00
|
|
|
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) {
|
2015-12-15 04:01:51 +03:00
|
|
|
defer qt.Recovering("QIntValidator::setBottom")
|
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.QIntValidator_SetBottom(ptr.Pointer(), C.int(v))
|
2015-10-24 18:18:24 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func (ptr *QIntValidator) SetTop(v int) {
|
2015-12-15 04:01:51 +03:00
|
|
|
defer qt.Recovering("QIntValidator::setTop")
|
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.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 {
|
2015-12-15 04:01:51 +03:00
|
|
|
defer qt.Recovering("QIntValidator::QIntValidator")
|
2015-12-06 02:56:16 +03:00
|
|
|
|
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 {
|
2015-12-15 04:01:51 +03:00
|
|
|
defer qt.Recovering("QIntValidator::QIntValidator")
|
2015-12-06 02:56:16 +03:00
|
|
|
|
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 {
|
2015-12-15 04:01:51 +03:00
|
|
|
defer qt.Recovering("QIntValidator::bottom")
|
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 int(C.QIntValidator_Bottom(ptr.Pointer()))
|
2015-10-24 18:18:24 +03:00
|
|
|
}
|
|
|
|
return 0
|
|
|
|
}
|
|
|
|
|
2015-12-15 04:01:51 +03:00
|
|
|
func (ptr *QIntValidator) ConnectSetRange(f func(bottom int, top int)) {
|
|
|
|
defer qt.Recovering("connect QIntValidator::setRange")
|
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(), "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))
|
2015-12-15 04:01:51 +03:00
|
|
|
return true
|
2015-10-24 18:18:24 +03:00
|
|
|
}
|
2015-12-15 04:01:51 +03:00
|
|
|
return false
|
|
|
|
|
2015-10-24 18:18:24 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
func (ptr *QIntValidator) Top() int {
|
2015-12-15 04:01:51 +03:00
|
|
|
defer qt.Recovering("QIntValidator::top")
|
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 int(C.QIntValidator_Top(ptr.Pointer()))
|
2015-10-24 18:18:24 +03:00
|
|
|
}
|
|
|
|
return 0
|
|
|
|
}
|
|
|
|
|
|
|
|
func (ptr *QIntValidator) DestroyQIntValidator() {
|
2015-12-15 04:01:51 +03:00
|
|
|
defer qt.Recovering("QIntValidator::~QIntValidator")
|
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.QIntValidator_DestroyQIntValidator(ptr.Pointer())
|
2015-10-24 18:18:24 +03:00
|
|
|
ptr.SetPointer(nil)
|
|
|
|
}
|
|
|
|
}
|