Implemented TextField.ReadOnly() on GTK+.
This commit is contained in:
parent
5fc368fc23
commit
cd96f8ee2e
|
@ -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))
|
||||
|
|
Loading…
Reference in New Issue