summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPietro Gagliardi <[email protected]>2014-08-05 17:46:42 -0400
committerPietro Gagliardi <[email protected]>2014-08-05 17:46:42 -0400
commit1badd5368128f5fef3e12b800f40a276a7553c4a (patch)
treee003277a97bd5684495606c47edcef8d3e05c306
parentc460c11b657a1ff243cf13b96a0fada63a7feee7 (diff)
Renamed textField to textfield; this is just for the private implementation.
-rw-r--r--redo/basicctrls.go1
-rw-r--r--redo/textfield_darwin.go26
-rw-r--r--redo/textfield_unix.go26
-rw-r--r--redo/textfield_windows.go30
4 files changed, 41 insertions, 42 deletions
diff --git a/redo/basicctrls.go b/redo/basicctrls.go
index f4f1297..b9265f9 100644
--- a/redo/basicctrls.go
+++ b/redo/basicctrls.go
@@ -42,7 +42,6 @@ func NewCheckbox(text string) Checkbox {
}
// TextField is a Control in which the user can enter a single line of text.
-// TODO rename private implementations from textField to textfield
type TextField interface {
Control
diff --git a/redo/textfield_darwin.go b/redo/textfield_darwin.go
index cb5b8fa..22a97cf 100644
--- a/redo/textfield_darwin.go
+++ b/redo/textfield_darwin.go
@@ -9,52 +9,52 @@ import (
// #include "objc_darwin.h"
import "C"
-type textField struct {
+type textfield struct {
_id C.id
}
-func newTextField() *textField {
- return &textField{
+func newTextField() *textfield {
+ return &textfield{
_id: C.newTextField(),
}
}
-func newPasswordField() *textField {
- return &textField{
+func newPasswordField() *textfield {
+ return &textfield{
_id: C.newPasswordField(),
}
}
-func (t *textField) Text() string {
+func (t *textfield) Text() string {
return C.GoString(C.textFieldText(t._id))
}
-func (t *textField) SetText(text string) {
+func (t *textfield) SetText(text string) {
ctext := C.CString(text)
defer C.free(unsafe.Pointer(ctext))
C.textFieldSetText(t._id, ctext)
}
-func (t *textField) id() C.id {
+func (t *textfield) id() C.id {
return t._id
}
-func (t *textField) setParent(p *controlParent) {
+func (t *textfield) setParent(p *controlParent) {
basesetParent(t, p)
}
-func (t *textField) allocate(x int, y int, width int, height int, d *sizing) []*allocation {
+func (t *textfield) allocate(x int, y int, width int, height int, d *sizing) []*allocation {
return baseallocate(t, x, y, width, height, d)
}
-func (t *textField) preferredSize(d *sizing) (width, height int) {
+func (t *textfield) preferredSize(d *sizing) (width, height int) {
return basepreferredSize(t, d)
}
-func (t *textField) commitResize(a *allocation, d *sizing) {
+func (t *textfield) commitResize(a *allocation, d *sizing) {
basecommitResize(t, a, d)
}
-func (t *textField) getAuxResizeInfo(d *sizing) {
+func (t *textfield) getAuxResizeInfo(d *sizing) {
basegetAuxResizeInfo(t, d)
}
diff --git a/redo/textfield_unix.go b/redo/textfield_unix.go
index 8f609f5..e802947 100644
--- a/redo/textfield_unix.go
+++ b/redo/textfield_unix.go
@@ -13,59 +13,59 @@ import (
// extern void checkboxToggled(GtkToggleButton *, gpointer);
import "C"
-type textField struct {
+type textfield struct {
_widget *C.GtkWidget
entry *C.GtkEntry
}
-func startNewTextField() *textField {
+func startNewTextField() *textfield {
widget := C.gtk_entry_new()
- return &textField{
+ return &textfield{
_widget: widget,
entry: (*C.GtkEntry)(unsafe.Pointer(widget)),
}
}
-func newTextField() *textField {
+func newTextField() *textfield {
return startNewTextField()
}
-func newPasswordField() *textField {
+func newPasswordField() *textfield {
t := startNewTextField()
C.gtk_entry_set_visibility(t.entry, C.FALSE)
return t
}
-func (t *textField) Text() string {
+func (t *textfield) Text() string {
return fromgstr(C.gtk_entry_get_text(t.entry))
}
-func (t *textField) SetText(text string) {
+func (t *textfield) SetText(text string) {
ctext := togstr(text)
defer freegstr(ctext)
C.gtk_entry_set_text(t.entry, ctext)
}
-func (t *textField) widget() *C.GtkWidget {
+func (t *textfield) widget() *C.GtkWidget {
return t._widget
}
-func (t *textField) setParent(p *controlParent) {
+func (t *textfield) setParent(p *controlParent) {
basesetParent(t, p)
}
-func (t *textField) allocate(x int, y int, width int, height int, d *sizing) []*allocation {
+func (t *textfield) allocate(x int, y int, width int, height int, d *sizing) []*allocation {
return baseallocate(t, x, y, width, height, d)
}
-func (t *textField) preferredSize(d *sizing) (width, height int) {
+func (t *textfield) preferredSize(d *sizing) (width, height int) {
return basepreferredSize(t, d)
}
-func (t *textField) commitResize(a *allocation, d *sizing) {
+func (t *textfield) commitResize(a *allocation, d *sizing) {
basecommitResize(t, a, d)
}
-func (t *textField) getAuxResizeInfo(d *sizing) {
+func (t *textfield) getAuxResizeInfo(d *sizing) {
basegetAuxResizeInfo(t, d)
}
diff --git a/redo/textfield_windows.go b/redo/textfield_windows.go
index 8410432..701c2b6 100644
--- a/redo/textfield_windows.go
+++ b/redo/textfield_windows.go
@@ -5,57 +5,57 @@ package ui
// #include "winapi_windows.h"
import "C"
-type textField struct {
+type textfield struct {
_hwnd C.HWND
_textlen C.LONG
}
var editclass = toUTF16("EDIT")
-func startNewTextField(style C.DWORD) *textField {
+func startNewTextField(style C.DWORD) *textfield {
hwnd := C.newControl(editclass,
style | C.ES_AUTOHSCROLL | C.ES_LEFT | C.ES_NOHIDESEL | C.WS_TABSTOP,
C.WS_EX_CLIENTEDGE) // WS_EX_CLIENTEDGE without WS_BORDER will show the canonical visual styles border (thanks to MindChild in irc.efnet.net/#winprog)
- t := &textField{
+ t := &textfield{
_hwnd: hwnd,
}
C.controlSetControlFont(t._hwnd)
return t
}
-func newTextField() *textField {
+func newTextField() *textfield {
return startNewTextField(0)
}
-func newPasswordField() *textField {
+func newPasswordField() *textfield {
return startNewTextField(C.ES_PASSWORD)
}
-func (t *textField) Text() string {
+func (t *textfield) Text() string {
return baseText(t)
}
-func (t *textField) SetText(text string) {
+func (t *textfield) SetText(text string) {
baseSetText(t, text)
}
-func (t *textField) hwnd() C.HWND {
+func (t *textfield) hwnd() C.HWND {
return t._hwnd
}
-func (t *textField) textlen() C.LONG {
+func (t *textfield) textlen() C.LONG {
return t._textlen
}
-func (t *textField) settextlen(len C.LONG) {
+func (t *textfield) settextlen(len C.LONG) {
t._textlen = len
}
-func (t *textField) setParent(p *controlParent) {
+func (t *textfield) setParent(p *controlParent) {
basesetParent(t, p)
}
-func (t *textField) allocate(x int, y int, width int, height int, d *sizing) []*allocation {
+func (t *textfield) allocate(x int, y int, width int, height int, d *sizing) []*allocation {
return baseallocate(t, x, y, width, height, d)
}
@@ -65,14 +65,14 @@ const (
textfieldHeight = 14
)
-func (t *textField) preferredSize(d *sizing) (width, height int) {
+func (t *textfield) preferredSize(d *sizing) (width, height int) {
return fromdlgunitsX(textfieldWidth, d), fromdlgunitsY(textfieldHeight, d)
}
-func (t *textField) commitResize(a *allocation, d *sizing) {
+func (t *textfield) commitResize(a *allocation, d *sizing) {
basecommitResize(t, a, d)
}
-func (t *textField) getAuxResizeInfo(d *sizing) {
+func (t *textfield) getAuxResizeInfo(d *sizing) {
basegetAuxResizeInfo(t, d)
}