Renamed textField to textfield in the Mac OS X port for consistency.

This commit is contained in:
Pietro Gagliardi 2014-08-27 13:17:31 -04:00
parent a9961feb2c
commit 7a83e3b577
6 changed files with 11 additions and 12 deletions

View File

@ -67,13 +67,13 @@ func (a *area) OpenTextFieldAt(x, y int) {
} }
func (a *area) TextFieldText() string { func (a *area) TextFieldText() string {
return C.GoString(C.textFieldText(a.textfield)) return C.GoString(C.textfieldText(a.textfield))
} }
func (a *area) SetTextFieldText(text string) { func (a *area) SetTextFieldText(text string) {
ctext := C.CString(text) ctext := C.CString(text)
defer C.free(unsafe.Pointer(ctext)) defer C.free(unsafe.Pointer(ctext))
C.textFieldSetText(a.textfield, ctext) C.textfieldSetText(a.textfield, ctext)
} }
func (a *area) OnTextFieldDismissed(f func()) { func (a *area) OnTextFieldDismissed(f func()) {

View File

@ -155,13 +155,13 @@ void textfieldSetDelegate(id textfield, void *t)
} }
// also good for labels // also good for labels
const char *textFieldText(id t) const char *textfieldText(id t)
{ {
return [[toNSTextField(t) stringValue] UTF8String]; return [[toNSTextField(t) stringValue] UTF8String];
} }
// also good for labels // also good for labels
void textFieldSetText(id t, char *text) void textfieldSetText(id t, char *text)
{ {
[toNSTextField(t) setStringValue:[NSString stringWithUTF8String:text]]; [toNSTextField(t) setStringValue:[NSString stringWithUTF8String:text]];
} }

View File

@ -32,13 +32,13 @@ func newStandaloneLabel(text string) Label {
} }
func (l *label) Text() string { func (l *label) Text() string {
return C.GoString(C.textFieldText(l._id)) return C.GoString(C.textfieldText(l._id))
} }
func (l *label) SetText(text string) { func (l *label) SetText(text string) {
ctext := C.CString(text) ctext := C.CString(text)
defer C.free(unsafe.Pointer(ctext)) defer C.free(unsafe.Pointer(ctext))
C.textFieldSetText(l._id, ctext) C.textfieldSetText(l._id, ctext)
} }
func (l *label) isStandalone() bool { func (l *label) isStandalone() bool {

View File

@ -71,8 +71,8 @@ extern id finishNewTextField(id, BOOL);
extern id newTextField(void); extern id newTextField(void);
extern id newPasswordField(void); extern id newPasswordField(void);
extern void textfieldSetDelegate(id, void *); extern void textfieldSetDelegate(id, void *);
extern const char *textFieldText(id); extern const char *textfieldText(id);
extern void textFieldSetText(id, char *); extern void textfieldSetText(id, char *);
extern id textfieldOpenInvalidPopover(id, char *); extern id textfieldOpenInvalidPopover(id, char *);
extern void textfieldCloseInvalidPopover(id); extern void textfieldCloseInvalidPopover(id);
extern id newLabel(void); extern id newLabel(void);

View File

@ -33,13 +33,13 @@ func newPasswordField() *textfield {
} }
func (t *textfield) Text() string { func (t *textfield) Text() string {
return C.GoString(C.textFieldText(t._id)) return C.GoString(C.textfieldText(t._id))
} }
func (t *textfield) SetText(text string) { func (t *textfield) SetText(text string) {
ctext := C.CString(text) ctext := C.CString(text)
defer C.free(unsafe.Pointer(ctext)) defer C.free(unsafe.Pointer(ctext))
C.textFieldSetText(t._id, ctext) C.textfieldSetText(t._id, ctext)
} }
func (t *textfield) OnChanged(f func()) { func (t *textfield) OnChanged(f func()) {

View File

@ -99,8 +99,7 @@ id newWarningPopover(char *text)
[wv->icon setRefusesFirstResponder:YES]; [wv->icon setRefusesFirstResponder:YES];
wv->label = (NSTextField *) newLabel(); wv->label = (NSTextField *) newLabel();
// TODO rename to textfieldSetText textfieldSetText((id) wv->label, text);
textFieldSetText((id) wv->label, text);
[wv->label setRefusesFirstResponder:YES]; [wv->label setRefusesFirstResponder:YES];
[wv addSubview:wv->icon]; [wv addSubview:wv->icon];