From e8df54cb825e7026a2e6f2fdaa15da1ab06cb607 Mon Sep 17 00:00:00 2001 From: Pietro Gagliardi Date: Sat, 26 Jul 2014 09:20:33 -0400 Subject: Implemented TextField on Mac OS X. --- redo/controls_darwin.go | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'redo/controls_darwin.go') diff --git a/redo/controls_darwin.go b/redo/controls_darwin.go index 02b2d64..a4e6c29 100644 --- a/redo/controls_darwin.go +++ b/redo/controls_darwin.go @@ -96,3 +96,29 @@ func (c *checkbox) Checked() bool { func (c *checkbox) SetChecked(checked bool) { C.checkboxSetChecked(c.id, toBOOL(checked)) } + +type textField struct { + *widgetbase +} + +func newTextField() *textField { + return &textField{ + widgetbase: newWidget(C.newTextField()), + } +} + +func newPasswordField() *textField { + return &textField{ + widgetbase: newWidget(C.newPasswordField()), + } +} + +func (t *textField) Text() string { + return C.GoString(C.textFieldText(t.id)) +} + +func (t *textField) SetText(text string) { + ctext := C.CString(text) + defer C.free(unsafe.Pointer(ctext)) + C.textFieldSetText(t.id, ctext) +} -- cgit v1.2.3