31 lines
715 B
Go
31 lines
715 B
Go
// 7 july 2014
|
|
|
|
package ui
|
|
|
|
// Control represents a control.
|
|
// All Controls have event handlers that take a single argument (the Doer active during the event) and return nothing.
|
|
type Control interface {
|
|
unparent()
|
|
parent(*window)
|
|
// TODO enable/disable (public)
|
|
// TODO show/hide (public)
|
|
controlSizing
|
|
}
|
|
|
|
// Button is a clickable button that performs some task.
|
|
type Button interface {
|
|
Control
|
|
|
|
// OnClicked sets the event handler for when the Button is clicked.
|
|
OnClicked(func())
|
|
|
|
// Text and SetText get and set the Button's label text.
|
|
Text() string
|
|
SetText(text string)
|
|
}
|
|
|
|
// NewButton creates a new Button with the given label text.
|
|
func NewButton(text string) Button {
|
|
return newButton(text)
|
|
}
|