diff options
| author | Pietro Gagliardi <[email protected]> | 2014-08-02 22:35:58 -0400 |
|---|---|---|
| committer | Pietro Gagliardi <[email protected]> | 2014-08-02 22:35:58 -0400 |
| commit | d018953d7ef1b276cc3229e04ba6fc75018c888a (patch) | |
| tree | 3f980a017ca498bf499ff9c5e6a53210606b12f9 /redo/textfield_darwin.go | |
| parent | 1f6bcde3d9ddcab921f2f4347148f6784ca36a14 (diff) | |
Split all the Control implementations into their own files and renamed the containerctrls implementation files to say tab instead as they only hold Tab. This is the first part of what should hopefully be the final restructuring.
Diffstat (limited to 'redo/textfield_darwin.go')
| -rw-r--r-- | redo/textfield_darwin.go | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/redo/textfield_darwin.go b/redo/textfield_darwin.go new file mode 100644 index 0000000..0b248a7 --- /dev/null +++ b/redo/textfield_darwin.go @@ -0,0 +1,38 @@ +// 16 july 2014 + +package ui + +import ( + "unsafe" +) + +// #include "objc_darwin.h" +import "C" + +type textField struct { + *controlbase +} + +func finishNewTextField(id C.id) *textField { + return &textField{ + controlbase: newControl(id), + } +} + +func newTextField() *textField { + return finishNewTextField(C.newTextField()) +} + +func newPasswordField() *textField { + return finishNewTextField(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) +} |
