35 lines
847 B
Go
35 lines
847 B
Go
// Copyright 2022 wanderer <a_mirre at utb dot cz>
|
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
package xkcdreader
|
|
|
|
import (
|
|
"fyne.io/fyne/v2"
|
|
"fyne.io/fyne/v2/app"
|
|
"fyne.io/fyne/v2/container"
|
|
"fyne.io/fyne/v2/layout"
|
|
"fyne.io/fyne/v2/widget"
|
|
"git.dotya.ml/wanderer/go-xkcdreader/cmd"
|
|
)
|
|
|
|
const appGreeting = "welcome to go-xkcdreader"
|
|
|
|
// RunApp performs sets up and runs the main application
|
|
func RunApp() {
|
|
a := app.New()
|
|
w := a.NewWindow(cmd.GetAppName())
|
|
|
|
centered := container.New(layout.NewHBoxLayout(), layout.NewSpacer(), makeGreeting(), layout.NewSpacer())
|
|
w.SetContent(container.New(layout.NewVBoxLayout(), centered))
|
|
|
|
w.Resize(fyne.NewSize(400, 400))
|
|
w.ShowAndRun()
|
|
}
|
|
|
|
// makeGreeting creates a greeting label
|
|
func makeGreeting() *widget.Label {
|
|
w := widget.NewLabel(appGreeting)
|
|
w.TextStyle.Monospace = true
|
|
return w
|
|
}
|