-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcheckboximpl.go
69 lines (57 loc) · 1.28 KB
/
checkboximpl.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
//go:build impl
package faithtop
import (
"github.com/therecipe/qt/core"
"github.com/therecipe/qt/widgets"
)
type CheckBoxImpl struct {
*WidgetImpl
checkbox *widgets.QCheckBox
}
func init() {
newCheckBoxImpl = func() ICheckBox {
v := &CheckBoxImpl{
checkbox: widgets.NewQCheckBox(nil),
}
v.WidgetImpl = widgetImplFrom(v.checkbox.QWidget_PTR())
return v
}
}
func (c *CheckBoxImpl) Checked(b bool) ICheckBox {
c.checkbox.SetChecked(b)
return c
}
func (c *CheckBoxImpl) Text(s string) ICheckBox {
c.checkbox.SetText(s)
return c
}
func (c *CheckBoxImpl) Assign(v *ICheckBox) ICheckBox {
*v = c
return c
}
func (c *CheckBoxImpl) IsChecked() bool {
return c.checkbox.IsChecked()
}
func (c *CheckBoxImpl) OnChanged(fn func(b bool)) ICheckBox {
c.checkbox.ConnectStateChanged(func(state int) {
if fn != nil {
fn(state == int(core.Qt__Checked))
}
})
return c
}
func (c *CheckBoxImpl) OnStateChanged(fn func(state CheckState)) ICheckBox {
c.checkbox.ConnectStateChanged(func(state int) {
if fn != nil {
fn(CheckState(state))
}
})
return c
}
func (c *CheckBoxImpl) GetCheckState() CheckState {
return CheckState(c.checkbox.CheckState())
}
func (c *CheckBoxImpl) CheckState(state CheckState) ICheckBox {
c.checkbox.SetCheckState(core.Qt__CheckState(state))
return c
}