-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcomboboximpl.go
56 lines (45 loc) · 1.02 KB
/
comboboximpl.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
//go:build impl
package faithtop
import "github.com/therecipe/qt/widgets"
type ComboBoxImpl struct {
*WidgetImpl
comboBox *widgets.QComboBox
}
func init() {
newComboBoxImpl = func() IComboBox {
v := &ComboBoxImpl{
comboBox: widgets.NewQComboBox(nil),
}
v.WidgetImpl = widgetImplFrom(v.comboBox.QWidget_PTR())
return v
}
}
func (c *ComboBoxImpl) Assign(v *IComboBox) IComboBox {
*v = c
return c
}
func (c *ComboBoxImpl) Clear() IComboBox {
c.comboBox.Clear()
return c
}
func (c *ComboBoxImpl) Data(texts []string) IComboBox {
c.Clear()
c.comboBox.AddItems(texts)
return c
}
func (c *ComboBoxImpl) Editable(b bool) IComboBox {
c.comboBox.SetEditable(b)
return c
}
func (c *ComboBoxImpl) OnTextChanged(fn func(text string)) IComboBox {
c.comboBox.ConnectCurrentTextChanged(fn)
return c
}
func (c *ComboBoxImpl) OnIndexChanged(fn func(index int)) IComboBox {
c.comboBox.ConnectCurrentIndexChanged(fn)
return c
}
func (c *ComboBoxImpl) Current(i int) IComboBox {
c.comboBox.SetCurrentIndex(i)
return c
}