blob: 0b248a7364a23f27c266352547ebd60d9b1a3bfb (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
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)
}
|