diff options
| author | Pietro Gagliardi <[email protected]> | 2014-11-05 13:08:06 -0500 |
|---|---|---|
| committer | Pietro Gagliardi <[email protected]> | 2014-11-05 13:08:06 -0500 |
| commit | cd96f8ee2e0a4ae3370a57357f9bcde4e2a8c36f (patch) | |
| tree | 3902039a7af356e6fcb142aceec1782e6fb10a39 | |
| parent | 5fc368fc23f0720fc193883d0709df8417268987 (diff) | |
Implemented TextField.ReadOnly() on GTK+.
| -rw-r--r-- | textfield_unix.go | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/textfield_unix.go b/textfield_unix.go index 6535d39..0320d3b 100644 --- a/textfield_unix.go +++ b/textfield_unix.go @@ -19,6 +19,7 @@ import "C" type textfield struct { *controlSingleWidget + editable *C.GtkEditable entry *C.GtkEntry changed *event } @@ -27,6 +28,7 @@ func startNewTextField() *textfield { widget := C.gtk_entry_new() t := &textfield{ controlSingleWidget: newControlSingleWidget(widget), + editable: (*C.GtkEditable)(unsafe.Pointer(widget)), entry: (*C.GtkEntry)(unsafe.Pointer(widget)), changed: newEvent(), } @@ -74,6 +76,16 @@ func (t *textfield) Invalid(reason string) { C.gtk_widget_error_bell(t.widget) } +// note that the property here is editable, which is the opposite of read-only + +func (t *textfield) ReadOnly() bool { + return !fromgbool(C.gtk_editable_get_editable(t.editable)) +} + +func (t *textfield) SetReadOnly(readonly bool) { + C.gtk_editable_set_editable(t.editable, togbool(!readonly)) +} + //export textfieldChanged func textfieldChanged(editable *C.GtkEditable, data C.gpointer) { t := (*textfield)(unsafe.Pointer(data)) |
