summaryrefslogtreecommitdiffstatshomepage
path: root/lineedit.go
diff options
context:
space:
mode:
authorAlexander Neumann <an2048@gmail.com>2013-05-01 12:38:42 +0200
committerAlexander Neumann <an2048@gmail.com>2013-05-01 12:38:42 +0200
commit13be99524765712660b3b7c65c97400c77e0914a (patch)
tree723b208348cf4eb2897d6d7ceef247e4f81202b7 /lineedit.go
parentexamples/tableview: Adjust to TableView change (diff)
downloadwireguard-windows-13be99524765712660b3b7c65c97400c77e0914a.tar.xz
wireguard-windows-13be99524765712660b3b7c65c97400c77e0914a.zip
Don't store Property values in widgets
Diffstat (limited to 'lineedit.go')
-rw-r--r--lineedit.go25
1 files changed, 10 insertions, 15 deletions
diff --git a/lineedit.go b/lineedit.go
index be27b437..5a2ab083 100644
--- a/lineedit.go
+++ b/lineedit.go
@@ -19,11 +19,9 @@ const (
type LineEdit struct {
WidgetBase
editingFinishedPublisher EventPublisher
+ readOnlyChangedPublisher EventPublisher
returnPressedPublisher EventPublisher
- textProperty Property
textChangedPublisher EventPublisher
- readOnlyProperty Property
- readOnlyChangedPublisher EventPublisher
charWidthFont *Font
charWidth int
}
@@ -40,26 +38,23 @@ func newLineEdit(parent Widget) (*LineEdit, error) {
return nil, err
}
- le.textProperty = NewProperty(
+ le.MustRegisterProperty("ReadOnly", NewProperty(
func() interface{} {
- return le.Text()
+ return le.ReadOnly()
},
func(v interface{}) error {
- return le.SetText(v.(string))
+ return le.SetReadOnly(v.(bool))
},
- le.textChangedPublisher.Event())
+ le.readOnlyChangedPublisher.Event()))
- le.readOnlyProperty = NewProperty(
+ le.MustRegisterProperty("Text", NewProperty(
func() interface{} {
- return le.ReadOnly()
+ return le.Text()
},
func(v interface{}) error {
- return le.SetReadOnly(v.(bool))
+ return le.SetText(v.(string))
},
- le.readOnlyChangedPublisher.Event())
-
- le.MustRegisterProperty("Text", le.textProperty)
- le.MustRegisterProperty("ReadOnly", le.readOnlyProperty)
+ le.textChangedPublisher.Event()))
return le, nil
}
@@ -225,7 +220,7 @@ func (le *LineEdit) ReturnPressed() *Event {
}
func (le *LineEdit) TextChanged() *Event {
- return le.textProperty.Changed()
+ return le.textChangedPublisher.Event()
}
func (le *LineEdit) WndProc(hwnd HWND, msg uint32, wParam, lParam uintptr) uintptr {