mirror of
https://github.com/mappu/miqt.git
synced 2024-12-22 08:58:37 +00:00
268 lines
7.0 KiB
Go
268 lines
7.0 KiB
Go
package qt
|
|
|
|
/*
|
|
|
|
#include "gen_qlcdnumber.h"
|
|
#include <stdlib.h>
|
|
|
|
*/
|
|
import "C"
|
|
|
|
import (
|
|
"runtime"
|
|
"runtime/cgo"
|
|
"unsafe"
|
|
)
|
|
|
|
type QLCDNumber__Mode int
|
|
|
|
const (
|
|
QLCDNumber__Hex QLCDNumber__Mode = 0
|
|
QLCDNumber__Dec QLCDNumber__Mode = 1
|
|
QLCDNumber__Oct QLCDNumber__Mode = 2
|
|
QLCDNumber__Bin QLCDNumber__Mode = 3
|
|
)
|
|
|
|
type QLCDNumber__SegmentStyle int
|
|
|
|
const (
|
|
QLCDNumber__Outline QLCDNumber__SegmentStyle = 0
|
|
QLCDNumber__Filled QLCDNumber__SegmentStyle = 1
|
|
QLCDNumber__Flat QLCDNumber__SegmentStyle = 2
|
|
)
|
|
|
|
type QLCDNumber struct {
|
|
h *C.QLCDNumber
|
|
*QFrame
|
|
}
|
|
|
|
func (this *QLCDNumber) cPointer() *C.QLCDNumber {
|
|
if this == nil {
|
|
return nil
|
|
}
|
|
return this.h
|
|
}
|
|
|
|
func newQLCDNumber(h *C.QLCDNumber) *QLCDNumber {
|
|
if h == nil {
|
|
return nil
|
|
}
|
|
return &QLCDNumber{h: h, QFrame: newQFrame_U(unsafe.Pointer(h))}
|
|
}
|
|
|
|
func newQLCDNumber_U(h unsafe.Pointer) *QLCDNumber {
|
|
return newQLCDNumber((*C.QLCDNumber)(h))
|
|
}
|
|
|
|
// NewQLCDNumber constructs a new QLCDNumber object.
|
|
func NewQLCDNumber() *QLCDNumber {
|
|
ret := C.QLCDNumber_new()
|
|
return newQLCDNumber(ret)
|
|
}
|
|
|
|
// NewQLCDNumber2 constructs a new QLCDNumber object.
|
|
func NewQLCDNumber2(numDigits uint) *QLCDNumber {
|
|
ret := C.QLCDNumber_new2((C.uint)(numDigits))
|
|
return newQLCDNumber(ret)
|
|
}
|
|
|
|
// NewQLCDNumber3 constructs a new QLCDNumber object.
|
|
func NewQLCDNumber3(parent *QWidget) *QLCDNumber {
|
|
ret := C.QLCDNumber_new3(parent.cPointer())
|
|
return newQLCDNumber(ret)
|
|
}
|
|
|
|
// NewQLCDNumber4 constructs a new QLCDNumber object.
|
|
func NewQLCDNumber4(numDigits uint, parent *QWidget) *QLCDNumber {
|
|
ret := C.QLCDNumber_new4((C.uint)(numDigits), parent.cPointer())
|
|
return newQLCDNumber(ret)
|
|
}
|
|
|
|
func (this *QLCDNumber) MetaObject() *QMetaObject {
|
|
return newQMetaObject_U(unsafe.Pointer(C.QLCDNumber_MetaObject(this.h)))
|
|
}
|
|
|
|
func (this *QLCDNumber) Metacast(param1 string) unsafe.Pointer {
|
|
param1_Cstring := C.CString(param1)
|
|
defer C.free(unsafe.Pointer(param1_Cstring))
|
|
return C.QLCDNumber_Metacast(this.h, param1_Cstring)
|
|
}
|
|
|
|
func QLCDNumber_Tr(s string) string {
|
|
s_Cstring := C.CString(s)
|
|
defer C.free(unsafe.Pointer(s_Cstring))
|
|
var _ms *C.struct_miqt_string = C.QLCDNumber_Tr(s_Cstring)
|
|
_ret := C.GoStringN(&_ms.data, C.int(int64(_ms.len)))
|
|
C.free(unsafe.Pointer(_ms))
|
|
return _ret
|
|
}
|
|
|
|
func QLCDNumber_TrUtf8(s string) string {
|
|
s_Cstring := C.CString(s)
|
|
defer C.free(unsafe.Pointer(s_Cstring))
|
|
var _ms *C.struct_miqt_string = C.QLCDNumber_TrUtf8(s_Cstring)
|
|
_ret := C.GoStringN(&_ms.data, C.int(int64(_ms.len)))
|
|
C.free(unsafe.Pointer(_ms))
|
|
return _ret
|
|
}
|
|
|
|
func (this *QLCDNumber) SmallDecimalPoint() bool {
|
|
return (bool)(C.QLCDNumber_SmallDecimalPoint(this.h))
|
|
}
|
|
|
|
func (this *QLCDNumber) DigitCount() int {
|
|
return (int)(C.QLCDNumber_DigitCount(this.h))
|
|
}
|
|
|
|
func (this *QLCDNumber) SetDigitCount(nDigits int) {
|
|
C.QLCDNumber_SetDigitCount(this.h, (C.int)(nDigits))
|
|
}
|
|
|
|
func (this *QLCDNumber) CheckOverflow(num float64) bool {
|
|
return (bool)(C.QLCDNumber_CheckOverflow(this.h, (C.double)(num)))
|
|
}
|
|
|
|
func (this *QLCDNumber) CheckOverflowWithNum(num int) bool {
|
|
return (bool)(C.QLCDNumber_CheckOverflowWithNum(this.h, (C.int)(num)))
|
|
}
|
|
|
|
func (this *QLCDNumber) Mode() QLCDNumber__Mode {
|
|
return (QLCDNumber__Mode)(C.QLCDNumber_Mode(this.h))
|
|
}
|
|
|
|
func (this *QLCDNumber) SetMode(mode QLCDNumber__Mode) {
|
|
C.QLCDNumber_SetMode(this.h, (C.int)(mode))
|
|
}
|
|
|
|
func (this *QLCDNumber) SegmentStyle() QLCDNumber__SegmentStyle {
|
|
return (QLCDNumber__SegmentStyle)(C.QLCDNumber_SegmentStyle(this.h))
|
|
}
|
|
|
|
func (this *QLCDNumber) SetSegmentStyle(segmentStyle QLCDNumber__SegmentStyle) {
|
|
C.QLCDNumber_SetSegmentStyle(this.h, (C.int)(segmentStyle))
|
|
}
|
|
|
|
func (this *QLCDNumber) Value() float64 {
|
|
return (float64)(C.QLCDNumber_Value(this.h))
|
|
}
|
|
|
|
func (this *QLCDNumber) IntValue() int {
|
|
return (int)(C.QLCDNumber_IntValue(this.h))
|
|
}
|
|
|
|
func (this *QLCDNumber) SizeHint() *QSize {
|
|
_ret := C.QLCDNumber_SizeHint(this.h)
|
|
_goptr := newQSize(_ret)
|
|
_goptr.GoGC() // Qt uses pass-by-value semantics for this type. Mimic with finalizer
|
|
return _goptr
|
|
}
|
|
|
|
func (this *QLCDNumber) Display(str string) {
|
|
str_ms := miqt_strdupg(str)
|
|
defer C.free(str_ms)
|
|
C.QLCDNumber_Display(this.h, (*C.struct_miqt_string)(str_ms))
|
|
}
|
|
|
|
func (this *QLCDNumber) DisplayWithNum(num int) {
|
|
C.QLCDNumber_DisplayWithNum(this.h, (C.int)(num))
|
|
}
|
|
|
|
func (this *QLCDNumber) Display2(num float64) {
|
|
C.QLCDNumber_Display2(this.h, (C.double)(num))
|
|
}
|
|
|
|
func (this *QLCDNumber) SetHexMode() {
|
|
C.QLCDNumber_SetHexMode(this.h)
|
|
}
|
|
|
|
func (this *QLCDNumber) SetDecMode() {
|
|
C.QLCDNumber_SetDecMode(this.h)
|
|
}
|
|
|
|
func (this *QLCDNumber) SetOctMode() {
|
|
C.QLCDNumber_SetOctMode(this.h)
|
|
}
|
|
|
|
func (this *QLCDNumber) SetBinMode() {
|
|
C.QLCDNumber_SetBinMode(this.h)
|
|
}
|
|
|
|
func (this *QLCDNumber) SetSmallDecimalPoint(smallDecimalPoint bool) {
|
|
C.QLCDNumber_SetSmallDecimalPoint(this.h, (C.bool)(smallDecimalPoint))
|
|
}
|
|
|
|
func (this *QLCDNumber) Overflow() {
|
|
C.QLCDNumber_Overflow(this.h)
|
|
}
|
|
func (this *QLCDNumber) OnOverflow(slot func()) {
|
|
C.QLCDNumber_connect_Overflow(this.h, unsafe.Pointer(uintptr(cgo.NewHandle(slot))))
|
|
}
|
|
|
|
//export miqt_exec_callback_QLCDNumber_Overflow
|
|
func miqt_exec_callback_QLCDNumber_Overflow(cb *C.void) {
|
|
gofunc, ok := (cgo.Handle(uintptr(unsafe.Pointer(cb))).Value()).(func())
|
|
if !ok {
|
|
panic("miqt: callback of non-callback type (heap corruption?)")
|
|
}
|
|
|
|
gofunc()
|
|
}
|
|
|
|
func QLCDNumber_Tr2(s string, c string) string {
|
|
s_Cstring := C.CString(s)
|
|
defer C.free(unsafe.Pointer(s_Cstring))
|
|
c_Cstring := C.CString(c)
|
|
defer C.free(unsafe.Pointer(c_Cstring))
|
|
var _ms *C.struct_miqt_string = C.QLCDNumber_Tr2(s_Cstring, c_Cstring)
|
|
_ret := C.GoStringN(&_ms.data, C.int(int64(_ms.len)))
|
|
C.free(unsafe.Pointer(_ms))
|
|
return _ret
|
|
}
|
|
|
|
func QLCDNumber_Tr3(s string, c string, n int) string {
|
|
s_Cstring := C.CString(s)
|
|
defer C.free(unsafe.Pointer(s_Cstring))
|
|
c_Cstring := C.CString(c)
|
|
defer C.free(unsafe.Pointer(c_Cstring))
|
|
var _ms *C.struct_miqt_string = C.QLCDNumber_Tr3(s_Cstring, c_Cstring, (C.int)(n))
|
|
_ret := C.GoStringN(&_ms.data, C.int(int64(_ms.len)))
|
|
C.free(unsafe.Pointer(_ms))
|
|
return _ret
|
|
}
|
|
|
|
func QLCDNumber_TrUtf82(s string, c string) string {
|
|
s_Cstring := C.CString(s)
|
|
defer C.free(unsafe.Pointer(s_Cstring))
|
|
c_Cstring := C.CString(c)
|
|
defer C.free(unsafe.Pointer(c_Cstring))
|
|
var _ms *C.struct_miqt_string = C.QLCDNumber_TrUtf82(s_Cstring, c_Cstring)
|
|
_ret := C.GoStringN(&_ms.data, C.int(int64(_ms.len)))
|
|
C.free(unsafe.Pointer(_ms))
|
|
return _ret
|
|
}
|
|
|
|
func QLCDNumber_TrUtf83(s string, c string, n int) string {
|
|
s_Cstring := C.CString(s)
|
|
defer C.free(unsafe.Pointer(s_Cstring))
|
|
c_Cstring := C.CString(c)
|
|
defer C.free(unsafe.Pointer(c_Cstring))
|
|
var _ms *C.struct_miqt_string = C.QLCDNumber_TrUtf83(s_Cstring, c_Cstring, (C.int)(n))
|
|
_ret := C.GoStringN(&_ms.data, C.int(int64(_ms.len)))
|
|
C.free(unsafe.Pointer(_ms))
|
|
return _ret
|
|
}
|
|
|
|
// Delete this object from C++ memory.
|
|
func (this *QLCDNumber) Delete() {
|
|
C.QLCDNumber_Delete(this.h)
|
|
}
|
|
|
|
// 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 *QLCDNumber) GoGC() {
|
|
runtime.SetFinalizer(this, func(this *QLCDNumber) {
|
|
this.Delete()
|
|
runtime.KeepAlive(this.h)
|
|
})
|
|
}
|