summaryrefslogtreecommitdiff
path: root/lineedit.go
diff options
context:
space:
mode:
authorPietro Gagliardi <[email protected]>2014-02-25 15:06:51 -0500
committerPietro Gagliardi <[email protected]>2014-02-25 15:06:51 -0500
commit06fa3a5174e02ebf1061e67e60530c6d519eb9c1 (patch)
tree4ee67ce5dc7aa8d10152915a422f5adc6ad6d9ba /lineedit.go
parent04ae299ef0918ad1e0c4482b71c00b49484924bb (diff)
Added password entry fields; they are the alternate mode of LineEdit.
Diffstat (limited to 'lineedit.go')
-rw-r--r--lineedit.go18
1 files changed, 14 insertions, 4 deletions
diff --git a/lineedit.go b/lineedit.go
index 61f1cf7..bcb28ac 100644
--- a/lineedit.go
+++ b/lineedit.go
@@ -9,10 +9,11 @@ import (
type LineEdit struct {
// TODO Typing event
- lock sync.Mutex
- created bool
- sysData *sysData
- initText string
+ lock sync.Mutex
+ created bool
+ sysData *sysData
+ initText string
+ password bool
}
// NewLineEdit makes a new LineEdit with the specified text.
@@ -23,6 +24,14 @@ func NewLineEdit(text string) *LineEdit {
}
}
+// NewPasswordEdit makes a new LineEdit which allows the user to enter a password.
+func NewPasswordEdit() *LineEdit {
+ return &LineEdit{
+ sysData: mksysdata(c_lineedit),
+ password: true,
+ }
+}
+
// SetText sets the LineEdit's text.
func (l *LineEdit) SetText(text string) (err error) {
l.lock.Lock()
@@ -50,6 +59,7 @@ func (l *LineEdit) make(window *sysData) error {
l.lock.Lock()
defer l.lock.Unlock()
+ l.sysData.alternate = l.password
err := l.sysData.make(l.initText, window)
if err != nil {
return err