2020-05-18 09:47:30 +00:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
2020-05-19 08:45:42 +00:00
|
|
|
"image/color"
|
|
|
|
|
|
|
|
"fyne.io/fyne"
|
2020-05-18 09:47:30 +00:00
|
|
|
"fyne.io/fyne/app"
|
2020-05-19 08:45:42 +00:00
|
|
|
"fyne.io/fyne/theme"
|
2020-05-18 09:47:30 +00:00
|
|
|
"fyne.io/fyne/widget"
|
2020-05-19 08:45:42 +00:00
|
|
|
|
|
|
|
fynewidget "git.martyn.berlin/martyn/LEDController/internal/fynewidget"
|
|
|
|
|
|
|
|
"log"
|
2020-05-18 09:47:30 +00:00
|
|
|
)
|
|
|
|
|
2020-05-19 08:45:42 +00:00
|
|
|
type tappableIcon struct {
|
|
|
|
widget.Icon
|
|
|
|
}
|
|
|
|
|
|
|
|
func newTappableIcon(res fyne.Resource) *tappableIcon {
|
|
|
|
icon := &tappableIcon{}
|
|
|
|
icon.ExtendBaseWidget(icon)
|
|
|
|
icon.SetResource(res)
|
|
|
|
|
|
|
|
return icon
|
|
|
|
}
|
|
|
|
|
|
|
|
func (t *tappableIcon) Tapped(_ *fyne.PointEvent) {
|
|
|
|
log.Println("I have been tapped")
|
|
|
|
}
|
|
|
|
|
|
|
|
func (t *tappableIcon) TappedSecondary(_ *fyne.PointEvent) {
|
|
|
|
}
|
|
|
|
|
2020-05-18 09:47:30 +00:00
|
|
|
func main() {
|
|
|
|
app := app.New()
|
|
|
|
w := app.NewWindow("Hello")
|
|
|
|
w.SetContent(widget.NewVBox(
|
|
|
|
widget.NewLabel("Hello Fyne!"),
|
2020-05-19 08:45:42 +00:00
|
|
|
newTappableIcon(theme.FyneLogo()),
|
|
|
|
fynewidget.NewOutputWidget(color.Black),
|
2020-05-18 09:47:30 +00:00
|
|
|
widget.NewButton("Quit", func() {
|
|
|
|
app.Quit()
|
|
|
|
}),
|
|
|
|
))
|
|
|
|
|
|
|
|
w.ShowAndRun()
|
|
|
|
}
|