-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patheditimpl.go
55 lines (45 loc) · 896 Bytes
/
editimpl.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
//go:build impl
package faithtop
import "github.com/therecipe/qt/widgets"
type EditImpl struct {
*WidgetImpl
edit *widgets.QLineEdit
}
func init() {
newEditImpl = func() IEdit {
v := &EditImpl{
edit: widgets.NewQLineEdit(nil),
}
v.WidgetImpl = widgetImplFrom(v.edit.QWidget_PTR())
return v
}
}
func (l *EditImpl) Assign(v *IEdit) IEdit {
*v = l
return l
}
func (l *EditImpl) Text(s string) IEdit {
l.edit.SetText(s)
return l
}
func (l *EditImpl) GetText() string {
return l.edit.Text()
}
func (l *EditImpl) Placeholder(s string) IEdit {
l.edit.SetPlaceholderText(s)
return l
}
func (l *EditImpl) PasswordMode(b bool) IEdit {
if b {
l.edit.SetEchoMode(widgets.QLineEdit__Password)
} else {
l.edit.SetEchoMode(widgets.QLineEdit__Normal)
}
return l
}
func (l *EditImpl) OnReturn(fn func()) IEdit {
l.edit.ConnectReturnPressed(func() {
fn()
})
return l
}