summaryrefslogtreecommitdiff
path: root/redo/controls_darwin.go
diff options
context:
space:
mode:
authorPietro Gagliardi <[email protected]>2014-07-29 13:48:31 -0400
committerPietro Gagliardi <[email protected]>2014-07-29 13:48:31 -0400
commitf4bb7360d4060d9c62c30d6b5508683a4fb6c472 (patch)
treed25ce5d5195a6ffcc01def1b4ae8015b7c9ce723 /redo/controls_darwin.go
parent8d7f0c9a62b9108e262380ae62f8c8b9cbb12bfc (diff)
Added Label and implemented it on all platforms.
Diffstat (limited to 'redo/controls_darwin.go')
-rw-r--r--redo/controls_darwin.go37
1 files changed, 32 insertions, 5 deletions
diff --git a/redo/controls_darwin.go b/redo/controls_darwin.go
index a4e6c29..d6968fc 100644
--- a/redo/controls_darwin.go
+++ b/redo/controls_darwin.go
@@ -101,16 +101,18 @@ type textField struct {
*widgetbase
}
-func newTextField() *textField {
+func finishNewTextField(id C.id) *textField {
return &textField{
- widgetbase: newWidget(C.newTextField()),
+ widgetbase: newWidget(id),
}
}
+func newTextField() *textField {
+ return finishNewTextField(C.newTextField())
+}
+
func newPasswordField() *textField {
- return &textField{
- widgetbase: newWidget(C.newPasswordField()),
- }
+ return finishNewTextField(C.newPasswordField())
}
func (t *textField) Text() string {
@@ -122,3 +124,28 @@ func (t *textField) SetText(text string) {
defer C.free(unsafe.Pointer(ctext))
C.textFieldSetText(t.id, ctext)
}
+
+// cheap trick
+type label struct {
+ *textField
+ standalone bool
+}
+
+func finishNewLabel(text string, standalone bool) *label {
+ l := &label{
+ textField: finishNewTextField(C.newLabel()),
+ standalone: standalone,
+ }
+ l.SetText(text)
+ return l
+}
+
+func newLabel(text string) Label {
+ return finishNewLabel(text, false)
+}
+
+func newStandaloneLabel(text string) Label {
+ return finishNewLabel(text, true)
+}
+
+// TODO label commitResize